diff options
author | Bjorn Helgaas | 2020-06-04 12:59:14 -0500 |
---|---|---|
committer | Bjorn Helgaas | 2020-06-04 12:59:14 -0500 |
commit | a1dcc1aa6f67243e1622a55a345a37343af14b4e (patch) | |
tree | 457f6acc2fe6f8cdb5e5f43e261490b95f7ab960 /drivers/pci | |
parent | 754262d1befb16a9581b7ccfa9d1e17d41c54969 (diff) | |
parent | c65822fef4adc0ba40c37a47337376ce75f7a7bc (diff) |
Merge branch 'remotes/lorenzo/pci/brcmstb'
- Assert fundamental reset on initialization (Nicolas Saenz Julienne)
- Remove unnecessary clk_put(); devm_clk_get() handles this automatically
(Jim Quinlan)
- Fix outbound memory window register stride offset (Jim Quinlan)
- Add "aspm-no-l0s" property for brcmstb and disable ASPM L0s when
present (Jim Quinlan)
- Add property to notify Raspberry Pi firmware of xHCI reset (Nicolas
Saenz Julienne)
- Add Raspberry Pi VL805 xHCI init function to trigger VL805 firmware
load (Nicolas Saenz Julienne)
- Wait in brcmstb probe for Raspberry Pi VL805 firmware initialization
(Nicolas Saenz Julienne)
- Load Raspberry Pi VL805 firmware in USB early handoff quirk (Nicolas
Saenz Julienne)
* remotes/lorenzo/pci/brcmstb:
USB: pci-quirks: Add Raspberry Pi 4 quirk
PCI: brcmstb: Wait for Raspberry Pi's firmware when present
firmware: raspberrypi: Introduce vl805 init routine
soc: bcm2835: Add notify xHCI reset property
PCI: brcmstb: Disable L0s component of ASPM if requested
dt-bindings: PCI: brcmstb: New prop 'aspm-no-l0s'
PCI: brcmstb: Fix window register offset from 4 to 8
PCI: brcmstb: Don't clk_put() a managed clock
PCI: brcmstb: Assert fundamental reset on initialization
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/controller/pcie-brcmstb.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 6d79d14527a6..7730ea845ff2 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -28,6 +28,8 @@ #include <linux/string.h> #include <linux/types.h> +#include <soc/bcm2835/raspberrypi-firmware.h> + #include "../pci.h" /* BRCM_PCIE_CAP_REGS - Offset for the mandatory capability config regs */ @@ -41,6 +43,9 @@ #define PCIE_RC_CFG_PRIV1_ID_VAL3 0x043c #define PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK 0xffffff +#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc +#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00 + #define PCIE_RC_DL_MDIO_ADDR 0x1100 #define PCIE_RC_DL_MDIO_WR_DATA 0x1104 #define PCIE_RC_DL_MDIO_RD_DATA 0x1108 @@ -54,11 +59,11 @@ #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO 0x400c #define PCIE_MEM_WIN0_LO(win) \ - PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 4) + PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 8) #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI 0x4010 #define PCIE_MEM_WIN0_HI(win) \ - PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 4) + PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 8) #define PCIE_MISC_RC_BAR1_CONFIG_LO 0x402c #define PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK 0x1f @@ -693,10 +698,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) int num_out_wins = 0; u16 nlw, cls, lnksta; int i, ret; - u32 tmp; + u32 tmp, aspm_support; /* Reset the bridge */ brcm_pcie_bridge_sw_init_set(pcie, 1); + brcm_pcie_perst_set(pcie, 1); usleep_range(100, 200); @@ -803,6 +809,15 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) num_out_wins++; } + /* Don't advertise L0s capability if 'aspm-no-l0s' */ + aspm_support = PCIE_LINK_STATE_L1; + if (!of_property_read_bool(pcie->np, "aspm-no-l0s")) + aspm_support |= PCIE_LINK_STATE_L0S; + tmp = readl(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); + u32p_replace_bits(&tmp, aspm_support, + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK); + writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); + /* * For config space accesses on the RC, show the right class for * a PCIe-PCIe bridge (the default setting is to be EP mode). @@ -899,7 +914,6 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) brcm_msi_remove(pcie); brcm_pcie_turn_off(pcie); clk_disable_unprepare(pcie->clk); - clk_put(pcie->clk); } static int brcm_pcie_remove(struct platform_device *pdev) @@ -917,11 +931,26 @@ static int brcm_pcie_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node, *msi_np; struct pci_host_bridge *bridge; + struct device_node *fw_np; struct brcm_pcie *pcie; struct pci_bus *child; struct resource *res; int ret; + /* + * We have to wait for Raspberry Pi's firmware interface to be up as a + * PCI fixup, rpi_firmware_init_vl805(), depends on it. This driver's + * probe can race with the firmware interface's (see + * drivers/firmware/raspberrypi.c) and potentially break the PCI fixup. + */ + fw_np = of_find_compatible_node(NULL, NULL, + "raspberrypi,bcm2835-firmware"); + if (fw_np && !rpi_firmware_get(fw_np)) { + of_node_put(fw_np); + return -EPROBE_DEFER; + } + of_node_put(fw_np); + bridge = devm_pci_alloc_host_bridge(&pdev->dev, sizeof(*pcie)); if (!bridge) return -ENOMEM; |