2020-02-03 17:16:59

by Benjamin GAIGNARD

[permalink] [raw]
Subject: [PATCH v2 1/2] dt-bindinsg: net: can: Convert can-transceiver to json-schema

Convert can-transceiver property to json-schema

Signed-off-by: Benjamin Gaignard <[email protected]>
---
.../bindings/net/can/can-transceiver.txt | 24 ----------------------
.../bindings/net/can/can-transceiver.yaml | 23 +++++++++++++++++++++
2 files changed, 23 insertions(+), 24 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/net/can/can-transceiver.txt
create mode 100644 Documentation/devicetree/bindings/net/can/can-transceiver.yaml

diff --git a/Documentation/devicetree/bindings/net/can/can-transceiver.txt b/Documentation/devicetree/bindings/net/can/can-transceiver.txt
deleted file mode 100644
index 0011f53ff159..000000000000
--- a/Documentation/devicetree/bindings/net/can/can-transceiver.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Generic CAN transceiver Device Tree binding
-------------------------------
-
-CAN transceiver typically limits the max speed in standard CAN and CAN FD
-modes. Typically these limitations are static and the transceivers themselves
-provide no way to detect this limitation at runtime. For this situation,
-the "can-transceiver" node can be used.
-
-Required Properties:
- max-bitrate: a positive non 0 value that determines the max
- speed that CAN/CAN-FD can run. Any other value
- will be ignored.
-
-Examples:
-
-Based on Texas Instrument's TCAN1042HGV CAN Transceiver
-
-m_can0 {
- ....
- can-transceiver {
- max-bitrate = <5000000>;
- };
- ...
-};
diff --git a/Documentation/devicetree/bindings/net/can/can-transceiver.yaml b/Documentation/devicetree/bindings/net/can/can-transceiver.yaml
new file mode 100644
index 000000000000..73bb084a45a8
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/can/can-transceiver.yaml
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/can-transceiver.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CAN transceiver Bindings
+
+description: CAN transceiver generic properties bindings
+
+maintainers:
+ - Rob Herring <[email protected]>
+
+properties:
+ can-transceiver:
+ type: object
+
+ properties:
+ max-bitrate:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: a positive non 0 value that determines the max speed that
+ CAN/CAN-FD can run.
+ minimum: 1
--
2.15.0


2020-02-06 20:48:00

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] dt-bindinsg: net: can: Convert can-transceiver to json-schema

On Mon, Feb 03, 2020 at 04:03:52PM +0100, Benjamin Gaignard wrote:
> Convert can-transceiver property to json-schema
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> .../bindings/net/can/can-transceiver.txt | 24 ----------------------
> .../bindings/net/can/can-transceiver.yaml | 23 +++++++++++++++++++++
> 2 files changed, 23 insertions(+), 24 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/net/can/can-transceiver.txt
> create mode 100644 Documentation/devicetree/bindings/net/can/can-transceiver.yaml
>
> diff --git a/Documentation/devicetree/bindings/net/can/can-transceiver.txt b/Documentation/devicetree/bindings/net/can/can-transceiver.txt
> deleted file mode 100644
> index 0011f53ff159..000000000000
> --- a/Documentation/devicetree/bindings/net/can/can-transceiver.txt
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -Generic CAN transceiver Device Tree binding
> -------------------------------
> -
> -CAN transceiver typically limits the max speed in standard CAN and CAN FD
> -modes. Typically these limitations are static and the transceivers themselves
> -provide no way to detect this limitation at runtime. For this situation,
> -the "can-transceiver" node can be used.
> -
> -Required Properties:
> - max-bitrate: a positive non 0 value that determines the max
> - speed that CAN/CAN-FD can run. Any other value
> - will be ignored.
> -
> -Examples:
> -
> -Based on Texas Instrument's TCAN1042HGV CAN Transceiver
> -
> -m_can0 {
> - ....
> - can-transceiver {
> - max-bitrate = <5000000>;
> - };
> - ...
> -};
> diff --git a/Documentation/devicetree/bindings/net/can/can-transceiver.yaml b/Documentation/devicetree/bindings/net/can/can-transceiver.yaml
> new file mode 100644
> index 000000000000..73bb084a45a8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/can/can-transceiver.yaml
> @@ -0,0 +1,23 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/can/can-transceiver.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: CAN transceiver Bindings
> +
> +description: CAN transceiver generic properties bindings
> +
> +maintainers:
> + - Rob Herring <[email protected]>
> +
> +properties:
> + can-transceiver:
> + type: object

I think we want to drop this (or define $nodename) and then do:

can-transceiver:
$ref: can-transceiver.yaml#

in the users.

> +
> + properties:
> + max-bitrate:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: a positive non 0 value that determines the max speed that
> + CAN/CAN-FD can run.
> + minimum: 1
> --
> 2.15.0
>