Linux clock framework development
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Cc: linux-clk@vger.kernel.org, sboyd@kernel.org,
	mturquette@baylibre.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, yangshiji66@outlook.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dt-bindings: clock: add clock definitions for Ralink SoCs
Date: Tue, 14 Jan 2025 08:09:17 +0100	[thread overview]
Message-ID: <a4796db2-e354-48e0-bd5f-da774f154473@kernel.org> (raw)
In-Reply-To: <CAMhs-H_6QTptfFsSEh7PKy8Fnoem1ph4j=mwT_23=J=adDDT8w@mail.gmail.com>

On 13/01/2025 13:58, Sergio Paracuellos wrote:
> On Mon, Jan 13, 2025 at 1:37 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>
>> On 13/01/2025 13:29, Sergio Paracuellos wrote:
>>>>>
>>>>>> 2. What is the point of this? We do not add constants when there are no
>>>>>> users. Commit msg explains here nothing.
>>>>>
>>>>> All of the old ralink SoCs' dts files which are in the tree are not
>>>>> properly updated. I expect to have them updated somewhere in time
>>>>> merging real base stuff from openwrt dts [0] files. Not having this
>>>>> header with definitions makes very hard to update dts and then
>>>>> checking the driver code becomes a need to see the indexes for the
>>>>> clocks to properly setup a consumer node. Because of this, this file
>>>>> is added here.
>>>>
>>>> Still there is no point without the users. I do not see any reason why
>>>> this cannot be combined with fixing driver to use the header. Not
>>>> combining is an indication this is not a binding in the first place.
>>>
>>> Driver uses a bunch of arrays for the clocks (base, fixed, factor and
>>> peripheral) and they are registered consecutively in order just using
>>> the ARRAY_SIZE macro for any of them. Thus, the direct application of
>>> these definitions would be for dts consumer nodes, not the driver
>>> itself.
>>
>> So what do you constants here fix? Driver can still reorganize arrays
>> breaking everything. If defining headers for proper ABI, then use that
>> ABI to make everything build-time testable and visible. That's why this
>> is not supposed to be a separate patch from users.
> 
> I understand your point and agree that the driver can do that, but the
> idea as this driver maintainer is not to do that :).
> Is adding something like the following in the binding itself with the
> header addition a possible way to go?
> 
> --- a/Documentation/devicetree/bindings/clock/mediatek,mtmips-sysc.yaml
> +++ b/Documentation/devicetree/bindings/clock/mediatek,mtmips-sysc.yaml
> @@ -18,6 +18,12 @@ description: |
>    These SoCs have an XTAL from where the cpu clock is
>    provided as well as derived clocks for the bus and the peripherals.
> 
> +  Each clock is assigned an identifier and client nodes use this identifier
> +  to specify the clock which they consume.
> +
> +  All these identifiers could be found in:
> +  [1]: <include/dt-bindings/clock/mediatek,mtmips-sysc.h>.
> +
>  properties:
>    compatible:
>      items:
> @@ -38,7 +44,8 @@ properties:
> 
>    '#clock-cells':
>      description:
> -      The first cell indicates the clock number.
> +      The first cell indicates the clock number, see [1] for available
> +      clocks.
>      const: 1
> 
> @@ -56,6 +63,8 @@ additionalProperties: false
> 
>  examples:
>    - |
> +    #include <dt-bindings/clock/mediatek,mtmips-sysc.h>
> +
>      syscon@0 {
>        compatible = "ralink,rt5350-sysc", "syscon";
>        reg = <0x0 0x100>;

This changes nothing.

> 
> I don't like the idea of changing the driver code for using these
> constants since I do believe that it would make code uglier and less
> maintainable. I just wanted to make things easier for the device tree

Then why having constants in the first place?

> consumer nodes. So if adding this header is not a possibility with the
> changes in the yaml file I will forget about this addition and this
> patch.

Header without user is pointless. Driver and the DTS are the expected users.


Best regards,
Krzysztof

  reply	other threads:[~2025-01-14  7:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13  8:28 [PATCH] dt-bindings: clock: add clock definitions for Ralink SoCs Sergio Paracuellos
2025-01-13 11:18 ` Krzysztof Kozlowski
2025-01-13 11:32   ` Sergio Paracuellos
2025-01-13 12:17     ` Krzysztof Kozlowski
2025-01-13 12:29       ` Sergio Paracuellos
2025-01-13 12:37         ` Krzysztof Kozlowski
2025-01-13 12:58           ` Sergio Paracuellos
2025-01-14  7:09             ` Krzysztof Kozlowski [this message]
2025-01-14  7:43               ` Sergio Paracuellos
2025-01-15  8:27                 ` Krzysztof Kozlowski
2025-01-15  9:00                   ` Sergio Paracuellos

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=a4796db2-e354-48e0-bd5f-da774f154473@kernel.org \
    --to=krzk@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sergio.paracuellos@gmail.com \
    --cc=yangshiji66@outlook.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