diff mbox series

[v4,1/2] dt-bindings: serial: Add rx-tx-swap to stm32-usart

Message ID 20210302190303.28630-1-devik@eaxlabs.cz
State Superseded
Headers show
Series [v4,1/2] dt-bindings: serial: Add rx-tx-swap to stm32-usart | expand

Commit Message

Martin Devera March 2, 2021, 7:03 p.m. UTC
Add new rx-tx-swap property to allow for RX & TX pin swapping.

Signed-off-by: Martin Devera <devik@eaxlabs.cz>
---
 .../devicetree/bindings/serial/st,stm32-uart.yaml  | 32 +++++++++++++++-------
 1 file changed, 22 insertions(+), 10 deletions(-)

Comments

Fabrice Gasnier March 3, 2021, 5:23 p.m. UTC | #1
On 3/2/21 8:03 PM, Martin Devera wrote:
> Add new rx-tx-swap property to allow for RX & TX pin swapping.
> 
> Signed-off-by: Martin Devera <devik@eaxlabs.cz>
> ---
>  .../devicetree/bindings/serial/st,stm32-uart.yaml  | 32 +++++++++++++++-------
>  1 file changed, 22 insertions(+), 10 deletions(-)
> 

Hi Martin,

I'm only wondering on moving the allOf and the st,hw-flow-ctrl prop. But
others may comment on this.

Feel free to add my:
Acked-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Thanks!
Fabrice

> diff --git a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
> index 8631678283f9..6eab2debebb5 100644
> --- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
> +++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
> @@ -9,9 +9,6 @@ maintainers:
>  
>  title: STMicroelectronics STM32 USART bindings
>  
> -allOf:
> -  - $ref: rs485.yaml
> -
>  properties:
>    compatible:
>      enum:
> @@ -40,6 +37,10 @@ properties:
>  
>    uart-has-rtscts: true
>  
> +  rx-tx-swap:
> +    type: boolean
> +    maxItems: 1
> +
>    dmas:
>      minItems: 1
>      maxItems: 2
> @@ -66,13 +67,24 @@ properties:
>    linux,rs485-enabled-at-boot-time: true
>    rs485-rx-during-tx: true
>  
> -if:
> -  required:
> -    - st,hw-flow-ctrl
> -then:
> -  properties:
> -    cts-gpios: false
> -    rts-gpios: false
> +allOf:
> +  - $ref: rs485.yaml
> +  - if:
> +      required:
> +        - st,hw-flow-ctrl
> +    then:
> +      properties:
> +        cts-gpios: false
> +        rts-gpios: false
> +  - if:
> +      required:
> +        - rx-tx-swap
> +    then:
> +      properties:
> +        compatible:
> +          enum:
> +            - st,stm32f7-uart
> +            - st,stm32h7-uart
>  
>  required:
>    - compatible
>
Rob Herring (Arm) March 8, 2021, 7:20 p.m. UTC | #2
On Tue, Mar 02, 2021 at 08:03:02PM +0100, Martin Devera wrote:
> Add new rx-tx-swap property to allow for RX & TX pin swapping.

> 

> Signed-off-by: Martin Devera <devik@eaxlabs.cz>

> ---

>  .../devicetree/bindings/serial/st,stm32-uart.yaml  | 32 +++++++++++++++-------

>  1 file changed, 22 insertions(+), 10 deletions(-)

> 

> diff --git a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml

> index 8631678283f9..6eab2debebb5 100644

> --- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml

> +++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml

> @@ -9,9 +9,6 @@ maintainers:

>  

>  title: STMicroelectronics STM32 USART bindings

>  

> -allOf:

> -  - $ref: rs485.yaml

> -

>  properties:

>    compatible:

>      enum:

> @@ -40,6 +37,10 @@ properties:

>  

>    uart-has-rtscts: true

>  

> +  rx-tx-swap:

> +    type: boolean

> +    maxItems: 1


Type is boolean, but 'maxItems' applies to arrays.

In any case, this is already defined in serial.yaml, so just 
'rx-tx-swap: true' here.

> +

>    dmas:

>      minItems: 1

>      maxItems: 2

> @@ -66,13 +67,24 @@ properties:

>    linux,rs485-enabled-at-boot-time: true

>    rs485-rx-during-tx: true

>  

> -if:

> -  required:

> -    - st,hw-flow-ctrl

> -then:

> -  properties:

> -    cts-gpios: false

> -    rts-gpios: false

> +allOf:


And add '- $ref: serial.yaml#' here.

> +  - $ref: rs485.yaml

> +  - if:

> +      required:

> +        - st,hw-flow-ctrl

> +    then:

> +      properties:

> +        cts-gpios: false

> +        rts-gpios: false

> +  - if:

> +      required:

> +        - rx-tx-swap

> +    then:

> +      properties:

> +        compatible:

> +          enum:

> +            - st,stm32f7-uart

> +            - st,stm32h7-uart


The normal pattern is the 'if' has compatible. You can put the other 
compatible strings in the if, and then 'then' is:

then:
  properties:
    rx-tx-swap: false


Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
index 8631678283f9..6eab2debebb5 100644
--- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
@@ -9,9 +9,6 @@  maintainers:
 
 title: STMicroelectronics STM32 USART bindings
 
-allOf:
-  - $ref: rs485.yaml
-
 properties:
   compatible:
     enum:
@@ -40,6 +37,10 @@  properties:
 
   uart-has-rtscts: true
 
+  rx-tx-swap:
+    type: boolean
+    maxItems: 1
+
   dmas:
     minItems: 1
     maxItems: 2
@@ -66,13 +67,24 @@  properties:
   linux,rs485-enabled-at-boot-time: true
   rs485-rx-during-tx: true
 
-if:
-  required:
-    - st,hw-flow-ctrl
-then:
-  properties:
-    cts-gpios: false
-    rts-gpios: false
+allOf:
+  - $ref: rs485.yaml
+  - if:
+      required:
+        - st,hw-flow-ctrl
+    then:
+      properties:
+        cts-gpios: false
+        rts-gpios: false
+  - if:
+      required:
+        - rx-tx-swap
+    then:
+      properties:
+        compatible:
+          enum:
+            - st,stm32f7-uart
+            - st,stm32h7-uart
 
 required:
   - compatible