summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@mailbox.org>2025-09-18 18:36:01 +0200
committerMarek Vasut <marek.vasut+renesas@mailbox.org>2025-10-17 21:53:52 +0200
commita1a898588c803da43d625e5ca25cb4c78f80c7f3 (patch)
tree5a821efa5c092a4d78061f4af9e8081982430735
parent2b634a80b5ce92232f309fdd7d7864098ca7fb95 (diff)
arm64: renesas: r8a779g3: Reset PCIe before next stage on Retronix R-Car V4H Sparrow Hawk
Fully reset both PCIe controllers before booting the next stage on Retronix R-Car V4H Sparrow Hawk board. This is necessary especially in case U-Boot brought up the PCIe controllers, at which point the next stage might be confused by the state of the PCIe controller. The reset has to happen this late and not in the PCIe controller driver, because the SRCR11 bits seem to affect both controllers. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
-rw-r--r--board/renesas/sparrowhawk/sparrowhawk.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/board/renesas/sparrowhawk/sparrowhawk.c b/board/renesas/sparrowhawk/sparrowhawk.c
index 58de7f25cbd..a4eda852743 100644
--- a/board/renesas/sparrowhawk/sparrowhawk.c
+++ b/board/renesas/sparrowhawk/sparrowhawk.c
@@ -267,3 +267,30 @@ void renesas_dram_init_banksize(void)
gd->bd->bi_dram[bank].size = 0x200000000ULL;
}
}
+
+#define SRCR6 0xe6152c18
+#define SRCR11 0xe6152c2c
+#define SRSTCLR6 0xe6152c98
+#define SRSTCLR11 0xe6152cac
+#define SRCR_PCIEC0_PWR_RESET BIT(24)
+#define SRCR_PCIEC1_PWR_RESET BIT(25)
+#define SRCR_PCIEC0_APP_RESET BIT(21)
+#define SRCR_PCIEC1_APP_RESET BIT(22)
+
+void board_cleanup_before_linux(void)
+{
+ if (!IS_ENABLED(CONFIG_PCI_RCAR_GEN4))
+ return;
+
+ /* Set cold and application reset for both PCIe cores */
+ writel(SRCR_PCIEC0_PWR_RESET | SRCR_PCIEC1_PWR_RESET, SRCR6);
+ readl(SRCR6);
+ writel(SRCR_PCIEC0_APP_RESET | SRCR_PCIEC1_APP_RESET, SRCR11);
+ readl(SRCR11);
+
+ /* Clear cold and application reset for both PCIe cores */
+ writel(SRCR_PCIEC0_PWR_RESET | SRCR_PCIEC1_PWR_RESET, SRSTCLR6);
+ readl(SRSTCLR6);
+ writel(SRCR_PCIEC0_APP_RESET | SRCR_PCIEC1_APP_RESET, SRSTCLR11);
+ readl(SRSTCLR11);
+}