Linux clock framework development
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Mike Looijmans <mike.looijmans@topic.nl>,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org
Cc: Conor Dooley <conor+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] dt-bindings: clock: fixed-clock: Add nvmem support
Date: Mon, 5 Jun 2023 15:38:13 +0200	[thread overview]
Message-ID: <5d1f08f1-792b-255b-89f0-dd5fa2f0baa4@linaro.org> (raw)
In-Reply-To: <20230605133410.15076-1-mike.looijmans@topic.nl>

On 05/06/2023 15:34, Mike Looijmans wrote:
> Add bindings for a fixed-rate clock that retrieves its rate from an
> NVMEM provider. This allows to store clock settings in EEPROM or EFUSE
> or similar device.
> 
> Component shortages lead to boards being shipped with different clock
> crystals, based on what was available at the time. The clock frequency
> was written to EEPROM at production time. Systems can adapt to a wide
> range of input frequencies using the clock framework, but this required
> us to patch the devicetree at runtime or use some custom driver. This
> provides a more generic solution.
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> 
> ---
> 
> Changes in v3:
> Modify fixed-clock instead of introducing nvmem-clock
> 
> Changes in v2:
> Changed "fixed-clock" into "nvmem-clock" in dts example
> Add minItems:1 to nvmem-cell-names
> 
>  .../bindings/clock/fixed-clock.yaml           | 25 ++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/clock/fixed-clock.yaml b/Documentation/devicetree/bindings/clock/fixed-clock.yaml
> index b0a4fb8256e2..23e4df96d3b0 100644
> --- a/Documentation/devicetree/bindings/clock/fixed-clock.yaml
> +++ b/Documentation/devicetree/bindings/clock/fixed-clock.yaml
> @@ -12,7 +12,9 @@ maintainers:
>  
>  properties:
>    compatible:
> -    const: fixed-clock
> +    enum:
> +      - fixed-clock
> +      - fixed-clock-nvmem

Do you even need new compatible? Isn't this the same clock from the
hardware point of view?

>  
>    "#clock-cells":
>      const: 0
> @@ -33,6 +35,27 @@ required:
>  
>  additionalProperties: false
>  

Put it under allOf. Entire block should be before additionalProperties
(just like in example-schema).

> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        const: fixed-clock-nvmem
> +
> +then:
> +  properties:
> +    nvmem-cells:
> +      maxItems: 2

Anyway, I don't think you tested it. Provide a DTS user of this. I don't
think it works and such user would point to mistakes.

Properties should be defined in top-level properties:, not in
allOf:if:then. In allOf:if:then you only narrow them.


> +      description:
> +        Reads clock-frequency and/or clock-accuracy from an NVMEM provider in
> +        binary native integer format. The size of the NVMEM cell can be 1, 2, 4
> +        or 8 bytes. If the contents of the nvmem are all zeroes or all 0xff, the
> +        value reverts to the one given in the property.
> +

Best regards,
Krzysztof


  parent reply	other threads:[~2023-06-05 13:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.1d0217a8-661f-4359-b77b-02222c761b01@emailsignatures365.codetwo.com>
2023-06-05 13:34 ` [PATCH v3 1/2] dt-bindings: clock: fixed-clock: Add nvmem support Mike Looijmans
2023-06-05 13:34   ` [PATCH v3 2/2] clk: Add fixed-clock-nvmem provider Mike Looijmans
2023-06-05 13:38   ` Krzysztof Kozlowski [this message]
2023-06-05 14:00     ` [PATCH v3 1/2] dt-bindings: clock: fixed-clock: Add nvmem support Mike Looijmans
2023-06-05 14:05       ` Krzysztof Kozlowski
2023-06-08 23:19       ` Stephen Boyd

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=5d1f08f1-792b-255b-89f0-dd5fa2f0baa4@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.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