[PATCH v5 10/18] staging: mt7621-pci: use pcie_[read|write] in RALINK_PCI_PCICFG_ADDR and RALINK_PCI_PCIMSK_ADDR

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621

[PATCH v5 04/18] staging: mt7621-pci: use pcie_[read|write] in [write|read]_config

2018-07-27 Thread Sergio Paracuellos
Instead of custom macros use pcie_read and pcie_write functions. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 67 - 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b

[PATCH v5 15/18] staging: mt7621-pci: add Kconfig file for mt7621 pci controller

2018-07-27 Thread Sergio Paracuellos
The driver is not using PCI_LEGACY code anymore and shall use the PCI_DRIVERS_GENERIC option to correct compile it. Add new Kconfig file for this controller setting there its correct dependencies. Signed-off-by: Sergio Paracuellos --- drivers/staging/Kconfig| 2 ++ drivers/staging

[PATCH v5 01/18] staging: mt7621-pci: use generic kernel pci subsystem read and write

2018-07-27 Thread Sergio Paracuellos
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 from device tree. Signed-off-by: Sergio

[PATCH v5 11/18] staging: mt7621-pci: remove RALINK_PCI_BASE from remaining definitions

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci

[PATCH v5 16/18] staging: mt7621-dts: add pcie controller port registers

2018-07-27 Thread Sergio Paracuellos
The pcie node of the device tree only contains registers for the host-bridge and pcie port 0. Add the pcie port 1 and pcie port 2 also. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-dts/mt7621.dtsi | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers

[PATCH v5 02/18] staging: mt7621-pci: remove dead code derived to not use custom reads and writes

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 171

[PATCH v5 08/18] staging: mt7621-pci: avoid register duplication per controller using pcie_[read|write]

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 62

[PATCH v5 09/18] staging: mt7621-pci: review includes putting them in alphabethic order

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 22 -- 1 file changed, 8 insertions(+), 14

[PATCH v5 03/18] staging: mt7621-pci: add pcie_write and pcie_read helpers

2018-07-27 Thread Sergio Paracuellos
Introdice this functions to make easier to write/read to/from an offset relative to base address Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers

[PATCH v5 13/18] staging: mt7621-pci: rename RALINK_PCI_CONFIG_DATA_VIRTUAL_REG definition

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621

[PATCH v5 03/16] staging: mt7621-pci: add pcie_write and pcie_read helpers

2018-07-27 Thread Sergio Paracuellos
Introdice this functions to make easier to write/read to/from an offset relative to base address Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers

[PATCH v5 02/16] staging: mt7621-pci: remove dead code derived to not use custom reads and writes

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 171

[PATCH v5 07/16] staging: mt7621-pci: remove unused macros

2018-07-27 Thread Sergio Paracuellos
There some macros that are not being used. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 29 + 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging

[PATCH v5 04/16] staging: mt7621-pci: use pcie_[read|write] in [write|read]_config

2018-07-27 Thread Sergio Paracuellos
Instead of custom macros use pcie_read and pcie_write functions. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 67 - 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b

[PATCH v5 05/16] staging: mt7621-pci: simplify read_config function

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 32 +++- 1

[PATCH v5 00/16] staging: mt7621-pci: avoid custom pci config read and writes

2018-07-27 Thread Sergio Paracuellos
ate a new port structure (platform has 3 pcie controllers) - Replace the use of pci_generic_config_[read|write]32 in favour of pci_generic_config_[read|write] and change map_bus implemen- tation for hopefully the right one. Best regards, Sergio Paracuellos Sergio Paracuellos

[PATCH v5 14/16] staging: mt7621-pci: remove remaining pci_legacy dependant code

2018-07-27 Thread Sergio Paracuellos
pcibios_* remaining code is not neccessary at all. We are mapping irq using of_irq_parse_and_map_pci and swizzle_irq which are set in driver 'probe' function. Remove this code. No kernel config option CONFIG_PCI_DRIVERS_LEGACY should be included anymore. Signed-off-by: Sergio Paracuellos

[PATCH v5 01/16] staging: mt7621-pci: use generic kernel pci subsystem read and write

2018-07-27 Thread Sergio Paracuellos
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 from device tree. Signed-off-by: Sergio

[PATCH v5 08/16] staging: mt7621-pci: avoid register duplication per controller using pcie_[read|write]

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 62

[PATCH v5 06/16] staging: mt7621-pci: simplify write_config function

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 20 +--- 1 file changed

[PATCH v5 12/16] staging: mt7621-pci: use BIT macro in preprocessor definitions

2018-07-27 Thread Sergio Paracuellos
Some preprocessor definitions are using a custom implementation of BIT macro. Just use linux kernel BIT macro instead. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers

[PATCH v5 09/16] staging: mt7621-pci: review includes putting them in alphabethic order

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 22 -- 1 file changed, 8 insertions(+), 14

[PATCH v5 16/16] staging: mt7621-dts: add pcie controller port registers

2018-07-27 Thread Sergio Paracuellos
The pcie node of the device tree only contains registers for the host-bridge and pcie port 0. Add the pcie port 1 and pcie port 2 also. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-dts/mt7621.dtsi | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers

[PATCH v5 13/16] staging: mt7621-pci: rename RALINK_PCI_CONFIG_DATA_VIRTUAL_REG definition

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621

[PATCH v5 11/16] staging: mt7621-pci: remove RALINK_PCI_BASE from remaining definitions

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci

[PATCH v5 10/16] staging: mt7621-pci: use pcie_[read|write] in RALINK_PCI_PCICFG_ADDR and RALINK_PCI_PCIMSK_ADDR

2018-07-27 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621

[PATCH v5 15/16] staging: mt7621-pci: add Kconfig file for mt7621 pci controller

2018-07-27 Thread Sergio Paracuellos
The driver is not using PCI_LEGACY code anymore and shall use the PCI_DRIVERS_GENERIC option to correct compile it. Add new Kconfig file for this controller setting there its correct dependencies. Signed-off-by: Sergio Paracuellos --- drivers/staging/Kconfig| 2 ++ drivers/staging

Re: [PATCH v10 00/15] staging: mt7621-pci: avoid custom pci config read and writes

2018-08-05 Thread Sergio Paracuellos
On Mon, Aug 6, 2018 at 2:21 AM, NeilBrown wrote: > On Fri, Aug 03 2018, Sergio Paracuellos wrote: > >> This patch series include an attempt to avoid the use of custom >> read and writes in driver code and use PCI subsystem common ones. >> >> In order to do this 'ma

[PATCH 00/11] staging: mt7621-pci: Parse ports info from DT and other minor cleanups

2018-08-10 Thread Sergio Paracuellos
, Sergio Paracuellos Sergio Paracuellos (11): staging: mt7621-pci: parse and init port data from device tree staging: mt7621-pci: replace return value if devm_pci_alloc_host_bridge call fails staging: mt7621-pci: add two helpers for read and write pcie register ports staging: mt7621-pci

[PATCH 03/11] staging: mt7621-pci: add two helpers for read and write pcie register ports

2018-08-10 Thread Sergio Paracuellos
mt7621-pcie_port data structure has filed 'base' as the base address for read and write related port registers. Create two inline functions 'pcie_port_read' and 'pcie_port_write' to make this task easier and code more readable. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci

[PATCH 02/11] staging: mt7621-pci: replace return value if devm_pci_alloc_host_bridge call fails

2018-08-10 Thread Sergio Paracuellos
Driver probe function calls 'devm_pci_alloc_host_bridge'. If this call fails it is returning -ENODEV. Return -ENOMEM instead which is more accurate for this. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 04/11] staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function

2018-08-10 Thread Sergio Paracuellos
Driver probe function is a mess and shall be refactored a lot. At first make use of assert and deassert control factoring out a new function called 'mt7621_pcie_enable_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 92 - 1

[PATCH 01/11] staging: mt7621-pci: parse and init port data from device tree

2018-08-10 Thread Sergio Paracuellos
Add initialization of each PCIe port reading and initializing data using device tree. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 74 +++-- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621-pci

[PATCH 06/11] staging: mt7621-pci: remove GPL2+ text from license header

2018-08-10 Thread Sergio Paracuellos
This file has a valid SPDX license line added so reamining GPL2+ boilerplate text is not needed at all. Remove it. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 31 +++ 1 file changed, 3 insertions(+), 28 deletions(-) diff --git

[PATCH 09/11] staging: mt7621-pci: reagroup reset related macros all together

2018-08-10 Thread Sergio Paracuellos
Reset bits related macros are in different parts. Reagroup all of them together to improve readability. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c

[PATCH 10/11] staging: mt7621-pci: make some function static

2018-08-10 Thread Sergio Paracuellos
There are some functions in driver code that can be declared 'static'. Just do it. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging

[PATCH 05/11] staging: mt7621-pci: remove [ASSERT|DEASSERT]_SYSRST_PCIE macros

2018-08-10 Thread Sergio Paracuellos
Driver is using reset_control kernel API's to manage this so this two macros are not needed anymore. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci

[PATCH 07/11] staging: mt7621-pci: remove two commented code lines

2018-08-10 Thread Sergio Paracuellos
This two lines whch are commented are not needed at all. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index

[PATCH 11/11] staging: mt7621-pci: show N_FTS status using a loop

2018-08-10 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 13 + 1 file

[PATCH 08/11] staging: mt7621-pci: remove reset related unused macros

2018-08-10 Thread Sergio Paracuellos
There are three macros which are not being used at all. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index

Re: [PATCH v10 00/15] staging: mt7621-pci: avoid custom pci config read and writes

2018-08-08 Thread Sergio Paracuellos
On Wed, Aug 8, 2018 at 2:08 PM, Greg KH wrote: > On Mon, Aug 06, 2018 at 10:21:46AM +1000, NeilBrown wrote: >> On Fri, Aug 03 2018, Sergio Paracuellos wrote: >> >> > This patch series include an attempt to avoid the use of custom >> > read and writes in driver

[PATCH v2 03/20] staging: mt7621-pci: add two helpers for read and write pcie register ports

2018-08-12 Thread Sergio Paracuellos
mt7621-pcie_port data structure has filed 'base' as the base address for read and write related port registers. Create two inline functions 'pcie_port_read' and 'pcie_port_write' to make this task easier and code more readable. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci

[PATCH v2 00/20] staging: mt7621-pci: Parse ports info from DT and other minor cleanups

2018-08-12 Thread Sergio Paracuellos
of the driver - fix some checkpatch complains - make use of sysctl from DT Hope this helps. Best regards, Sergio Paracuellos Sergio Paracuellos (20): staging: mt7621-pci: parse and init port data from device tree staging: mt7621-pci: replace return value

[PATCH v2 19/20] staging: mt7621-pci: use dev_* functions instead of printk

2018-08-12 Thread Sergio Paracuellos
checkpatch script is complaining about the use of printk instead of use more proper dev_* kernel functions. Replace all of them removing warnings. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions

[PATCH v2 20/20] staging: mt7621-pci: do not initialise statics to 0

2018-08-12 Thread Sergio Paracuellos
Static variables are initialised to 0 by GCC and checkpatch script also complains about that. Make it happy. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c

[PATCH v2 12/20] staging: mt7621-pci: rewrite pcie phy related functions

2018-08-12 Thread Sergio Paracuellos
macros also resetting and adding bits using bitwise operators directly in the code. Now these function are offset-based on the port to use them cleaner in driver probe functio and improving readability. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 287

[PATCH v2 17/20] staging: mt7621-pci: remap and use sysctl from device tree

2018-08-12 Thread Sergio Paracuellos
There are some pointer read and writes which can be replaced properly using sysctl registers readed from device tree. Remap sysctl registers and replace in proper places. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 38 - 1 file

[PATCH v2 11/20] staging: mt7621-pci: show N_FTS status using a loop

2018-08-12 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 13 + 1 file

[PATCH v2 09/20] staging: mt7621-pci: reagroup reset related macros all together

2018-08-12 Thread Sergio Paracuellos
Reset bits related macros are in different parts. Reagroup all of them together to improve readability. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c

[PATCH v2 14/20] staging: mt7621-pci: debug port N_FTS inside 'mt7621_pcie_enable_port'

2018-08-12 Thread Sergio Paracuellos
Move debug for the port N_FTS from driver probe function to the more appropiate one 'mt7621_pcie_enable_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/mt7621-pci

[PATCH v2 02/20] staging: mt7621-pci: replace return value if devm_pci_alloc_host_bridge call fails

2018-08-12 Thread Sergio Paracuellos
Driver probe function calls 'devm_pci_alloc_host_bridge'. If this call fails it is returning -ENODEV. Return -ENOMEM instead which is more accurate for this. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH v2 10/20] staging: mt7621-pci: make some function static

2018-08-12 Thread Sergio Paracuellos
There are some functions in driver code that can be declared 'static'. Just do it. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging

[PATCH v2 01/20] staging: mt7621-pci: parse and init port data from device tree

2018-08-12 Thread Sergio Paracuellos
Add initialization of each PCIe port reading and initializing data using device tree. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 74 +++-- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621-pci

[PATCH v2 04/20] staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function

2018-08-12 Thread Sergio Paracuellos
Driver probe function is a mess and shall be refactored a lot. At first make use of assert and deassert control factoring out a new function called 'mt7621_pcie_enable_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 92 - 1

[PATCH v2 06/20] staging: mt7621-pci: remove GPL2+ text from license header

2018-08-12 Thread Sergio Paracuellos
This file has a valid SPDX license line added so reamining GPL2+ boilerplate text is not needed at all. Remove it. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 31 +++ 1 file changed, 3 insertions(+), 28 deletions(-) diff --git

[PATCH v2 08/20] staging: mt7621-pci: remove reset related unused macros

2018-08-12 Thread Sergio Paracuellos
There are three macros which are not being used at all. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index

[PATCH v2 18/20] staging: mt7621-pci: use a trailing */ on a separate line

2018-08-12 Thread Sergio Paracuellos
Chackpatch script is compalining about one comment which is not following the kernel style. Fix it. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b

[PATCH v2 15/20] staging: mt7621-pci: rename 'mt7621_pcie_enable_port' into 'mt7621_pcie_init_port'

2018-08-12 Thread Sergio Paracuellos
Rename function 'mt7621_pcie_enable_port' with a name which is better for what the function is really doing calling it 'mt7621_pcie_init_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v2 07/20] staging: mt7621-pci: remove two commented code lines

2018-08-12 Thread Sergio Paracuellos
This two lines whch are commented are not needed at all. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index

[PATCH v2 05/20] staging: mt7621-pci: remove [ASSERT|DEASSERT]_SYSRST_PCIE macros

2018-08-12 Thread Sergio Paracuellos
Driver is using reset_control kernel API's to manage this so this two macros are not needed anymore. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci

[PATCH v2 13/20] staging: mt7621-pci: factor out 'mt7621_enable_phy' function

2018-08-12 Thread Sergio Paracuellos
Factor out a new function 'mt7621_enable_phy' for enabling the pcie phy for each port and call it from 'mt7621_pcie_enable_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git

[PATCH v2 16/20] staging: mt7621-dts: add sysctl registers base address to pcie

2018-08-12 Thread Sergio Paracuellos
Add missing system control registers address in pcie node of the device tree. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-dts/mt7621.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts

Re: [PATCH v2 12/20] staging: mt7621-pci: rewrite pcie phy related functions

2018-08-14 Thread Sergio Paracuellos
On Tue, Aug 14, 2018 at 12:51 PM, Dan Carpenter wrote: > On Sun, Aug 12, 2018 at 08:45:57PM +0200, Sergio Paracuellos wrote: >> @@ -561,15 +660,13 @@ static int mt7621_pci_probe(struct platform_device >> *pdev) >> >> mdelay(100); >> >> - list_for_

Re: [PATCH v2 04/20] staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function

2018-08-14 Thread Sergio Paracuellos
On Tue, Aug 14, 2018 at 12:43 PM, Dan Carpenter wrote: > On Sun, Aug 12, 2018 at 08:45:49PM +0200, Sergio Paracuellos wrote: >> Driver probe function is a mess and shall be refactored a lot. At first >> make use of assert and deassert control factoring out a new fun

Re: [PATCH v2 11/20] staging: mt7621-pci: show N_FTS status using a loop

2018-08-14 Thread Sergio Paracuellos
On Tue, Aug 14, 2018 at 12:46 PM, Dan Carpenter wrote: > On Sun, Aug 12, 2018 at 08:45:56PM +0200, Sergio Paracuellos wrote: >> diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c >> b/drivers/staging/mt7621-pci/pci-mt7621.c >> index ec1d822..f499c108 100644 >> --- a

Re: [PATCH v2 00/20] staging: mt7621-pci: Parse ports info from DT and other minor cleanups

2018-08-21 Thread Sergio Paracuellos
On Mon, Aug 20, 2018 at 3:33 AM, NeilBrown wrote: > On Sun, Aug 12 2018, Sergio Paracuellos wrote: > >> This patch series parse remaining port info from device tree storing >> it in mt7621_pcie_port struct created for this. >> >> Also minor cleanups are performed

[PATCH v3 04/20] staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function

2018-08-25 Thread Sergio Paracuellos
Driver probe function is a mess and shall be refactored a lot. At first make use of assert and deassert control factoring out a new function called 'mt7621_pcie_enable_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 88 +++-- 1

[PATCH v3 03/20] staging: mt7621-pci: add two helpers for read and write pcie register ports

2018-08-25 Thread Sergio Paracuellos
mt7621-pcie_port data structure has filed 'base' as the base address for read and write related port registers. Create two inline functions 'pcie_port_read' and 'pcie_port_write' to make this task easier and code more readable. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci

[PATCH v3 00/20] staging: mt7621-pci: Parse ports info from DT and other minor cleanups

2018-08-25 Thread Sergio Paracuellos
of the driver - fix some checkpatch complains - make use of sysctl from DT Hope this helps. Best regards, Sergio Paracuellos Sergio Paracuellos (20): staging: mt7621-pci: parse and init port data from device tree staging: mt7621-pci: replace return value

[PATCH v3 06/20] staging: mt7621-pci: remove GPL2+ text from license header

2018-08-25 Thread Sergio Paracuellos
This file has a valid SPDX license line added so reamining GPL2+ boilerplate text is not needed at all. Remove it. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 31 +++ 1 file changed, 3 insertions(+), 28 deletions(-) diff --git

[PATCH v3 08/20] staging: mt7621-pci: remove reset related unused macros

2018-08-25 Thread Sergio Paracuellos
There are three macros which are not being used at all. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index

[PATCH v3 01/20] staging: mt7621-pci: parse and init port data from device tree

2018-08-25 Thread Sergio Paracuellos
Add initialization of each PCIe port reading and initializing data using device tree. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 75 +++-- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621-pci

[PATCH v3 07/20] staging: mt7621-pci: remove two commented code lines

2018-08-25 Thread Sergio Paracuellos
This two lines whch are commented are not needed at all. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index

[PATCH v3 10/20] staging: mt7621-pci: make some function static

2018-08-25 Thread Sergio Paracuellos
There are some functions in driver code that can be declared 'static'. Just do it. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging

[PATCH v3 09/20] staging: mt7621-pci: reagroup reset related macros all together

2018-08-25 Thread Sergio Paracuellos
Reset bits related macros are in different parts. Reagroup all of them together to improve readability. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c

[PATCH v3 13/20] staging: mt7621-pci: factor out 'mt7621_enable_phy' function

2018-08-25 Thread Sergio Paracuellos
Factor out a new function 'mt7621_enable_phy' for enabling the pcie phy for each port and call it from 'mt7621_pcie_enable_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git

[PATCH v3 16/20] staging: mt7621-dts: add sysctl registers base address to pcie

2018-08-25 Thread Sergio Paracuellos
Add missing system control registers address in pcie node of the device tree. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-dts/mt7621.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts

[PATCH v3 11/20] staging: mt7621-pci: show N_FTS status using a loop

2018-08-25 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 13 + 1 file

[PATCH v3 19/20] staging: mt7621-pci: use dev_* functions instead of printk

2018-08-25 Thread Sergio Paracuellos
checkpatch script is complaining about the use of printk instead of use more proper dev_* kernel functions. Replace all of them removing warnings. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions

[PATCH v3 02/20] staging: mt7621-pci: replace return value if devm_pci_alloc_host_bridge call fails

2018-08-25 Thread Sergio Paracuellos
Driver probe function calls 'devm_pci_alloc_host_bridge'. If this call fails it is returning -ENODEV. Return -ENOMEM instead which is more accurate for this. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH v3 05/20] staging: mt7621-pci: remove [ASSERT|DEASSERT]_SYSRST_PCIE macros

2018-08-25 Thread Sergio Paracuellos
Driver is using reset_control kernel API's to manage this so this two macros are not needed anymore. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci

[PATCH v3 14/20] staging: mt7621-pci: debug port N_FTS inside 'mt7621_pcie_enable_port'

2018-08-25 Thread Sergio Paracuellos
Move debug for the port N_FTS from driver probe function to the more appropiate one 'mt7621_pcie_enable_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci

[PATCH v3 12/20] staging: mt7621-pci: rewrite pcie phy related functions

2018-08-25 Thread Sergio Paracuellos
macros also resetting and adding bits using bitwise operators directly in the code. Now these function are offset-based on the port to use them cleaner in driver probe functio and improving readability. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 295

[PATCH v3 17/20] staging: mt7621-pci: remap and use sysctl from device tree

2018-08-25 Thread Sergio Paracuellos
There are some pointer read and writes which can be replaced properly using sysctl registers readed from device tree. Remap sysctl registers and replace in proper places. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 38 - 1 file

[PATCH v3 20/20] staging: mt7621-pci: do not initialise statics to 0

2018-08-25 Thread Sergio Paracuellos
Static variables are initialised to 0 by GCC and checkpatch script also complains about that. Make it happy. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c

[PATCH] staging: mt7621-pci: dt-bindings: add DT documentation for PCI MT7621

2018-07-16 Thread Sergio Paracuellos
This commit adds device tree bindings documentation for PCIEE controller of MT7621 SoC. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/mediatek,mt7621-pci.txt | 97 ++ 1 file changed, 97 insertions(+) create mode 100644 drivers/staging/mt7621-pci/mediatek

Re: [PATCH 2/3] staging: mt7621-pci: use generic kernel pci subsystem read and write

2018-07-14 Thread Sergio Paracuellos
On Sat, Jul 14, 2018 at 10:04:32AM +1000, NeilBrown wrote: > On Tue, Jul 10 2018, Sergio Paracuellos wrote: > > > map_bus callback is called before every .read/.write operation. > > Implement it and change custom read write operations for the > > pci subsystem generics.

[PATCH v3 01/15] staging: mt7621-pci: use generic kernel pci subsystem read and write

2018-07-14 Thread Sergio Paracuellos
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 from device tree. Signed-off-by: Sergio

[PATCH v3 03/15] staging: mt7621-pci: add pcie_write and pcie_read helpers

2018-07-14 Thread Sergio Paracuellos
Introdice this functions to make easier to write/read to/from an offset relative to base address Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers

[PATCH v3 00/15] staging: mt7621-pci: avoid custom pci config read and writes

2018-07-14 Thread Sergio Paracuellos
of pci_generic_config_[read|write] and change map_bus implemen- tation for hopefully the right one. Best regards, Sergio Paracuellos (15): staging: mt7621-pci: use generic kernel pci subsystem read and write staging: mt7621-pci: remove dead code derived to not use custom reads and writes

[PATCH v3 11/15] staging: mt7621-pci: remove RALINK_PCI_BASE from remaining definitions

2018-07-14 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci

[PATCH v3 07/15] staging: mt7621-pci: remove unused macros

2018-07-14 Thread Sergio Paracuellos
There some macros that are not being used. Remove them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 29 + 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging

[PATCH v3 14/15] staging: mt7621-pci: remove duplicated include

2018-07-14 Thread Sergio Paracuellos
linux/pci.h is being included twice. Remove one of them. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index 41e03e3..3befd76

[PATCH v3 06/15] staging: mt7621-pci: simplify write_config function

2018-07-14 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 20 +--- 1 file changed

[PATCH v3 13/15] staging: mt7621-pci: rename RALINK_PCI_CONFIG_DATA_VIRTUAL_REG definition

2018-07-14 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621

[PATCH v3 05/15] staging: mt7621-pci: simplify read_config function

2018-07-14 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 32 +++- 1

[PATCH v3 10/15] staging: mt7621-pci: use pcie_[read|write] in RALINK_PCI_PCICFG_ADDR and RALINK_PCI_PCIMSK_ADDR

2018-07-14 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621

[PATCH v3 04/15] staging: mt7621-pci: use pcie_[read|write] in [write|read]_config

2018-07-14 Thread Sergio Paracuellos
Instead of custom macros use pcie_read and pcie_write functions. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 67 - 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b

[PATCH v3 02/15] staging: mt7621-pci: remove dead code derived to not use custom reads and writes

2018-07-14 Thread Sergio Paracuellos
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 --- drivers/staging/mt7621-pci/pci-mt7621.c | 172

<    5   6   7   8   9   10   11   12   13   14   >