public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Chuan Liu <chuan.liu@amlogic.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	 Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>,
	 Kevin Hilman <khilman@baylibre.com>,
	 Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	 linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH 24/26] clk: amlogic: add composite clock helpers
Date: Thu, 03 Jul 2025 10:39:49 +0200	[thread overview]
Message-ID: <1j5xg9d5wq.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <a9b6ffdc-489f-4be9-9005-e987df739901@amlogic.com> (Chuan Liu's message of "Thu, 3 Jul 2025 15:24:50 +0800")

On Thu 03 Jul 2025 at 15:24, Chuan Liu <chuan.liu@amlogic.com> wrote:

> Hi Jerome:
>
>
> On 7/2/2025 11:26 PM, Jerome Brunet wrote:
>> [ EXTERNAL EMAIL ]
>>
>> Device composite clocks tend to reproduce the usual sel/div/gate
>> arrangement.
>>
>> Add macros to help define simple composite clocks in the system.
>>
>> The idea is _not_ to replace all instances of mux, div or gate with those
>> macros. It is rather to use it for recurring and/or simple composite
>> clocks, reducing controller verbosity where it makes sense. This should
>> help reviews focus on the tricky parts.
>>
>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
>> ---
>>   drivers/clk/meson/meson-clkc-utils.h | 57 ++++++++++++++++++++++++++++++++++++
>>   1 file changed, 57 insertions(+)
>>
>> diff --git a/drivers/clk/meson/meson-clkc-utils.h b/drivers/clk/meson/meson-clkc-utils.h
>> index 95d9f85f7ca22f63a16f8665d6f7a250b21bfdb8..ddadf14b4923781d8807546f35a1ba2e6a8a894a 100644
>> --- a/drivers/clk/meson/meson-clkc-utils.h
>> +++ b/drivers/clk/meson/meson-clkc-utils.h
>> @@ -48,4 +48,61 @@ struct clk_regmap _name = {                                          \
>>   #define MESON_PCLK_RO(_name, _reg, _bit, _pdata, _flags)               \
>>          __MESON_PCLK(_name, _reg, _bit, &clk_regmap_gate_ro_ops, _pdata, _flags)
>>
>> +/* Helpers for the usual sel/div/gate composite clocks */
>> +#define MESON_COMP_SEL(_prefix, _name, _reg, _shift, _mask, _pdata,    \
>> +                      _table, _dflags, _iflags)                        \
>> +struct clk_regmap _prefix##_name##_sel = {                             \
>
>
> Can we apply the same naming style to the '**PCLK' clocks? The SoC prefix in
> clock names looks inconsistent and awkward.

Replied on patch 5

>
>
>> +       .data = &(struct clk_regmap_mux_data) {                         \
>> +               .offset = (_reg),                                       \
>> +               .mask = (_mask),                                        \
>> +               .shift = (_shift),                                      \
>> +               .flags = (_dflags),                                     \
>> +               .table = (_table),                                      \
>> +       },                                                              \
>> +       .hw.init = &(struct clk_init_data){                             \
>> +               .name = #_name "_sel",                                  \
>> +               .ops = &clk_regmap_mux_ops,                             \
>> +               .parent_data = _pdata,                                  \
>> +               .num_parents = ARRAY_SIZE(_pdata),                      \
>> +               .flags = (_iflags),                                     \
>> +       },                                                              \
>> +}
>> +
>> +#define MESON_COMP_DIV(_prefix, _name, _reg, _shift, _width,           \
>> +                      _dflags, _iflags)                                \
>> +struct clk_regmap _prefix##_name##_div = {                             \
>> +       .data = &(struct clk_regmap_div_data) {                         \
>> +               .offset = (_reg),                                       \
>> +               .shift = (_shift),                                      \
>> +               .width = (_width),                                      \
>> +               .flags = (_dflags),                                     \
>> +       },                                                              \
>> +       .hw.init = &(struct clk_init_data) {                            \
>> +               .name = #_name "_div",                                  \
>> +               .ops = &clk_regmap_divider_ops,                         \
>> +               .parent_hws = (const struct clk_hw *[]) {               \
>> +                       &_prefix##_name##_sel.hw                        \
>> +               },                                                      \
>> +               .num_parents = 1,                                       \
>> +               .flags = (_iflags),                                     \
>> +       },                                                              \
>> +}
>> +
>> +#define MESON_COMP_GATE(_prefix, _name, _reg, _bit, _iflags)           \
>> +struct clk_regmap _prefix##_name = {                                   \
>> +       .data = &(struct clk_regmap_gate_data) {                        \
>> +               .offset = (_reg),                                       \
>> +               .bit_idx = (_bit),                                      \
>> +       },                                                              \
>> +       .hw.init = &(struct clk_init_data) {                            \
>> +               .name = #_name,                                         \
>> +               .ops = &clk_regmap_gate_ops,                            \
>> +               .parent_hws = (const struct clk_hw *[]) {               \
>> +                       &_prefix##_name##_div.hw                        \
>> +               },                                                      \
>> +               .num_parents = 1,                                       \
>> +               .flags = (_iflags),                                     \
>> +       },                                                              \
>> +}
>> +
>>   #endif
>>
>> --
>> 2.47.2
>>
>>
>> _______________________________________________
>> linux-amlogic mailing list
>> linux-amlogic@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-amlogic

-- 
Jerome

  reply	other threads:[~2025-07-03  8:39 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 15:25 [PATCH 00/26] clk: amlogic: clock controllers clean-up and factorisation Jerome Brunet
2025-07-02 15:25 ` [PATCH 01/26] clk: amlogic: a1-peripherals: naming consistency alignment Jerome Brunet
2025-07-02 15:26 ` [PATCH 02/26] clk: amlogic: a1-pll: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 03/26] clk: amlogic: axg-ao: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 04/26] clk: amlogic: axg: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 05/26] clk: amlogic: c3-peripherals: " Jerome Brunet
2025-07-03  2:51   ` Chuan Liu
2025-07-03  7:48     ` Jerome Brunet
2025-07-03  8:31       ` Chuan Liu
2025-07-03  9:02         ` Jerome Brunet
2025-07-03  9:23           ` Chuan Liu
2025-07-02 15:26 ` [PATCH 06/26] clk: amlogic: c3-pll: " Jerome Brunet
2025-07-03  2:57   ` Chuan Liu
2025-07-02 15:26 ` [PATCH 07/26] clk: amlogic: g12a-ao: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 08/26] clk: amlogic: g12a: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 09/26] clk: amlogic: gxbb-ao: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 10/26] clk: amlogic: gxbb: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 11/26] clk: amlogic: meson8b: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 12/26] clk: amlogic: s4-peripherals: " Jerome Brunet
2025-07-03  3:18   ` Chuan Liu
2025-07-03  7:54     ` Jerome Brunet
2025-07-03  8:00       ` Chuan Liu
2025-07-02 15:26 ` [PATCH 13/26] clk: amlogic: s4-pll: " Jerome Brunet
2025-07-03  3:19   ` Chuan Liu
2025-07-02 15:26 ` [PATCH 14/26] clk: amlogic: meson8-ddr: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 15/26] clk: amlogic: drop meson-clkcee Jerome Brunet
2025-07-02 15:26 ` [PATCH 16/26] clk: amlogic: add probe helper for mmio based controllers Jerome Brunet
2025-07-03  3:29   ` Chuan Liu
2025-07-03  8:35     ` Jerome Brunet
2025-07-02 15:26 ` [PATCH 17/26] clk: amlogic: use probe helper in " Jerome Brunet
2025-07-03  6:29   ` Chuan Liu
2025-07-02 15:26 ` [PATCH 18/26] clk: amlogic: aoclk: use clkc-utils syscon probe Jerome Brunet
2025-07-02 15:26 ` [PATCH 19/26] clk: amlogic: move PCLK definition to clkc-utils Jerome Brunet
2025-07-02 15:26 ` [PATCH 20/26] clk: amlogic: drop CLK_SET_RATE_PARENT from peripheral clocks Jerome Brunet
2025-07-02 15:26 ` [PATCH 21/26] clk: amlogic: pclk explicitly use CLK_IGNORE_UNUSED Jerome Brunet
2025-07-03  7:05   ` Chuan Liu
2025-07-02 15:26 ` [PATCH 22/26] clk: amlogic: introduce a common pclk definition Jerome Brunet
2025-07-03  7:10   ` Chuan Liu
2025-07-02 15:26 ` [PATCH 23/26] clk: amlogic: use the " Jerome Brunet
2025-07-03  7:16   ` Chuan Liu
2025-07-03  8:39     ` Jerome Brunet
2025-07-02 15:26 ` [PATCH 24/26] clk: amlogic: add composite clock helpers Jerome Brunet
2025-07-03  7:24   ` Chuan Liu
2025-07-03  8:39     ` Jerome Brunet [this message]
2025-07-02 15:26 ` [PATCH 25/26] clk: amlogic: align s4 and c3 pwm clock descriptions Jerome Brunet
2025-07-03  7:27   ` Chuan Liu
2025-07-02 15:26 ` [PATCH 26/26] clk: amlogic: c3-peripherals: use helper for basic composite clocks Jerome Brunet
2025-07-03  7:56   ` Chuan Liu
2025-07-03  8:44     ` Jerome Brunet
2025-08-06  7:10 ` [PATCH 00/26] clk: amlogic: clock controllers clean-up and factorisation Chuan Liu
2025-08-25 14:24 ` Jerome Brunet
2025-09-21 11:25 ` Mark Brown
2025-09-21 12:21   ` Martin Blumenstingl
2025-09-21 12:59     ` Jerome Brunet
2025-09-22  9:40       ` Mark Brown
2025-09-22 11:02         ` Martin Blumenstingl

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=1j5xg9d5wq.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=chuan.liu@amlogic.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=mturquette@baylibre.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