linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: ti: clkctrl: Fix failed to enable error with double udelay timeout
@ 2019-09-30 15:40 Tony Lindgren
  2019-10-07  0:57 ` Keerthy
  2019-11-04 17:57 ` Stephen Boyd
  0 siblings, 2 replies; 5+ messages in thread
From: Tony Lindgren @ 2019-09-30 15:40 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Tero Kristo
  Cc: devicetree, linux-clk, linux-omap, Keerthy

Commit 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if
timekeeping is suspended") added handling for cases when timekeeping is
suspended. But looks like we can still get occasional "failed to enable"
errors on the PM runtime resume path with udelay() returning faster than
expected.

With ti-sysc interconnect target module driver this leads into device
failure with PM runtime failing with "failed to enable" clkctrl error.

Let's fix the issue with a delay of two times the desired delay as in
often done for udelay() to account for the inaccuracy.

Fixes: 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if timekeeping is suspended")
Cc: Keerthy <j-keerthy@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clkctrl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -100,11 +100,12 @@ static bool _omap4_is_timeout(union omap4_timeout *time, u32 timeout)
 	 * can be from a timer that requires pm_runtime access, which
 	 * will eventually bring us here with timekeeping_suspended,
 	 * during both suspend entry and resume paths. This happens
-	 * at least on am43xx platform.
+	 * at least on am43xx platform. Account for flakeyness
+	 * with udelay() by multiplying the timeout value by 2.
 	 */
 	if (unlikely(_early_timeout || timekeeping_suspended)) {
 		if (time->cycles++ < timeout) {
-			udelay(1);
+			udelay(1 * 2);
 			return false;
 		}
 	} else {
-- 
2.23.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: ti: clkctrl: Fix failed to enable error with double udelay timeout
  2019-09-30 15:40 [PATCH] clk: ti: clkctrl: Fix failed to enable error with double udelay timeout Tony Lindgren
@ 2019-10-07  0:57 ` Keerthy
  2019-10-10 14:05   ` Tony Lindgren
  2019-11-04 17:57 ` Stephen Boyd
  1 sibling, 1 reply; 5+ messages in thread
From: Keerthy @ 2019-10-07  0:57 UTC (permalink / raw)
  To: Tony Lindgren, Michael Turquette, Stephen Boyd, Tero Kristo
  Cc: devicetree, linux-clk, linux-omap



On 30/09/19 9:10 PM, Tony Lindgren wrote:
> Commit 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if
> timekeeping is suspended") added handling for cases when timekeeping is
> suspended. But looks like we can still get occasional "failed to enable"
> errors on the PM runtime resume path with udelay() returning faster than
> expected.
> 
> With ti-sysc interconnect target module driver this leads into device
> failure with PM runtime failing with "failed to enable" clkctrl error.
> 
> Let's fix the issue with a delay of two times the desired delay as in
> often done for udelay() to account for the inaccuracy.

Tested for DS0 and rtc+ddr modes on am43 and ds0 on am33.

Tested-by: Keerthy <j-keerthy@ti.com>

> 
> Fixes: 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if timekeeping is suspended")
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>   drivers/clk/ti/clkctrl.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
> --- a/drivers/clk/ti/clkctrl.c
> +++ b/drivers/clk/ti/clkctrl.c
> @@ -100,11 +100,12 @@ static bool _omap4_is_timeout(union omap4_timeout *time, u32 timeout)
>   	 * can be from a timer that requires pm_runtime access, which
>   	 * will eventually bring us here with timekeeping_suspended,
>   	 * during both suspend entry and resume paths. This happens
> -	 * at least on am43xx platform.
> +	 * at least on am43xx platform. Account for flakeyness
> +	 * with udelay() by multiplying the timeout value by 2.
>   	 */
>   	if (unlikely(_early_timeout || timekeeping_suspended)) {
>   		if (time->cycles++ < timeout) {
> -			udelay(1);
> +			udelay(1 * 2);
>   			return false;
>   		}
>   	} else {
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: ti: clkctrl: Fix failed to enable error with double udelay timeout
  2019-10-07  0:57 ` Keerthy
@ 2019-10-10 14:05   ` Tony Lindgren
  2019-10-24  8:00     ` Tero Kristo
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Lindgren @ 2019-10-10 14:05 UTC (permalink / raw)
  To: Keerthy
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, devicetree,
	linux-clk, linux-omap

* Keerthy <j-keerthy@ti.com> [191007 00:57]:
> 
> 
> On 30/09/19 9:10 PM, Tony Lindgren wrote:
> > Commit 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if
> > timekeeping is suspended") added handling for cases when timekeeping is
> > suspended. But looks like we can still get occasional "failed to enable"
> > errors on the PM runtime resume path with udelay() returning faster than
> > expected.
> > 
> > With ti-sysc interconnect target module driver this leads into device
> > failure with PM runtime failing with "failed to enable" clkctrl error.
> > 
> > Let's fix the issue with a delay of two times the desired delay as in
> > often done for udelay() to account for the inaccuracy.
> 
> Tested for DS0 and rtc+ddr modes on am43 and ds0 on am33.
> 
> Tested-by: Keerthy <j-keerthy@ti.com>

Thanks for testing. This one should be applied into v5.4-rc series
please if no more comments.

Regards,

Tony

> > Fixes: 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if timekeeping is suspended")
> > Cc: Keerthy <j-keerthy@ti.com>
> > Cc: Tero Kristo <t-kristo@ti.com>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > ---
> >   drivers/clk/ti/clkctrl.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
> > --- a/drivers/clk/ti/clkctrl.c
> > +++ b/drivers/clk/ti/clkctrl.c
> > @@ -100,11 +100,12 @@ static bool _omap4_is_timeout(union omap4_timeout *time, u32 timeout)
> >   	 * can be from a timer that requires pm_runtime access, which
> >   	 * will eventually bring us here with timekeeping_suspended,
> >   	 * during both suspend entry and resume paths. This happens
> > -	 * at least on am43xx platform.
> > +	 * at least on am43xx platform. Account for flakeyness
> > +	 * with udelay() by multiplying the timeout value by 2.
> >   	 */
> >   	if (unlikely(_early_timeout || timekeeping_suspended)) {
> >   		if (time->cycles++ < timeout) {
> > -			udelay(1);
> > +			udelay(1 * 2);
> >   			return false;
> >   		}
> >   	} else {
> > 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: ti: clkctrl: Fix failed to enable error with double udelay timeout
  2019-10-10 14:05   ` Tony Lindgren
@ 2019-10-24  8:00     ` Tero Kristo
  0 siblings, 0 replies; 5+ messages in thread
From: Tero Kristo @ 2019-10-24  8:00 UTC (permalink / raw)
  To: Tony Lindgren, Keerthy
  Cc: Michael Turquette, Stephen Boyd, devicetree, linux-clk, linux-omap

On 10/10/2019 17:05, Tony Lindgren wrote:
> * Keerthy <j-keerthy@ti.com> [191007 00:57]:
>>
>>
>> On 30/09/19 9:10 PM, Tony Lindgren wrote:
>>> Commit 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if
>>> timekeeping is suspended") added handling for cases when timekeeping is
>>> suspended. But looks like we can still get occasional "failed to enable"
>>> errors on the PM runtime resume path with udelay() returning faster than
>>> expected.
>>>
>>> With ti-sysc interconnect target module driver this leads into device
>>> failure with PM runtime failing with "failed to enable" clkctrl error.
>>>
>>> Let's fix the issue with a delay of two times the desired delay as in
>>> often done for udelay() to account for the inaccuracy.
>>
>> Tested for DS0 and rtc+ddr modes on am43 and ds0 on am33.
>>
>> Tested-by: Keerthy <j-keerthy@ti.com>
> 
> Thanks for testing. This one should be applied into v5.4-rc series
> please if no more comments.

Queued up for 5.4 fixes, thanks.

-Tero

> 
> Regards,
> 
> Tony
> 
>>> Fixes: 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if timekeeping is suspended")
>>> Cc: Keerthy <j-keerthy@ti.com>
>>> Cc: Tero Kristo <t-kristo@ti.com>
>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>> ---
>>>    drivers/clk/ti/clkctrl.c | 5 +++--
>>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
>>> --- a/drivers/clk/ti/clkctrl.c
>>> +++ b/drivers/clk/ti/clkctrl.c
>>> @@ -100,11 +100,12 @@ static bool _omap4_is_timeout(union omap4_timeout *time, u32 timeout)
>>>    	 * can be from a timer that requires pm_runtime access, which
>>>    	 * will eventually bring us here with timekeeping_suspended,
>>>    	 * during both suspend entry and resume paths. This happens
>>> -	 * at least on am43xx platform.
>>> +	 * at least on am43xx platform. Account for flakeyness
>>> +	 * with udelay() by multiplying the timeout value by 2.
>>>    	 */
>>>    	if (unlikely(_early_timeout || timekeeping_suspended)) {
>>>    		if (time->cycles++ < timeout) {
>>> -			udelay(1);
>>> +			udelay(1 * 2);
>>>    			return false;
>>>    		}
>>>    	} else {
>>>

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: ti: clkctrl: Fix failed to enable error with double udelay timeout
  2019-09-30 15:40 [PATCH] clk: ti: clkctrl: Fix failed to enable error with double udelay timeout Tony Lindgren
  2019-10-07  0:57 ` Keerthy
@ 2019-11-04 17:57 ` Stephen Boyd
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2019-11-04 17:57 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Tero Kristo, Tony Lindgren
  Cc: devicetree, linux-clk, linux-omap, Keerthy

Quoting Tony Lindgren (2019-09-30 08:40:01)
> Commit 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if
> timekeeping is suspended") added handling for cases when timekeeping is
> suspended. But looks like we can still get occasional "failed to enable"
> errors on the PM runtime resume path with udelay() returning faster than
> expected.
> 
> With ti-sysc interconnect target module driver this leads into device
> failure with PM runtime failing with "failed to enable" clkctrl error.
> 
> Let's fix the issue with a delay of two times the desired delay as in
> often done for udelay() to account for the inaccuracy.
> 
> Fixes: 3d8598fb9c5a ("clk: ti: clkctrl: use fallback udelay approach if timekeeping is suspended")
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-fixes


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-04 17:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 15:40 [PATCH] clk: ti: clkctrl: Fix failed to enable error with double udelay timeout Tony Lindgren
2019-10-07  0:57 ` Keerthy
2019-10-10 14:05   ` Tony Lindgren
2019-10-24  8:00     ` Tero Kristo
2019-11-04 17:57 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).