linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Abel Vesa <abelvesa@kernel.org>,
	Aisheng Dong <aisheng.dong@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Peng Fan (OSS) <peng.fan@oss.nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>
Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH 1/4] clk: imx: lpcg-scu: SW workaround for errata (e10858)
Date: Wed, 16 Oct 2024 14:46:42 -0700	[thread overview]
Message-ID: <98e82f4c4e6c62fe61d65ae03b027f79.sboyd@kernel.org> (raw)
In-Reply-To: <20241014-imx-clk-v1-v1-1-ee75876d3102@nxp.com>

Quoting Peng Fan (OSS) (2024-10-14 02:11:22)
> diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c
> index dd5abd09f3e206a5073767561b517d5b3320b28c..2cffec0c42dccc256e8dc5e9181952e250870a76 100644
> --- a/drivers/clk/imx/clk-lpcg-scu.c
> +++ b/drivers/clk/imx/clk-lpcg-scu.c
> @@ -6,6 +6,7 @@
>  
>  #include <linux/bits.h>
>  #include <linux/clk-provider.h>
> +#include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/io.h>
>  #include <linux/slab.h>
> @@ -41,6 +42,31 @@ struct clk_lpcg_scu {
>  
>  #define to_clk_lpcg_scu(_hw) container_of(_hw, struct clk_lpcg_scu, hw)
>  
> +/* e10858 -LPCG clock gating register synchronization errata */
> +static void lpcg_e10858_writel(ulong rate, void __iomem *reg, u32 val)

s/ulong/unsigned long/

> +{
> +       u32 reg1;
> +
> +       writel(val, reg);
> +
> +       if (rate >= 24000000 || rate == 0) {

Can be '24 * HZ_PER_MHZ'

> +               /*
> +                * The time taken to access the LPCG registers from the AP core
> +                * through the interconnect is longer than the minimum delay
> +                * of 4 clock cycles required by the errata.
> +                * Adding a readl will provide sufficient delay to prevent
> +                * back-to-back writes.
> +                */
> +               reg1 = readl(reg);
> +       } else {
> +               /*
> +                * For clocks running below 24MHz, wait a minimum of
> +                * 4 clock cycles.
> +                */
> +               ndelay(4 * (DIV_ROUND_UP(1000000000, rate)));

Can be '1000 * HZ_PER_MHZ'


  parent reply	other threads:[~2024-10-16 21:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14  9:11 [PATCH 0/4] clk: imx: scu and fracn pll update Peng Fan (OSS)
2024-10-14  9:11 ` [PATCH 1/4] clk: imx: lpcg-scu: SW workaround for errata (e10858) Peng Fan (OSS)
2024-10-14 14:20   ` Fabio Estevam
2024-10-15  2:25     ` Peng Fan
2024-10-16 21:46   ` Stephen Boyd [this message]
2024-10-14  9:11 ` [PATCH 2/4] clk: imx: lpcg-scu: Skip HDMI LPCG clock save/restore Peng Fan (OSS)
2024-10-14  9:11 ` [PATCH 3/4] clk: imx: fracn-gppll: correct PLL initialization flow Peng Fan (OSS)
2024-10-14  9:11 ` [PATCH 4/4] clk: imx: fracn-gppll: fix pll power up Peng Fan (OSS)
2024-10-16 21:49   ` Stephen Boyd

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=98e82f4c4e6c62fe61d65ae03b027f79.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=abelvesa@kernel.org \
    --cc=aisheng.dong@nxp.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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;
as well as URLs for NNTP newsgroup(s).