From: Jerome Brunet <jbrunet@baylibre.com>
To: Chen-Yu Tsai <wens@kernel.org>
Cc: Junhui Liu <junhui.liu@pigmoral.tech>,
Alexandre Belloni <alexandre.belloni@bootlin.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>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Maxime Ripard <mripard@kernel.org>,
linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-clk@vger.kernel.org
Subject: Re: [PATCH v6 2/4] clk: sunxi-ng: div: add read-only operation support
Date: Wed, 22 Jul 2026 18:28:45 +0200 [thread overview]
Message-ID: <1jse5bc7k2.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <CAGb2v64HjXygw76zaNi9KaG-zfc+hZoeyp4EHyz68fcdK-AXNw@mail.gmail.com> (Chen-Yu Tsai's message of "Wed, 22 Jul 2026 23:40:07 +0800")
On mer. 22 juil. 2026 at 23:40, Chen-Yu Tsai <wens@kernel.org> wrote:
> On Wed, Jul 22, 2026 at 10:48 PM Jerome Brunet <jbrunet@baylibre.com> wrote:
>>
>> Add support for sunxi-ng read-only dividers. This will be
>> useful to the a733 oscillator detection logic.
>>
>> Reviewed-by: Chen-Yu Tsai <wens@kernel.org>
>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
>> ---
>> drivers/clk/sunxi-ng/ccu_div.c | 31 +++++++++++++++++++++++++++++--
>> drivers/clk/sunxi-ng/ccu_div.h | 1 +
>
>> drivers/clk/sunxi-ng/ccu_mux.c | 2 +-
>> drivers/clk/sunxi-ng/ccu_mux.h | 4 ++++
>
> Left over stuff?
>
Argh indeed, that's no longer necessary
>
>> 4 files changed, 35 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/clk/sunxi-ng/ccu_div.c b/drivers/clk/sunxi-ng/ccu_div.c
>> index 62d680ccb524..c385e0160f13 100644
>> --- a/drivers/clk/sunxi-ng/ccu_div.c
>> +++ b/drivers/clk/sunxi-ng/ccu_div.c
>> @@ -20,8 +20,22 @@ static int ccu_div_determine_rate_helper(struct ccu_mux_internal *mux,
>> if (cd->common.features & CCU_FEATURE_FIXED_POSTDIV)
>> req->rate *= cd->fixed_post_div;
>>
>> - ret = divider_determine_rate(&cd->common.hw, req, cd->div.table,
>> - cd->div.width, cd->div.flags);
>> + if (cd->div.flags & CLK_DIVIDER_READ_ONLY) {
>> + unsigned long val;
>> + u32 reg;
>> +
>> + reg = readl(cd->common.base + cd->common.reg);
>> + val = reg >> cd->div.shift;
>> + val &= (1 << cd->div.width) - 1;
>> +
>> + ret = divider_ro_determine_rate(&cd->common.hw, req, cd->div.table,
>> + cd->div.width, cd->div.flags, val);
>> +
>> + } else {
>> + ret = divider_determine_rate(&cd->common.hw, req, cd->div.table,
>> + cd->div.width, cd->div.flags);
>> + }
>> +
>> if (ret)
>> return ret;
>>
>> @@ -143,3 +157,16 @@ const struct clk_ops ccu_div_ops = {
>> .set_rate = ccu_div_set_rate,
>> };
>> EXPORT_SYMBOL_NS_GPL(ccu_div_ops, "SUNXI_CCU");
>> +
>> +const struct clk_ops ccu_rodiv_ops = {
>> + .disable = ccu_div_disable,
>> + .enable = ccu_div_enable,
>> + .is_enabled = ccu_div_is_enabled,
>> +
>> + .get_parent = ccu_div_get_parent,
>> + .set_parent = ccu_div_set_parent,
>> +
>> + .determine_rate = ccu_div_determine_rate,
>> + .recalc_rate = ccu_div_recalc_rate,
>> +};
>> +EXPORT_SYMBOL_NS_GPL(ccu_rodiv_ops, "SUNXI_CCU");
>> diff --git a/drivers/clk/sunxi-ng/ccu_div.h b/drivers/clk/sunxi-ng/ccu_div.h
>> index be00b3277e97..a30a92780a05 100644
>> --- a/drivers/clk/sunxi-ng/ccu_div.h
>> +++ b/drivers/clk/sunxi-ng/ccu_div.h
>> @@ -300,5 +300,6 @@ static inline struct ccu_div *hw_to_ccu_div(struct clk_hw *hw)
>> }
>>
>> extern const struct clk_ops ccu_div_ops;
>> +extern const struct clk_ops ccu_rodiv_ops;
>>
>> #endif /* _CCU_DIV_H_ */
>> diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c
>> index 4503c9780c39..12bfc99c9172 100644
>> --- a/drivers/clk/sunxi-ng/ccu_mux.c
>> +++ b/drivers/clk/sunxi-ng/ccu_mux.c
>> @@ -67,7 +67,7 @@ unsigned long ccu_mux_helper_apply_prediv(struct ccu_common *common,
>> return parent_rate / ccu_mux_get_prediv(common, cm, parent_index);
>> }
>>
>> -static unsigned long ccu_mux_helper_unapply_prediv(struct ccu_common *common,
>> +unsigned long ccu_mux_helper_unapply_prediv(struct ccu_common *common,
>> struct ccu_mux_internal *cm,
>> int parent_index,
>> unsigned long parent_rate)
>> diff --git a/drivers/clk/sunxi-ng/ccu_mux.h b/drivers/clk/sunxi-ng/ccu_mux.h
>> index c94a4bde5d01..272a2c36a8f2 100644
>> --- a/drivers/clk/sunxi-ng/ccu_mux.h
>> +++ b/drivers/clk/sunxi-ng/ccu_mux.h
>> @@ -134,6 +134,10 @@ unsigned long ccu_mux_helper_apply_prediv(struct ccu_common *common,
>> struct ccu_mux_internal *cm,
>> int parent_index,
>> unsigned long parent_rate);
>> +unsigned long ccu_mux_helper_unapply_prediv(struct ccu_common *common,
>> + struct ccu_mux_internal *cm,
>> + int parent_index,
>> + unsigned long parent_rate);
>> int ccu_mux_helper_determine_rate(struct ccu_common *common,
>> struct ccu_mux_internal *cm,
>> struct clk_rate_request *req,
>>
>> --
>> 2.47.3
>>
--
Jerome
next prev parent reply other threads:[~2026-07-22 16:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 14:48 [PATCH v6 0/4] clk: sun6i-rtc: Add support for Allwinner A733 SoC Jerome Brunet
2026-07-22 14:48 ` [PATCH v6 1/4] clk: sunxi-ng: mux: fix determine helper rate propagation Jerome Brunet
2026-07-22 15:07 ` sashiko-bot
2026-07-22 14:48 ` [PATCH v6 2/4] clk: sunxi-ng: div: add read-only operation support Jerome Brunet
2026-07-22 15:00 ` sashiko-bot
2026-07-22 15:40 ` Chen-Yu Tsai
2026-07-22 16:28 ` Jerome Brunet [this message]
2026-07-22 14:48 ` [PATCH v6 3/4] clk: sunxi-ng: sun6i-rtc: split main oscillator div and gate Jerome Brunet
2026-07-22 14:57 ` sashiko-bot
2026-07-22 14:48 ` [PATCH v6 4/4] clk: sunxi-ng: sun6i-rtc: add a733 support Jerome Brunet
2026-07-22 14:57 ` 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=1jse5bc7k2.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=alexandre.belloni@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=junhui.liu@pigmoral.tech \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--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