summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/dts/rk3588-jaguar-u-boot.dtsi6
-rw-r--r--board/theobroma-systems/jaguar_rk3588/jaguar_rk3588.c20
2 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm/dts/rk3588-jaguar-u-boot.dtsi b/arch/arm/dts/rk3588-jaguar-u-boot.dtsi
index dcda4f99d6e..0fbbb50fc5a 100644
--- a/arch/arm/dts/rk3588-jaguar-u-boot.dtsi
+++ b/arch/arm/dts/rk3588-jaguar-u-boot.dtsi
@@ -21,6 +21,12 @@
bootph-some-ram;
};
+&gpio0 {
+ /* Need gpio0 in SPL for spl_board_init() to control GPIO0_D0 */
+ /* TODO: once we have a U-Boot TPL, use bootph-pre-sram; */
+ bootph-pre-ram;
+};
+
&gpio2 {
bootph-pre-ram;
bootph-some-ram;
diff --git a/board/theobroma-systems/jaguar_rk3588/jaguar_rk3588.c b/board/theobroma-systems/jaguar_rk3588/jaguar_rk3588.c
index 3f484646701..5177aa9d6e8 100644
--- a/board/theobroma-systems/jaguar_rk3588/jaguar_rk3588.c
+++ b/board/theobroma-systems/jaguar_rk3588/jaguar_rk3588.c
@@ -54,6 +54,8 @@ int rockchip_early_misc_init_r(void)
#define GPIO0B7_PU_EN BIT(15)
+#define M2_NVME_PERSTN 24 /* GPIO0_D0, PERSTN signal to the M.2 NVMe slot */
+
void spl_board_init(void)
{
/*
@@ -67,6 +69,24 @@ void spl_board_init(void)
* pull-up.
*/
struct rk3588_pmu2_ioc * const ioc = (void *)PMU2_IOC_BASE;
+ int ret;
+ /* TODO: once we have a U-Boot TPL, move this to tpl_board_init() */
rk_setreg(&ioc->gpio0b_p, GPIO0B7_PU_EN);
+
+ /*
+ * Set the M.2 NVMe slot PERSTN to a defined low
+ * state as early as possible
+ */
+ ret = gpio_request(M2_NVME_PERSTN, "M2_NVME_PERSTN");
+ if (ret) {
+ log_err("M2_NVME_PERSTN: gpio request failed: %d\n", ret);
+ return;
+ }
+
+ ret = gpio_direction_output(M2_NVME_PERSTN, 0);
+ if (ret) {
+ log_err("M2_NVME_PERSTN: gpio direction set failed: %d\n", ret);
+ return;
+ }
}