mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <sha@pengutronix.de>
Cc: barebox@lists.infradead.org, Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH v3 15/15] usb: ohci-at91: fix possible hang chainloading barebox
Date: Tue, 20 Feb 2024 10:26:10 +0100	[thread overview]
Message-ID: <ee0561e8-1280-4450-9a9c-eb318b557399@pengutronix.de> (raw)
In-Reply-To: <Zc9f4d42rpSZh8qu@pengutronix.de>

On 16.02.24 14:15, Sascha Hauer wrote:
> On Thu, Feb 15, 2024 at 05:30:09PM +0100, Ahmad Fatoum wrote:
>> barebox, like Linux, will consider disabling parents when disabling a
>> child clock. In the AT91 OHCI driver ported to barebox from Linux, this
>> leads to the USB clock shutdown during device shutdown to propagate up
>> to PLLB, which is also disabled.
>>
>> On probe of the kernel driver, the USB clock rate is set to 48MHz, which
>> propagates up to the PLL, which is powered on again. In barebox, this clock
>> rate propagation does not happen and the PLL is only initially
>> configured in the first stage bootloader.
>>
>> This has the effect that chainloading barebox from within barebox will
>> hang as the first barebox disables PLLB on shutdown and the second
>> barebox never power it on.
>>
>> The proper solution would be to support propagation of clock rate change
>> requests, but till we have that, patch the driver, so only the immediate
>> clock is disabled and not its parents.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>> v3:
>>   - new patch
>> ---
>>  drivers/clk/clk.c            | 12 +++++++++---
>>  drivers/usb/host/ohci-at91.c | 13 +++++++++++--
>>  include/linux/clk.h          | 20 ++++++++++++++++++--
>>  3 files changed, 38 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>> index d3f5d5e83880..03533b61df0a 100644
>> --- a/drivers/clk/clk.c
>> +++ b/drivers/clk/clk.c
>> @@ -66,7 +66,7 @@ int clk_enable(struct clk *clk)
>>  	return 0;
>>  }
>>  
>> -void clk_disable(struct clk *clk)
>> +void clk_disable_one(struct clk *clk)
>>  {
> 
> I don't like this very much as it screws up the enable counter of the
> clocks.
> 
> Cou could mark the PLL clock as critical or simply not disable the clock
> in the driver.

Ok, I will think about it. I will drop this from v2.

Thanks,
Ahmad

> 
> Sascha
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2024-02-20  9:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 16:29 [PATCH v3 00/15] ARM: at91: skov-arm9cpu (SAM9263) first stage support Ahmad Fatoum
2024-02-15 16:29 ` [PATCH v3 01/15] mci: atmel_mci: disable power save mode Ahmad Fatoum
2024-02-15 16:29 ` [PATCH v3 02/15] mci: atmel_mci: fix zeroing of block length on AT91SAM9263 Ahmad Fatoum
2024-02-15 16:29 ` [PATCH v3 03/15] ARM: replace ENTRY_FUNCTION_HEAD with ENTRY_FUNCTION_WITHSTACK_HEAD Ahmad Fatoum
2024-02-15 16:29 ` [PATCH v3 04/15] ARM: at91: use AT91 header instead of generic barebox ARM's Ahmad Fatoum
2024-02-15 16:29 ` [PATCH v3 05/15] ARM: at91: implement SAM9_ENTRY_FUNCTION Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 06/15] ARM: at91: sam9263_ll: drop PLL charge pump initialization Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 07/15] ARM: at91: sam9263_ll: pass AT91_PMC_LL_AT91SAM9263 to PMC functions Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 08/15] ARM: at91: sam9263_ll: refactor MCK switch to PLLA for clarity Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 09/15] ARM: at91: sam9263_ll: support configuration of PLLB Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 10/15] ARM: dts: AT91: skov-arm9cpu: remove barebox environment on NOR Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 11/15] ARM: at91: skov-arm9cpu: Add SD-Card xload support Ahmad Fatoum
2024-02-15 22:29   ` Sam Ravnborg
2024-02-20  9:25     ` Ahmad Fatoum
2024-02-21 16:28       ` Sam Ravnborg
2024-02-15 16:30 ` [PATCH v3 12/15] ARM: at91: skov-arm9cpu: configure SMC for NOR flash use Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 13/15] ARM: at91: skov-arm9cpu: configure more appropriate hostname Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 14/15] ARM: AT91: skov-arm9cpu: support environment on SD-Card Ahmad Fatoum
2024-02-15 16:30 ` [PATCH v3 15/15] usb: ohci-at91: fix possible hang chainloading barebox Ahmad Fatoum
2024-02-16 13:15   ` Sascha Hauer
2024-02-20  9:26     ` Ahmad Fatoum [this message]
2024-02-15 22:33 ` [PATCH v3 00/15] ARM: at91: skov-arm9cpu (SAM9263) first stage support Sam Ravnborg
2024-02-20  9:27   ` Ahmad Fatoum

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=ee0561e8-1280-4450-9a9c-eb318b557399@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sam@ravnborg.org \
    --cc=sha@pengutronix.de \
    /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