ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Ludwig Kormann <ludwig.kormann@ict42.de>,
	"linux-sunxi@lists.linux.dev" <linux-sunxi@lists.linux.dev>
Cc: jagan@amarulasolutions.com, trini@konsulko.com, u-boot@lists.denx.de
Subject: Re: [PATCH 1/1] sunxi: sun4i: add missing sdelay() to clock_init_safe()
Date: Thu, 1 Feb 2024 16:24:44 +0000	[thread overview]
Message-ID: <20240201162444.1cf81b0b@donnerap.manchester.arm.com> (raw)
In-Reply-To: <20240201084550.200913-1-ludwig.kormann@ict42.de>

On Thu,  1 Feb 2024 09:45:50 +0100
Ludwig Kormann <ludwig.kormann@ict42.de> wrote:

Hi,

> This delay is required after switching the clock source.
> 
> See “A20 Reference manual v1.4” Page 50 / section
> “1.5.4.16. CPU/AHB/APB0 CLOCK RATIO”: “If the clock
> source is changed, at most to wait for 8 present running
> clock cycles.”
> 
> This is already implemented in clock_set_pll1(), but was
> still missing in clock_init_safe().
> 
> Signed-off-by: Ludwig Kormann <ludwig.kormann@ict42.de>

Good catch, thanks for sending this!

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  arch/arm/mach-sunxi/clock_sun4i.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/mach-sunxi/clock_sun4i.c b/arch/arm/mach-sunxi/clock_sun4i.c
> index 8f1d1b65f0..ac3b7a801f 100644
> --- a/arch/arm/mach-sunxi/clock_sun4i.c
> +++ b/arch/arm/mach-sunxi/clock_sun4i.c
> @@ -25,6 +25,7 @@ void clock_init_safe(void)
>  	       APB0_DIV_1 << APB0_DIV_SHIFT |
>  	       CPU_CLK_SRC_OSC24M << CPU_CLK_SRC_SHIFT,
>  	       &ccm->cpu_ahb_apb0_cfg);
> +	sdelay(20);
>  	writel(PLL1_CFG_DEFAULT, &ccm->pll1_cfg);
>  	sdelay(200);
>  	writel(AXI_DIV_1 << AXI_DIV_SHIFT |
> @@ -32,6 +33,7 @@ void clock_init_safe(void)
>  	       APB0_DIV_1 << APB0_DIV_SHIFT |
>  	       CPU_CLK_SRC_PLL1 << CPU_CLK_SRC_SHIFT,
>  	       &ccm->cpu_ahb_apb0_cfg);
> +	sdelay(20);
>  #ifdef CONFIG_MACH_SUN7I
>  	setbits_le32(&ccm->ahb_gate0, 0x1 << AHB_GATE_OFFSET_DMA);
>  #endif


           reply	other threads:[~2024-02-01 16:24 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20240201084550.200913-1-ludwig.kormann@ict42.de>]

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=20240201162444.1cf81b0b@donnerap.manchester.arm.com \
    --to=andre.przywara@arm.com \
    --cc=jagan@amarulasolutions.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=ludwig.kormann@ict42.de \
    --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 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 read-only IMAP folder(s) and NNTP newsgroup(s).