mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Jian Hu <jian.hu@amlogic.com>
To: Neil Armstrong <neil.armstrong@linaro.org>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Dmitry Rokosov <ddrokosov@sberdevices.ru>
Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Chuan Liu <chuan.liu@amlogic.com>
Subject: Re: [PATCH v2] clk: meson: Fix PLL enable timing
Date: Wed, 18 Nov 2026 11:17:22 +0800	[thread overview]
Message-ID: <5071a345-759e-4678-a33f-d80a7c782fc6@amlogic.com> (raw)
In-Reply-To: <20261104-fix_enable_timing-v2-1-05cdaf34fcdb@amlogic.com>

Hi Martin,


This patch aims to resolve this potential PLL unlock issue.
It has been tested on T7, C3, S4, AXG, GXL, SM1 and A1,
covering almost all Amlogic clk drivers except meson8b.
Could you help test it?

On 11/4/2026 10:13 AM, Jian Hu via B4 Relay wrote:
> From: Jian Hu <jian.hu@amlogic.com>
>
> The hardware requires a 50us delay after setting the PLL enable
> bit to allow the PLL power-up sequence to complete.
>
> Without this delay, GP0 and HIFI PLLs on Amlogic T7, SM1 and C3
> may fail to lock under stress testing.
>
> Add a 50us delay after enabling the PLL and another 50us delay
> after deasserting the PLL reset.
>
> Testing on GXL shows that the PLL works correctly without the
> additional delay and continues to lock successfully after the
> 50us delay is added.
>
> On A1, remove the redundant 10us delay before enabling the
> self-adaption current module, as the new PLL enable delay already
> covers this timing requirement.
>
> Fixes: b6ec400aa153 ("clk: meson: introduce new pll power-on sequence for A1 SoC family")
> Signed-off-by: Chuan Liu <chuan.liu@amlogic.com>
> Signed-off-by: Jian Hu <jian.hu@amlogic.com>
> ---
> For example, enabling the GP0 PLL at 1512MHz may lose lock and
> result in an output I/O error:
>
> echo 1512000000 > /sys/kernel/debug/clk/gp0_pll/clk_rate
> echo 1 > /sys/kernel/debug/clk/gp0_pll/clk_prepare_enable
> sh: write error: I/O error
>
> Tested on: T7, C3, S4, AXG, GXL, SM1 and A1.
> ---
> Changes in v2:
> - Combine Chuan's patch to this patch.
> - Update the Fixes tag.
> - Move test details below the commit message.
> - Link to Chuan's patch: https://lore.kernel.org/all/20251031-optimize_pll_driver-v3-2-92f3b2f36a83@amlogic.com
> - Link to v1: https://lore.kernel.org/r/20261028-fix_enable_timing-v1-1-70f060ec3f2a@amlogic.com
> ---
>   drivers/clk/meson/clk-pll.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c
> index 1ea6579a760f..477eb9958a8d 100644
> --- a/drivers/clk/meson/clk-pll.c
> +++ b/drivers/clk/meson/clk-pll.c
> @@ -369,20 +369,25 @@ static int meson_clk_pll_enable(struct clk_hw *hw)
>          /* Enable the pll */
>          meson_parm_write(clk->map, &pll->en, 1);
>
> +       /* Wait for the PLL power-up sequence to complete */
> +       udelay(50);
> +
>          /* Take the pll out reset */
> -       if (MESON_PARM_APPLICABLE(&pll->rst))
> +       if (MESON_PARM_APPLICABLE(&pll->rst)) {
>                  meson_parm_write(clk->map, &pll->rst, 0);
> +               /* Wait for the PLL loop to stabilize */
> +               udelay(50);
> +       }
>
>          /*
>           * Compared with the previous SoCs, self-adaption current module
>           * is newly added for A1, keep the new power-on sequence to enable the
>           * PLL. The sequence is:
> -        * 1. enable the pll, delay for 10us
> +        * 1. enable the pll, delay for 50us
>           * 2. enable the pll self-adaption current module, delay for 40us
>           * 3. enable the lock detect module
>           */
>          if (MESON_PARM_APPLICABLE(&pll->current_en)) {
> -               udelay(10);
>                  meson_parm_write(clk->map, &pll->current_en, 1);
>                  udelay(40);
>          }
>
> ---
> base-commit: 363f97a1ce635b86be7fd263d56a040fbd87bdbb
> change-id: 20261027-fix_enable_timing-842bfa84d4d4
>
> Best regards,
> --
> Jian Hu <jian.hu@amlogic.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

      reply	other threads:[~2026-11-18  3:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  2:13 Jian Hu via B4 Relay
2026-11-18  3:17 ` Jian Hu [this message]

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=5071a345-759e-4678-a33f-d80a7c782fc6@amlogic.com \
    --to=jian.hu@amlogic.com \
    --cc=bmasney+clk@redhat.com \
    --cc=chuan.liu@amlogic.com \
    --cc=ddrokosov@sberdevices.ru \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=sboyd@kernel.org \
    /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

all inboxes | Powered by JetHome®