Skip to contentSkip to conversation

PCI: iproc: Skip BCMA-attached controllers in the platform bus driver

PATCH Applied Semih Baskan 4 participants 4 messages Oct 19 – Oct 31

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: iproc: Skip BCMA-attached controllers in the platform bus driver

Since commit 767012397976 ("ARM: dts: BCM5301X: Describe PCIe controllers fully"), the Northstar PCIe nodes under the "brcm,bus-axi" node have compatible = "brcm,iproc-pcie". bcma_bus_register() creates platform devices for the children of that node before it registers its own cores, so pcie-iproc-platform probes these controllers before pcie-iproc-bcma does, as IPROC_PCIE_PAXB.

IPROC_PCIE_PAXB sets has_apb_err_disable, so the first config read on bus 1 reads APB_ERR_EN at offset 0xf40. The report in the Closes: link shows that read taking an external abort. On a BCM47081 (PCIe core revision 0x01) with a device behind the root port, the board does not boot, and it boots when has_apb_err_disable is cleared.

Return -ENODEV for a controller whose parent is "brcm,bus-axi", before the driver allocates or maps anything, so that the controller is left to pcie-iproc-bcma. The devicetree stays as it is. The check does not depend on CONFIG_PCIE_IPROC_BCMA, because a kernel with only pcie-iproc-platform does not boot on the BCM47081 either. On a BCM47094 (core revision 0x07) pcie-iproc-platform enumerates the devices on its own, so there a kernel without CONFIG_PCIE_IPROC_BCMA loses PCIe, as before v7.1. CONFIG_PCIE_IPROC_BCMA defaults to y on ARCH_BCM_5301X.

Tested on an ASUS RT-N18U (BCM47081) on a 6.18 kernel with the controller/iproc-bcma changes backported. With both drivers enabled, pcie-iproc-bcma binds controller 0, the BCM4360 behind it enumerates and the platform driver logs nothing. With only pcie-iproc-platform enabled, the board boots without PCIe. Without this change, neither configuration boots on this board.

Fixes 767012397976 ("ARM: dts: BCM5301X: Describe PCIe controllers fully")

---
This is on controller/iproc-bcma in pci.git and needs 9850907ee1dd ("PCI: iproc: Use the EROM outbound window on BCMA"). Without that commit, pcie-iproc-bcma fails with -EBUSY on v7.1 and later, so this change alone would leave Northstar without PCIe. If this goes to stable, 39d1c645bb99 and 9850907ee1dd have to go with it.

Mani's sketch [1] returned -EINVAL; this returns -ENODEV, which the driver core does not log as a probe failure.

[1] https://lore.kernel.org/r/179197555828.38040.6359970121400952902.b4-reply@b4

 drivers/pci/controller/pcie-iproc-platform.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/controller/pcie-iproc-platform.c +3 -0
index 4c9a0c4bb923..63560c733a8f 100644
@@ -45,6 +45,9 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
 	struct pci_host_bridge *bridge;
 	int ret;
 
+	if (of_device_is_compatible(np->parent, "brcm,bus-axi"))
+		return -ENODEV;
+
 	bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
 	if (!bridge)
 		return -ENOMEM;

base-commit: 9850907ee1dd4376c09c4129e0adbe3b39d191b7

Signature · 1 line
2.43.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 13 lines

Since commit 767012397976 ("ARM: dts: BCM5301X: Describe PCIe controllers fully"), the Northstar PCIe nodes under the "brcm,bus-axi" node have compatible = "brcm,iproc-pcie". bcma_bus_register() creates platform devices for the children of that node before it registers its own cores, so pcie-iproc-platform probes these controllers before pcie-iproc-bcma does, as IPROC_PCIE_PAXB.

IPROC_PCIE_PAXB sets has_apb_err_disable, so the first config read on bus 1 reads APB_ERR_EN at offset 0xf40. The report in the Closes: link shows that read taking an external abort. On a BCM47081 (PCIe core revision 0x01) with a device behind the root port, the board does not boot, and it boots when has_apb_err_disable is cleared.

Quoted 8 lines

Return -ENODEV for a controller whose parent is "brcm,bus-axi", before the driver allocates or maps anything, so that the controller is left

[ ... ]
Fixes 767012397976 ("ARM: dts: BCM5301X: Describe PCIe controllers fully")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Tested-by on v1 1/1
#2 lore raw
In reply to Semih Baskan
Quoted 29 lines · Semih Baskan

Since commit 767012397976 ("ARM: dts: BCM5301X: Describe PCIe controllers fully"), the Northstar PCIe nodes under the "brcm,bus-axi" node have compatible = "brcm,iproc-pcie". bcma_bus_register() creates platform devices for the children of that node before it registers its own cores, so pcie-iproc-platform probes these controllers before pcie-iproc-bcma does, as IPROC_PCIE_PAXB.

IPROC_PCIE_PAXB sets has_apb_err_disable, so the first config read on bus 1 reads APB_ERR_EN at offset 0xf40. The report in the Closes: link shows that read taking an external abort. On a BCM47081 (PCIe core revision 0x01) with a device behind the root port, the board does not boot, and it boots when has_apb_err_disable is cleared.

Return -ENODEV for a controller whose parent is "brcm,bus-axi", before the driver allocates or maps anything, so that the controller is left to pcie-iproc-bcma. The devicetree stays as it is. The check does not depend on CONFIG_PCIE_IPROC_BCMA, because a kernel with only pcie-iproc-platform does not boot on the BCM47081 either. On a BCM47094 (core revision 0x07) pcie-iproc-platform enumerates the devices on its own, so there a kernel without CONFIG_PCIE_IPROC_BCMA loses PCIe, as before v7.1. CONFIG_PCIE_IPROC_BCMA defaults to y on ARCH_BCM_5301X.

Tested on an ASUS RT-N18U (BCM47081) on a 6.18 kernel with the controller/iproc-bcma changes backported. With both drivers enabled, pcie-iproc-bcma binds controller 0, the BCM4360 behind it enumerates and the platform driver logs nothing. With only pcie-iproc-platform enabled, the board boots without PCIe. Without this change, neither configuration boots on this board.

Quoted 5 lines
Fixes 767012397976 ("ARM: dts: BCM5301X: Describe PCIe controllers fully")

On a SmartRG SR400-AC which is based upon BCM4708:

Thank you Semih!

Signature · 1 line
Florian
maintainer Applied
#3 lore raw
In reply to Semih Baskan
Quoted 1 line · Semih Baskan

PCI: iproc: Skip BCMA-attached controllers in the platform bus driver

Applied, thanks!

[1/1] PCI: iproc: Skip BCMA-attached controllers in the platform bus driver

      commit: 4d3e0b32afedfcbed5f1e38ddec035af545e64ef

Best regards,

Signature · 1 line
மணிவண்ணன் சதாசிவம்