[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAARXrtk6ZynSzm=xA1E1M8aSJNb=BZ7jxg4gvWa_QJ_=LaQeog@mail.gmail.com>
Date: Thu, 8 Mar 2018 13:38:47 +0800
From: Lei YU <mine260309@...il.com>
To: Joel Stanley <joel@....id.au>
Cc: Eddie James <eajames@...ux.vnet.ibm.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-clk@...r.kernel.org,
Michael Turquette <mturquette@...libre.com>, sboyd@...nel.org,
Ryan Chen <ryan_chen@...eedtech.com>
Subject: Re: [PATCH] clk: aspeed: Prevent reset if clock is enabled
On Thu, Mar 8, 2018 at 11:42 AM, Joel Stanley <joel@....id.au> wrote:
>> + /* Only reset/enable/unreset if clock is stopped */
>> + regmap_read(gate->map, ASPEED_CLK_STOP_CTRL, ®);
>> + if (!(reg & clk))
>> + return 0;
>
> This doesn't generalise to all of the clocks, as some clocks use set
> to disable. Perhaps we could do something like this:
>
> /* Only reset/enable/unreset if clock is stopped. The LPC clock
> on ast2500 has issues otherwise */
> enval = (gate->flags & CLK_GATE_SET_TO_DISABLE) ? 0 : clk;
> regmap_read(gate->map, ASPEED_CLK_STOP_CTRL, ®);
> if ((reg & clk) == enval) {
> spin_unlock_irqrestore(gate->lock, flags);
> return 0;
> }
>
> I think we should also do this operation under the lock.
>
> Please cc Ryan Chen <ryan_chen@...eedtech.com> so he can confirm that
> this workaround is valid, and credit Lei who spent a lot of time
> investigating this issue. Perhaps "Root-caused-by".
>
The code has aspeed_clk_is_enabled() already, why not just:
if (aspeed_clk_is_enabled(hw))
return 0;
Powered by blists - more mailing lists