Skip to contentSkip to conversation

soc: qcom: ocmem: let the driver work again

PATCH New Dmitry Baryshkov 1 participant 4 messages Mar 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover soc: qcom: ocmem: let the driver work again

Commit d6edc31f3a68 ("clk: qcom: smd-rpm: Separate out interconnect bus clocks") moved control over several RPM resources from the clk-smd-rpm driver to the icc-rpm.c interconnect helpers. However it was unnoticed that the OCMEM device also uses that clock. The clock is not required as all OCMEM users (currently only the GPU) will vote on the OCMEM NOC, bringing up the clock. Make it optional (and also apply several other small fixes).

---
Changes in v2:
- Switched to dev_err_ptr_probe() (Konrad)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Dmitry Baryshkov (3):
soc: qcom: ocmem: make the core clock optional
soc: qcom: ocmem: register reasons for probe deferrals
soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available

 drivers/soc/qcom/ocmem.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

---
base-commit: 8e5a478b6d6a5bb0a3d52147862b15e4d826af19
change-id: 20260323-ocmem-dfe2d207d0e9

Best regards,

Signature · 2 lines
With best wishes
Dmitry
#1 lore raw

PATCH v2 1/3 soc: qcom: ocmem: make the core clock optional

OCMEM's core clock (aka RPM bus 2 clock) is being handled internally by the interconnect driver. Corresponding clock has been dropped from the SMD RPM clock driver. The users of the ocmem will vote on the ocmemnoc interconnect paths, making sure that ocmem is on. Make the clock optional, keeping it for compatibility with older DT.

Fixes d6edc31f3a68 ("clk: qcom: smd-rpm: Separate out interconnect bus clocks")
---
 drivers/soc/qcom/ocmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/ocmem.c +1 -1
index 6a23f18b0281..dd46bb14b7be 100644
@@ -308,7 +308,7 @@ static int ocmem_dev_probe(struct platform_device *pdev)
 	ocmem->dev = dev;
 	ocmem->config = device_get_match_data(dev);
 
-	ocmem->core_clk = devm_clk_get(dev, "core");
+	ocmem->core_clk = devm_clk_get_optional(dev, "core");
 	if (IS_ERR(ocmem->core_clk))
 		return dev_err_probe(dev, PTR_ERR(ocmem->core_clk),
 				     "Unable to get core clock\n");
Signature · 1 line
2.47.3
#2 lore raw

PATCH v2 2/3 soc: qcom: ocmem: register reasons for probe deferrals

In reply to Dmitry Baryshkov

Instead of printing messages to the dmesg, let the message be recorded as a reason for the OCMEM client deferral.

Fixes 88c1e9404f1d ("soc: qcom: add OCMEM driver")
---
 drivers/soc/qcom/ocmem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/soc/qcom/ocmem.c +4 -4
index dd46bb14b7be..d47ce5707fd8 100644
@@ -196,10 +196,10 @@ struct ocmem *of_get_ocmem(struct device *dev)
 	}
 
 	pdev = of_find_device_by_node(devnode->parent);
-	if (!pdev) {
-		dev_err(dev, "Cannot find device node %s\n", devnode->name);
-		return ERR_PTR(-EPROBE_DEFER);
-	}
+	if (!pdev)
+		return dev_err_ptr_probe(dev, -EPROBE_DEFER,
+					 "Cannot find device node %s\n",
+					 devnode->name);
 
 	ocmem = platform_get_drvdata(pdev);
 	put_device(&pdev->dev);
Signature · 1 line
2.47.3
#3 lore raw

PATCH v2 3/3 soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available

In reply to Dmitry Baryshkov

If OCMEM is declared in DT, it is expected that it is present and handled by the driver. The GPU driver will ignore -ENODEV error, which typically means that OCMEM isn't defined in DT. Let ocmem return -EPROBE_DEFER if it supposed to be used, but it is not probed (yet).

Fixes 88c1e9404f1d ("soc: qcom: add OCMEM driver")
---
 drivers/soc/qcom/ocmem.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/soc/qcom/ocmem.c +3 -4
index d47ce5707fd8..96ca0b87bfc4 100644
@@ -203,10 +203,9 @@ struct ocmem *of_get_ocmem(struct device *dev)
 
 	ocmem = platform_get_drvdata(pdev);
 	put_device(&pdev->dev);
-	if (!ocmem) {
-		dev_err(dev, "Cannot get ocmem\n");
-		return ERR_PTR(-ENODEV);
-	}
+	if (!ocmem)
+		return dev_err_ptr_probe(dev, -EPROBE_DEFER, "Cannot get ocmem\n");
+
 	return ocmem;
 }
 EXPORT_SYMBOL_GPL(of_get_ocmem);
Signature · 1 line
2.47.3