diff mbox series

[v2,2/4] dt-bindings: serial: uartlite: Add properties for synthesis-time parameters

Message ID 20210727221740.1997731-3-sean.anderson@seco.com
State Superseded
Headers show
Series tty: serial: uartlite: Disable changing fixed parameters | expand

Commit Message

Sean Anderson July 27, 2021, 10:17 p.m. UTC
The uartlite device is a "soft" device. Many parameters, such as baud
rate, data bits, and the presence of a parity bit are configured before
synthesis and may not be changed (or discovered) at runtime. However, we
must know what these settings are in order to properly calculate the
uart timeout (and to inform the user about the actual baud of the uart).

These properties are present for out-of-tree bindings generated by
Xilinx's tools. However, they are also (mostly) present in in-tree
bindings. I chose current-speed over xlnx,baudrate primarily because it
seemed to be used by more existing bindings. Although these properties
are marked as "required", note that only current-speed is required by
the driver itself. Hopefully, this will allow for an easier transition.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

(no changes since v1)

 .../bindings/serial/xlnx,opb-uartlite.yaml    | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

Comments

Rob Herring (Arm) Aug. 2, 2021, 9:24 p.m. UTC | #1
On Tue, Jul 27, 2021 at 06:17:38PM -0400, Sean Anderson wrote:
> The uartlite device is a "soft" device. Many parameters, such as baud

> rate, data bits, and the presence of a parity bit are configured before

> synthesis and may not be changed (or discovered) at runtime. However, we

> must know what these settings are in order to properly calculate the

> uart timeout (and to inform the user about the actual baud of the uart).

> 

> These properties are present for out-of-tree bindings generated by

> Xilinx's tools. However, they are also (mostly) present in in-tree

> bindings. I chose current-speed over xlnx,baudrate primarily because it

> seemed to be used by more existing bindings. Although these properties

> are marked as "required", note that only current-speed is required by

> the driver itself. Hopefully, this will allow for an easier transition.

> 

> Signed-off-by: Sean Anderson <sean.anderson@seco.com>

> ---

> 

> (no changes since v1)

> 

>  .../bindings/serial/xlnx,opb-uartlite.yaml    | 39 +++++++++++++++++++

>  1 file changed, 39 insertions(+)

> 

> diff --git a/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml b/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml

> index 4ef29784ae97..28859e70e60f 100644

> --- a/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml

> +++ b/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml

> @@ -32,13 +32,49 @@ properties:

>    clock-names:

>      const: s_axi_aclk

>  

> +  current-speed:

> +    $ref: /schemas/types.yaml#/definitions/uint32

> +    description:

> +      The fixed baud rate that the device was configured for.

> +

> +  xlnx,data-bits:

> +    $ref: /schemas/types.yaml#/definitions/uint32

> +    enum: [5, 6, 7, 8]

> +    default: 8


default with required doesn't make sense as 'default' what value is 
assumed in the property isn't present.

> +    description:

> +      The fixed number of data bits that the device was configured for.

> +

> +  xlnx,use-parity:

> +    $ref: /schemas/types.yaml#/definitions/uint32

> +    enum: [0, 1]

> +    default: 0

> +    description:

> +      Whether parity checking was enabled when the device was configured.

> +

> +  xlnx,odd-parity:

> +    $ref: /schemas/types.yaml#/definitions/uint32

> +    enum: [0, 1]

> +    description:

> +      Whether odd parity was configured.

> +

>  required:

>    - compatible

>    - reg

>    - interrupts

> +  - current-speed

> +  - xlnx,data-bits

> +  - xlnx,use-parity

>  

>  allOf:

>    - $ref: /schemas/serial.yaml#

> +  - if:

> +      properties:

> +        xlnx,use-parity:

> +          contains:

> +            const: 1

> +    then:

> +      required:

> +        - xlnx,odd-parity

>  

>  additionalProperties: true

>  

> @@ -49,5 +85,8 @@ examples:

>          reg = <0x800c0000 0x10000>;

>          interrupts = <0x0 0x6e 0x1>;

>          port-number = <0>;

> +        current-speed = <115200>;

> +        xlnx,data-bits = <8>;

> +        xlnx,use-parity = <0>;

>        };

>  ...

> -- 

> 2.25.1

> 

>
Sean Anderson Aug. 2, 2021, 9:50 p.m. UTC | #2
On 8/2/21 5:24 PM, Rob Herring wrote:
> On Tue, Jul 27, 2021 at 06:17:38PM -0400, Sean Anderson wrote:

>> The uartlite device is a "soft" device. Many parameters, such as baud

>> rate, data bits, and the presence of a parity bit are configured before

>> synthesis and may not be changed (or discovered) at runtime. However, we

>> must know what these settings are in order to properly calculate the

>> uart timeout (and to inform the user about the actual baud of the uart).

>> 

>> These properties are present for out-of-tree bindings generated by

>> Xilinx's tools. However, they are also (mostly) present in in-tree

>> bindings. I chose current-speed over xlnx,baudrate primarily because it

>> seemed to be used by more existing bindings. Although these properties

>> are marked as "required", note that only current-speed is required by

>> the driver itself. Hopefully, this will allow for an easier transition.

>> 

>> Signed-off-by: Sean Anderson <sean.anderson@seco.com>

>> ---

>> 

>> (no changes since v1)

>> 

>>  .../bindings/serial/xlnx,opb-uartlite.yaml    | 39 +++++++++++++++++++

>>  1 file changed, 39 insertions(+)

>> 

>> diff --git a/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml b/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml

>> index 4ef29784ae97..28859e70e60f 100644

>> --- a/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml

>> +++ b/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml

>> @@ -32,13 +32,49 @@ properties:

>>    clock-names:

>>      const: s_axi_aclk

>>  

>> +  current-speed:

>> +    $ref: /schemas/types.yaml#/definitions/uint32

>> +    description:

>> +      The fixed baud rate that the device was configured for.

>> +

>> +  xlnx,data-bits:

>> +    $ref: /schemas/types.yaml#/definitions/uint32

>> +    enum: [5, 6, 7, 8]

>> +    default: 8

> 

> default with required doesn't make sense as 'default' what value is

> assumed in the property isn't present.


Ok, will remove.

>> +    description:

>> +      The fixed number of data bits that the device was configured for.

>> +

>> +  xlnx,use-parity:

>> +    $ref: /schemas/types.yaml#/definitions/uint32

>> +    enum: [0, 1]

>> +    default: 0

>> +    description:

>> +      Whether parity checking was enabled when the device was configured.

>> +

>> +  xlnx,odd-parity:

>> +    $ref: /schemas/types.yaml#/definitions/uint32

>> +    enum: [0, 1]

>> +    description:

>> +      Whether odd parity was configured.

>> +

>>  required:

>>    - compatible

>>    - reg

>>    - interrupts

>> +  - current-speed

>> +  - xlnx,data-bits

>> +  - xlnx,use-parity

>>  

>>  allOf:

>>    - $ref: /schemas/serial.yaml#

>> +  - if:

>> +      properties:

>> +        xlnx,use-parity:

>> +          contains:

>> +            const: 1

>> +    then:

>> +      required:

>> +        - xlnx,odd-parity

>>  

>>  additionalProperties: true

>>  

>> @@ -49,5 +85,8 @@ examples:

>>          reg = <0x800c0000 0x10000>;

>>          interrupts = <0x0 0x6e 0x1>;

>>          port-number = <0>;

>> +        current-speed = <115200>;

>> +        xlnx,data-bits = <8>;

>> +        xlnx,use-parity = <0>;

>>        };

>>  ...

>> -- 

>> 2.25.1

>> 

>> 

>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml b/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml
index 4ef29784ae97..28859e70e60f 100644
--- a/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml
+++ b/Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.yaml
@@ -32,13 +32,49 @@  properties:
   clock-names:
     const: s_axi_aclk
 
+  current-speed:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      The fixed baud rate that the device was configured for.
+
+  xlnx,data-bits:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [5, 6, 7, 8]
+    default: 8
+    description:
+      The fixed number of data bits that the device was configured for.
+
+  xlnx,use-parity:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1]
+    default: 0
+    description:
+      Whether parity checking was enabled when the device was configured.
+
+  xlnx,odd-parity:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1]
+    description:
+      Whether odd parity was configured.
+
 required:
   - compatible
   - reg
   - interrupts
+  - current-speed
+  - xlnx,data-bits
+  - xlnx,use-parity
 
 allOf:
   - $ref: /schemas/serial.yaml#
+  - if:
+      properties:
+        xlnx,use-parity:
+          contains:
+            const: 1
+    then:
+      required:
+        - xlnx,odd-parity
 
 additionalProperties: true
 
@@ -49,5 +85,8 @@  examples:
         reg = <0x800c0000 0x10000>;
         interrupts = <0x0 0x6e 0x1>;
         port-number = <0>;
+        current-speed = <115200>;
+        xlnx,data-bits = <8>;
+        xlnx,use-parity = <0>;
       };
 ...