Commit graph

41 commits

Author SHA1 Message Date
Mamta Shukla 984e165b8a staging: mt7621-pci: Prefer using the BIT macro
Replace all occurrences of (1<<x) with BIT(x).

Signed-off-by: Mamta Shukla <mamtashukla555@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 14:59:39 +02:00
Mamta Shukla 5cfa4f7007 staging: mt7621-pci: Add spaces around '<<'
Add spaces around '<<' to fix checkpatch issue.
CHECK: spaces preferred around that '<<' (ctx:VxV)

Signed-off-by: Mamta Shukla <mamtashukla555@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 14:59:39 +02:00
Mamta Shukla 0c5ca367ad staging: mt7621-pci: Add spaces around '|'
Add spaces around '|' to fix checkpatch issue
CHECK: spaces preferred around that '|' (ctx:VxV)

Signed-off-by: Mamta Shukla <mamtashukla555@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 14:59:39 +02:00
Mamta Shukla 8f36481fbb staging: mt7621-pci: Add spaces around '&'
Add spaces around '&' to fix checkpatch issue.
CHECK: spaces preferred around that '&' (ctx:VxV)

Signed-off-by: Mamta Shukla <mamtashukla555@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 14:59:38 +02:00
Mamta Shukla 101c82f239 staging: mt7621-pci: Do not initialise statics to 0
Remove initialisation for static global variable to fix checkpatch issue.
ERROR: do not initialise statics to 0

Signed-off-by: Mamta Shukla <mamtashukla555@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 14:59:38 +02:00
Rob Herring 7e33f3850c staging: mt7621-pci: remove unnecessary check of device_type == pci
PCI host drivers have already matched on compatible strings, so checking
device_type is redundant. Also, device_type is considered deprecated for
FDT though we've still been requiring it for PCI hosts as it is useful
for finding PCI buses.

Cc: devel@driverdev.osuosl.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-10 10:38:17 +02:00
Sergio Paracuellos 293dcd6592 staging: mt7621-pci: show N_FTS status using a loop
There are some printk's which can be replaced properly
using dev_* kernel functions. Use dev_info to show
N_FTS status for each port using a loop instead of duplicating
lines of code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:31:59 +02:00
Sergio Paracuellos 02d72eef18 staging: mt7621-pci: make some function static
There are some functions in driver code that can be declared
'static'. Just do it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:31:59 +02:00
Sergio Paracuellos 4cafd03a91 staging: mt7621-pci: remove remaining pci_legacy dependant code
pcibios_* remaining code is not neccessary at all. We can use
map_irq set to of_irq_parse_and_map_pci driver 'probe' function.
Remove this code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos 8594351af0 staging: mt7621-pci: rename RALINK_PCI_CONFIG_DATA_VIRTUAL_REG definition
RALINK_PCI_CONFIG_DATA_VIRTUAL_REG is a very long name. Make it a bit
shorter renaming it to RALINK_PCI_CONFIG_DATA.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos 88e8fa0c26 staging: mt7621-pci: use BIT macro in preprocessor definitions
Some preprocessor definitions are using a custom implementation of
BIT macro. Just use linux kernel BIT macro instead.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos c00f0352be staging: mt7621-pci: remove RALINK_PCI_BASE from remaining definitions
RALINK_PCI_BASE has no sense and this driver has base address readed
and mapped from device tree. Remove remaining uses of it and
change code to use pcie_read and pcie_write functions in places
where this was being used.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos 152f3893f4 staging: mt7621-pci: use pcie_[read|write] in RALINK_PCI_PCICFG_ADDR and RALINK_PCI_PCIMSK_ADDR
RALINK_PCI_PCICFG_ADDR and RALINK_PCI_PCIMSK_ADDR are defined to be directly
referenced for read and write. Use pcie_read and pcie_write instead changing
its definition to a simple relative offset to pcie base address.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos cd7d07db8b staging: mt7621-pci: review includes putting them in alphabethic order
There are some includes that are being used that are not really
needed to correct driver compilation. Remove them and reorder the
rest alphabetically.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos e38bb17540 staging: mt7621-pci: avoid register duplication per controller using pcie_[read|write]
Use pcie_[read|write] fucntions to read and write controller registers.
Define those only by offset and pass controller offset + register offset
relative to base address to functions.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos edec14020e staging: mt7621-pci: remove unused macros
There some macros that are not being used. Remove them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos f8427fae57 staging: mt7621-pci: simplify write_config function
write_config function is always called with bus and func
being 0. Avoid those params and just use 0 inside the
function. Review parameter types changing for more proper
ones.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos c0431f4f4a staging: mt7621-pci: simplify read_config function
read_config function is always called with bus and func
being 0. Avoid those params and just use 0 inside the
function. Return readed value instead pass a reference
parameter.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos 9f999b4150 staging: mt7621-pci: use pcie_[read|write] in [write|read]_config
Instead of custom macros use pcie_read and pcie_write functions.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos 52ed727ca0 staging: mt7621-pci: add pcie_write and pcie_read helpers
Introdice this functions to make easier to write/read to/from
an offset relative to base address

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos e9d03d17dd staging: mt7621-pci: remove dead code derived to not use custom reads and writes
Driver is using now pci subsystem generics reads and writes and requesting
bus resources without using legacy code functions. Because of this there is
a lot of dead code that can be removed.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:41 +02:00
Sergio Paracuellos 8571c62d45 staging: mt7621-pci: use generic kernel pci subsystem read and write
map_bus callback is called before every .read/.write operation.
Implement it and change custom read write operations for the
pci subsystem generics. Make the probe function to don't use
legacy stuff and request bus resources directly. Get pci register
base and ranges from device tree.
The driver is not using PCI_LEGACY code anymore and shall use the
PCI_DRIVERS_GENERIC option to correct compile it. Add also new
Kconfig file for this controller setting there its correct dependencies.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 14:08:40 +02:00
Oliver Hübers 7d6bc56932 staging: mt7621: Add SPDX license identifier
Signed-off-by: Oliver Hübers <oliver.huebers@web.de>
Signed-off-by: Vanessa Borgmann <nessa.x@web.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-16 10:35:59 +02:00
Oliver Hübers bb4e1ca9b2 staging: mt7621-pci: Include preferred headers
This fixes the following checkpatch warnings:
Use #include <linux/pci.h> instead of <asm/pci.h>
Use #include <linux/io.h> instead of <asm/io.h>

Signed-off-by: Oliver Hübers <oliver.huebers@web.de>
Signed-off-by: Vanessa Borgmann <nessa.x@web.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-16 10:19:14 +02:00
Sergio Paracuellos 2427d174a4 staging: mt7621-pci: factor out mt7621_pci_get_cfgaddr function
To get config address the same pattern is repeated in some functions
along the code. Factor out a new mt7621_pci_get_cfgaddr for calculate
it and use it in convenient places. Adjust types to match to u32 where
is neccesary.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-10 12:44:55 +02:00
Sergio Paracuellos fc4afdfea0 staging: mt7621-pci: remove unused macro MV_READ_DATA
This macro is not being used at all along the code.
Just remove it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-10 12:44:55 +02:00
Peter Vernia 4cd6bacfaa staging: mt7621-pci: Move open-braces to match kernel code style
Moves some open-braces to the end of the conditional statement to match the
kernel's coding style

Signed-off-by: Peter Vernia <peter.vernia@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-07 10:25:04 +02:00
Peter Vernia bd84b26835 staging: mt7621-pci: Add spaces after commas in pci-mt7621.c
Adds spaces after commas in parameter lists in pci-mt7621.c

Signed-off-by: Peter Vernia <peter.vernia@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-07 10:25:04 +02:00
Peter Vernia d723b7cca5 staging: mt7621-pci: Fix spacing around equals sign
Add spaces in front of the equals sign in assignment operations

Signed-off-by: Peter Vernia <peter.vernia@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-07 10:25:04 +02:00
Peter Vernia b6c319606e staging: mt7621-pci: Fix spaces around parenthesis in pci-7621.c
Adds spaces before open parenthesis, and removes spaces after open parenthesis

Signed-off-by: Peter Vernia <peter.vernia@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-07 10:25:04 +02:00
Abdun Nihaal 0d6485282a staging: mt7621-pci: Fix coding style error
This patch removes space after * to fix the following checkpatch error:

ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-17 09:05:12 +02:00
NeilBrown c0f784ba92 staging: mt7621-pci: use rt_sysc_?32() to access system-control register.
This driver currently has internal knowledge ofthe address
of system-control registers and accesses them by dereferencing
a constant pointer.

It is cleaner to use rt_sysc_r32(), rt_sysc_w32(), rt_sysc_m32()
which is a more standard interface.
So change the defined names to offsets instead of pointers,
and use these functions.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-17 09:05:11 +02:00
Sankalp Negi 86417b7ccc staging: mt7621-pci: Fix line size exceeding 80 columns.
This patch fixes the checkpatch.pl warning:

WARNING: line over 80 characters

Signed-off-by: Sankalp Negi <sankalpnegi2310@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31 19:00:53 +02:00
NeilBrown bb52645a9c staging: mt7621-pci: remove some dead code.
Some code is dead because it is commented out.
Some is dead because it is uninteresting printks.
Some is dead because it declares unused functions.

Remove it all.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:09:23 -07:00
NeilBrown a6f1748415 staging: mt7621-pci: remove unnecessary resource details.
These resources are extracted from devicetree, so they aren't
needed here.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:09:23 -07:00
NeilBrown bba9b3ec0f staging: mt7621-pci: remove conditional compilation.
Code currently defines:

#define CONFIG_PCIE_PORT0
#define CONFIG_PCIE_PORT1
#define CONFIG_PCIE_PORT2
#define GPIO_PERST

and then compiles code only if they are defined.
We might want to disable some of these via devicetree one
day, but for now just remove the #defines and the
conditions - all the code for different ports is
easy to identify.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:09:23 -07:00
NeilBrown d4e3a1f6ce staging: mt7621-pci: white-space cleanups.
- remove white space at end of line.
- no more than 2 blank line at a time
- remove spaces before tabs
- use tabs to line things up
- re-indent some #define do{}while(0)

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:09:23 -07:00
NeilBrown 46d093124d staging: mt7621-pci: improve interrupt mapping
As the Interrupts for the PCI adapters are listed in
devicetree we shouldn't need to have them explicit in the code.

The simplest way to do this is to use of_irq_parse_and_map_pci()
and specify an interrupt-map which identifies the different
PCI hosts by bus/slot numbers.
This has the advantage that the hwirq number are mapped to virq
numbers for us, so the ugly hack can go.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:09:23 -07:00
Christian Lütke-Stetzkamp 70100e25ae staging: mt7621-pci: Remove redundant owner assignment
Remove the owner assignment form the platform driver as
platform_driver_register() already initializes the owner.
Found using coccinelle.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:12 +02:00
NeilBrown c4c11ae8e4 staging: mt7621-pci: Hack 2 more PCI interrupts for gnubee1
The mt7621-pci support 3 pci devices and has 3 interrupts.
Each of these need to be enabled by the same sort of hack to
map hwirq number to virq number.
This is a hack which will go as soon as I understand how this is
supposed to work.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:33:20 +02:00
John Crispin 03f152e31f staging: mt7621-pci: MIPS/ralink: add MT7621 pcie driver
NeilBrown: forward port and hack to work on GNUBEE1

Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 19:56:01 +01:00