devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Matthew Gerlach <matthew.gerlach@altera.com>
Cc: krzk+dt@kernel.org, conor+dt@kernel.org, mturquette@baylibre.com,
	dinguyen@kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH] dt-bindings: clock: socfpga: convert to yaml
Date: Tue, 22 Apr 2025 08:23:56 -0500	[thread overview]
Message-ID: <20250422132356.GA1020502-robh@kernel.org> (raw)
In-Reply-To: <20250417160616.47558-1-matthew.gerlach@altera.com>

On Thu, Apr 17, 2025 at 09:06:16AM -0700, Matthew Gerlach wrote:
> Convert the clock device tree bindings to yaml for the Altera SoCFPGA
> Cyclone5, Arria5, and Arria10 chip families. Since the clock nodes are
> subnodes to Altera SOCFPGA Clock Manager, the yaml was added to
> socfpga-clk-manager.yaml.
> 
> Signed-off-by: Matthew Gerlach <matthew.gerlach@altera.com>
> ---
>  .../arm/altera/socfpga-clk-manager.yaml       | 118 +++++++++++++++++-
>  .../bindings/clock/altr_socfpga.txt           |  30 -----
>  2 files changed, 117 insertions(+), 31 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/clock/altr_socfpga.txt
> 
> diff --git a/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.yaml b/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.yaml
> index 572381306681..4cda13259530 100644
> --- a/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.yaml
> +++ b/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.yaml
> @@ -9,17 +9,133 @@ title: Altera SOCFPGA Clock Manager
>  maintainers:
>    - Dinh Nguyen <dinguyen@kernel.org>
>  
> -description: test
> +description:
> +  This binding describes the Altera SOCFGPA Clock Manager and its associated
> +  tree of clocks, pll's, and clock gates for the Cyclone5, Arria5 and Arria10
> +  chip families.
>  
>  properties:
>    compatible:
>      items:
>        - const: altr,clk-mgr
> +
>    reg:
>      maxItems: 1
>  
> +  clocks:
> +    type: object
> +    additionalProperties: false
> +
> +    properties:
> +      "#address-cells":
> +        const: 1
> +
> +      "#size-cells":
> +        const: 0
> +
> +    patternProperties:
> +      "^osc[0-9]$":
> +        type: object
> +
> +      "^[a-z0-9,_]+[clk,pll,clk_gate,clk_divided](@[a-f0-9]+)?$":

This regex doesn't do what you think it does. You want:

"^[a-z0-9,_]+(clk|pll|clk_gate|clk_divided)(@[a-f0-9]+)?$"

However, I don't see clk_gate or clk_divided used anywhere, so I would 
simplify to:

"(clk|pll)(@[a-f0-9]+)?$"


> +        type: object
> +        additionalProperties: false
> +
> +        properties:
> +
> +          compatible:
> +            enum:
> +              - altr,socfpga-pll-clock
> +              - altr,socfpga-perip-clk
> +              - altr,socfpga-gate-clk
> +              - altr,socfpga-a10-pll-clock
> +              - altr,socfpga-a10-perip-clk
> +              - altr,socfpga-a10-gate-clk
> +              - fixed-clock
> +
> +          clocks:
> +            $ref: /schemas/types.yaml#/definitions/phandle-array

clocks already has a type.

> +            description: one or more phandles to input clock

I assume there is some max, so make this constraints:

minItems: 1
maxItems: ?

> +
> +          "#address-cells":
> +            const: 1
> +
> +          "#clock-cells":
> +            const: 0
> +
> +          "#size-cells":
> +            const: 0
> +
> +          clk-gate:
> +            $ref: /schemas/types.yaml#/definitions/uint32-array
> +            items:
> +              - description: gating register offset
> +              - description: bit index
> +
> +          div-reg:
> +            $ref: /schemas/types.yaml#/definitions/uint32-array
> +            items:
> +              - description: divider register offset
> +              - description: bit shift
> +              - description: bit width
> +
> +          fixed-divider:
> +            $ref: /schemas/types.yaml#/definitions/uint32
> +
> +          reg:
> +            maxItems: 1
> +
> +        patternProperties:
> +          "^[a-z0-9,_]+[clk,pll](@[a-f0-9]+)?$":

Similar issues here.

> +            type: object
> +            additionalProperties: false
> +
> +            properties:
> +              compatible:
> +                enum:
> +                  - altr,socfpga-perip-clk
> +                  - altr,socfpga-gate-clk
> +                  - altr,socfpga-a10-perip-clk
> +                  - altr,socfpga-a10-gate-clk
> +
> +              "#clock-cells":
> +                const: 0
> +
> +              clocks:
> +                $ref: /schemas/types.yaml#/definitions/phandle-array
> +                description: one or more phandles to input clock
> +
> +              clk-gate:
> +                $ref: /schemas/types.yaml#/definitions/uint32-array
> +                items:
> +                  - description: gating register offset
> +                  - description: bit index
> +
> +              div-reg:
> +                $ref: /schemas/types.yaml#/definitions/uint32-array
> +                items:
> +                  - description: divider register offset
> +                  - description: bit shift
> +                  - description: bit width
> +
> +              fixed-divider:
> +                $ref: /schemas/types.yaml#/definitions/uint32

As these properties are all just repeated, put them all under '$defs' 
and reference that in both places.

> +
> +              reg:
> +                maxItems: 1

'reg' goes after compatible.

> +
> +            required:
> +              - compatible
> +              - clocks
> +              - "#clock-cells"
> +
> +        required:
> +          - compatible
> +          - "#clock-cells"
> +
>  required:
>    - compatible
> +  - reg
>  
>  additionalProperties: false
>  

  reply	other threads:[~2025-04-22 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 16:06 [PATCH] dt-bindings: clock: socfpga: convert to yaml Matthew Gerlach
2025-04-22 13:23 ` Rob Herring [this message]
2025-04-22 16:39   ` Gerlach, Matthew

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=20250422132356.GA1020502-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.gerlach@altera.com \
    --cc=mturquette@baylibre.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).