diff mbox series

[2/5] dt-bindings: mfd: atmel,at91-usart: convert to json-schema

Message ID 20220817075517.49575-3-sergiu.moga@microchip.com
State New
Headers show
Series Make atmel serial driver aware of GCLK | expand

Commit Message

Sergiu Moga Aug. 17, 2022, 7:55 a.m. UTC
Convert at91 USART DT Binding for Atmel/Microchip SoCs to
json-schema format.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
---
 .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
 .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
 2 files changed, 190 insertions(+), 98 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt

Comments

Krzysztof Kozlowski Aug. 18, 2022, 8:39 a.m. UTC | #1
On 17/08/2022 10:55, Sergiu Moga wrote:
> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
> json-schema format.
> 
> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
> ---
>  .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>  .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>  2 files changed, 190 insertions(+), 98 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>  delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
> new file mode 100644
> index 000000000000..cf15d73fa1e8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml

One more thing - I think this should be in serial directory, not mfd,
even though it includes SPI. MFD is just a Linux naming/wrapper device.

Best regards,
Krzysztof
Sergiu Moga Aug. 19, 2022, 8:37 a.m. UTC | #2
On 18.08.2022 11:38, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On 17/08/2022 10:55, Sergiu Moga wrote:
>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>> json-schema format.
>>
>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>> ---
>>   .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>   .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>   2 files changed, 190 insertions(+), 98 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>   delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>> new file mode 100644
>> index 000000000000..cf15d73fa1e8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>> @@ -0,0 +1,190 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/mfd/atmel,at91-usart.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
>> +
>> +maintainers:
>> +  - Richard Genoud <richard.genoud@gmail.com>
>> +
>> +properties:
>> +  compatible:
>> +    oneOf:
> This looks quite different than bindings and you commit msg is saying it
> is only a conversion. Mention any changes against original bindings.


Noted. Will make the commit message more descriptive to also include the 
new compatibles.  Perhaps the addition of the GCLK should come under a 
different patch as well.


>> +      - const: atmel,at91rm9200-usart
>> +      - const: atmel,at91sam9260-usart
>> +      - const: microchip,sam9x60-usart
> That's an enum
>
>> +      - items:
>> +          - const: atmel,at91rm9200-dbgu
>> +          - const: atmel,at91rm9200-usart
>> +      - items:
>> +          - const: atmel,at91sam9260-dbgu
>> +          - const: atmel,at91sam9260-usart
>> +      - items:
>> +          - const: microchip,sam9x60-dbgu
>> +          - const: microchip,sam9x60-usart
>> +      - items:
>> +          - const: microchip,sam9x60-usart
>> +          - const: atmel,at91sam9260-usart
> This is not correct - contradicts earlier one.
>

Yes, this was for a DT node we have internally, my bad. You are right, 
it does not really make sense and it should not be the other way around: 
having the DT validate the binding. I will remove this combination in 
the next version.


>> +      - items:
>> +          - const: microchip,sam9x60-dbgu
>> +          - const: microchip,sam9x60-usart
>> +          - const: atmel,at91sam9260-dbgu
>> +          - const: atmel,at91sam9260-usart
> What? You wrote above that microchip,sam9x60-dbgu is compatible only
> with microchip,sam9x60-usart. Now you write it is also compatible with
> other ones?


Yes, this one is intended because the 9x60 IP has new functionalities on 
top of 9260, and some nodes do keep all four as fallback.


>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  clock-names:
>> +    contains:
>> +      const: usart
> No, this has to be specific/fixed list.


I wanted to highlight the fact that it must contain either:
clock-names = "usart";
or
clock-names = "usart", "gclk";

What would be the recommended way of doing this then?

>> +
>> +  clocks:
>> +    minItems: 1
>> +    maxItems: 2
> Not really - define the items. One item could be optional, though.
>
>> +
>> +  dmas:
>> +    items:
>> +      - description: TX DMA Channel
>> +      - description: RX DMA Channel
>> +
>> +  dma-names:
>> +    items:
>> +      - const: tx
>> +      - const: rx
>> +
>> +  atmel,usart-mode:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: |
> No need for |
>
>> +      Must be either 1 for SPI or 0 for USART.
> Mention the header.
>
>> +    enum: [ 0, 1 ]
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +  - clock-names
>> +  - clocks
>> +
>> +if:
> Put it under allOf.
>
>> +  properties:
>> +    $nodename:
>> +      pattern: "^serial@[0-9a-f]+$"
>> +then:
>> +  allOf:
>> +    - $ref: /schemas/serial/serial.yaml#
>> +    - $ref: /schemas/serial/rs485.yaml#
>> +
>> +  properties:
>> +    atmel,use-dma-rx:
>> +      type: boolean
>> +      description: use of PDC or DMA for receiving data
>> +
>> +    atmel,use-dma-tx:
>> +      type: boolean
>> +      description: use of PDC or DMA for transmitting data
>> +
>> +    atmel,fifo-size:
>> +      $ref: /schemas/types.yaml#/definitions/uint32
>> +      description: |
> No need for |
>
>> +        Maximum number of data the RX and TX FIFOs can store for FIFO
>> +        capable USARTS.
>> +      enum: [ 16, 32 ]
>> +
>> +else:
>> +  if:
>> +    properties:
>> +      $nodename:
>> +        pattern: "^spi@[0-9a-f]+$"
>> +  then:
>> +    allOf:
>> +      - $ref: /schemas/spi/spi-controller.yaml#
>> +
>> +    properties:
>> +      atmel,usart-mode:
>> +        const: 1
>> +
>> +      "#size-cells":
>> +        const: 0
>> +
>> +      "#address-cells":
>> +        const: 1
>> +
>> +    required:
>> +      - atmel,usart-mode
>> +      - "#size-cells"
>> +      - "#address-cells"
>> +
>> +unevaluatedProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    #include <dt-bindings/mfd/at91-usart.h>
>> +    #include <dt-bindings/dma/at91.h>
>> +
>> +    /* use PDC */
>> +    usart0: serial@fff8c000 {
>> +        compatible = "atmel,at91sam9260-usart";
>> +        reg = <0xfff8c000 0x4000>;
>> +        interrupts = <7>;
>> +        clocks = <&usart0_clk>;
>> +        clock-names = "usart";
>> +        atmel,use-dma-rx;
>> +        atmel,use-dma-tx;
>> +        rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
>> +        cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
>> +        dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
>> +        dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
>> +        dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
>> +        rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
>> +    };
>> +
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    #include <dt-bindings/mfd/at91-usart.h>
>> +    #include <dt-bindings/dma/at91.h>
>> +
>> +    /* use DMA */
>> +    usart1: serial@f001c000 {
>> +        compatible = "atmel,at91sam9260-usart";
>> +        reg = <0xf001c000 0x100>;
>> +        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
>> +        clocks = <&usart0_clk>;
>> +        clock-names = "usart";
>> +        atmel,use-dma-rx;
>> +        atmel,use-dma-tx;
>> +        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
>> +               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
>> +        dma-names = "tx", "rx";
>> +        atmel,fifo-size = <32>;
>> +    };
>> +
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    #include <dt-bindings/mfd/at91-usart.h>
>> +    #include <dt-bindings/dma/at91.h>
>> +
>> +    /* SPI mode */
>> +    spi0: spi@f001c000 {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        compatible = "atmel,at91sam9260-usart";
>> +        atmel,usart-mode = <AT91_USART_MODE_SPI>;
>> +        reg = <0xf001c000 0x100>;
> compatible, then reg then the reset of properties
>
>> +        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
>> +        clocks = <&usart0_clk>;
>> +        clock-names = "usart";
>> +        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
>> +               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
>> +        dma-names = "tx", "rx";
>> +        cs-gpios = <&pioB 3 GPIO_ACTIVE_HIGH>;
>> +    };
> Best regards,
> Krzysztof


Regards,
     Sergiu
Sergiu Moga Aug. 19, 2022, 8:38 a.m. UTC | #3
On 18.08.2022 11:39, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On 17/08/2022 10:55, Sergiu Moga wrote:
>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>> json-schema format.
>>
>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>> ---
>>   .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>   .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>   2 files changed, 190 insertions(+), 98 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>   delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>> new file mode 100644
>> index 000000000000..cf15d73fa1e8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
> One more thing - I think this should be in serial directory, not mfd,
> even though it includes SPI. MFD is just a Linux naming/wrapper device.
>
> Best regards,
> Krzysztof

I would rather keep it in this directory, since its corresponding driver 
is also in the mfd directory.

Regards,
     Sergiu
Krzysztof Kozlowski Aug. 19, 2022, 8:41 a.m. UTC | #4
On 19/08/2022 11:37, Sergiu.Moga@microchip.com wrote:

>>> +      - items:
>>> +          - const: atmel,at91rm9200-dbgu
>>> +          - const: atmel,at91rm9200-usart
>>> +      - items:
>>> +          - const: atmel,at91sam9260-dbgu
>>> +          - const: atmel,at91sam9260-usart
>>> +      - items:
>>> +          - const: microchip,sam9x60-dbgu
>>> +          - const: microchip,sam9x60-usart
>>> +      - items:
>>> +          - const: microchip,sam9x60-usart
>>> +          - const: atmel,at91sam9260-usart
>> This is not correct - contradicts earlier one.
>>
> 
> Yes, this was for a DT node we have internally, my bad. You are right, 
> it does not really make sense and it should not be the other way around: 
> having the DT validate the binding. I will remove this combination in 
> the next version.

You need to fix any out of tree DTS or upstream it.
> 
> 
>>> +      - items:
>>> +          - const: microchip,sam9x60-dbgu
>>> +          - const: microchip,sam9x60-usart
>>> +          - const: atmel,at91sam9260-dbgu
>>> +          - const: atmel,at91sam9260-usart
>> What? You wrote above that microchip,sam9x60-dbgu is compatible only
>> with microchip,sam9x60-usart. Now you write it is also compatible with
>> other ones?
> 
> 
> Yes, this one is intended because the 9x60 IP has new functionalities on 
> top of 9260, and some nodes do keep all four as fallback.

Then all nodes should keep fallbacks.

> 
> 
>>> +
>>> +  reg:
>>> +    maxItems: 1
>>> +
>>> +  interrupts:
>>> +    maxItems: 1
>>> +
>>> +  clock-names:
>>> +    contains:
>>> +      const: usart
>> No, this has to be specific/fixed list.
> 
> 
> I wanted to highlight the fact that it must contain either:
> clock-names = "usart";
> or
> clock-names = "usart", "gclk";
> 
> What would be the recommended way of doing this then?

We have an example for this.

https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindings/example-schema.yaml#L91


Best regards,
Krzysztof
Krzysztof Kozlowski Aug. 19, 2022, 8:47 a.m. UTC | #5
On 19/08/2022 11:38, Sergiu.Moga@microchip.com wrote:
> On 18.08.2022 11:39, Krzysztof Kozlowski wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> On 17/08/2022 10:55, Sergiu Moga wrote:
>>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>>> json-schema format.
>>>
>>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>>> ---
>>>   .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>>   .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>>   2 files changed, 190 insertions(+), 98 deletions(-)
>>>   create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>   delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>> new file mode 100644
>>> index 000000000000..cf15d73fa1e8
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>> One more thing - I think this should be in serial directory, not mfd,
>> even though it includes SPI. MFD is just a Linux naming/wrapper device.
>>
>> Best regards,
>> Krzysztof
> 
> I would rather keep it in this directory, since its corresponding driver 
> is also in the mfd directory.

Sorry, but that's poor argument. Driver subsystems match Linux
convention, not necessarily hardware type/naming. Bindings directories
match hardware. MFD bindings are only for MFD wrapper drivers and this
is a serial interface. Not a MFD. You even do not add MFD devices in the
driver but add *always one* device depending on serial feature you want.
This is not even MFD device but regular platform device with children.

You put it in SoC, though, because all other SoCs store it there...

Best regards,
Krzysztof
Krzysztof Kozlowski Aug. 19, 2022, 9:05 a.m. UTC | #6
On 19/08/2022 11:47, Krzysztof Kozlowski wrote:
> On 19/08/2022 11:38, Sergiu.Moga@microchip.com wrote:
>> On 18.08.2022 11:39, Krzysztof Kozlowski wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On 17/08/2022 10:55, Sergiu Moga wrote:
>>>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>>>> json-schema format.
>>>>
>>>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>>>> ---
>>>>   .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>>>   .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>>>   2 files changed, 190 insertions(+), 98 deletions(-)
>>>>   create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>>   delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>> new file mode 100644
>>>> index 000000000000..cf15d73fa1e8
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>> One more thing - I think this should be in serial directory, not mfd,
>>> even though it includes SPI. MFD is just a Linux naming/wrapper device.
>>>
>>> Best regards,
>>> Krzysztof
>>
>> I would rather keep it in this directory, since its corresponding driver 
>> is also in the mfd directory.
> 
> Sorry, but that's poor argument. Driver subsystems match Linux
> convention, not necessarily hardware type/naming. Bindings directories
> match hardware. MFD bindings are only for MFD wrapper drivers and this
> is a serial interface. Not a MFD. You even do not add MFD devices in the
> driver but add *always one* device depending on serial feature you want.
> This is not even MFD device but regular platform device with children.
> 
> You put it in SoC, though, because all other SoCs store it there...

The last one should be:

You could put it in SoC, though, because all other SoCs store it there...

Best regards,
Krzysztof
Sergiu Moga Aug. 19, 2022, 9:25 a.m. UTC | #7
On 18.08.2022 11:38, Krzysztof Kozlowski wrote:
> On 17/08/2022 10:55, Sergiu Moga wrote:
>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>> json-schema format.
>>
>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>> ---
>>   .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>   .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>   2 files changed, 190 insertions(+), 98 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>   delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>> new file mode 100644
>> index 000000000000..cf15d73fa1e8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>> @@ -0,0 +1,190 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/mfd/atmel,at91-usart.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
>> +
>> +maintainers:
>> +  - Richard Genoud <richard.genoud@gmail.com>
>> +
>> +properties:
>> +  compatible:
>> +    oneOf:
> This looks quite different than bindings and you commit msg is saying it
> is only a conversion. Mention any changes against original bindings.
>
>> +      - const: atmel,at91rm9200-usart
>> +      - const: atmel,at91sam9260-usart
>> +      - const: microchip,sam9x60-usart
> That's an enum
>
>> +      - items:
>> +          - const: atmel,at91rm9200-dbgu
>> +          - const: atmel,at91rm9200-usart
>> +      - items:
>> +          - const: atmel,at91sam9260-dbgu
>> +          - const: atmel,at91sam9260-usart
>> +      - items:
>> +          - const: microchip,sam9x60-dbgu
>> +          - const: microchip,sam9x60-usart
>> +      - items:
>> +          - const: microchip,sam9x60-usart
>> +          - const: atmel,at91sam9260-usart
> This is not correct - contradicts earlier one.
>
>> +      - items:
>> +          - const: microchip,sam9x60-dbgu
>> +          - const: microchip,sam9x60-usart
>> +          - const: atmel,at91sam9260-dbgu
>> +          - const: atmel,at91sam9260-usart
> What? You wrote above that microchip,sam9x60-dbgu is compatible only
> with microchip,sam9x60-usart. Now you write it is also compatible with
> other ones?
>
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  clock-names:
>> +    contains:
>> +      const: usart
> No, this has to be specific/fixed list.
>
>> +
>> +  clocks:
>> +    minItems: 1
>> +    maxItems: 2
> Not really - define the items. One item could be optional, though.
>
>> +
>> +  dmas:
>> +    items:
>> +      - description: TX DMA Channel
>> +      - description: RX DMA Channel
>> +
>> +  dma-names:
>> +    items:
>> +      - const: tx
>> +      - const: rx
>> +
>> +  atmel,usart-mode:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: |
> No need for |
>
>> +      Must be either 1 for SPI or 0 for USART.
> Mention the header.
>
>> +    enum: [ 0, 1 ]
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +  - clock-names
>> +  - clocks
>> +
>> +if:
> Put it under allOf.


I missed this in the first read, but what do you mean by under allOf? 
The only allOf's in this file are under the then:'s.


>> +  properties:
>> +    $nodename:
>> +      pattern: "^serial@[0-9a-f]+$"
>> +then:
>> +  allOf:
>> +    - $ref: /schemas/serial/serial.yaml#
>> +    - $ref: /schemas/serial/rs485.yaml#
>> +
>> +  properties:
>> +    atmel,use-dma-rx:
>> +      type: boolean
>> +      description: use of PDC or DMA for receiving data
>> +
>> +    atmel,use-dma-tx:
>> +      type: boolean
>> +      description: use of PDC or DMA for transmitting data
>> +
>> +    atmel,fifo-size:
>> +      $ref: /schemas/types.yaml#/definitions/uint32
>> +      description: |
> No need for |
>
>> +        Maximum number of data the RX and TX FIFOs can store for FIFO
>> +        capable USARTS.
>> +      enum: [ 16, 32 ]
>> +
>> +else:
>> +  if:
>> +    properties:
>> +      $nodename:
>> +        pattern: "^spi@[0-9a-f]+$"
>> +  then:
>> +    allOf:
>> +      - $ref: /schemas/spi/spi-controller.yaml#
>> +
>> +    properties:
>> +      atmel,usart-mode:
>> +        const: 1
>> +
>> +      "#size-cells":
>> +        const: 0
>> +
>> +      "#address-cells":
>> +        const: 1
>> +
>> +    required:
>> +      - atmel,usart-mode
>> +      - "#size-cells"
>> +      - "#address-cells"
>> +
>> +unevaluatedProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    #include <dt-bindings/mfd/at91-usart.h>
>> +    #include <dt-bindings/dma/at91.h>
>> +
>> +    /* use PDC */
>> +    usart0: serial@fff8c000 {
>> +        compatible = "atmel,at91sam9260-usart";
>> +        reg = <0xfff8c000 0x4000>;
>> +        interrupts = <7>;
>> +        clocks = <&usart0_clk>;
>> +        clock-names = "usart";
>> +        atmel,use-dma-rx;
>> +        atmel,use-dma-tx;
>> +        rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
>> +        cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
>> +        dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
>> +        dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
>> +        dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
>> +        rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
>> +    };
>> +
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    #include <dt-bindings/mfd/at91-usart.h>
>> +    #include <dt-bindings/dma/at91.h>
>> +
>> +    /* use DMA */
>> +    usart1: serial@f001c000 {
>> +        compatible = "atmel,at91sam9260-usart";
>> +        reg = <0xf001c000 0x100>;
>> +        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
>> +        clocks = <&usart0_clk>;
>> +        clock-names = "usart";
>> +        atmel,use-dma-rx;
>> +        atmel,use-dma-tx;
>> +        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
>> +               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
>> +        dma-names = "tx", "rx";
>> +        atmel,fifo-size = <32>;
>> +    };
>> +
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    #include <dt-bindings/mfd/at91-usart.h>
>> +    #include <dt-bindings/dma/at91.h>
>> +
>> +    /* SPI mode */
>> +    spi0: spi@f001c000 {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        compatible = "atmel,at91sam9260-usart";
>> +        atmel,usart-mode = <AT91_USART_MODE_SPI>;
>> +        reg = <0xf001c000 0x100>;
> compatible, then reg then the reset of properties
>
>> +        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
>> +        clocks = <&usart0_clk>;
>> +        clock-names = "usart";
>> +        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
>> +               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
>> +        dma-names = "tx", "rx";
>> +        cs-gpios = <&pioB 3 GPIO_ACTIVE_HIGH>;
>> +    };
> Best regards,
> Krzysztof


Regards,
     Sergiu
Krzysztof Kozlowski Aug. 19, 2022, 12:06 p.m. UTC | #8
On 19/08/2022 12:25, Sergiu.Moga@microchip.com wrote:
> On 18.08.2022 11:38, Krzysztof Kozlowski wrote:
>> On 17/08/2022 10:55, Sergiu Moga wrote:
>>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>>> json-schema format.
>>>
>>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>>> ---
>>>   .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>>   .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>>   2 files changed, 190 insertions(+), 98 deletions(-)
>>>   create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>   delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>> new file mode 100644
>>> index 000000000000..cf15d73fa1e8
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>> @@ -0,0 +1,190 @@
>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>> +# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/mfd/atmel,at91-usart.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
>>> +
>>> +maintainers:
>>> +  - Richard Genoud <richard.genoud@gmail.com>
>>> +
>>> +properties:
>>> +  compatible:
>>> +    oneOf:
>> This looks quite different than bindings and you commit msg is saying it
>> is only a conversion. Mention any changes against original bindings.
>>
>>> +      - const: atmel,at91rm9200-usart
>>> +      - const: atmel,at91sam9260-usart
>>> +      - const: microchip,sam9x60-usart
>> That's an enum
>>
>>> +      - items:
>>> +          - const: atmel,at91rm9200-dbgu
>>> +          - const: atmel,at91rm9200-usart
>>> +      - items:
>>> +          - const: atmel,at91sam9260-dbgu
>>> +          - const: atmel,at91sam9260-usart
>>> +      - items:
>>> +          - const: microchip,sam9x60-dbgu
>>> +          - const: microchip,sam9x60-usart
>>> +      - items:
>>> +          - const: microchip,sam9x60-usart
>>> +          - const: atmel,at91sam9260-usart
>> This is not correct - contradicts earlier one.
>>
>>> +      - items:
>>> +          - const: microchip,sam9x60-dbgu
>>> +          - const: microchip,sam9x60-usart
>>> +          - const: atmel,at91sam9260-dbgu
>>> +          - const: atmel,at91sam9260-usart
>> What? You wrote above that microchip,sam9x60-dbgu is compatible only
>> with microchip,sam9x60-usart. Now you write it is also compatible with
>> other ones?
>>
>>> +
>>> +  reg:
>>> +    maxItems: 1
>>> +
>>> +  interrupts:
>>> +    maxItems: 1
>>> +
>>> +  clock-names:
>>> +    contains:
>>> +      const: usart
>> No, this has to be specific/fixed list.
>>
>>> +
>>> +  clocks:
>>> +    minItems: 1
>>> +    maxItems: 2
>> Not really - define the items. One item could be optional, though.
>>
>>> +
>>> +  dmas:
>>> +    items:
>>> +      - description: TX DMA Channel
>>> +      - description: RX DMA Channel
>>> +
>>> +  dma-names:
>>> +    items:
>>> +      - const: tx
>>> +      - const: rx
>>> +
>>> +  atmel,usart-mode:
>>> +    $ref: /schemas/types.yaml#/definitions/uint32
>>> +    description: |
>> No need for |
>>
>>> +      Must be either 1 for SPI or 0 for USART.
>> Mention the header.
>>
>>> +    enum: [ 0, 1 ]
>>> +
>>> +required:
>>> +  - compatible
>>> +  - reg
>>> +  - interrupts
>>> +  - clock-names
>>> +  - clocks
>>> +
>>> +if:
>> Put it under allOf.
> 
> 
> I missed this in the first read, but what do you mean by under allOf? 
> The only allOf's in this file are under the then:'s.
> 

It means that "if:" is preferred to be under allOf, just like example
schema is showing:
https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindings/example-schema.yaml

Not some other allOf, which could be many in your bindings. The one
allOf in top-level, just like example schema.


Best regards,
Krzysztof
Eugen Hristev Sept. 1, 2022, 11:31 a.m. UTC | #9
On 8/19/22 12:05 PM, Krzysztof Kozlowski wrote:
> On 19/08/2022 11:47, Krzysztof Kozlowski wrote:
>> On 19/08/2022 11:38, Sergiu.Moga@microchip.com wrote:
>>> On 18.08.2022 11:39, Krzysztof Kozlowski wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>
>>>> On 17/08/2022 10:55, Sergiu Moga wrote:
>>>>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>>>>> json-schema format.
>>>>>
>>>>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>>>>> ---
>>>>>    .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>>>>    .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>>>>    2 files changed, 190 insertions(+), 98 deletions(-)
>>>>>    create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>>>    delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>>> new file mode 100644
>>>>> index 000000000000..cf15d73fa1e8
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>> One more thing - I think this should be in serial directory, not mfd,
>>>> even though it includes SPI. MFD is just a Linux naming/wrapper device.
>>>>
>>>> Best regards,
>>>> Krzysztof
>>>
>>> I would rather keep it in this directory, since its corresponding driver
>>> is also in the mfd directory.
>>
>> Sorry, but that's poor argument. Driver subsystems match Linux
>> convention, not necessarily hardware type/naming. Bindings directories
>> match hardware. MFD bindings are only for MFD wrapper drivers and this
>> is a serial interface. Not a MFD. You even do not add MFD devices in the
>> driver but add *always one* device depending on serial feature you want.
>> This is not even MFD device but regular platform device with children.
>>
>> You put it in SoC, though, because all other SoCs store it there...
> 
> The last one should be:
> 
> You could put it in SoC, though, because all other SoCs store it there...

Hi,

If it this is only a conversion to yaml, why do you want it moved to 
another dir ?
Perhaps if you consider SoC or serial as a better place, it should be 
done through a different patch.

Also, disputing whether this is really a MFD or not, is not in the scope 
of this patch.

Eugen

> 
> Best regards,
> Krzysztof
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
Krzysztof Kozlowski Sept. 5, 2022, 10:10 a.m. UTC | #10
On 01/09/2022 13:31, Eugen.Hristev@microchip.com wrote:
>>>>>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>>>> new file mode 100644
>>>>>> index 000000000000..cf15d73fa1e8
>>>>>> --- /dev/null
>>>>>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>>> One more thing - I think this should be in serial directory, not mfd,
>>>>> even though it includes SPI. MFD is just a Linux naming/wrapper device.
>>>>>
>>>>> Best regards,
>>>>> Krzysztof
>>>>
>>>> I would rather keep it in this directory, since its corresponding driver
>>>> is also in the mfd directory.
>>>
>>> Sorry, but that's poor argument. Driver subsystems match Linux
>>> convention, not necessarily hardware type/naming. Bindings directories
>>> match hardware. MFD bindings are only for MFD wrapper drivers and this
>>> is a serial interface. Not a MFD. You even do not add MFD devices in the
>>> driver but add *always one* device depending on serial feature you want.
>>> This is not even MFD device but regular platform device with children.
>>>
>>> You put it in SoC, though, because all other SoCs store it there...
>>
>> The last one should be:
>>
>> You could put it in SoC, though, because all other SoCs store it there...
> 
> Hi,
> 
> If it this is only a conversion to yaml, why do you want it moved to 
> another dir ?
> Perhaps if you consider SoC or serial as a better place, it should be 
> done through a different patch.
> 
> Also, disputing whether this is really a MFD or not, is not in the scope 
> of this patch.
> 

Because you are converting - thus renaming - the bindings, so this is
the place to put them in proper place. The conversion to DT Schema comes
pretty often with small fixups, so proper location is one of them.
That's quite common case.

Best regards,
Krzysztof
Lee Jones Sept. 5, 2022, 2:37 p.m. UTC | #11
On Fri, 19 Aug 2022, Sergiu.Moga@microchip.com wrote:

> On 18.08.2022 11:39, Krzysztof Kozlowski wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > On 17/08/2022 10:55, Sergiu Moga wrote:
> >> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
> >> json-schema format.
> >>
> >> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
> >> ---
> >>   .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
> >>   .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
> >>   2 files changed, 190 insertions(+), 98 deletions(-)
> >>   create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
> >>   delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
> >> new file mode 100644
> >> index 000000000000..cf15d73fa1e8
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
> > One more thing - I think this should be in serial directory, not mfd,
> > even though it includes SPI. MFD is just a Linux naming/wrapper device.
> >
> > Best regards,
> > Krzysztof
> 
> I would rather keep it in this directory, since its corresponding driver 
> is also in the mfd directory.

Looks like a UART driver to me.

Which MFD driver does this pertain to?
Sergiu Moga Sept. 5, 2022, 3:22 p.m. UTC | #12
On 05.09.2022 17:37, Lee Jones wrote:
> 
> On Fri, 19 Aug 2022, Sergiu.Moga@microchip.com wrote:
> 
>> On 18.08.2022 11:39, Krzysztof Kozlowski wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On 17/08/2022 10:55, Sergiu Moga wrote:
>>>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>>>> json-schema format.
>>>>
>>>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>>>> ---
>>>>    .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>>>    .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>>>    2 files changed, 190 insertions(+), 98 deletions(-)
>>>>    create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>>    delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>> new file mode 100644
>>>> index 000000000000..cf15d73fa1e8
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>> One more thing - I think this should be in serial directory, not mfd,
>>> even though it includes SPI. MFD is just a Linux naming/wrapper device.
>>>
>>> Best regards,
>>> Krzysztof
>>
>> I would rather keep it in this directory, since its corresponding driver
>> is also in the mfd directory.
> 
> Looks like a UART driver to me.
> 
> Which MFD driver does this pertain to?
> 
> --
> Lee Jones [李琼斯]

Hi,

It's this one: drivers/mfd/at91-usart.c[1]


[1] 
https://elixir.bootlin.com/linux/v6.0-rc4/source/drivers/mfd/at91-usart.c



Regards,
	Sergiu
Krzysztof Kozlowski Sept. 5, 2022, 4:12 p.m. UTC | #13
On 05/09/2022 17:22, Sergiu.Moga@microchip.com wrote:
> On 05.09.2022 17:37, Lee Jones wrote:
>>
>> On Fri, 19 Aug 2022, Sergiu.Moga@microchip.com wrote:
>>
>>> On 18.08.2022 11:39, Krzysztof Kozlowski wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>
>>>> On 17/08/2022 10:55, Sergiu Moga wrote:
>>>>> Convert at91 USART DT Binding for Atmel/Microchip SoCs to
>>>>> json-schema format.
>>>>>
>>>>> Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
>>>>> ---
>>>>>    .../bindings/mfd/atmel,at91-usart.yaml        | 190 ++++++++++++++++++
>>>>>    .../devicetree/bindings/mfd/atmel-usart.txt   |  98 ---------
>>>>>    2 files changed, 190 insertions(+), 98 deletions(-)
>>>>>    create mode 100644 Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>>>    delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-usart.txt
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>>> new file mode 100644
>>>>> index 000000000000..cf15d73fa1e8
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
>>>> One more thing - I think this should be in serial directory, not mfd,
>>>> even though it includes SPI. MFD is just a Linux naming/wrapper device.
>>>>
>>>> Best regards,
>>>> Krzysztof
>>>
>>> I would rather keep it in this directory, since its corresponding driver
>>> is also in the mfd directory.
>>
>> Looks like a UART driver to me.
>>
>> Which MFD driver does this pertain to?
>>
>> --
>> Lee Jones [李琼斯]
> 
> Hi,
> 
> It's this one: drivers/mfd/at91-usart.c[1]
> 
> 
> [1] 
> https://elixir.bootlin.com/linux/v6.0-rc4/source/drivers/mfd/at91-usart.c

Which is not a "real MFD driver" because it probes exactly one child
(depending on the chosen serial protocol). Aren't MFD supposed to have
more then one child?


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
new file mode 100644
index 000000000000..cf15d73fa1e8
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/atmel,at91-usart.yaml
@@ -0,0 +1,190 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/atmel,at91-usart.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
+
+maintainers:
+  - Richard Genoud <richard.genoud@gmail.com>
+
+properties:
+  compatible:
+    oneOf:
+      - const: atmel,at91rm9200-usart
+      - const: atmel,at91sam9260-usart
+      - const: microchip,sam9x60-usart
+      - items:
+          - const: atmel,at91rm9200-dbgu
+          - const: atmel,at91rm9200-usart
+      - items:
+          - const: atmel,at91sam9260-dbgu
+          - const: atmel,at91sam9260-usart
+      - items:
+          - const: microchip,sam9x60-dbgu
+          - const: microchip,sam9x60-usart
+      - items:
+          - const: microchip,sam9x60-usart
+          - const: atmel,at91sam9260-usart
+      - items:
+          - const: microchip,sam9x60-dbgu
+          - const: microchip,sam9x60-usart
+          - const: atmel,at91sam9260-dbgu
+          - const: atmel,at91sam9260-usart
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clock-names:
+    contains:
+      const: usart
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  dmas:
+    items:
+      - description: TX DMA Channel
+      - description: RX DMA Channel
+
+  dma-names:
+    items:
+      - const: tx
+      - const: rx
+
+  atmel,usart-mode:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Must be either 1 for SPI or 0 for USART.
+    enum: [ 0, 1 ]
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clock-names
+  - clocks
+
+if:
+  properties:
+    $nodename:
+      pattern: "^serial@[0-9a-f]+$"
+then:
+  allOf:
+    - $ref: /schemas/serial/serial.yaml#
+    - $ref: /schemas/serial/rs485.yaml#
+
+  properties:
+    atmel,use-dma-rx:
+      type: boolean
+      description: use of PDC or DMA for receiving data
+
+    atmel,use-dma-tx:
+      type: boolean
+      description: use of PDC or DMA for transmitting data
+
+    atmel,fifo-size:
+      $ref: /schemas/types.yaml#/definitions/uint32
+      description: |
+        Maximum number of data the RX and TX FIFOs can store for FIFO
+        capable USARTS.
+      enum: [ 16, 32 ]
+
+else:
+  if:
+    properties:
+      $nodename:
+        pattern: "^spi@[0-9a-f]+$"
+  then:
+    allOf:
+      - $ref: /schemas/spi/spi-controller.yaml#
+
+    properties:
+      atmel,usart-mode:
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+      "#address-cells":
+        const: 1
+
+    required:
+      - atmel,usart-mode
+      - "#size-cells"
+      - "#address-cells"
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/mfd/at91-usart.h>
+    #include <dt-bindings/dma/at91.h>
+
+    /* use PDC */
+    usart0: serial@fff8c000 {
+        compatible = "atmel,at91sam9260-usart";
+        reg = <0xfff8c000 0x4000>;
+        interrupts = <7>;
+        clocks = <&usart0_clk>;
+        clock-names = "usart";
+        atmel,use-dma-rx;
+        atmel,use-dma-tx;
+        rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
+        cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
+        dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
+        dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
+        dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
+        rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
+    };
+
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/mfd/at91-usart.h>
+    #include <dt-bindings/dma/at91.h>
+
+    /* use DMA */
+    usart1: serial@f001c000 {
+        compatible = "atmel,at91sam9260-usart";
+        reg = <0xf001c000 0x100>;
+        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
+        clocks = <&usart0_clk>;
+        clock-names = "usart";
+        atmel,use-dma-rx;
+        atmel,use-dma-tx;
+        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
+               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
+        dma-names = "tx", "rx";
+        atmel,fifo-size = <32>;
+    };
+
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/mfd/at91-usart.h>
+    #include <dt-bindings/dma/at91.h>
+
+    /* SPI mode */
+    spi0: spi@f001c000 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        compatible = "atmel,at91sam9260-usart";
+        atmel,usart-mode = <AT91_USART_MODE_SPI>;
+        reg = <0xf001c000 0x100>;
+        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
+        clocks = <&usart0_clk>;
+        clock-names = "usart";
+        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
+               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
+        dma-names = "tx", "rx";
+        cs-gpios = <&pioB 3 GPIO_ACTIVE_HIGH>;
+    };
diff --git a/Documentation/devicetree/bindings/mfd/atmel-usart.txt b/Documentation/devicetree/bindings/mfd/atmel-usart.txt
deleted file mode 100644
index a09133066aff..000000000000
--- a/Documentation/devicetree/bindings/mfd/atmel-usart.txt
+++ /dev/null
@@ -1,98 +0,0 @@ 
-* Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
-
-Required properties for USART:
-- compatible: Should be one of the following:
-	- "atmel,at91rm9200-usart"
-	- "atmel,at91sam9260-usart"
-	- "microchip,sam9x60-usart"
-	- "atmel,at91rm9200-dbgu", "atmel,at91rm9200-usart"
-	- "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"
-	- "microchip,sam9x60-dbgu", "microchip,sam9x60-usart"
-- reg: Should contain registers location and length
-- interrupts: Should contain interrupt
-- clock-names: tuple listing input clock names.
-	Required elements: "usart"
-- clocks: phandles to input clocks.
-
-Required properties for USART in SPI mode:
-- #size-cells      : Must be <0>
-- #address-cells   : Must be <1>
-- cs-gpios: chipselects (internal cs not supported)
-- atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h)
-
-Optional properties in serial and SPI mode:
-- dma bindings for dma transfer:
-	- dmas: DMA specifier, consisting of a phandle to DMA controller node,
-		memory peripheral interface and USART DMA channel ID, FIFO configuration.
-		The order of DMA channels is fixed. The first DMA channel must be TX
-		associated channel and the second one must be RX associated channel.
-		Refer to dma.txt and atmel-dma.txt for details.
-	- dma-names: "tx" for TX channel.
-		     "rx" for RX channel.
-		     The order of dma-names is also fixed. The first name must be "tx"
-		     and the second one must be "rx" as in the examples below.
-
-Optional properties in serial mode:
-- atmel,use-dma-rx: use of PDC or DMA for receiving data
-- atmel,use-dma-tx: use of PDC or DMA for transmitting data
-- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.
-  It will use specified PIO instead of the peripheral function pin for the USART feature.
-  If unsure, don't specify this property.
-- atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO
-  capable USARTs.
-- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
-
-<chip> compatible description:
-- at91rm9200:  legacy USART support
-- at91sam9260: generic USART implementation for SAM9 SoCs
-
-Example:
-- use PDC:
-	usart0: serial@fff8c000 {
-		compatible = "atmel,at91sam9260-usart";
-		reg = <0xfff8c000 0x4000>;
-		interrupts = <7>;
-		clocks = <&usart0_clk>;
-		clock-names = "usart";
-		atmel,use-dma-rx;
-		atmel,use-dma-tx;
-		rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
-		cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
-		dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
-		dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
-		dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
-		rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
-	};
-
-- use DMA:
-	usart0: serial@f001c000 {
-		compatible = "atmel,at91sam9260-usart";
-		reg = <0xf001c000 0x100>;
-		interrupts = <12 4 5>;
-		clocks = <&usart0_clk>;
-		clock-names = "usart";
-		atmel,use-dma-rx;
-		atmel,use-dma-tx;
-		dmas = <&dma0 2 0x3>,
-		       <&dma0 2 0x204>;
-		dma-names = "tx", "rx";
-		atmel,fifo-size = <32>;
-	};
-
-- SPI mode:
-	#include <dt-bindings/mfd/at91-usart.h>
-
-	spi0: spi@f001c000 {
-		#address-cells = <1>;
-		#size-cells = <0>;
-		compatible = "atmel,at91rm9200-usart", "atmel,at91sam9260-usart";
-		atmel,usart-mode = <AT91_USART_MODE_SPI>;
-		reg = <0xf001c000 0x100>;
-		interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
-		clocks = <&usart0_clk>;
-		clock-names = "usart";
-		dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
-		       <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
-		dma-names = "tx", "rx";
-		cs-gpios = <&pioB 3 0>;
-	};