Commit graph

105 commits

Author SHA1 Message Date
Sergio Paracuellos
3b2fa0c926 MIPS: ralink: enable PCI support only if driver for mt7621 SoC is selected
Some versions of SoC MT7621 have three PCI express hosts. Some boards
make use of those PCI through the staging driver mt7621-pci. Recently
PCI support has been removed from MT7621 Soc kernel configuration due
to a build error. This makes imposible to compile staging driver and
produces a regression for gnubee based boards. Enable support for PCI
again but enable it only if staging mt7621-pci driver is selected.

Fixes: c4d48cf5e2 ("MIPS: ralink: deactivate PCI support for SOC_MT7621")
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: ralf@linux-mips.org
Cc: jhogan@kernel.org
Cc: john@phrozen.org
Cc: NeilBrown <neil@brown.name>
Cc: linux-mips@vger.kernel.org
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20191019081233.7337-1-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-14 13:09:37 +08:00
Sergio Paracuellos
b483b4e4d3 staging: mt7621-pci: add quirks for 'E2' revision using 'soc_device_attribute'
Depending on revision of the chip, reset lines are inverted. Make code
more readable making use of 'soc_device_match' in driver probe function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20191006181032.19112-1-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-07 12:25:47 +02:00
Sergio Paracuellos
7f9b583358 staging: mt7621-pci: avoid use 'err' local variable
Function 'mt7621_pcie_request_resources' is using 'err'
local variable to get value returned from 'devm_request_pci_bus_resources'
and returning after that. This is not needed at all. Instead of that
just directly return returned value by the function which is also
returning zero on success.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20190720072908.16795-1-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-25 09:58:26 +02:00
Nishka Dasgupta
2125a44149 staging: mt7621-pci: Add of_node_put() before return
Each iteration of for_each_available_child_of_node puts the previous
node, but in the case of a return from the middle of the loop, there is
no put, thus causing a memory leak. Hence add an of_node_put before the
return in two places.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190716055944.3237-1-nishkadg.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-22 07:34:15 +02:00
Sergio Paracuellos
0ae0cf509d staging: mt7621-pci: fix PCIE_FTS_NUM_LO macro
Add missing parenthesis to PCIE_FTS_NUM_LO macro to do the
same it was being done in original code.

Fixes: a4b2eb912b ("staging: mt7621-pci: rewrite RC FTS configuration")
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-01 08:58:21 +02:00
Sergio Paracuellos
2e26e96672 staging: mt7621-pci: use 'module_init' instead of 'arch_initcall'
This driver has dependencies on mt7621-gpio and mt7621-pci-phy which
are init in later stages. Hence, when this driver is probed it is always
returning 'EPROBE_DEFER' and being initialized afterwards. Use function
'module_init' to just initialize later.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-21 16:50:10 +02:00
Sergio Paracuellos
cdf6f83b3c staging: mt7621-pci: add phy exit call if phy_power_on call fails
Add missing call to 'phy_exit' function if the phy_power_on call fails.
With this call added the error path is properly handled.

Fixes: 07420a02b0 ("staging: mt7621-pci: use gpio perst instead of builtin behaviour")
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-21 16:50:10 +02:00
Sergio Paracuellos
36e92f611e staging: mt7621-pci: disable pcie port clock if there is no pcie link
When there is no pcie link detected we have to properly disable the
port pcie clock.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-21 16:50:10 +02:00
Sergio Paracuellos
014860188c staging: mt7621-pci: dt-bindings: add perst-gpio to sample bindings
Both driver and device tree have been updated to use GPIO perst.
Update bindings documentation also.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20 14:45:50 +02:00
Sergio Paracuellos
07420a02b0 staging: mt7621-pci: use gpio perst instead of builtin behaviour
Some boards seems to ignore the PERST builtin behaviour to properly
perform a pcie line reset. Use gpio PERST behaviour instead which
seems to be more common.

Fixes: bd1a05bd87 ("staging: mt7621-pci: use PERST_N instead of gpio control")
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20 14:45:49 +02:00
Sergio Paracuellos
fdd228cd6d staging: mt7621-pci: fix two messages in driver code
There are two messages in driver code which are not correct.
Fix both of them to clarify boot runs.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20 14:45:49 +02:00
Greg Kroah-Hartman
97ed8eab2a staging: add missing SPDX lines to Makefile files
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-03 11:10:15 +02:00
Greg Kroah-Hartman
99b75a4e32 staging: add missing SPDX lines to Kconfig files
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-03 11:10:15 +02:00
Greg Kroah-Hartman
b397f82585 Merge 5.1-rc3 into staging-next
We want those fixes and this resolves an erofs merge conflict.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-01 07:49:24 +02:00
Maxim Zhukov
90cd9bed5a staging, mt7621-pci: fix build without pci support
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-18 07:59:04 +01:00
Branden Bonaby
6d49a15ead staging: mt7621-pci: IF statement expression comparing to NULL
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-03-18 07:05:24 +01:00
Sergio Paracuellos
8b20408a56 staging: mt7621-pci: reverse condition to check for enabled port
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: 802a2f7b2f: 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-19 11:14:14 +01:00
Sergio Paracuellos
1623171dc1 staging: mt7621-pci: remove two register writes
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-19 11:13:08 +01:00
Sergio Paracuellos
186e868060 staging: mt7621-pci: replace spaces with tabs in comment
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-19 11:13:08 +01:00
Sergio Paracuellos
fa461f6a4c staging: mt7621-pci: remove not used definitions
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-19 11:13:08 +01:00
Sergio Paracuellos
47f87b690d staging: mt7621-pci: add reset control for general pcie reset
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-19 11:13:07 +01:00
Sergio Paracuellos
52ec10337c staging: mt7621-pci: update driver's TODO file
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-11 10:02:50 +01:00
Guilherme Tadashi Maeoka
d099c72d38 Staging: mt7621-pci: Fix space required coding style
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-02-11 10:02:50 +01:00
George Hilliard
9a41352614 staging: Mediatek: Use individual config flags in Makefile
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-18 11:01:02 +01:00
Sergio Paracuellos
7c106cbb2b staging: mt7621-pci: use PCI definitions instead of hardcode values
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-15 16:08:36 +01:00
Sergio Paracuellos
61f9bde6ea staging: mt7621-pci: handle phy using new generic phy 'pci-mt7621-phy' driver
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>
2019-01-07 11:28:14 +01:00
Sergio Paracuellos
8cfb722bd5 staging: mt7621-pci: add comment clarifying inverted reset lines
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-12-05 09:39:45 +01:00
Sergio Paracuellos
2f5496d878 staging: mt7621-pci: avoid using clk_* operations
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: ad9c87e129: "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-26 20:59:05 +01:00
Sergio Paracuellos
e51844bf82 staging: mt7621-pci: fix reset lines for each pcie port
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: 745eeeac68 ("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-26 20:59:05 +01:00
Sergio Paracuellos
fe62afd7eb staging: mt7621-pci: dt-bindings: update bindings doc removing sysctls registers
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-26 20:59:05 +01:00
Sergio Paracuellos
ce0c99e22e staging: mt7621-pci: avoid mapping sysctls registers
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: 89e9f6e6ad: 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-26 20:59:05 +01:00
Sergio Paracuellos
5451e22618 staging: mt7621-pci: dt-bindings: add dt bindings for mt7621 pcie controller
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-11 11:38:53 -08:00
Sergio Paracuellos
98afdd565f staging: mt7621-pci: replace 'mdelay()' with 'msleep()'
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-11 11:36:16 -08:00
Sergio Paracuellos
b8d97d43bf staging: mt7621-pci: move some code into 'mt7621_pcie_init_ports'
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-11 11:36:16 -08:00
Sergio Paracuellos
802a2f7b2f staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function
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-11 11:36:16 -08:00
Sergio Paracuellos
1e80699fd6 staging: mt7621-pci: enable interrupt when port is being enabled
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-11 11:36:16 -08:00
Sergio Paracuellos
bcb4530736 staging: mt7621-pci: use PCIE_PORT_LINKUP instead of hardcode value
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-11 11:36:16 -08:00
Sergio Paracuellos
bd1a05bd87 staging: mt7621-pci: use PERST_N instead of gpio control
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-11 11:36:16 -08:00
Sergio Paracuellos
fb672b450c staging: mt7621-pci: add some definitions for enabling and disabling GEN and GEN1 clocks
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-11 11:36:16 -08:00
Sergio Paracuellos
301c15be69 staging: mt7621-pci: rewrite hardcoded code for enabling ports
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-11 11:36:16 -08:00
Sergio Paracuellos
a4b2eb912b staging: mt7621-pci: rewrite RC FTS configuration
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-11 11:36:16 -08:00
Sergio Paracuellos
ce3368dc94 staging: mt7621-pci: align function definition style along the code
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-11 11:36:16 -08:00
Sergio Paracuellos
b842e0b972 staging: mt7621-pci: remove non sense comment
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-11 11:36:16 -08:00
Sergio Paracuellos
a934d90175 staging: mt7621-pci: reorder preprocessor definitions
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-11 11:36:15 -08:00
Sergio Paracuellos
58180d33ee staging: mt7621-pci: remove unused preprocessor definitions
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-11 11:36:15 -08:00
Sergio Paracuellos
cd910f19ac staging: mt7621-pci: factor out 'mt7621_pcie_init_ports' function
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-11 11:36:15 -08:00
Sergio Paracuellos
e2200279af staging: mt7621-pci: avoid use of global variable 'pcie_link_status'
'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-11 11:36:15 -08:00
Sergio Paracuellos
a41a1f8618 staging: mt7621-pci: factor out 'mt7621_pcie_enable_ports' function
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-11 11:36:15 -08:00
Sergio Paracuellos
d936550784 staging: mt7621-pci: use dev_* functions instead of printk
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-11 11:36:15 -08:00
Sergio Paracuellos
d2bac2fd6d staging: mt7621-pci: use a trailing */ on a separate line
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-11 11:36:15 -08:00