linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tero Kristo <t-kristo@ti.com>
To: Suman Anna <s-anna@ti.com>, <linux-clk@vger.kernel.org>,
	<sboyd@kernel.org>, <mturquette@baylibre.com>
Cc: <linux-omap@vger.kernel.org>, <tony@atomide.com>
Subject: Re: [PATCH 1/3] clk: ti: clkctrl: add support for polling clock status for enable only
Date: Mon, 19 Aug 2019 12:13:57 +0300	[thread overview]
Message-ID: <99f2b99f-6b5a-eef6-cc6f-fed7431f7cc8@ti.com> (raw)
In-Reply-To: <6a088bc2-e854-b4fa-3c97-ce94dd2a92cb@ti.com>

On 08/08/2019 01:43, Suman Anna wrote:
> Hi Tero,
> 
> On 8/7/19 8:04 AM, Tero Kristo wrote:
>> The activity status for certain clocks is possible to be polled only
>> during enable phase; the disable phase depends on additional reset
>> logic.
> 
> I am not sure this is an entirely accurate statement. Can you explain
> why this is an issue only with disable sequence and not enable sequence?
> Almost sounds like you are doing some asymmetric sequence w.r.t clocks
> and resets.

This follows the recommended ordering sequence from TRM, so reset will 
be de-asserted before enabling clock, so we can keep the polling there.

Going down, reset must be asserted post disabling clocks, which results 
a timeout if the idle status check is not bypassed.

This is kind of not perfect and should be fixed later to somehow add a 
direct link between the clock and reset lines, so that we know when 
there is dependency between the two and can check the status of both to 
see if we should poll something or not.

> 
> On the downstream kernel, we have reused the existing NO_IDLEST flag as
> a quirk within both the enable and disable functions for the IPs with
> hardreset lines, and this patch seems to introduce a new NO_IDLE_POLL
> flag but only during the disable path.

The NO_IDLEST patch is not perfect, as it introduces a timing hazard 
where while enabling the module one can access the IP registers before 
it has left idle, leading into a crash.

-Tero

> 
> regards
> Suman
> 
> If the disable phase is polled with these clocks, it will
>> result in a timeout. To fix this, add logic for polling the clock
>> activity only during enable, and add a new flag for this purpose.
>>
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>> ---
>>   drivers/clk/ti/clkctrl.c | 5 ++++-
>>   drivers/clk/ti/clock.h   | 1 +
>>   2 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
>> index 975995e..f5517a8 100644
>> --- a/drivers/clk/ti/clkctrl.c
>> +++ b/drivers/clk/ti/clkctrl.c
>> @@ -25,6 +25,7 @@
>>   #include "clock.h"
>>   
>>   #define NO_IDLEST			0x1
>> +#define NO_IDLE_POLL			0x2
>>   
>>   #define OMAP4_MODULEMODE_MASK		0x3
>>   
>> @@ -187,7 +188,7 @@ static void _omap4_clkctrl_clk_disable(struct clk_hw *hw)
>>   
>>   	ti_clk_ll_ops->clk_writel(val, &clk->enable_reg);
>>   
>> -	if (clk->flags & NO_IDLEST)
>> +	if (clk->flags & (NO_IDLEST | NO_IDLE_POLL))
>>   		goto exit;
>>   
>>   	/* Wait until module is disabled */
>> @@ -597,6 +598,8 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
>>   			hw->enable_bit = MODULEMODE_HWCTRL;
>>   		if (reg_data->flags & CLKF_NO_IDLEST)
>>   			hw->flags |= NO_IDLEST;
>> +		if (reg_data->flags & CLKF_NO_IDLE_POLL)
>> +			hw->flags |= NO_IDLE_POLL;
>>   
>>   		if (reg_data->clkdm_name)
>>   			hw->clkdm_name = reg_data->clkdm_name;
>> diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
>> index e4b8392..6410ff6 100644
>> --- a/drivers/clk/ti/clock.h
>> +++ b/drivers/clk/ti/clock.h
>> @@ -82,6 +82,7 @@ enum {
>>   #define CLKF_SW_SUP			BIT(5)
>>   #define CLKF_HW_SUP			BIT(6)
>>   #define CLKF_NO_IDLEST			BIT(7)
>> +#define CLKF_NO_IDLE_POLL		BIT(8)
>>   
>>   #define CLKF_SOC_MASK			GENMASK(11, 8)
>>   
>>
> 

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

  reply	other threads:[~2019-08-19  9:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 13:04 [PATCH 0/3] clk: ti: couple of fixes towards 5.4 Tero Kristo
2019-08-07 13:04 ` [PATCH 1/3] clk: ti: clkctrl: add support for polling clock status for enable only Tero Kristo
2019-08-07 22:43   ` Suman Anna
2019-08-19  9:13     ` Tero Kristo [this message]
2019-08-19 21:07       ` Suman Anna
2019-08-20  8:17         ` Tero Kristo
2019-08-07 13:04 ` [PATCH 2/3] clk: ti: dra7xx: remove idlest polling from disabling ipu/dsp clocks Tero Kristo
2019-08-07 22:50   ` Suman Anna
2019-08-19  9:19     ` Tero Kristo
2019-08-19 21:11       ` Suman Anna
2019-08-07 13:04 ` [PATCH 3/3] clk: ti: dra7xx: add timer_sys_ck clock alias Tero Kristo
2019-08-07 22:56   ` Suman Anna
2019-08-19 21:14     ` Suman Anna
2019-08-23 18:16       ` Tero Kristo
2019-08-26 22:26         ` Suman Anna
2019-08-27  5:57           ` Tero Kristo
2019-08-07 22:25 ` [PATCH 0/3] clk: ti: couple of fixes towards 5.4 Stephen Boyd
2019-08-19  9:17   ` Tero Kristo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99f2b99f-6b5a-eef6-cc6f-fed7431f7cc8@ti.com \
    --to=t-kristo@ti.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=s-anna@ti.com \
    --cc=sboyd@kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).