diff mbox series

[v2,4/5] dt-bindings: gpio: convert Atmel GPIO to json-schema

Message ID 20240625043525.279711-5-manikandan.m@microchip.com (mailing list archive)
State New
Headers show
Series Convert Atmel PIO3 Pinctrl and GPIO bindings to yaml | expand

Commit Message

Manikandan Muralidharan June 25, 2024, 4:35 a.m. UTC
Convert the Atmel GPIO controller binding document to DT schema format
using json-schema.
The compatible string "microchip,sam9x7-gpio" is added as well.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
---
changes in v2:
- Fix bot errors with 'make dt_binding_check', missed to add
"atmel,at91rm9200-gpio" as separate compatible for devices that uses it
- Remove label from example
- Add default entry for #gpio-lines property
- Add new compatible string details in commit message
---
 .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 81 +++++++++++++++++++
 .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 -------
 2 files changed, 81 insertions(+), 31 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
 delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt

Comments

Conor Dooley June 25, 2024, 4:34 p.m. UTC | #1
On Tue, Jun 25, 2024 at 10:05:24AM +0530, Manikandan Muralidharan wrote:
> Convert the Atmel GPIO controller binding document to DT schema format
> using json-schema.
> The compatible string "microchip,sam9x7-gpio" is added as well.
> 
> Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
> ---
> changes in v2:
> - Fix bot errors with 'make dt_binding_check', missed to add
> "atmel,at91rm9200-gpio" as separate compatible for devices that uses it
> - Remove label from example
> - Add default entry for #gpio-lines property
> - Add new compatible string details in commit message
> ---
>  .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 81 +++++++++++++++++++
>  .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 -------
>  2 files changed, 81 insertions(+), 31 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt
> 
> diff --git a/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> new file mode 100644
> index 000000000000..3dd70933ed8e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> @@ -0,0 +1,81 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Microchip GPIO controller (PIO)
> +
> +maintainers:
> +  - Manikandan Muralidharan <manikandan.m@microchip.com>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - atmel,at91sam9x5-gpio
> +              - microchip,sam9x60-gpio
> +          - const: atmel,at91rm9200-gpio
> +      - items:
> +          - enum:
> +              - microchip,sam9x7-gpio
> +          - const: microchip,sam9x60-gpio
> +          - const: atmel,at91rm9200-gpio

It's worth pointing out that this is required, because the driver
implements a different set of ops for the sam9x60. There's not just more
of them, they're different too.
Are the sam9x60 and at91rm9200 are actually compatible, or is the
fallback here some mistake that originated in the dts?
Manikandan Muralidharan June 26, 2024, 8:32 a.m. UTC | #2
Hi Conor,

On 25/06/24 10:04 pm, Conor Dooley wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> 
> ForwardedMessage.eml
> 
> Subject:
> Re: [PATCH v2 4/5] dt-bindings: gpio: convert Atmel GPIO to json-schema
> From:
> Conor Dooley <conor@kernel.org>
> Date:
> 25/06/24, 10:04 pm
> 
> To:
> Manikandan Muralidharan <manikandan.m@microchip.com>
> CC:
> linus.walleij@linaro.org, brgl@bgdev.pl, robh@kernel.org, 
> krzk+dt@kernel.org, conor+dt@kernel.org, nicolas.ferre@microchip.com, 
> alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, arnd@arndb.de, 
> durai.manickamkr@microchip.com, linux-gpio@vger.kernel.org, 
> devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, 
> linux-kernel@vger.kernel.org
> 
> 
> On Tue, Jun 25, 2024 at 10:05:24AM +0530, Manikandan Muralidharan wrote:
>> Convert the Atmel GPIO controller binding document to DT schema format
>> using json-schema.
>> The compatible string "microchip,sam9x7-gpio" is added as well.
>>
>> Signed-off-by: Manikandan Muralidharan<manikandan.m@microchip.com>
>> ---
>> changes in v2:
>> - Fix bot errors with 'make dt_binding_check', missed to add
>> "atmel,at91rm9200-gpio" as separate compatible for devices that uses it
>> - Remove label from example
>> - Add default entry for #gpio-lines property
>> - Add new compatible string details in commit message
>> ---
>>   .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 81 +++++++++++++++++++
>>   .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 -------
>>   2 files changed, 81 insertions(+), 31 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>>   delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt
>>
>> diff --git a/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>> new file mode 100644
>> index 000000000000..3dd70933ed8e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>> @@ -0,0 +1,81 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id:http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
>> +$schema:http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Microchip GPIO controller (PIO)
>> +
>> +maintainers:
>> +  - Manikandan Muralidharan<manikandan.m@microchip.com>
>> +
>> +properties:
>> +  compatible:
>> +    oneOf:
>> +      - items:
>> +          - enum:
>> +              - atmel,at91sam9x5-gpio
>> +              - microchip,sam9x60-gpio
>> +          - const: atmel,at91rm9200-gpio
>> +      - items:
>> +          - enum:
>> +              - microchip,sam9x7-gpio
>> +          - const: microchip,sam9x60-gpio
>> +          - const: atmel,at91rm9200-gpio
> It's worth pointing out that this is required, because the driver
> implements a different set of ops for the sam9x60. There's not just more
> of them, they're different too.
> Are the sam9x60 and at91rm9200 are actually compatible, or is the
> fallback here some mistake that originated in the dts?
> 
The PIO3 pinctrl driver uses the compatible "atmel,at91rm9200-gpio" to 
find the number of active GPIO banks and also to differentiate them from 
the pinmux child nodes.The driver probe fails if the at91rm9200 is not 
present in the GPIO bank compatible property list.
For sam9x7, "microchip,sam9x60-gpio" is used as the fallback compatible 
and "atmel,at91rm9200-gpio" is added by default to avoid probe issues 
and help find the number of GPIO banks by the driver.
Conor Dooley June 26, 2024, 8:59 a.m. UTC | #3
On Wed, Jun 26, 2024 at 08:32:41AM +0000, Manikandan.M@microchip.com wrote:
> On 25/06/24 10:04 pm, Conor Dooley wrote:
> > Re: [PATCH v2 4/5] dt-bindings: gpio: convert Atmel GPIO to json-schema
> > From: Conor Dooley <conor@kernel.org>
> > On Tue, Jun 25, 2024 at 10:05:24AM +0530, Manikandan Muralidharan wrote:
> >> Convert the Atmel GPIO controller binding document to DT schema format
> >> using json-schema.
> >> The compatible string "microchip,sam9x7-gpio" is added as well.
> >>
> >> Signed-off-by: Manikandan Muralidharan<manikandan.m@microchip.com>
> >> ---
> >> changes in v2:
> >> - Fix bot errors with 'make dt_binding_check', missed to add
> >> "atmel,at91rm9200-gpio" as separate compatible for devices that uses it
> >> - Remove label from example
> >> - Add default entry for #gpio-lines property
> >> - Add new compatible string details in commit message
> >> ---
> >>   .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 81 +++++++++++++++++++
> >>   .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 -------
> >>   2 files changed, 81 insertions(+), 31 deletions(-)
> >>   create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> >>   delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> >> new file mode 100644
> >> index 000000000000..3dd70933ed8e
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> >> @@ -0,0 +1,81 @@
> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id:http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
> >> +$schema:http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: Microchip GPIO controller (PIO)
> >> +
> >> +maintainers:
> >> +  - Manikandan Muralidharan<manikandan.m@microchip.com>
> >> +
> >> +properties:
> >> +  compatible:
> >> +    oneOf:
> >> +      - items:
> >> +          - enum:
> >> +              - atmel,at91sam9x5-gpio
> >> +              - microchip,sam9x60-gpio
> >> +          - const: atmel,at91rm9200-gpio
> >> +      - items:
> >> +          - enum:
> >> +              - microchip,sam9x7-gpio
> >> +          - const: microchip,sam9x60-gpio
> >> +          - const: atmel,at91rm9200-gpio
> > It's worth pointing out that this is required, because the driver
> > implements a different set of ops for the sam9x60. There's not just more
> > of them, they're different too.
> > Are the sam9x60 and at91rm9200 are actually compatible, or is the
> > fallback here some mistake that originated in the dts?
> > 
> The PIO3 pinctrl driver uses the compatible "atmel,at91rm9200-gpio" to 
> find the number of active GPIO banks and also to differentiate them from 
> the pinmux child nodes.The driver probe fails if the at91rm9200 is not 
> present in the GPIO bank compatible property list.
> For sam9x7, "microchip,sam9x60-gpio" is used as the fallback compatible 
> and "atmel,at91rm9200-gpio" is added by default to avoid probe issues 
> and help find the number of GPIO banks by the driver.

That's unfortunately not what I asked. Forget about
at91_pinctrl_child_count() for a minute and answer the question again:
Are the sam9x60 and at91rm9200 actually compatible?

Hints:
- Do the registers that are in the at91rm9200 have the same behaviour in
  the sam9x60?
- Are the new registers in sam9x60 optional, so that if all sam9x60 code
  was deleted from the driver, the driver would still work for the subset
  of features that the at91rm9200 already supports?

Thanks,
Conor.
Manikandan Muralidharan June 27, 2024, 6:08 a.m. UTC | #4
Hi Conor,

On 26/06/24 2:29 pm, Conor Dooley wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> 
> ForwardedMessage.eml
> 
> Subject:
> Re: [PATCH v2 4/5] dt-bindings: gpio: convert Atmel GPIO to json-schema
> From:
> Conor Dooley <conor@kernel.org>
> Date:
> 26/06/24, 2:29 pm
> 
> To:
> Manikandan.M@microchip.com
> CC:
> linus.walleij@linaro.org, brgl@bgdev.pl, robh@kernel.org, 
> krzk+dt@kernel.org, conor+dt@kernel.org, Nicolas.Ferre@microchip.com, 
> alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, arnd@arndb.de, 
> Durai.ManickamKR@microchip.com, linux-gpio@vger.kernel.org, 
> devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, 
> linux-kernel@vger.kernel.org
> 
> 
> On Wed, Jun 26, 2024 at 08:32:41AM +0000,Manikandan.M@microchip.com  wrote:
>> On 25/06/24 10:04 pm, Conor Dooley wrote:
>>> Re: [PATCH v2 4/5] dt-bindings: gpio: convert Atmel GPIO to json-schema
>>> From: Conor Dooley<conor@kernel.org>
>>> On Tue, Jun 25, 2024 at 10:05:24AM +0530, Manikandan Muralidharan wrote:
>>>> Convert the Atmel GPIO controller binding document to DT schema format
>>>> using json-schema.
>>>> The compatible string "microchip,sam9x7-gpio" is added as well.
>>>>
>>>> Signed-off-by: Manikandan Muralidharan<manikandan.m@microchip.com>
>>>> ---
>>>> changes in v2:
>>>> - Fix bot errors with 'make dt_binding_check', missed to add
>>>> "atmel,at91rm9200-gpio" as separate compatible for devices that uses it
>>>> - Remove label from example
>>>> - Add default entry for #gpio-lines property
>>>> - Add new compatible string details in commit message
>>>> ---
>>>>    .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 81 +++++++++++++++++++
>>>>    .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 -------
>>>>    2 files changed, 81 insertions(+), 31 deletions(-)
>>>>    create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>>>>    delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>>>> new file mode 100644
>>>> index 000000000000..3dd70933ed8e
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>>>> @@ -0,0 +1,81 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id:http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
>>>> +$schema:http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: Microchip GPIO controller (PIO)
>>>> +
>>>> +maintainers:
>>>> +  - Manikandan Muralidharan<manikandan.m@microchip.com>
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +    oneOf:
>>>> +      - items:
>>>> +          - enum:
>>>> +              - atmel,at91sam9x5-gpio
>>>> +              - microchip,sam9x60-gpio
>>>> +          - const: atmel,at91rm9200-gpio
>>>> +      - items:
>>>> +          - enum:
>>>> +              - microchip,sam9x7-gpio
>>>> +          - const: microchip,sam9x60-gpio
>>>> +          - const: atmel,at91rm9200-gpio
>>> It's worth pointing out that this is required, because the driver
>>> implements a different set of ops for the sam9x60. There's not just more
>>> of them, they're different too.
>>> Are the sam9x60 and at91rm9200 are actually compatible, or is the
>>> fallback here some mistake that originated in the dts?
>>>
>> The PIO3 pinctrl driver uses the compatible "atmel,at91rm9200-gpio" to
>> find the number of active GPIO banks and also to differentiate them from
>> the pinmux child nodes.The driver probe fails if the at91rm9200 is not
>> present in the GPIO bank compatible property list.
>> For sam9x7, "microchip,sam9x60-gpio" is used as the fallback compatible
>> and "atmel,at91rm9200-gpio" is added by default to avoid probe issues
>> and help find the number of GPIO banks by the driver.
> That's unfortunately not what I asked. Forget about
> at91_pinctrl_child_count() for a minute and answer the question again:
> Are the sam9x60 and at91rm9200 actually compatible?
> 
> Hints:
> - Do the registers that are in the at91rm9200 have the same behaviour in
>    the sam9x60?
The registers in at91rm9200 have the same behavior as sam9x60 expect 
that the former supports only 2 Peripheral function per pin while 
sam9x60 supports 4.
> - Are the new registers in sam9x60 optional, so that if all sam9x60 code
>    was deleted from the driver, the driver would still work for the subset
>    of features that the at91rm9200 already supports?
at91rm9200 function will work for sam9x60 but not up-to its full 
potential.The new registers in sam9x60 for drive-strength, slew-rate, 
debounce, pull-down will help drive the the current pinmux configs for 
sam9x60/9x7 board DT.
> 
> Thanks,
> Conor.
>
Conor Dooley June 27, 2024, 3:42 p.m. UTC | #5
On Thu, Jun 27, 2024 at 06:08:15AM +0000, Manikandan.M@microchip.com wrote:
> Hi Conor,
> 
> On 26/06/24 2:29 pm, Conor Dooley wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > 
> > ForwardedMessage.eml
> > 
> > Subject:
> > Re: [PATCH v2 4/5] dt-bindings: gpio: convert Atmel GPIO to json-schema
> > From:
> > Conor Dooley <conor@kernel.org>
> > Date:
> > 26/06/24, 2:29 pm
> > 
> > To:
> > Manikandan.M@microchip.com
> > CC:
> > linus.walleij@linaro.org, brgl@bgdev.pl, robh@kernel.org, 
> > krzk+dt@kernel.org, conor+dt@kernel.org, Nicolas.Ferre@microchip.com, 
> > alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, arnd@arndb.de, 
> > Durai.ManickamKR@microchip.com, linux-gpio@vger.kernel.org, 
> > devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, 
> > linux-kernel@vger.kernel.org
> > 
> > 
> > On Wed, Jun 26, 2024 at 08:32:41AM +0000,Manikandan.M@microchip.com  wrote:
> >> On 25/06/24 10:04 pm, Conor Dooley wrote:
> >>> Re: [PATCH v2 4/5] dt-bindings: gpio: convert Atmel GPIO to json-schema
> >>> From: Conor Dooley<conor@kernel.org>
> >>> On Tue, Jun 25, 2024 at 10:05:24AM +0530, Manikandan Muralidharan wrote:
> >>>> Convert the Atmel GPIO controller binding document to DT schema format
> >>>> using json-schema.
> >>>> The compatible string "microchip,sam9x7-gpio" is added as well.
> >>>>
> >>>> Signed-off-by: Manikandan Muralidharan<manikandan.m@microchip.com>
> >>>> ---
> >>>> changes in v2:
> >>>> - Fix bot errors with 'make dt_binding_check', missed to add
> >>>> "atmel,at91rm9200-gpio" as separate compatible for devices that uses it
> >>>> - Remove label from example
> >>>> - Add default entry for #gpio-lines property
> >>>> - Add new compatible string details in commit message
> >>>> ---
> >>>>    .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 81 +++++++++++++++++++
> >>>>    .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 -------
> >>>>    2 files changed, 81 insertions(+), 31 deletions(-)
> >>>>    create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> >>>>    delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> >>>> new file mode 100644
> >>>> index 000000000000..3dd70933ed8e
> >>>> --- /dev/null
> >>>> +++ b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> >>>> @@ -0,0 +1,81 @@
> >>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >>>> +%YAML 1.2
> >>>> +---
> >>>> +$id:http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
> >>>> +$schema:http://devicetree.org/meta-schemas/core.yaml#
> >>>> +
> >>>> +title: Microchip GPIO controller (PIO)
> >>>> +
> >>>> +maintainers:
> >>>> +  - Manikandan Muralidharan<manikandan.m@microchip.com>
> >>>> +
> >>>> +properties:
> >>>> +  compatible:
> >>>> +    oneOf:
> >>>> +      - items:
> >>>> +          - enum:
> >>>> +              - atmel,at91sam9x5-gpio
> >>>> +              - microchip,sam9x60-gpio
> >>>> +          - const: atmel,at91rm9200-gpio
> >>>> +      - items:
> >>>> +          - enum:
> >>>> +              - microchip,sam9x7-gpio
> >>>> +          - const: microchip,sam9x60-gpio
> >>>> +          - const: atmel,at91rm9200-gpio
> >>> It's worth pointing out that this is required, because the driver
> >>> implements a different set of ops for the sam9x60. There's not just more
> >>> of them, they're different too.
> >>> Are the sam9x60 and at91rm9200 are actually compatible, or is the
> >>> fallback here some mistake that originated in the dts?
> >>>
> >> The PIO3 pinctrl driver uses the compatible "atmel,at91rm9200-gpio" to
> >> find the number of active GPIO banks and also to differentiate them from
> >> the pinmux child nodes.The driver probe fails if the at91rm9200 is not
> >> present in the GPIO bank compatible property list.
> >> For sam9x7, "microchip,sam9x60-gpio" is used as the fallback compatible
> >> and "atmel,at91rm9200-gpio" is added by default to avoid probe issues
> >> and help find the number of GPIO banks by the driver.
> > That's unfortunately not what I asked. Forget about
> > at91_pinctrl_child_count() for a minute and answer the question again:
> > Are the sam9x60 and at91rm9200 actually compatible?
> > 
> > Hints:
> > - Do the registers that are in the at91rm9200 have the same behaviour in
> >    the sam9x60?
> The registers in at91rm9200 have the same behavior as sam9x60 expect 
> that the former supports only 2 Peripheral function per pin while 
> sam9x60 supports 4.
> > - Are the new registers in sam9x60 optional, so that if all sam9x60 code
> >    was deleted from the driver, the driver would still work for the subset
> >    of features that the at91rm9200 already supports?
> at91rm9200 function will work for sam9x60 but not up-to its full 
> potential.The new registers in sam9x60 for drive-strength, slew-rate, 
> debounce, pull-down will help drive the the current pinmux configs for 
> sam9x60/9x7 board DT.

Right. The compatible setup makes sense then, just an explanation for
why should go into your commit message.

Thanks,
Conor.
Conor Dooley June 27, 2024, 3:44 p.m. UTC | #6
On Thu, Jun 27, 2024 at 04:42:24PM +0100, Conor Dooley wrote:
> > >>>> +properties:
> > >>>> +  compatible:
> > >>>> +    oneOf:
> > >>>> +      - items:
> > >>>> +          - enum:
> > >>>> +              - atmel,at91sam9x5-gpio
> > >>>> +              - microchip,sam9x60-gpio
> > >>>> +          - const: atmel,at91rm9200-gpio
> > >>>> +      - items:
> > >>>> +          - enum:
> > >>>> +              - microchip,sam9x7-gpio
> > >>>> +          - const: microchip,sam9x60-gpio
> > >>>> +          - const: atmel,at91rm9200-gpio
> > >>> It's worth pointing out that this is required, because the driver
> > >>> implements a different set of ops for the sam9x60. There's not just more
> > >>> of them, they're different too.
> > >>> Are the sam9x60 and at91rm9200 are actually compatible, or is the
> > >>> fallback here some mistake that originated in the dts?
> > >>>
> > >> The PIO3 pinctrl driver uses the compatible "atmel,at91rm9200-gpio" to
> > >> find the number of active GPIO banks and also to differentiate them from
> > >> the pinmux child nodes.The driver probe fails if the at91rm9200 is not
> > >> present in the GPIO bank compatible property list.
> > >> For sam9x7, "microchip,sam9x60-gpio" is used as the fallback compatible
> > >> and "atmel,at91rm9200-gpio" is added by default to avoid probe issues
> > >> and help find the number of GPIO banks by the driver.
> > > That's unfortunately not what I asked. Forget about
> > > at91_pinctrl_child_count() for a minute and answer the question again:
> > > Are the sam9x60 and at91rm9200 actually compatible?
> > > 
> > > Hints:
> > > - Do the registers that are in the at91rm9200 have the same behaviour in
> > >    the sam9x60?
> > The registers in at91rm9200 have the same behavior as sam9x60 expect 
> > that the former supports only 2 Peripheral function per pin while 
> > sam9x60 supports 4.
> > > - Are the new registers in sam9x60 optional, so that if all sam9x60 code
> > >    was deleted from the driver, the driver would still work for the subset
> > >    of features that the at91rm9200 already supports?
> > at91rm9200 function will work for sam9x60 but not up-to its full 
> > potential.The new registers in sam9x60 for drive-strength, slew-rate, 
> > debounce, pull-down will help drive the the current pinmux configs for 
> > sam9x60/9x7 board DT.
> 
> Right. The compatible setup makes sense then, just an explanation for
> why should go into your commit message.

Gah, I forgot to say, with that:
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
new file mode 100644
index 000000000000..3dd70933ed8e
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
@@ -0,0 +1,81 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip GPIO controller (PIO)
+
+maintainers:
+  - Manikandan Muralidharan <manikandan.m@microchip.com>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - atmel,at91sam9x5-gpio
+              - microchip,sam9x60-gpio
+          - const: atmel,at91rm9200-gpio
+      - items:
+          - enum:
+              - microchip,sam9x7-gpio
+          - const: microchip,sam9x60-gpio
+          - const: atmel,at91rm9200-gpio
+      - items:
+          - const: atmel,at91rm9200-gpio
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  gpio-controller: true
+  gpio-line-names: true
+
+  "#gpio-cells":
+    const: 2
+
+  clocks:
+    maxItems: 1
+
+  "#gpio-lines":
+    description:
+      Number of gpio, 32 by default if absent
+    maxItems: 1
+    default: 32
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-controller
+  - "#interrupt-cells"
+  - gpio-controller
+  - "#gpio-cells"
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/at91.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    gpio@fffff400 {
+            compatible = "atmel,at91rm9200-gpio";
+            reg = <0xfffff400 0x200>;
+            interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
+            #gpio-cells = <2>;
+            gpio-controller;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+            clocks = <&pmc PMC_TYPE_PERIPHERAL 2>;
+    };
+...
diff --git a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt b/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
deleted file mode 100644
index 29416f9c3220..000000000000
--- a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
+++ /dev/null
@@ -1,31 +0,0 @@ 
-* Atmel GPIO controller (PIO)
-
-Required properties:
-- compatible: "atmel,<chip>-gpio", where <chip> is at91rm9200 or at91sam9x5.
-- reg: Should contain GPIO controller registers location and length
-- interrupts: Should be the port interrupt shared by all the pins.
-- #gpio-cells: Should be two.  The first cell is the pin number and
-  the second cell is used to specify optional parameters to declare if the GPIO
-  is active high or low. See gpio.txt.
-- gpio-controller: Marks the device node as a GPIO controller.
-- interrupt-controller: Marks the device node as an interrupt controller.
-- #interrupt-cells: Should be two. The first cell is the pin number and the
-  second cell is used to specify irq type flags, see the two cell description
-  in interrupt-controller/interrupts.txt for details.
-
-optional properties:
-- #gpio-lines: Number of gpio if absent 32.
-
-
-Example:
-	pioA: gpio@fffff200 {
-		compatible = "atmel,at91rm9200-gpio";
-		reg = <0xfffff200 0x100>;
-		interrupts = <2 4>;
-		#gpio-cells = <2>;
-		gpio-controller;
-		#gpio-lines = <19>;
-		interrupt-controller;
-		#interrupt-cells = <2>;
-	};
-