[4/9] dt-bindings: gpio: change items restriction of clock for rockchip,gpio-bank

Message ID 20210618062449.1067106-5-jay.xu@rock-chips.com
State Superseded
Headers show
Series
  • Untitled series #138193
Related show

Commit Message

Jianqun Xu June 18, 2021, 6:24 a.m.
From: Liang Chen <cl@rock-chips.com>

The clock property need 2 items on some rockchip chips.

Signed-off-by: Liang Chen <cl@rock-chips.com>
---
 .../devicetree/bindings/gpio/rockchip,gpio-bank.yaml         | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Heiko Stuebner June 22, 2021, 1:02 p.m. | #1
Hi Jay,

Am Freitag, 18. Juni 2021, 08:24:44 CEST schrieb Jianqun Xu:
> From: Liang Chen <cl@rock-chips.com>

> 

> The clock property need 2 items on some rockchip chips.

> 

> Signed-off-by: Liang Chen <cl@rock-chips.com>

> ---

>  .../devicetree/bindings/gpio/rockchip,gpio-bank.yaml         | 5 ++++-

>  1 file changed, 4 insertions(+), 1 deletion(-)

> 

> diff --git a/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml b/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml

> index d993e002cebe..0d62c28fb58d 100644

> --- a/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml

> +++ b/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml

> @@ -22,7 +22,10 @@ properties:

>      maxItems: 1

>  

>    clocks:

> -    maxItems: 1

> +    minItems: 1

> +    items:

> +      - description: APB interface clock source

> +      - description: GPIO debounce reference clock source


as said in a previous mail, please adapt this to use clock-names for the
two clock variant. Maybe something like

clocks:
  minItems: 1
  maxItems: 2

clock-names:
  minItems: 1
  maxItems: 2
  items:
    - const: apb_pclk
    - const: debounce

if:
   properties:
     clocks:
       items:
         const: 2
then:
   required:
    - clock-names

[not yet sure if that works]



Heiko

>  

>    gpio-controller: true

>  

>
Rob Herring June 23, 2021, 5:24 p.m. | #2
On Tue, Jun 22, 2021 at 7:02 AM Heiko Stübner <heiko@sntech.de> wrote:
>

> Hi Jay,

>

> Am Freitag, 18. Juni 2021, 08:24:44 CEST schrieb Jianqun Xu:

> > From: Liang Chen <cl@rock-chips.com>

> >

> > The clock property need 2 items on some rockchip chips.

> >

> > Signed-off-by: Liang Chen <cl@rock-chips.com>

> > ---

> >  .../devicetree/bindings/gpio/rockchip,gpio-bank.yaml         | 5 ++++-

> >  1 file changed, 4 insertions(+), 1 deletion(-)

> >

> > diff --git a/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml b/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml

> > index d993e002cebe..0d62c28fb58d 100644

> > --- a/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml

> > +++ b/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml

> > @@ -22,7 +22,10 @@ properties:

> >      maxItems: 1

> >

> >    clocks:

> > -    maxItems: 1

> > +    minItems: 1

> > +    items:

> > +      - description: APB interface clock source

> > +      - description: GPIO debounce reference clock source

>

> as said in a previous mail, please adapt this to use clock-names for the

> two clock variant. Maybe something like

>

> clocks:

>   minItems: 1

>   maxItems: 2


While this is fine, the version above with descriptions is better.

> clock-names:

>   minItems: 1

>   maxItems: 2


Don't need maxItems here. Implied by 'items' length.

>   items:

>     - const: apb_pclk

>     - const: debounce

>

> if:

>    properties:

>      clocks:

>        items:

>          const: 2


This says clocks must have values of 2. You want this:

clocks:
  minItems: 2

Note that is condition will also be true if 'clocks' is not present. I
assume it's required elsewhere.

> then:

>    required:

>     - clock-names

>

> [not yet sure if that works]

Patch

diff --git a/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml b/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml
index d993e002cebe..0d62c28fb58d 100644
--- a/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml
+++ b/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml
@@ -22,7 +22,10 @@  properties:
     maxItems: 1
 
   clocks:
-    maxItems: 1
+    minItems: 1
+    items:
+      - description: APB interface clock source
+      - description: GPIO debounce reference clock source
 
   gpio-controller: true