lede/target/linux/bcm27xx/patches-6.12/950-0887-PCI-brcmstb-set-BCM7712-2712-specific-AXI-bridge-han.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

70 lines
2.4 KiB
Diff

From 6dc140bcf2bed2bfd16f895dbe6c6da229cab2c6 Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.com>
Date: Mon, 10 Feb 2025 15:14:22 +0000
Subject: [PATCH] PCI: brcmstb: set BCM7712/2712-specific AXI bridge handling
behaviours
These chips use a UBUS-AXI bridge component that has configurable
timeout and error response handling.
Suppress AXI error responses to CPU requests, otherwise these are fatal
if they reach the ARM cluster, and set reasonably large timeouts for
both Mem and Cfg requests.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
---
drivers/pci/controller/pcie-brcmstb.c | 35 +++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -209,6 +209,17 @@
#define PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_PWRDN_MASK 0x1
#define PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_PWRDN_SHIFT 0x0
+/* BCM7712/2712-specific registers */
+#define PCIE_MISC_UBUS_CTRL 0x40a4
+#define PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_ERR_DIS_MASK BIT(13)
+#define PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_DECERR_DIS_MASK BIT(19)
+
+#define PCIE_MISC_UBUS_TIMEOUT 0x40a8
+
+#define PCIE_MISC_RC_CONFIG_RETRY_TIMEOUT 0x405c
+
+#define PCIE_MISC_AXI_READ_ERROR_DATA 0x4170
+
/* Forward declarations */
struct brcm_pcie;
@@ -859,6 +870,30 @@ static int brcm_pcie_post_setup_bcm2712(
tmp |= 0x12;
writel(tmp, pcie->base + PCIE_RC_PL_PHY_CTL_15);
+ /*
+ * BCM7712/2712 uses a UBUS-AXI bridge.
+ * Suppress AXI error responses and return 1s for read failures.
+ */
+ tmp = readl(pcie->base + PCIE_MISC_UBUS_CTRL);
+ u32p_replace_bits(&tmp, 1, PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_ERR_DIS_MASK);
+ u32p_replace_bits(&tmp, 1, PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_DECERR_DIS_MASK);
+ writel(tmp, pcie->base + PCIE_MISC_UBUS_CTRL);
+ writel(0xffffffff, pcie->base + PCIE_MISC_AXI_READ_ERROR_DATA);
+
+ /*
+ * Adjust timeouts. The UBUS timeout also affects Configuration Request
+ * Retry responses, as the request will get terminated if
+ * either timeout expires, so both have to be a large value
+ * (in clocks of 750MHz).
+ * Set UBUS timeout to 250ms, then set RC config retry timeout
+ * to be ~240ms.
+ *
+ * If CRSSVE=1 this will stop the core from blocking on a Retry
+ * response, but does require the device to be well-behaved...
+ */
+ writel(0xB2D0000, pcie->base + PCIE_MISC_UBUS_TIMEOUT);
+ writel(0xABA0000, pcie->base + PCIE_MISC_RC_CONFIG_RETRY_TIMEOUT);
+
return 0;
}