Skip to contentSkip to conversation

soc: qcom: ocmem: let the driver work again

PATCH Applied Dmitry Baryshkov 4 participants 11 messages Mar 23 – Mar 24

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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).

---
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 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
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] soc: qcom: ocmem: make the core clock optional

Quoted 9 lines · Dmitry Baryshkov

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")

---

Konrad

#3 lore raw

PATCH 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..d57baa9cfa03 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 ERR_PTR(dev_err_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
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] soc: qcom: ocmem: register reasons for probe deferrals

Quoted 15 lines · 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 +0 -0
index dd46bb14b7be..d57baa9cfa03 100644
@@ -196,10 +196,10 @@ struct ocmem *of_get_ocmem(struct device *dev)
 	}

drivers/soc/qcom/ocmem.c struct ocmem *of_get_ocmem(struct device *dev) · line 202

Quoted 10 lines
drivers/soc/qcom/ocmem.c +4 -4
 
 	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 ERR_PTR(dev_err_probe(dev, -EPROBE_DEFER,
+					     "Cannot find device node %s\n",
+					     devnode->name));

dev_err_ptr_probe()

Konrad

#5 lore raw

Re: [PATCH 2/3] soc: qcom: ocmem: register reasons for probe deferrals

Quoted 17 lines · Konrad Dybcio
Quoted 16 lines · 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 +0 -0
index dd46bb14b7be..d57baa9cfa03 100644
@@ -196,10 +196,10 @@ struct ocmem *of_get_ocmem(struct device *dev)
 	}
 
Quoted 11 lines

drivers/soc/qcom/ocmem.c struct ocmem *of_get_ocmem(struct device *dev) · line 202

Quoted 9 lines
drivers/soc/qcom/ocmem.c +4 -4
 	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 ERR_PTR(dev_err_probe(dev, -EPROBE_DEFER,
+					     "Cannot find device node %s\n",
+					     devnode->name));

dev_err_ptr_probe()

Cool!

Quoted 4 lines

Konrad

Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on v1 2/3
#6 lore raw

Re: [PATCH 2/3] soc: qcom: ocmem: register reasons for probe deferrals

In reply to Dmitry Baryshkov
Quoted 15 lines · 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 +0 -0
index dd46bb14b7be..d57baa9cfa03 100644
@@ -196,10 +196,10 @@ struct ocmem *of_get_ocmem(struct device *dev)
 	}

drivers/soc/qcom/ocmem.c struct ocmem *of_get_ocmem(struct device *dev) · line 202

Quoted 10 lines
drivers/soc/qcom/ocmem.c +4 -4
 
 	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 ERR_PTR(dev_err_probe(dev, -EPROBE_DEFER,
+					     "Cannot find device node %s\n",
+					     devnode->name));

dev_err_probe() was introduced in 2020 (a787e5400a1c) and this driver was added to the tree prior to that.

#7 lore raw

Re: [PATCH 2/3] soc: qcom: ocmem: register reasons for probe deferrals

Quoted 29 lines · Brian Masney
Quoted 15 lines · 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 +0 -0
index dd46bb14b7be..d57baa9cfa03 100644
@@ -196,10 +196,10 @@ struct ocmem *of_get_ocmem(struct device *dev)
 	}

drivers/soc/qcom/ocmem.c struct ocmem *of_get_ocmem(struct device *dev) · line 202

Quoted 10 lines
drivers/soc/qcom/ocmem.c +4 -4
 
 	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 ERR_PTR(dev_err_probe(dev, -EPROBE_DEFER,
+					     "Cannot find device node %s\n",
+					     devnode->name));
Quoted 2 lines

dev_err_probe() was introduced in 2020 (a787e5400a1c) and this driver was added to the tree prior to that.

Well... Fixes doesnt' require porting (or 1:1 porting).

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

PATCH 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 d57baa9cfa03..c35a98984acc 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 ERR_PTR(dev_err_probe(dev, -EPROBE_DEFER, "Cannot get ocmem\n"));
+
 	return ocmem;
 }
 EXPORT_SYMBOL_GPL(of_get_ocmem);
Signature · 1 line
2.47.3
Reviewed-by on v1 3/3
#9 lore raw

Re: [PATCH 3/3] soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available

Quoted 16 lines · 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 +0 -0
index d57baa9cfa03..c35a98984acc 100644

drivers/soc/qcom/ocmem.c struct ocmem *of_get_ocmem(struct device *dev) · line 207

Quoted 9 lines
drivers/soc/qcom/ocmem.c +2 -4
@@ -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 ERR_PTR(dev_err_probe(dev, -EPROBE_DEFER, "Cannot get ocmem\n"));

dev_err_ptr_probe()

Konrad

maintainer Applied
#10 lore raw
In reply to Dmitry Baryshkov
Quoted 9 lines · Dmitry Baryshkov

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).

[...]

Applied, thanks!

[1/3] soc: qcom: ocmem: make the core clock optional

      commit: e8a61c51417c679d1a599fb36695e9d3b8d95514
[2/3] soc: qcom: ocmem: register reasons for probe deferrals
      commit: 9dfd69cd89cd6afa4723be9098979abeef3bb8c6
[3/3] soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available
      commit: 91b59009c7d48b58dbc50fecb27f2ad20749a05a

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>