diff mbox series

[02/22] dt-bindings: gpio: fsl-imx-gpio: Add gpio-ranges property

Message ID 20200823161550.3981-2-krzk@kernel.org
State New
Headers show
Series [01/22] dt-bindings: gpio: fsl-imx-gpio: Add i.MX 8 compatibles | expand

Commit Message

Krzysztof Kozlowski Aug. 23, 2020, 4:15 p.m. UTC
The GPIO controller node can have gpio-ranges property.  This fixes
dtbs_check warnings like:

  arch/arm64/boot/dts/freescale/imx8mm-evk.dt.yaml: gpio@30200000: 'gpio-ranges' does not match any of the regexes: 'pinctrl-[0-9]+'
    From schema: Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 .../devicetree/bindings/gpio/fsl-imx-gpio.yaml    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Sascha Hauer Aug. 24, 2020, 5:24 a.m. UTC | #1
On Sun, Aug 23, 2020 at 06:15:30PM +0200, Krzysztof Kozlowski wrote:
> The GPIO controller node can have gpio-ranges property.  This fixes
> dtbs_check warnings like:
> 
>   arch/arm64/boot/dts/freescale/imx8mm-evk.dt.yaml: gpio@30200000: 'gpio-ranges' does not match any of the regexes: 'pinctrl-[0-9]+'
>     From schema: Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  .../devicetree/bindings/gpio/fsl-imx-gpio.yaml    | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> index 454db20c2d1a..1fac69573bb9 100644
> --- a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> +++ b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> @@ -51,6 +51,9 @@ properties:
>  
>    gpio-controller: true
>  
> +  gpio-ranges:
> +    maxItems: 1
> +
>  required:
>    - compatible
>    - reg
> @@ -62,6 +65,18 @@ required:
>  
>  additionalProperties: false
>  
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: fsl,imx8mp-gpio
> +    then:
> +      properties:
> +        gpio-ranges:
> +          minItems: 1
> +          maxItems: 2

Why do you limit this to fsl,imx8mp-gpio? The i.MX5,6,7 dtsi files use
gpio-ranges as well and other i.MX dtsi files could also use it.

Sascha
Krzysztof Kozlowski Aug. 24, 2020, 6:38 a.m. UTC | #2
On Mon, Aug 24, 2020 at 07:24:46AM +0200, Sascha Hauer wrote:
> On Sun, Aug 23, 2020 at 06:15:30PM +0200, Krzysztof Kozlowski wrote:
> > The GPIO controller node can have gpio-ranges property.  This fixes
> > dtbs_check warnings like:
> > 
> >   arch/arm64/boot/dts/freescale/imx8mm-evk.dt.yaml: gpio@30200000: 'gpio-ranges' does not match any of the regexes: 'pinctrl-[0-9]+'
> >     From schema: Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > 
> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> > ---
> >  .../devicetree/bindings/gpio/fsl-imx-gpio.yaml    | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > index 454db20c2d1a..1fac69573bb9 100644
> > --- a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > +++ b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > @@ -51,6 +51,9 @@ properties:
> >  
> >    gpio-controller: true
> >  
> > +  gpio-ranges:
> > +    maxItems: 1
> > +
> >  required:
> >    - compatible
> >    - reg
> > @@ -62,6 +65,18 @@ required:
> >  
> >  additionalProperties: false
> >  
> > +allOf:
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: fsl,imx8mp-gpio
> > +    then:
> > +      properties:
> > +        gpio-ranges:
> > +          minItems: 1
> > +          maxItems: 2
> 
> Why do you limit this to fsl,imx8mp-gpio? The i.MX5,6,7 dtsi files use
> gpio-ranges as well and other i.MX dtsi files could also use it.

All other cases use maximum one element in gpio-ranges, so they are
covered so I assumed they are continuous. But if it not the case, I can
make all them maximum 2.

Best regards,
Krzysztof
Sascha Hauer Aug. 24, 2020, 6:58 a.m. UTC | #3
On Mon, Aug 24, 2020 at 08:38:06AM +0200, Krzysztof Kozlowski wrote:
> On Mon, Aug 24, 2020 at 07:24:46AM +0200, Sascha Hauer wrote:
> > On Sun, Aug 23, 2020 at 06:15:30PM +0200, Krzysztof Kozlowski wrote:
> > > The GPIO controller node can have gpio-ranges property.  This fixes
> > > dtbs_check warnings like:
> > > 
> > >   arch/arm64/boot/dts/freescale/imx8mm-evk.dt.yaml: gpio@30200000: 'gpio-ranges' does not match any of the regexes: 'pinctrl-[0-9]+'
> > >     From schema: Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > > 
> > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> > > ---
> > >  .../devicetree/bindings/gpio/fsl-imx-gpio.yaml    | 15 +++++++++++++++
> > >  1 file changed, 15 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > > index 454db20c2d1a..1fac69573bb9 100644
> > > --- a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > > +++ b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > > @@ -51,6 +51,9 @@ properties:
> > >  
> > >    gpio-controller: true
> > >  
> > > +  gpio-ranges:
> > > +    maxItems: 1
> > > +
> > >  required:
> > >    - compatible
> > >    - reg
> > > @@ -62,6 +65,18 @@ required:
> > >  
> > >  additionalProperties: false
> > >  
> > > +allOf:
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            const: fsl,imx8mp-gpio
> > > +    then:
> > > +      properties:
> > > +        gpio-ranges:
> > > +          minItems: 1
> > > +          maxItems: 2
> > 
> > Why do you limit this to fsl,imx8mp-gpio? The i.MX5,6,7 dtsi files use
> > gpio-ranges as well and other i.MX dtsi files could also use it.
> 
> All other cases use maximum one element in gpio-ranges, so they are
> covered so I assumed they are continuous. But if it not the case, I can
> make all them maximum 2.

I misread this, I thought you allow gpio-ranges only for imx8mp, but
it's only the maxItems you set differently for that SoC. Anyway,
arch/arm/boot/dts/imx6dl.dtsi has this:

&gpio1 {
        gpio-ranges = <&iomuxc  0 131 2>, <&iomuxc  2 137 8>, <&iomuxc 10 189 2>,
                      <&iomuxc 12 194 1>, <&iomuxc 13 193 1>, <&iomuxc 14 192 1>,
                      <&iomuxc 15 191 1>, <&iomuxc 16 185 2>, <&iomuxc 18 184 1>,
                      <&iomuxc 19 187 1>, <&iomuxc 20 183 1>, <&iomuxc 21 188 1>,
                      <&iomuxc 22 123 3>, <&iomuxc 25 121 1>, <&iomuxc 26 127 1>,
                      <&iomuxc 27 126 1>, <&iomuxc 28 128 1>, <&iomuxc 29 130 1>,
                      <&iomuxc 30 129 1>, <&iomuxc 31 122 1>;
};

I don't think it makes sense to specify maxItems.

Sascha
Krzysztof Kozlowski Aug. 24, 2020, 7:07 a.m. UTC | #4
On Mon, Aug 24, 2020 at 08:58:01AM +0200, Sascha Hauer wrote:
> On Mon, Aug 24, 2020 at 08:38:06AM +0200, Krzysztof Kozlowski wrote:
> > On Mon, Aug 24, 2020 at 07:24:46AM +0200, Sascha Hauer wrote:
> > > On Sun, Aug 23, 2020 at 06:15:30PM +0200, Krzysztof Kozlowski wrote:
> > > > The GPIO controller node can have gpio-ranges property.  This fixes
> > > > dtbs_check warnings like:
> > > > 
> > > >   arch/arm64/boot/dts/freescale/imx8mm-evk.dt.yaml: gpio@30200000: 'gpio-ranges' does not match any of the regexes: 'pinctrl-[0-9]+'
> > > >     From schema: Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > > > 
> > > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> > > > ---
> > > >  .../devicetree/bindings/gpio/fsl-imx-gpio.yaml    | 15 +++++++++++++++
> > > >  1 file changed, 15 insertions(+)
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > > > index 454db20c2d1a..1fac69573bb9 100644
> > > > --- a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > > > +++ b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
> > > > @@ -51,6 +51,9 @@ properties:
> > > >  
> > > >    gpio-controller: true
> > > >  
> > > > +  gpio-ranges:
> > > > +    maxItems: 1
> > > > +
> > > >  required:
> > > >    - compatible
> > > >    - reg
> > > > @@ -62,6 +65,18 @@ required:
> > > >  
> > > >  additionalProperties: false
> > > >  
> > > > +allOf:
> > > > +  - if:
> > > > +      properties:
> > > > +        compatible:
> > > > +          contains:
> > > > +            const: fsl,imx8mp-gpio
> > > > +    then:
> > > > +      properties:
> > > > +        gpio-ranges:
> > > > +          minItems: 1
> > > > +          maxItems: 2
> > > 
> > > Why do you limit this to fsl,imx8mp-gpio? The i.MX5,6,7 dtsi files use
> > > gpio-ranges as well and other i.MX dtsi files could also use it.
> > 
> > All other cases use maximum one element in gpio-ranges, so they are
> > covered so I assumed they are continuous. But if it not the case, I can
> > make all them maximum 2.
> 
> I misread this, I thought you allow gpio-ranges only for imx8mp, but
> it's only the maxItems you set differently for that SoC. Anyway,
> arch/arm/boot/dts/imx6dl.dtsi has this:
> 
> &gpio1 {
>         gpio-ranges = <&iomuxc  0 131 2>, <&iomuxc  2 137 8>, <&iomuxc 10 189 2>,
>                       <&iomuxc 12 194 1>, <&iomuxc 13 193 1>, <&iomuxc 14 192 1>,
>                       <&iomuxc 15 191 1>, <&iomuxc 16 185 2>, <&iomuxc 18 184 1>,
>                       <&iomuxc 19 187 1>, <&iomuxc 20 183 1>, <&iomuxc 21 188 1>,
>                       <&iomuxc 22 123 3>, <&iomuxc 25 121 1>, <&iomuxc 26 127 1>,
>                       <&iomuxc 27 126 1>, <&iomuxc 28 128 1>, <&iomuxc 29 130 1>,
>                       <&iomuxc 30 129 1>, <&iomuxc 31 122 1>;
> };
> 
> I don't think it makes sense to specify maxItems.

Indeed, I will skip the max limit.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
index 454db20c2d1a..1fac69573bb9 100644
--- a/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
@@ -51,6 +51,9 @@  properties:
 
   gpio-controller: true
 
+  gpio-ranges:
+    maxItems: 1
+
 required:
   - compatible
   - reg
@@ -62,6 +65,18 @@  required:
 
 additionalProperties: false
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: fsl,imx8mp-gpio
+    then:
+      properties:
+        gpio-ranges:
+          minItems: 1
+          maxItems: 2
+
 examples:
   - |
     gpio0: gpio@73f84000 {