devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Sam Protsenko <semen.protsenko@linaro.org>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 11/16] clk: samsung: Keep register offsets in chip specific structure
Date: Thu, 22 Feb 2024 08:47:01 +0100	[thread overview]
Message-ID: <c4f7e3cb-db9b-48be-883e-33878d2510e8@linaro.org> (raw)
In-Reply-To: <CAPLW+4=kpk=Vg=nX-hVxcCS0OttC6xmyUcB005tmX+vtUF9TLA@mail.gmail.com>

On 22/02/2024 01:42, Sam Protsenko wrote:
> On Tue, Feb 20, 2024 at 5:04 AM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> On 16/02/2024 23:32, Sam Protsenko wrote:
>>> Abstract CPU clock registers by keeping their offsets in a dedicated
>>> chip specific structure to accommodate for oncoming Exynos850 support,
>>> which has different offsets for cluster 0 and cluster 1. This rework
>>> also makes it possible to use exynos_set_safe_div() for all chips, so
>>> exynos5433_set_safe_div() is removed here to reduce the code
>>> duplication.
>>>
>>
>> So that's the answer why you could not use flags anymore - you need an
>> enum, not a bitmap. Such short explanation should be in previous commits
>> justifying moving reg layout to new property.
> 
> Will do, thanks.
> 
>>
>>> No functional change.
>>>
>>> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
>>> ---
>>>  drivers/clk/samsung/clk-cpu.c | 156 +++++++++++++++++++---------------
>>>  1 file changed, 86 insertions(+), 70 deletions(-)
>>>
>>> diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c
>>> index 04394d2166c9..744b609c222d 100644
>>> --- a/drivers/clk/samsung/clk-cpu.c
>>> +++ b/drivers/clk/samsung/clk-cpu.c
>>> @@ -44,12 +44,14 @@ typedef int (*exynos_rate_change_fn_t)(struct clk_notifier_data *ndata,
>>>
>>>  /**
>>>   * struct exynos_cpuclk_chip - Chip specific data for CPU clock
>>> + * @regs: register offsets for CPU related clocks
>>>   * @pre_rate_cb: callback to run before CPU clock rate change
>>>   * @post_rate_cb: callback to run after CPU clock rate change
>>>   */
>>>  struct exynos_cpuclk_chip {
>>> -     exynos_rate_change_fn_t pre_rate_cb;
>>> -     exynos_rate_change_fn_t post_rate_cb;
>>> +     const void                              * const regs;
>>
>> Why this is void?
>>
> 
> Different chips can have very different register layout. For example,
> older Exynos chips usually keep multiple CPU divider ratios in one
> single register, whereas more modern chips have a dedicated register
> for each divider clock. Also, old chips usually split divider ratio vs
> DIV clock status between different registers, but in modern chips they
> both live in one single register. Having (void *) makes it possible to
> keep pointers to different structures, and each function for the
> particular chip can "know" which exactly structure is stored there,
> casting (void *) to a needed type. Another way to do that would be to
> have "one-size-fits-all" structure with all possible registers for all
> possible chips. I don't know, I just didn't like that for a couple of
> reasons, so decided to go with (void *).
> 
> I'll add some explanation in the commit message in v2.

Currently the one-size-fits-all seems feasible, even if few fields are
not matching, so I would prefer to go this approach.

Best regards,
Krzysztof


  reply	other threads:[~2024-02-22  7:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 22:32 [PATCH 00/16] clk: samsung: Add CPU clocks for Exynos850 Sam Protsenko
2024-02-16 22:32 ` [PATCH 01/16] dt-bindings: clock: exynos850: Add CMU_CPUCLK0 and CMU_CPUCL1 Sam Protsenko
2024-02-16 22:32 ` [PATCH 02/16] clk: samsung: Improve clk-cpu.c style Sam Protsenko
2024-02-16 22:32 ` [PATCH 03/16] clk: samsung: Pull struct exynos_cpuclk into clk-cpu.c Sam Protsenko
2024-02-16 22:32 ` [PATCH 04/16] clk: samsung: Reduce params count in exynos_register_cpu_clock() Sam Protsenko
2024-02-16 22:32 ` [PATCH 05/16] clk: samsung: Use single CPU clock notifier callback for all chips Sam Protsenko
2024-02-16 22:32 ` [PATCH 06/16] clk: samsung: Group CPU clock functions by chip Sam Protsenko
2024-02-16 22:32 ` [PATCH 07/16] clk: samsung: Pass actual clock controller base address to CPU_CLK() Sam Protsenko
2024-02-20 10:53   ` Krzysztof Kozlowski
2024-02-21 23:41     ` Sam Protsenko
2024-02-16 22:32 ` [PATCH 08/16] clk: samsung: Use clk.h as a single header for Samsung CCF Sam Protsenko
2024-02-20 10:55   ` Krzysztof Kozlowski
2024-02-16 22:32 ` [PATCH 09/16] clk: samsung: Pass register layout type explicitly to CLK_CPU() Sam Protsenko
2024-02-20 10:56   ` Krzysztof Kozlowski
2024-02-16 22:32 ` [PATCH 10/16] clk: samsung: Keep CPU clock chip specific data in a dedicated struct Sam Protsenko
2024-02-16 22:32 ` [PATCH 11/16] clk: samsung: Keep register offsets in chip specific structure Sam Protsenko
2024-02-20 11:04   ` Krzysztof Kozlowski
2024-02-22  0:42     ` Sam Protsenko
2024-02-22  7:47       ` Krzysztof Kozlowski [this message]
2024-02-24 19:57         ` Sam Protsenko
2024-02-16 22:32 ` [PATCH 12/16] clk: samsung: Pass mask to wait_until_mux_stable() Sam Protsenko
2024-02-16 22:32 ` [PATCH 13/16] clk: samsung: Add CPU clock support for Exynos850 Sam Protsenko
2024-02-16 22:32 ` [PATCH 14/16] clk: samsung: Implement manual PLL control for ARM64 SoCs Sam Protsenko
2024-02-16 22:32 ` [PATCH 15/16] clk: samsung: exynos850: Add CMU_CPUCL0 and CMU_CPUCL1 Sam Protsenko
2024-02-16 22:32 ` [PATCH 16/16] arm64: dts: exynos: Add CPU clocks Sam Protsenko
2024-02-20 11:07 ` [PATCH 00/16] clk: samsung: Add CPU clocks for Exynos850 Krzysztof Kozlowski
2024-02-21 23:07   ` Sam Protsenko
2024-02-22  7:45     ` Krzysztof Kozlowski

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=c4f7e3cb-db9b-48be-883e-33878d2510e8@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=alim.akhtar@samsung.com \
    --cc=conor+dt@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@kernel.org \
    --cc=semen.protsenko@linaro.org \
    --cc=tomasz.figa@gmail.com \
    /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).