Re: [PATCH 1/4] dt-bindings: gpio: Replace DW APB GPIO legacy bindings with YAML-based one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 13, 2020 at 1:40 PM Sergey Semin
<Sergey.Semin@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, Mar 12, 2020 at 08:47:56AM -0500, Rob Herring wrote:
> > On Fri, Mar 6, 2020 at 7:25 AM <Sergey.Semin@xxxxxxxxxxxxxxxxxxxx> wrote:
> > >
> >
> > Subject is kind of long and wordy. Perhaps:
> >
> > dt-bindings: gpio: Convert snps,dw-apb-gpio to DT schema
> >
>
> Ok. I'll also do this for all similar patches in another patchsets.
>
> > > From: Serge Semin <Sergey.Semin@xxxxxxxxxxxxxxxxxxxx>
> > >
> > > Modern device tree bindings are supposed to be created as YAML-files
> > > in accordance with dt-schema. This commit replaces Synopsys DW GPIO
> > > legacy bare text bindings with YAML file. As before the bindings file
> > > states that the corresponding dts node is supposed to be compatible
> > > with generic DW I2C controller indicated by the "snps,dw-apb-gpio"
> > > compatible string and provide a mandatory registers memory range.
> > > It may also have an optional clocks and resets phandle references.
> > >
> > > There must be specified at least one subnode with
> > > "snps,dw-apb-gpio-port" compatible string indicating the GPIO port,
> > > which would actually export the GPIO controller functionality. Such
> > > nodes should have traditional GPIO controller properties together
> > > with optional interrupt-controller attributes if the corresponding
> > > controller was synthesized to detected and report the input values
> > > change to the parental IRQ controller.
> > >
> > > Signed-off-by: Serge Semin <Sergey.Semin@xxxxxxxxxxxxxxxxxxxx>
> > > Signed-off-by: Alexey Malahov <Alexey.Malahov@xxxxxxxxxxxxxxxxxxxx>
> > > Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
> > > Cc: Paul Burton <paulburton@xxxxxxxxxx>
> > > Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
> > >
> > > ---
> > >
> > > Synopsis DesignWare APB SSI controller has a bindings property
> > > "snps,nr-gpios" of numeric type, which means the number of GPIO pins
> > > exported by the corresponding controller port. There is also a generic
> > > pattern-property "*-gpios", which corresponds to a GPIOs array. As you
> > > can see the GPIOs array property wildcard matches the vendor-specific
> > > property "snps,nr-gpios" property while having an incompatible type.
> > > Due to this the DW APB GPIO dts-nodes evaluation will report the
> > > following error:
> > >
> > > snps,nr-gpios:0:0: 8 is not valid under any of the given schemas (Possible causes of the failure):
> > > snps,nr-gpios:0:0: missing phandle tag in 8
> > >
> > > I didn't manage to fix the problem by redefining the property schema (this
> > > might be impossible anyway). In my opinion the best way to solve it would be
> > > to change the DW APB SSI Controller bindings so the driver would accept the
> > > standard "ngpios" property for the same purpose. But in this case we would have
> > > to alter all the dts files currently having the "snps,dw-apb-ssi" compatible
> > > nodes (it's a lot). I know the bindings modifications aren't that much welcome
> > > in the kernel community and there are good reasons why. So what do you think
> > > would be the better way to fix the problem with the property types collision?
> >
> > Does this change (to dt-schema) work for you?
> >
> > diff --git a/schemas/gpio/gpio.yaml b/schemas/gpio/gpio.yaml
> > index 1d9c109f9791..d1c08ccfdc1a 100644
> > --- a/schemas/gpio/gpio.yaml
> > +++ b/schemas/gpio/gpio.yaml
> > @@ -34,7 +34,7 @@ properties:
> >        - $ref: "/schemas/types.yaml#/definitions/phandle-array"
> >
> >  patternProperties:
> > -  ".*-gpios?$":
> > +  "(?<!,nr)-gpios?$":
> >      $ref: "/schemas/types.yaml#/definitions/phandle-array"
> >    "^gpios$":
> >      $ref: "/schemas/types.yaml#/definitions/phandle-array"
> >
>
> It partly fixes the problem. There is meta-schems/gpios.yaml ,
> which also has a rule for the properties with "-gpios" suffix. So yours
> alteration together with the next one shall fix the problem completely:

Oh right. I'll commit a fix for both.

>
> --- a/meta-schemas/gpios.yaml   2020-03-13 20:20:10.072900019 +0300
> +++ b/meta-schemas/gpios.yaml   2020-03-13 20:20:16.000953216 +0300
> @@ -19,9 +19,7 @@
>      $ref: "cell.yaml#array"
>
>  patternProperties:
> -  '.*-gpio$':
> -    $ref: "cell.yaml#array"
> -  '.*-gpios$':
> +  '(?<!,nr)-gpios?$':
>      $ref: "cell.yaml#array"
>
>  dependencies:
>
> Regarding the generic schemas/gpio/gpio.yaml . Do you think I should be
> also allOf-ing it in my DT schema?

Only if you want to check everything twice. Most of the core schemas
always get applied. The exception is generally bus controllers like
SPI, I2C, etc.

Rob



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux