aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/mt7621-pci (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-04-03staging: add missing SPDX lines to Makefile filesGreg Kroah-Hartman1-0/+1
There are a few remaining drivers/staging/*/Makefile files that do not have SPDX identifiers in them. Add the correct GPL-2.0 identifier to them to make scanning tools happy. Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03staging: add missing SPDX lines to Kconfig filesGreg Kroah-Hartman1-0/+1
There are a few remaining drivers/staging/*/Kconfig files that do not have SPDX identifiers in them. Add the correct GPL-2.0 identifier to them to make scanning tools happy. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-01Merge 5.1-rc3 into staging-nextGreg Kroah-Hartman1-0/+1
We want those fixes and this resolves an erofs merge conflict. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging, mt7621-pci: fix build without pci supportMaxim Zhukov1-0/+1
Add depends on PCI for PCI_MT7621 Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: mt7621-pci: IF statement expression comparing to NULLBranden Bonaby1-1/+1
Remove comparison to NULL in the if statement expression to match the Linux Kernel coding style. CHECK: Comparison to NULL could be written "res" Signed-off-by: Branden Bonaby <brandonbonaby94@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-19staging: mt7621-pci: reverse condition to check for enabled portSergio Paracuellos1-1/+1
Each enabled port is being checked in 'mt7621_pcie_enable_ports" function calling 'mt7621_pcie_enable_port'. The return value for this function on success is zero, so the check is reversed. Fix it. Fixes: 802a2f7b2fe3: staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-19staging: mt7621-pci: remove two register writesSergio Paracuellos1-4/+0
There is no need to write IO and memory space window Host PCI bridge registers before doing anything else. Just use its default values which should be ok. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Reviewed-by: NeilBrown <neil@brown.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-19staging: mt7621-pci: replace spaces with tabs in commentSergio Paracuellos1-9/+9
To properly follow kernel style replace spaces with tabs in comment where link status bits are explained. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Reviewed-by: NeilBrown <neil@brown.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-19staging: mt7621-pci: remove not used definitionsSergio Paracuellos1-2/+0
There are two definitions which are not being used at all. Remove them. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Reviewed-by: NeilBrown <neil@brown.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-19staging: mt7621-pci: add reset control for general pcie resetSergio Paracuellos1-5/+10
There is still a reset line which is not being handled using reset_control properly and just being accessing writing registers. Use reset_control instead for pcie general reset line. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Reviewed-by: NeilBrown <neil@brown.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-11staging: mt7621-pci: update driver's TODO fileSergio Paracuellos1-8/+0
Some of the things included in driver's TODO file have been properly achieved. Update file accordly. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-11Staging: mt7621-pci: Fix space required coding styleGuilherme Tadashi Maeoka1-2/+2
Fix some space required coding style. Signed-off-by: Guilherme Tadashi Maeoka <gui.maeoka@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-18staging: Mediatek: Use individual config flags in MakefileGeorge Hilliard1-1/+1
These drivers can be useful on other MT76xx SoCs, which have compatible peripherals. The drivers were selectable in Kconfig, but they were quietly excluded from the build because the SOC_MT7621 chip was not selected. So, make the Makefiles use the same flags as Kconfig for these drivers. mt7621-dma and mt7621-dts are left alone because they truly do require that SoC. I have personally confirmed that the mt7621-spi driver works on the MT7688, which was what prompted this change. Cc: linux-kernel@vger.kernel.org Cc: devel@driverdev.osuosl.org Cc: NeilBrown <neil@brown.name> Cc: sergio.paracuellos@gmail.com Signed-off-by: George Hilliard <thirtythreeforty@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-15staging: mt7621-pci: use PCI definitions instead of hardcode valuesSergio Paracuellos1-2/+3
Seting up ports to enable PCI_COMMAND_MASTER is using '0x4' as a hardcore value and '0x4' also for PCI_COMMAND register instead of use definitions from linux pci system headers. Replace both. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-07staging: mt7621-pci: handle phy using new generic phy 'pci-mt7621-phy' driverSergio Paracuellos1-218/+32
Phy part of this driver has been moved to a new 'pci-mt7621-phy' driver. Change code to use kernel's generic phy API removing also no more need moved code. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05staging: mt7621-pci: add comment clarifying inverted reset linesSergio Paracuellos1-0/+4
To avoid people reading this code being very confused, add a comment clarifying the need for invert resets on some chip revisions. Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-26staging: mt7621-pci: avoid using clk_* operationsSergio Paracuellos1-16/+0
There is no clock driver for ralink mips and clk_enable are no-ops for this architecture. This has been also tested without using clocks and seems to work so avoid to use them in this driver. Fixes: ad9c87e129d1: "staging: mt7621-pci: parse and init port data from device tree" Reported-by: NeilBrown <neil@brown.name> 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-11-26staging: mt7621-pci: fix reset lines for each pcie portSergio Paracuellos1-6/+32
Depending of chip revision reset lines are inverted. It is also necessary to read PCIE_FTS_NUM register before enabling the phy. Hence update the code to achieve this. Fixes: 745eeeac68d7 ("staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function") Reported-by: NeilBrown <neil@brown.name> 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-11-26staging: mt7621-pci: dt-bindings: update bindings doc removing sysctls registersSergio Paracuellos1-2/+1
The sysctl register are already claimed by palmbus, so pci fails to claim it. Device tree has been updated to not use it at all with pcie. Update bindings documentation. 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-11-26staging: mt7621-pci: avoid mapping sysctls registersSergio Paracuellos1-14/+1
The sysctl register are already claimed by palmbus, so pci fails to claim it. The best way to access the sysc registers is to use rt_sysc_[rwm]32(). Fixes: 89e9f6e6adfc: staging: mt7621-pci: remap and use sysctl from device tree Reported-by: NeilBrown <neil@brown.name> 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-11-11staging: mt7621-pci: dt-bindings: add dt bindings for mt7621 pcie controllerSergio Paracuellos1-0/+100
This commit adds pci device tree bindings for the Mt7621 pci controller. This is a temporal file included in staging driver directory and will be moved to its correct location when this driver gets out of staging. Cc: Rob Herring <robh@kernel.org> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: replace 'mdelay()' with 'msleep()'Sergio Paracuellos1-1/+1
Function 'mt7621_pcie_init_ports' is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: move some code into 'mt7621_pcie_init_ports'Sergio Paracuellos1-10/+8
Some clocks bits related code is in driver probe function and can perfectly be moved into 'mt7621_pcie_init_ports' function which is a more accurate place for it. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' functionSergio Paracuellos1-35/+45
Function 'mt7621_pcie_enable_ports' tries to enable all PCI ports. To make it more readable the single port initialization part has been factor out into a new 'mt7621_pcie_enable_port' function. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: enable interrupt when port is being enabledSergio Paracuellos1-4/+5
Interrupt is being enabled in port initialization when the port phy has not been initialized yet. Just enable the interrupt when the port is being enabled which is a more accurate place for this. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: use PCIE_PORT_LINKUP instead of hardcode valueSergio Paracuellos1-1/+1
PCIE_PORT_LINKUP is defined and can be used to check if link is up for each controller. Use it instead of use a hardcode value. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: use PERST_N instead of gpio controlSergio Paracuellos1-22/+24
Driver is using gpio control instead of each port PERST_N bit. Use PERST_N bit of each port cleaning all the ugly gpio code in driver probe function. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: add some definitions for enabling and disabling GEN and GEN1 clocksSergio Paracuellos1-3/+7
Instead of use hardcoded values when calling 'rt_sysc_m32' for enabling and disabling RALINK_PCIE_CLK_GEN and RALINK_PCIE_CLK_GEN1 create some preprocessor definitions. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: rewrite hardcoded code for enabling portsSergio Paracuellos1-6/+15
There are some hardcoded values in the process for enabling and disabling some stuff inside 'mt7621_pcie_enable_ports' function. Create some preprocessor definitions to make code more readable. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: rewrite RC FTS configurationSergio Paracuellos1-5/+11
The RC FTS configuration is done using hardcoded registers and bitshift operations. Make it a bit clean defining some prepocessor definitions and simple macros. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: align function definition style along the codeSergio Paracuellos1-8/+5
Make some function definition changes in order to get all the functions in the code with the same style. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: remove non sense commentSergio Paracuellos1-5/+0
There is a comment at the beggining which has no sense at all. Remove it. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: reorder preprocessor definitionsSergio Paracuellos1-16/+18
Reorder a bit register definitions and some values into logical groups adding some comments for each group. Also unify all of register to use 16 bit in definitions instead of having some with 16 bits and some with 8 bits. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: remove unused preprocessor definitionsSergio Paracuellos1-9/+0
There are some preprocessor definition which are not being used at all. Remove them cleaning the code a bit. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: factor out 'mt7621_pcie_init_ports' functionSergio Paracuellos1-10/+18
Instead of just inline this code in the probe driver function factor out a new 'mt7621_pcie_init_ports' function to achieve this. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: avoid use of global variable 'pcie_link_status'Sergio Paracuellos1-50/+75
'pcie_link_status' is a global variable which is being used as a mask to know which virtual bridges are or not enabled. Instead of this extract a new 'mt7621_pcie_init_virtual_bridges' function where a similar local variable is used for the same task. This allow us to properly configure the virtual PCI-PCI bridges in configuration registers of the mt7621 pci controller. For a correct initiation of which is connected use 'enabled' field of 'mt7621_pcie_port' struct. With this change driver probe function gets a bit cleaner and readable. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: factor out 'mt7621_pcie_enable_ports' functionSergio Paracuellos1-64/+42
Driver probe function check for a bit in 'pcie_link_status' for enabling the pcie port or not. Instead of this add 'enabled' field in 'mt7621_pcie_port' structure and check its value to achieve this inside a new 'mt7621_pcie_enable_ports' function. The offsets for the correct port are derived from the slot of the port. This field 'enabled' is properly initilized in 'mt7621_pcie_init_port'. Also depending of the number of ports enabled we have to properly init its registers taking into account that we will use virtual bridges from zero to num_slots_enabled as follows: - Only one enabled -> only enable virtual bridge 0. - Two enabled -> enable virtual bridges 0 and 1. - Three enabled -> enable virtual bridges 0, 1 and 2. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: use dev_* functions instead of printkSergio Paracuellos1-6/+8
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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: use a trailing */ on a separate lineSergio Paracuellos1-2/+4
Chackpatch script is compalining about one comment which is not following the kernel style. Fix it. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: remap and use sysctl from device treeSergio Paracuellos1-5/+33
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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: rename 'mt7621_pcie_enable_port' into 'mt7621_pcie_init_port'Sergio Paracuellos1-2/+2
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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: debug port N_FTS inside 'mt7621_pcie_enable_port'Sergio Paracuellos1-3/+3
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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: factor out 'mt7621_enable_phy' functionSergio Paracuellos1-3/+10
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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: rewrite pcie phy related functionsSergio Paracuellos1-99/+195
Function 'bypass_pipe_rst' and 'set_phy_for_ssc' can be written in a cleaner way. Instead of use comments to see which bits are the ones which are being enabled add new macros with that information using BIT and GENMASK kernel macros. Avoid the use of set_pcie_phy which is kind of dark and use new 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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: reagroup reset related macros all togetherSergio Paracuellos1-2/+3
Reset bits related macros are in different parts. Reagroup all of them together to improve readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: remove reset related unused macrosSergio Paracuellos1-4/+0
There are three macros which are not being used at all. Remove them. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: remove two commented code linesSergio Paracuellos1-5/+0
This two lines whch are commented are not needed at all. Remove them. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: remove GPL2+ text from license headerSergio Paracuellos1-28/+3
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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: remove [ASSERT|DEASSERT]_SYSRST_PCIE macrosSergio Paracuellos1-15/+0
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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' functionSergio Paracuellos1-47/+41
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 <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>