Skip to contentSkip to conversation

remoteproc/davinci: common clock framework related fixes

PATCH In review Bartosz Golaszewski 2 participants 5 messages May 2, 2018 – May 9, 2018 Remote processor (remoteproc)

lore
Share & tools
lore
#0 lore raw

cover remoteproc/davinci: common clock framework related fixes

From: Bartosz Golaszewski <[email protected]>

Hi Bjorn,

this series contains the patches from my previous remoteproc series[1] which are safe to apply on top of 4.17-rc1. They contain fixes needed for the driver to work once we're done converting to using the CCF for DaVinci.

The last remoteproc patch will be sent later once the platform parts are applied.

All the patches are reviewed and tested.

[1] https://lkml.org/lkml/2018/4/17/1000

Bartosz Golaszewski (3):
remoteproc/davinci: add the missing retval check for clk_enable() remoteproc/davinci: prepare and unprepare the clock where needed remoteproc/davinci: use octal permissions for module_param()

 drivers/remoteproc/da8xx_remoteproc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/3 remoteproc/davinci: add the missing retval check for clk_enable()

From: Bartosz Golaszewski <[email protected]>

The davinci platform is being switched to using the common clock framework, where clk_enable() can fail. Add the return value check.

---
 drivers/remoteproc/da8xx_remoteproc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/remoteproc/da8xx_remoteproc.c +7 -1
index bf3b9034c319..2b24291337b7 100644
@@ -138,6 +138,7 @@ static int da8xx_rproc_start(struct rproc *rproc)
 	struct device *dev = rproc->dev.parent;
 	struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv;
 	struct clk *dsp_clk = drproc->dsp_clk;
+	int ret;
 
 	/* hw requires the start (boot) address be on 1KB boundary */
 	if (rproc->bootaddr & 0x3ff) {
@@ -148,7 +149,12 @@ static int da8xx_rproc_start(struct rproc *rproc)
 
 	writel(rproc->bootaddr, drproc->bootreg);
 
-	clk_enable(dsp_clk);
+	ret = clk_enable(dsp_clk);
+	if (ret) {
+		dev_err(dev, "clk_enable() failed: %d\n", ret);
+		return ret;
+	}
+
 	davinci_clk_reset_deassert(dsp_clk);
 
 	return 0;
Signature · 1 line
2.17.0
#2 lore raw

Re: [PATCH 1/3] remoteproc/davinci: add the missing retval check for clk_enable()

Quoted 9 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

The davinci platform is being switched to using the common clock framework, where clk_enable() can fail. Add the return value check.

Hi Bartosz,

All three patches applied to rproc-next.

Regards,
Bjorn

Quoted 33 lines
---
 drivers/remoteproc/da8xx_remoteproc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/remoteproc/da8xx_remoteproc.c +7 -1
index bf3b9034c319..2b24291337b7 100644
@@ -138,6 +138,7 @@ static int da8xx_rproc_start(struct rproc *rproc)
 	struct device *dev = rproc->dev.parent;
 	struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv;
 	struct clk *dsp_clk = drproc->dsp_clk;
+	int ret;
 
 	/* hw requires the start (boot) address be on 1KB boundary */
 	if (rproc->bootaddr & 0x3ff) {
@@ -148,7 +149,12 @@ static int da8xx_rproc_start(struct rproc *rproc)
 
 	writel(rproc->bootaddr, drproc->bootreg);
 
-	clk_enable(dsp_clk);
+	ret = clk_enable(dsp_clk);
+	if (ret) {
+		dev_err(dev, "clk_enable() failed: %d\n", ret);
+		return ret;
+	}
+
 	davinci_clk_reset_deassert(dsp_clk);
 
 	return 0;
Signature · 1 line
2.17.0
#3 lore raw

PATCH 2/3 remoteproc/davinci: prepare and unprepare the clock where needed

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

We're currently switching the platform to using the common clock framework. We need to explicitly prepare and unprepare the rproc clock.

---
 drivers/remoteproc/da8xx_remoteproc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/remoteproc/da8xx_remoteproc.c +3 -3
index 2b24291337b7..f134192922e0 100644
@@ -149,9 +149,9 @@ static int da8xx_rproc_start(struct rproc *rproc)
 
 	writel(rproc->bootaddr, drproc->bootreg);
 
-	ret = clk_enable(dsp_clk);
+	ret = clk_prepare_enable(dsp_clk);
 	if (ret) {
-		dev_err(dev, "clk_enable() failed: %d\n", ret);
+		dev_err(dev, "clk_prepare_enable() failed: %d\n", ret);
 		return ret;
 	}
 
@@ -165,7 +165,7 @@ static int da8xx_rproc_stop(struct rproc *rproc)
 	struct da8xx_rproc *drproc = rproc->priv;
 
 	davinci_clk_reset_assert(drproc->dsp_clk);
-	clk_disable(drproc->dsp_clk);
+	clk_disable_unprepare(drproc->dsp_clk);
 
 	return 0;
 }
Signature · 1 line
2.17.0
#4 lore raw

PATCH 3/3 remoteproc/davinci: use octal permissions for module_param()

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Checkpatch recommends to use octal perms instead of S_IRUGO.

---
 drivers/remoteproc/da8xx_remoteproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/da8xx_remoteproc.c +1 -1
index f134192922e0..b668e32996e2 100644
@@ -25,7 +25,7 @@
 #include "remoteproc_internal.h"
 
 static char *da8xx_fw_name;
-module_param(da8xx_fw_name, charp, S_IRUGO);
+module_param(da8xx_fw_name, charp, 0444);
 MODULE_PARM_DESC(da8xx_fw_name,
 		 "Name of DSP firmware file in /lib/firmware (if not specified defaults to 'rproc-dsp-fw')");
 
Signature · 1 line
2.17.0