diff mbox series

[next,RFC,1/5] ram: rk3399: allow to fail DRAM init if pctl_start fails

Message ID 20241105-rk3399-dram-init-v1-1-1e29acdf0966@cherry.de
State New
Delegated to: Kever Yang
Headers show
Series rockchip: panic() when DRAM init fails | expand

Commit Message

Quentin Schulz Nov. 5, 2024, 5:21 p.m. UTC
From: Quentin Schulz <quentin.schulz@cherry.de>

pctl_start() can fail but how this is handled currently is by calling
hang() directly in the driver instead of propagating the error and
letting other code handling it.

This prepares for a future commit which removes the hang() in favor of
letting Rockchip's arch code handle it in a common place.

No change in behavior expected in this commit.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 drivers/ram/rockchip/sdram_rk3399.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
index 6fa8f268770d1c6d69431857e115264957d75703..63d7852555cea3296b7cd9eed422c4d5d1c9776b 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -791,9 +791,9 @@  static void set_ds_odt(const struct chan_info *chan,
 	phy_io_config(denali_phy, denali_ctl, params, mr5);
 }
 
-static void pctl_start(struct dram_info *dram,
-		       struct rk3399_sdram_params *params,
-		       u32 channel_mask)
+static int pctl_start(struct dram_info *dram,
+		      struct rk3399_sdram_params *params,
+		      u32 channel_mask)
 {
 	const struct chan_info *chan_0 = &dram->chan[0];
 	const struct chan_info *chan_1 = &dram->chan[1];
@@ -892,6 +892,8 @@  static void pctl_start(struct dram_info *dram,
 					params->phy_regs.denali_phy[937] &
 					0xFF);
 	}
+
+	return 0;
 }
 
 static int pctl_cfg(struct dram_info *dram, const struct chan_info *chan,
@@ -2940,7 +2942,8 @@  static int sdram_init(struct dram_info *dram,
 			}
 
 			/* start to trigger initialization */
-			pctl_start(dram, params, 3);
+			if (pctl_start(dram, params, 3))
+				return -EINVAL;
 
 			/* LPDDR2/LPDDR3 need to wait DAI complete, max 10us */
 			if (dramtype == LPDDR3)