From: Andre Przywara <andre.przywara@arm.com>
To: Chen-Yu Tsai <wens@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH v2 2/5] clk: sunxi-ng: mp: support clocks with just a shift register
Date: Thu, 24 Sep 2026 08:54:38 +0200 [thread overview]
Message-ID: <20260924085438.3edce740@ryzen.lan> (raw)
In-Reply-To: <CAGb2v67XsgfoYrJ6gJ_kshjnbSOOrJt9fK6RE1ErsTuHuVji5w@mail.gmail.com>
On Fri, 18 Sep 2026 11:51:19 +0800
Chen-Yu Tsai <wens@kernel.org> wrote:
Hi,
> On Fri, Sep 18, 2026 at 6:39 AM Andre Przywara <andre.przywara@arm.com> wrote:
> >
> > The "mp" clock models a mod clock with divider and a shift field. At
> > least one clock in the Allwinner A523 features just a power-of-2 divider
> > field, so support an initialisation of the clock without providing an
> > actual divider field.
>
> Please just use the single divider clock type instead. It properly supports
> power-of-2 dividers.
Ah, indeed, there is SUNXI_CCU_P_DATA_WITH_MUX_GATE now, will drop this
patch then.
So when using that macro it looks like this:
static SUNXI_CCU_P_DATA_WITH_MUX_GATE(pll_cpu_l_div_clk, "pll-cpu-l-div",
pll_cpu_l_hws, 0x060,
16, 2, /* P */
0, 0, /* no mux */
0, /* no gate */
CLK_SET_RATE_PARENT); /* flags */
There are still some unused bits, does that look OK or shall I add a
macro that allows to skip mux and gate?
static SUNXI_CCU_P_DATA(pll_cpu_l_div_clk, "pll-cpu-l-div",
pll_cpu_l_hws, 0x60,
16, 2, /* P */
CLK_SET_RATE_PARENT); /* flags */
Cheers,
Andre
>
> ChenYu
>
> > Add a check whether the "width" field is 0, and skip the divider
> > handling in this case, as the GENMASK macro will not work with a zero
> > length.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > ---
> > drivers/clk/sunxi-ng/ccu_mp.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c
> > index 7cdb0eedc69b5..3896cb94bf733 100644
> > --- a/drivers/clk/sunxi-ng/ccu_mp.c
> > +++ b/drivers/clk/sunxi-ng/ccu_mp.c
> > @@ -236,9 +236,11 @@ static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate,
> > spin_lock_irqsave(cmp->common.lock, flags);
> >
> > reg = readl(cmp->common.base + cmp->common.reg);
> > - reg &= ~GENMASK(cmp->m.width + cmp->m.shift - 1, cmp->m.shift);
> > + if (cmp->m.width)
> > + reg &= ~GENMASK(cmp->m.width + cmp->m.shift - 1, cmp->m.shift);
> > reg &= ~GENMASK(cmp->p.width + cmp->p.shift - 1, cmp->p.shift);
> > - reg |= (m - cmp->m.offset) << cmp->m.shift;
> > + if (cmp->m.width)
> > + reg |= (m - cmp->m.offset) << cmp->m.shift;
> > if (shift)
> > reg |= ilog2(p) << cmp->p.shift;
> > else
> > --
> > 2.43.0
> >
>
next prev parent reply other threads:[~2026-09-24 6:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 22:39 [PATCH v2 0/5] arm64: allwinner: a523: Enable CPU clocks Andre Przywara
2026-09-17 22:39 ` [PATCH v2 1/5] clk: sunxi-ng: generalise update bit Andre Przywara
2026-09-21 15:47 ` Chen-Yu Tsai
2026-09-17 22:39 ` [PATCH v2 2/5] clk: sunxi-ng: mp: support clocks with just a shift register Andre Przywara
2026-09-18 3:51 ` Chen-Yu Tsai
2026-09-24 6:54 ` Andre Przywara [this message]
2026-09-17 22:39 ` [PATCH v2 3/5] dt-bindings: clock: sun55i-a523-ccu: Add A523 CPU CCU clock controller Andre Przywara
2026-09-17 22:46 ` sashiko-bot
2026-09-17 22:39 ` [PATCH v2 4/5] clk: sunxi-ng: add support for the A523/T527 CPU CCU Andre Przywara
2026-09-17 22:51 ` sashiko-bot
2026-09-17 22:39 ` [PATCH v2 5/5] arm64: dts: allwinner: a523: add CPU clocks Andre Przywara
2026-09-17 22:46 ` sashiko-bot
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=20260924085438.3edce740@ryzen.lan \
--to=andre.przywara@arm.com \
--cc=bmasney+clk@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jbrunet+clk@baylibre.com \
--cc=jernej.skrabec@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=sboyd@kernel.org \
--cc=wens@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