Commit graph

10 commits

Author SHA1 Message Date
Florian Fainelli be908d21b2 PCI: iproc: Fix header comment "Corporation" misspelling
Fix an obvious "Broadcom Corporation" typo in a header comment.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Ray Jui <rjui@broadcom.com>
2015-10-22 13:53:13 -05:00
Ray Jui e99a187b5c PCI: iproc: Add outbound mapping support
Certain SoCs require the PCIe outbound mapping to be configured in
software.  Add support for those chips.

[jonmason: Use %pap format when printing size_t to avoid warnings in 32-bit
build.]
[arnd: Use div64_u64() instead of "%" to avoid __aeabi_uldivmod link error
in 32-bit build.]
Signed-off-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2015-10-16 08:18:24 -05:00
Ray Jui aaf22ab4e9 PCI: iproc: Improve link detection logic
Improve the link detection logic by explicitly querying the link status
register to ensure link is active.

Also force class to PCI_CLASS_BRIDGE_PCI (0x0604) through the host
configuration space register.

Signed-off-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Anup Patel <anup.patel@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
2015-09-25 18:19:40 -05:00
Ray Jui 199ff14100 PCI: iproc: Fix PCIe reset logic
The current reset logic does not always properly reset the device.  For
example, in the case when the perst_b signal is already de-asserted in the
bootloader, the current reset logic fails to trigger a proper assert ->
de-assert reset sequence.

Fix the issue by always triggering the proper reset sequence.

Also explicitly select the desired reset source, i.e., perst_b, and reduce
the wait time after the device comes out of reset from 250 ms to 100 ms,
based on recommendation from the ASIC team.

Tested-by: Vladimir Dreizin <vdreizin@broadcom.com>
Tested-by: Darren Edamura <dedamura@broadcom.com>
Signed-off-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Vladimir Dreizin <vdreizin@broadcom.com>
Reviewed-by: Trac Hoang <trhoang@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
2015-09-25 18:13:04 -05:00
Ray Jui bdb8a1844f PCI: iproc: Call pci_fixup_irqs() for ARM64 as well as ARM
After 459a07721c ("PCI: Build setup-irq.o for arm64"), we build
setup-irq.o for arm64, so we can use pci_fixup_irqs() on both arm and
arm64.

Remove the "#ifdef CONFIG_ARM" around the call to pci_fixup_irqs().

[bhelgaas: changelog]
Signed-off-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2015-09-25 18:10:11 -05:00
Ray Jui 8d9bfe3702 PCI: iproc: Add arm64 support
Add arm64 support to the iProc PCIe driver.

Note that on arm32, bus->sysdata points to the arm32-specific pci_sys_data
struct, and pci_sys_data.private_data contains the iproc_pcie pointer.
For arm64, there's nothing corresponding to pci_sys_data, so we keep the
iproc_pcie pointer directly in bus->sysdata.

In addition, arm64 does IRQ mapping in pcibios_add_device(), so it doesn't
need pci_fixup_irqs() as arm32 does.

Signed-off-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
2015-07-22 14:55:00 -05:00
Markus Elfring 93972d18bb PCI: iproc: Delete unnecessary checks before phy calls
The functions phy_exit() and phy_power_off() test whether their argument is
NULL and then return immediately.  Thus the test around the calls is not
needed.

This issue was detected by using the Coccinelle software.

[bhelgaas: also phy_init() and phy_power_on(), as Ray Jui suggested]
[bhelgaas: also remove tests in iproc_pcie_remove()]
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
2015-07-14 14:59:52 -05:00
Hauke Mehrtens 18c4342aa5 PCI: iproc: Directly add PCI resources
The struct iproc_pcie.resources member was pointing to a stack variable and
is invalid after the registration function returned.

Remove this pointer and add a parameter to the function.

Tested-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
2015-05-27 18:27:54 -05:00
Hauke Mehrtens c1e02ceaf5 PCI: iproc: Allow override of device tree IRQ mapping function
The iProc core PCIe driver defaults to using of_irq_parse_and_map_pci() for
IRQ mapping.  Add iproc_pcie.map_irq so bus interfaces that don't use
device tree can override this by supplying their own IRQ mapping function.

[bhelgaas: changelog]
Posting: http://lkml.kernel.org/r/1431465781-10753-1-git-send-email-hauke@hauke-m.de
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ray Jui <rjui@broadcom.com.com>
2015-05-20 09:19:40 -05:00
Ray Jui 1fb37a8178 PCI: iproc: Add Broadcom iProc PCIe support
Add support for the Broadcom iProc PCIe controller.

pcie-iproc.c is the common core driver, and a front-end bus interface needs
to be added to support different bus interfaces.

pcie-iproc-platform.c contains the support for the platform bus interface.

Signed-off-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-04-08 14:19:36 -05:00