* [PATCH] i2c: rcar: make sure clocks are on when doing hw init
@ 2015-10-29 19:19 Wolfram Sang
2015-10-29 19:38 ` Geert Uytterhoeven
2015-10-30 0:03 ` Kuninori Morimoto
0 siblings, 2 replies; 7+ messages in thread
From: Wolfram Sang @ 2015-10-29 19:19 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, Kuninori Morimoto
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/i2c/busses/i2c-rcar.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 616433d387cdb2..ef26e933b1e9cb 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -612,7 +612,10 @@ static int rcar_i2c_probe(struct platform_device *pdev)
if (IS_ERR(priv->io))
return PTR_ERR(priv->io);
+ pm_runtime_enable(dev);
+ pm_runtime_get_sync(dev);
rcar_i2c_init(priv);
+ pm_runtime_put(dev);
irq = platform_get_irq(pdev, 0);
init_waitqueue_head(&priv->wait);
@@ -634,7 +637,6 @@ static int rcar_i2c_probe(struct platform_device *pdev)
return ret;
}
- pm_runtime_enable(dev);
platform_set_drvdata(pdev, priv);
ret = i2c_add_numbered_adapter(adap);
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init
2015-10-29 19:19 [PATCH] i2c: rcar: make sure clocks are on when doing hw init Wolfram Sang
@ 2015-10-29 19:38 ` Geert Uytterhoeven
2015-10-30 0:03 ` Kuninori Morimoto
1 sibling, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2015-10-29 19:38 UTC (permalink / raw)
To: Wolfram Sang
Cc: Linux I2C, Linux-sh list, Magnus Damm, Simon Horman,
Laurent Pinchart, Kuninori Morimoto
Hi Wolfram,
On Thu, Oct 29, 2015 at 8:19 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Thanks for your patch!
I suspect this bug was also the cause of the spurious failures of the R-Car
Gen2 regulator quirk code I experienced sometimes during the last few
days.
> ---
> drivers/i2c/busses/i2c-rcar.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 616433d387cdb2..ef26e933b1e9cb 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -612,7 +612,10 @@ static int rcar_i2c_probe(struct platform_device *pdev)
> if (IS_ERR(priv->io))
> return PTR_ERR(priv->io);
>
> + pm_runtime_enable(dev);
> + pm_runtime_get_sync(dev);
> rcar_i2c_init(priv);
> + pm_runtime_put(dev);
>
> irq = platform_get_irq(pdev, 0);
> init_waitqueue_head(&priv->wait);
> @@ -634,7 +637,6 @@ static int rcar_i2c_probe(struct platform_device *pdev)
> return ret;
pm_runtime_disable() in error path?
> }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init
2015-10-29 19:19 [PATCH] i2c: rcar: make sure clocks are on when doing hw init Wolfram Sang
2015-10-29 19:38 ` Geert Uytterhoeven
@ 2015-10-30 0:03 ` Kuninori Morimoto
2015-11-11 8:26 ` Wolfram Sang
1 sibling, 1 reply; 7+ messages in thread
From: Kuninori Morimoto @ 2015-10-30 0:03 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven
Hi, Wolfram
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> drivers/i2c/busses/i2c-rcar.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 616433d387cdb2..ef26e933b1e9cb 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -612,7 +612,10 @@ static int rcar_i2c_probe(struct platform_device *pdev)
> if (IS_ERR(priv->io))
> return PTR_ERR(priv->io);
>
> + pm_runtime_enable(dev);
> + pm_runtime_get_sync(dev);
> rcar_i2c_init(priv);
> + pm_runtime_put(dev);
Please correct me if I'm misunderstanding, but in my experience,
above rcar_i2c_init() result can be removed if SoC has power-off feature,
and if IP doesn't keep register value power-off case ?
This case register doesn't keep myfunc_A's setting,
because it calls pm_runtime_put()
pm_runtime_get_sync()
myfunc_A()
pm_runtime_put()
...
pm_runtime_get_sync()
myfunc_B()
pm_runtime_put()
It should be this ?
pm_runtime_get_sync()
myfunc_A()
myfunc_B()
pm_runtime_put()
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init
2015-10-30 0:03 ` Kuninori Morimoto
@ 2015-11-11 8:26 ` Wolfram Sang
2015-11-11 9:03 ` Kuninori Morimoto
0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2015-11-11 8:26 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven
[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]
Morimoto-san,
> > + pm_runtime_enable(dev);
> > + pm_runtime_get_sync(dev);
> > rcar_i2c_init(priv);
> > + pm_runtime_put(dev);
>
> Please correct me if I'm misunderstanding, but in my experience,
> above rcar_i2c_init() result can be removed if SoC has power-off feature,
> and if IP doesn't keep register value power-off case ?
> This case register doesn't keep myfunc_A's setting,
> because it calls pm_runtime_put()
>
> pm_runtime_get_sync()
> myfunc_A()
> pm_runtime_put()
> ...
> pm_runtime_get_sync()
> myfunc_B()
> pm_runtime_put()
>
> It should be this ?
>
> pm_runtime_get_sync()
> myfunc_A()
> myfunc_B()
> pm_runtime_put()
This is for power-off case, right? Wouldn't it be clearer then to add a
resume function to pm_ops of the I2C driver which reinit the registers?
Doing it before every transfer might be simpler but is also a bit
implicit or subtle, I'd think.
And for completeness: The above is only for the power-off case. In
module-standby (MSTP bits), register values are always retained.
Correct?
Regards,
Wolfram
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init
2015-11-11 8:26 ` Wolfram Sang
@ 2015-11-11 9:03 ` Kuninori Morimoto
2015-11-11 16:34 ` Wolfram Sang
0 siblings, 1 reply; 7+ messages in thread
From: Kuninori Morimoto @ 2015-11-11 9:03 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven
Hi Wolfram
> > pm_runtime_get_sync()
> > myfunc_A()
> > pm_runtime_put()
> > ...
> > pm_runtime_get_sync()
> > myfunc_B()
> > pm_runtime_put()
> >
> > It should be this ?
> >
> > pm_runtime_get_sync()
> > myfunc_A()
> > myfunc_B()
> > pm_runtime_put()
>
> This is for power-off case, right? Wouldn't it be clearer then to add a
> resume function to pm_ops of the I2C driver which reinit the registers?
> Doing it before every transfer might be simpler but is also a bit
> implicit or subtle, I'd think.
>
> And for completeness: The above is only for the power-off case. In
> module-standby (MSTP bits), register values are always retained.
> Correct?
I'm not sure detail of pm_runtime, but it depends on
power-domain support ?
On SH-Mobile case, it automatically power-off:ed if all driver
user was gone. This feature is not yet supported on R-Car case I think.
So, both case are not problem at this point, but 1st case will be
problem if power-domain was suppored.
(If my memory was correct...)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init
2015-11-11 9:03 ` Kuninori Morimoto
@ 2015-11-11 16:34 ` Wolfram Sang
2015-11-11 23:54 ` Kuninori Morimoto
0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2015-11-11 16:34 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven
[-- Attachment #1: Type: text/plain, Size: 129 bytes --]
> On SH-Mobile case, it automatically power-off:ed if all driver
> user was gone.
It does that without calling some callback?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init
2015-11-11 16:34 ` Wolfram Sang
@ 2015-11-11 23:54 ` Kuninori Morimoto
0 siblings, 0 replies; 7+ messages in thread
From: Kuninori Morimoto @ 2015-11-11 23:54 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven
Hi Wolfram
> > On SH-Mobile case, it automatically power-off:ed if all driver
> > user was gone.
>
> It does that without calling some callback?
Do you mean you can call init() in callback ?
I don't care detail of design. But my concern was that
register value might be disappear during many get/put if
power-domain was implemented
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-11-11 23:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29 19:19 [PATCH] i2c: rcar: make sure clocks are on when doing hw init Wolfram Sang
2015-10-29 19:38 ` Geert Uytterhoeven
2015-10-30 0:03 ` Kuninori Morimoto
2015-11-11 8:26 ` Wolfram Sang
2015-11-11 9:03 ` Kuninori Morimoto
2015-11-11 16:34 ` Wolfram Sang
2015-11-11 23:54 ` Kuninori Morimoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox