[PATCH 1/2] clk: sunxi-ng: Provide a default reset hook

Subsystems: arm/allwinner sunxi soc support, common clk framework, the rest

STALE3256d

5 messages, 4 authors, 2017-08-30 · open the first message on its own page

[PATCH 1/2] clk: sunxi-ng: Provide a default reset hook

From: Maxime Ripard <hidden>
Date: 2017-08-25 09:49:52

The reset hook was left implemented. Provide a dumb implementation so that
client drivers can depend on it.

Signed-off-by: Maxime Ripard <redacted>
---
 drivers/clk/sunxi-ng/ccu_reset.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/drivers/clk/sunxi-ng/ccu_reset.c b/drivers/clk/sunxi-ng/ccu_reset.c
index 6c31d48783a7..1dc4e98ea802 100644
--- a/drivers/clk/sunxi-ng/ccu_reset.c
+++ b/drivers/clk/sunxi-ng/ccu_reset.c
@@ -8,6 +8,7 @@
  * the License, or (at your option) any later version.
  */
 
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/reset-controller.h>
 
@@ -49,7 +50,18 @@ static int ccu_reset_deassert(struct reset_controller_dev *rcdev,
 	return 0;
 }
 
+static int ccu_reset_reset(struct reset_controller_dev *rcdev,
+			   unsigned long id)
+{
+	ccu_reset_assert(rcdev, id);
+	udelay(10);
+	ccu_reset_deassert(rcdev, id);
+
+	return 0;
+}
+
 const struct reset_control_ops ccu_reset_ops = {
 	.assert		= ccu_reset_assert,
 	.deassert	= ccu_reset_deassert,
+	.reset		= ccu_reset_reset,
 };
-- 
2.13.5

[PATCH 2/2] mmc: sunxi: Reset the device at probe time

From: Maxime Ripard <hidden>
Date: 2017-08-25 09:49:53

We might be into some troubles if the bootloader misconfigured the MMC
controller.

We currently only de-assert the reset line at probe time, which means that
if the device was already out of reset, we're going to keep whatever state
was set already.

Switch to a reset instead of the deassert to have a device in a pristine
state when we start operating.

Signed-off-by: Maxime Ripard <redacted>
---
 drivers/mmc/host/sunxi-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index da5f46a14497..53c970fe0873 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1242,7 +1242,7 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
 	}
 
 	if (!IS_ERR(host->reset)) {
-		ret = reset_control_deassert(host->reset);
+		ret = reset_control_reset(host->reset);
 		if (ret) {
 			dev_err(&pdev->dev, "reset err %d\n", ret);
 			goto error_disable_clk_sample;
-- 
2.13.5

Re: [PATCH 2/2] mmc: sunxi: Reset the device at probe time

From: Ulf Hansson <hidden>
Date: 2017-08-30 13:14:11

On 25 August 2017 at 11:49, Maxime Ripard
[off-list ref] wrote:
We might be into some troubles if the bootloader misconfigured the MMC
controller.

We currently only de-assert the reset line at probe time, which means that
if the device was already out of reset, we're going to keep whatever state
was set already.

Switch to a reset instead of the deassert to have a device in a pristine
state when we start operating.

Signed-off-by: Maxime Ripard <redacted>
Thanks, applied for next!

Kind regards
Uffe
quoted hunk
---
 drivers/mmc/host/sunxi-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index da5f46a14497..53c970fe0873 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1242,7 +1242,7 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
        }

        if (!IS_ERR(host->reset)) {
-               ret = reset_control_deassert(host->reset);
+               ret = reset_control_reset(host->reset);
                if (ret) {
                        dev_err(&pdev->dev, "reset err %d\n", ret);
                        goto error_disable_clk_sample;
--
2.13.5

Re: [PATCH 1/2] clk: sunxi-ng: Provide a default reset hook

From: icenowy@aosc.io
Date: 2017-08-27 13:01:04

在 2017-08-25 17:49,Maxime Ripard 写道:
The reset hook was left implemented. Provide a dumb implementation so 
that
client drivers can depend on it.
I think some clients should also convert to use this.

For example:

- The TCON driver in sun4i-drm. (It now uses reset_control_status, but
   this is also not implemented in CCU.)
- The EPHY in dwmac-sun8i driver. (It uses explicit assert then 
deassert)

P.S. maybe the status hook should also be implemented?
quoted hunk
Signed-off-by: Maxime Ripard <redacted>
---
 drivers/clk/sunxi-ng/ccu_reset.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/drivers/clk/sunxi-ng/ccu_reset.c 
b/drivers/clk/sunxi-ng/ccu_reset.c
index 6c31d48783a7..1dc4e98ea802 100644
--- a/drivers/clk/sunxi-ng/ccu_reset.c
+++ b/drivers/clk/sunxi-ng/ccu_reset.c
@@ -8,6 +8,7 @@
  * the License, or (at your option) any later version.
  */

+#include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/reset-controller.h>
@@ -49,7 +50,18 @@ static int ccu_reset_deassert(struct
reset_controller_dev *rcdev,
 	return 0;
 }

+static int ccu_reset_reset(struct reset_controller_dev *rcdev,
+			   unsigned long id)
+{
+	ccu_reset_assert(rcdev, id);
+	udelay(10);
+	ccu_reset_deassert(rcdev, id);
+
+	return 0;
+}
+
 const struct reset_control_ops ccu_reset_ops = {
 	.assert		= ccu_reset_assert,
 	.deassert	= ccu_reset_deassert,
+	.reset		= ccu_reset_reset,
 };

Re: [PATCH 1/2] clk: sunxi-ng: Provide a default reset hook

From: Chen-Yu Tsai <hidden>
Date: 2017-08-27 13:10:02

On Sun, Aug 27, 2017 at 9:01 PM,  [off-list ref] wrote:
在 2017-08-25 17:49,Maxime Ripard 写道:
quoted
The reset hook was left implemented. Provide a dumb implementation so that
client drivers can depend on it.

I think some clients should also convert to use this.

For example:

- The TCON driver in sun4i-drm. (It now uses reset_control_status, but
  this is also not implemented in CCU.)
I have patches for both sides of this.
- The EPHY in dwmac-sun8i driver. (It uses explicit assert then deassert)

P.S. maybe the status hook should also be implemented?
Yes.

ChenYu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help