diff mbox

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

Message ID 20170825094953.3247-1-maxime.ripard@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maxime Ripard Aug. 25, 2017, 9:49 a.m. UTC
The reset hook was left implemented. Provide a dumb implementation so that
client drivers can depend on it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clk/sunxi-ng/ccu_reset.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Icenowy Zheng Aug. 27, 2017, 1:01 p.m. UTC | #1
在 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?

> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  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,
>  };
Chen-Yu Tsai Aug. 27, 2017, 1:10 p.m. UTC | #2
On Sun, Aug 27, 2017 at 9:01 PM,  <icenowy@aosc.io> wrote:
> 在 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.)

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
Ulf Hansson Aug. 30, 2017, 12:29 p.m. UTC | #3
On 25 August 2017 at 11:49, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The reset hook was left implemented. Provide a dumb implementation so that
> client drivers can depend on it.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Do you want me to pick this up via my mmc tree? If so, is that okay by
the clock maintainers?

Kind regards
Uffe

> ---
>  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
>
Maxime Ripard Aug. 30, 2017, 12:36 p.m. UTC | #4
Hi Ulf,

On Wed, Aug 30, 2017 at 02:29:24PM +0200, Ulf Hansson wrote:
> On 25 August 2017 at 11:49, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > The reset hook was left implemented. Provide a dumb implementation so that
> > client drivers can depend on it.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> 
> Do you want me to pick this up via my mmc tree? If so, is that okay by
> the clock maintainers?

I also happen to be the maintainer of that part of the kernel
(reporting to Mike and Stephen of course). We don't have anything
touching that file in next, so unless they feel like it should go
through their tree, it would be easier to keep the two changes
together and merge them through your tree.

Maxime
Ulf Hansson Aug. 30, 2017, 1:14 p.m. UTC | #5
On 30 August 2017 at 14:36, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi Ulf,
>
> On Wed, Aug 30, 2017 at 02:29:24PM +0200, Ulf Hansson wrote:
>> On 25 August 2017 at 11:49, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>> > The reset hook was left implemented. Provide a dumb implementation so that
>> > client drivers can depend on it.
>> >
>> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>>
>> Do you want me to pick this up via my mmc tree? If so, is that okay by
>> the clock maintainers?
>
> I also happen to be the maintainer of that part of the kernel
> (reporting to Mike and Stephen of course). We don't have anything
> touching that file in next, so unless they feel like it should go
> through their tree, it would be easier to keep the two changes
> together and merge them through your tree.

Alright, I have picked it up for next!

Kind regards
Uffe
Stephen Boyd Sept. 1, 2017, 8:30 p.m. UTC | #6
On 08/30, Ulf Hansson wrote:
> On 30 August 2017 at 14:36, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Hi Ulf,
> >
> > On Wed, Aug 30, 2017 at 02:29:24PM +0200, Ulf Hansson wrote:
> >> On 25 August 2017 at 11:49, Maxime Ripard
> >> <maxime.ripard@free-electrons.com> wrote:
> >> > The reset hook was left implemented. Provide a dumb implementation so that
> >> > client drivers can depend on it.
> >> >
> >> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> >>
> >> Do you want me to pick this up via my mmc tree? If so, is that okay by
> >> the clock maintainers?
> >
> > I also happen to be the maintainer of that part of the kernel
> > (reporting to Mike and Stephen of course). We don't have anything
> > touching that file in next, so unless they feel like it should go
> > through their tree, it would be easier to keep the two changes
> > together and merge them through your tree.
> 
> Alright, I have picked it up for next!
> 

Thanks!

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

if that helps.
diff mbox

Patch

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,
 };