Skip to content

Commit 65ccba8

Browse files
P33Mpopcornmix
authored andcommitted
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>
1 parent 657b976 commit 65ccba8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,17 @@
209209
#define PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_PWRDN_MASK 0x1
210210
#define PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_PWRDN_SHIFT 0x0
211211

212+
/* BCM7712/2712-specific registers */
213+
#define PCIE_MISC_UBUS_CTRL 0x40a4
214+
#define PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_ERR_DIS_MASK BIT(13)
215+
#define PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_DECERR_DIS_MASK BIT(19)
216+
217+
#define PCIE_MISC_UBUS_TIMEOUT 0x40a8
218+
219+
#define PCIE_MISC_RC_CONFIG_RETRY_TIMEOUT 0x405c
220+
221+
#define PCIE_MISC_AXI_READ_ERROR_DATA 0x4170
222+
212223
/* Forward declarations */
213224
struct brcm_pcie;
214225

@@ -859,6 +870,30 @@ static int brcm_pcie_post_setup_bcm2712(struct brcm_pcie *pcie)
859870
tmp |= 0x12;
860871
writel(tmp, pcie->base + PCIE_RC_PL_PHY_CTL_15);
861872

873+
/*
874+
* BCM7712/2712 uses a UBUS-AXI bridge.
875+
* Suppress AXI error responses and return 1s for read failures.
876+
*/
877+
tmp = readl(pcie->base + PCIE_MISC_UBUS_CTRL);
878+
u32p_replace_bits(&tmp, 1, PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_ERR_DIS_MASK);
879+
u32p_replace_bits(&tmp, 1, PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_DECERR_DIS_MASK);
880+
writel(tmp, pcie->base + PCIE_MISC_UBUS_CTRL);
881+
writel(0xffffffff, pcie->base + PCIE_MISC_AXI_READ_ERROR_DATA);
882+
883+
/*
884+
* Adjust timeouts. The UBUS timeout also affects Configuration Request
885+
* Retry responses, as the request will get terminated if
886+
* either timeout expires, so both have to be a large value
887+
* (in clocks of 750MHz).
888+
* Set UBUS timeout to 250ms, then set RC config retry timeout
889+
* to be ~240ms.
890+
*
891+
* If CRSSVE=1 this will stop the core from blocking on a Retry
892+
* response, but does require the device to be well-behaved...
893+
*/
894+
writel(0xB2D0000, pcie->base + PCIE_MISC_UBUS_TIMEOUT);
895+
writel(0xABA0000, pcie->base + PCIE_MISC_RC_CONFIG_RETRY_TIMEOUT);
896+
862897
return 0;
863898
}
864899

0 commit comments

Comments
 (0)