Skip to contentSkip to conversation

clk: qcom: rpmh: make clkaN optional

PATCH RESEND In review Pengyu Luo 2 participants 2 messages May 18, 2025

Subsystems (3)
lore
Share & tools
lore

Pengyu Luo

author
#0 lore raw

PATCH RESEND v2 1/1 clk: qcom: rpmh: make clkaN optional

On SM8650, clkaN are missing in cmd-db for some specific devices. This caused a boot failure. Printing log during initramfs phase, I found

[    0.053281] clk-rpmh 17a00000.rsc:clock-controller: missing RPMh resource address for clka1

Adding the optional property to avoid probing failure which causes countless deferred probe. In the downstream tree,similar workarounds are introduced for SM7635, SM8550, SM8635, SM8650, SM8750.

---
Changes in v2:
- using capital letters, sm[0-9]+ => SM[0-9]+, rpmh => RPMh (Dmitry)
- correct typo, alform => plaform (Dmitry)
- remove tested-by tag from myself (Dmitry)
- line break to keep 80 characters per line (Dmitry)
- Link to v1: https://lore.kernel.org/all/[email protected]

---
 drivers/clk/qcom/clk-rpmh.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/clk/qcom/clk-rpmh.c +12 -0
index c7675930f..0aea8e1b7 100644
@@ -66,6 +66,8 @@ struct clk_rpmh {
 struct clk_rpmh_desc {
 	struct clk_hw **clks;
 	size_t num_clks;
+	/* RPMh clock clkaN are optional for this platform */
+	bool clka_optional;
 };
 
 static DEFINE_MUTEX(rpmh_clk_lock);
@@ -648,6 +650,7 @@ static struct clk_hw *sm8550_rpmh_clocks[] = {
 static const struct clk_rpmh_desc clk_rpmh_sm8550 = {
 	.clks = sm8550_rpmh_clocks,
 	.num_clks = ARRAY_SIZE(sm8550_rpmh_clocks),
+	.clka_optional = true,
 };
 
 static struct clk_hw *sm8650_rpmh_clocks[] = {
@@ -679,6 +682,7 @@ static struct clk_hw *sm8650_rpmh_clocks[] = {
 static const struct clk_rpmh_desc clk_rpmh_sm8650 = {
 	.clks = sm8650_rpmh_clocks,
 	.num_clks = ARRAY_SIZE(sm8650_rpmh_clocks),
+	.clka_optional = true,
 };
 
 static struct clk_hw *sc7280_rpmh_clocks[] = {
@@ -847,6 +851,7 @@ static struct clk_hw *sm8750_rpmh_clocks[] = {
 static const struct clk_rpmh_desc clk_rpmh_sm8750 = {
 	.clks = sm8750_rpmh_clocks,
 	.num_clks = ARRAY_SIZE(sm8750_rpmh_clocks),
+	.clka_optional = true,
 };
 
 static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec,
@@ -890,6 +895,13 @@ static int clk_rpmh_probe(struct platform_device *pdev)
 		rpmh_clk = to_clk_rpmh(hw_clks[i]);
 		res_addr = cmd_db_read_addr(rpmh_clk->res_name);
 		if (!res_addr) {
+			hw_clks[i] = NULL;
+
+			if (desc->clka_optional &&
+			    !strncmp(rpmh_clk->res_name, "clka",
+				     sizeof("clka") - 1))
+				continue;
+
 			dev_err(&pdev->dev, "missing RPMh resource address for %s\n",
 				rpmh_clk->res_name);
 			return -ENODEV;
Signature · 1 line
2.49.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 17 lines · Pengyu Luo

On SM8650, clkaN are missing in cmd-db for some specific devices. This caused a boot failure. Printing log during initramfs phase, I found

[    0.053281] clk-rpmh 17a00000.rsc:clock-controller: missing RPMh resource address for clka1

Adding the optional property to avoid probing failure which causes countless deferred probe. In the downstream tree,similar workarounds are introduced for SM7635, SM8550, SM8635, SM8650, SM8750.

---
Changes in v2:
- using capital letters, sm[0-9]+ => SM[0-9]+, rpmh => RPMh (Dmitry)
- correct typo, alform => plaform (Dmitry)
- remove tested-by tag from myself (Dmitry)
- line break to keep 80 characters per line (Dmitry)
- Link to v1: https://lore.kernel.org/all/[email protected]

Quoted 4 lines
---
 drivers/clk/qcom/clk-rpmh.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Signature · 2 lines
With best wishes
Dmitry