All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: "Jernej Škrabec" <jernej.skrabec@gmail.com>
Cc: u-boot@lists.denx.de, Tom Rini <trini@konsulko.com>,
	Cody Eksal <masterr3c0rd@epochal.quest>,
	Chris Morgan <macromorgan@hotmail.com>,
	linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 2/3] sunxi: spl: initialise timer before clocks
Date: Tue, 12 Aug 2025 00:01:14 +0100	[thread overview]
Message-ID: <20250812000114.602f53c2@minigeek.lan> (raw)
In-Reply-To: <20250811165225.2a01a93d@donnerap.manchester.arm.com>

On Mon, 11 Aug 2025 16:52:25 +0100
Andre Przywara <andre.przywara@arm.com> wrote:

Hi,

> On Mon, 11 Aug 2025 17:34:47 +0200
> Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
> 
> > Dne sobota, 2. avgust 2025 ob 01:49:17 Srednjeevropski poletni čas je Andre Przywara napisal(a):  
> > > Recent changes in the H6 clock code added delay() calls into the SPL clock
> > > setup routine, which requires the timers to work. When compiling for
> > > AArch64, we are always using the Arm Generic Timer (aka. arch timer),
> > > which does not require further setup, hence having an empty timer_init()
> > > routine.
> > > However for 32-bit SoCs we use the Allwinner timers, which require some
> > > setup routine, and hence we need timer_init() to be called before
> > > clock_init().
> > > 
> > > Swap the order of the two calls, to be more robust when compiling the H6
> > > clock code for AArch32 or when using the Allwinner timers for whatever
> > > reason.
> > > 
> > > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > > ---
> > >  arch/arm/mach-sunxi/board.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
> > > index fb4837c2082..432b1c10f92 100644
> > > --- a/arch/arm/mach-sunxi/board.c
> > > +++ b/arch/arm/mach-sunxi/board.c
> > > @@ -476,8 +476,8 @@ void board_init_f(ulong dummy)
> > >  	/* Enable non-secure access to some peripherals */
> > >  	tzpc_init();
> > >  
> > > -	clock_init();
> > >  	timer_init();
> > > +	clock_init();    
> > 
> > I contemplated similar change in past. It works fine for 64-bit architectures,
> > but I'm unsure for 32-bit. If you take a look at A83t clock code, it uses
> > sdelay() exactly because timer is not initialized at that time.
> > 
> > So, are you sure that this change has no unwanted side effects?  
> 
> No, I am not ;-)
> I was about to test this on some more boards. But I think with the
> change in that direction, the only issue would be if the timer_init() code
> relies on the clocks being set up already. And since timer_init() is only
> *one* rather small function, just doing MMIO accesses, I think the risk is
> quite low.
> 
> Thanks for having a look anyway, I will report back how the test goes.

Alright, I booted this patch on:
A10, A20, A33, V40, A80, A83T, T113s3, F1C100s, H3
(/me puts the mini-USB cables back into the shelf now)

For the A83T specifically, as a test, I replaced the sdelay() calls with
udelay() ones, and it hangs with mainline, but works with this patch.

So unless someone speaks up now, I am tempted to merge this patch.

Cheers,
Andre

  parent reply	other threads:[~2025-08-11 23:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01 23:49 [PATCH 0/3] sunxi: assorted fixes to DRAM and clock init Andre Przywara
2025-08-01 23:49 ` [PATCH 1/3] sunxi: a133: dram: fix data type for address variable Andre Przywara
2025-08-11 15:36   ` Jernej Škrabec
2025-08-01 23:49 ` [PATCH 2/3] sunxi: spl: initialise timer before clocks Andre Przywara
2025-08-11 15:34   ` Jernej Škrabec
2025-08-11 15:52     ` Andre Przywara
2025-08-11 16:31       ` Jernej Škrabec
2025-08-11 23:01       ` Andre Przywara [this message]
2025-08-12  4:14   ` Jernej Škrabec
2025-08-01 23:49 ` [PATCH 3/3] sunxi: H616: dram: fix LPDDR3 mode register settings Andre Przywara
2025-08-11 15:49   ` Jernej Škrabec
2025-08-11 16:08     ` Andre Przywara
2025-08-11 16:28       ` Jernej Škrabec

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=20250812000114.602f53c2@minigeek.lan \
    --to=andre.przywara@arm.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=macromorgan@hotmail.com \
    --cc=masterr3c0rd@epochal.quest \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.