diff mbox series

[V2,4/5] dt-bindings: serial: Convert MXS auart to json-schema

Message ID 1597222284-32609-4-git-send-email-Anson.Huang@nxp.com (mailing list archive)
State New, archived
Headers show
Series [V2,1/5] dt-bindings: clock: Update i.MX28 example | expand

Commit Message

Anson Huang Aug. 12, 2020, 8:51 a.m. UTC
Convert the MXS auart binding to DT schema format using json-schema.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
changes since V1:
	- update examples to align with i.MX23/i.MX28 clock bindings;
	- add minItem to clocks/clock-names property as i.MX23/i.MX28 have optional clocks
	  property with one item.
---
 .../devicetree/bindings/serial/fsl-mxs-auart.txt   | 53 -------------
 .../devicetree/bindings/serial/fsl-mxs-auart.yaml  | 91 ++++++++++++++++++++++
 2 files changed, 91 insertions(+), 53 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
 create mode 100644 Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml

Comments

Rob Herring Aug. 18, 2020, 2:17 a.m. UTC | #1
On Wed, Aug 12, 2020 at 04:51:23PM +0800, Anson Huang wrote:
> Convert the MXS auart binding to DT schema format using json-schema.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> changes since V1:
> 	- update examples to align with i.MX23/i.MX28 clock bindings;
> 	- add minItem to clocks/clock-names property as i.MX23/i.MX28 have optional clocks
> 	  property with one item.
> ---
>  .../devicetree/bindings/serial/fsl-mxs-auart.txt   | 53 -------------
>  .../devicetree/bindings/serial/fsl-mxs-auart.yaml  | 91 ++++++++++++++++++++++
>  2 files changed, 91 insertions(+), 53 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
>  create mode 100644 Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
> 
> diff --git a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
> deleted file mode 100644
> index 5c96d41..0000000
> --- a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
> +++ /dev/null
> @@ -1,53 +0,0 @@
> -* Freescale MXS Application UART (AUART)
> -
> -Required properties for all SoCs:
> -- compatible : Should be one of fallowing variants:
> -	"fsl,imx23-auart" - Freescale i.MX23
> -	"fsl,imx28-auart" - Freescale i.MX28
> -	"alphascale,asm9260-auart" - Alphascale ASM9260
> -- reg : Address and length of the register set for the device
> -- interrupts : Should contain the auart interrupt numbers
> -- dmas: DMA specifier, consisting of a phandle to DMA controller node
> -  and AUART DMA channel ID.
> -  Refer to dma.txt and fsl-mxs-dma.txt for details.
> -- dma-names: "rx" for RX channel, "tx" for TX channel.
> -
> -Required properties for "alphascale,asm9260-auart":
> -- clocks : the clocks feeding the watchdog timer. See clock-bindings.txt
> -- clock-names : should be set to
> -	"mod" - source for tick counter.
> -	"ahb" - ahb gate.
> -
> -Optional properties:
> -- uart-has-rtscts : Indicate the UART has RTS and CTS lines
> -  for hardware flow control,
> -	it also means you enable the DMA support for this UART.
> -- {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.
> -
> -Example:
> -auart0: serial@8006a000 {
> -	compatible = "fsl,imx28-auart", "fsl,imx23-auart";
> -	reg = <0x8006a000 0x2000>;
> -	interrupts = <112>;
> -	dmas = <&dma_apbx 8>, <&dma_apbx 9>;
> -	dma-names = "rx", "tx";
> -	cts-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
> -	dsr-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
> -	dcd-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
> -};
> -
> -Note: Each auart port should have an alias correctly numbered in "aliases"
> -node.
> -
> -Example:
> -
> -aliases {
> -	serial0 = &auart0;
> -	serial1 = &auart1;
> -	serial2 = &auart2;
> -	serial3 = &auart3;
> -	serial4 = &auart4;
> -};
> diff --git a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
> new file mode 100644
> index 0000000..5c4fa75
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
> @@ -0,0 +1,91 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/serial/fsl-mxs-auart.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Freescale MXS Application UART (AUART)
> +
> +maintainers:
> +  - Kumar Gala <galak@codeaurora.org>

Why is Kumar maintainer and that's a really old email address?

> +
> +allOf:
> +  - $ref: "serial.yaml"
> +
> +properties:
> +  compatible:
> +    enum:
> +      - fsl,imx23-auart
> +      - fsl,imx28-auart
> +      - alphascale,asm9260-auart
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  dmas:
> +    items:
> +      - description: DMA controller phandle and request line for RX
> +      - description: DMA controller phandle and request line for TX
> +
> +  dma-names:
> +    items:
> +      - const: rx
> +      - const: tx
> +
> +  clocks:
> +    items:
> +      - description: mod clock
> +      - description: ahb clock
> +    minItems: 1
> +
> +  clock-names:
> +    items:
> +      - const: mod
> +      - const: ahb
> +    minItems: 1
> +
> +  uart-has-rtscts: true
> +  rts-gpios: true
> +  cts-gpios: true
> +  dtr-gpios: true
> +  dsr-gpios: true
> +  rng-gpios: true
> +  dcd-gpios: true
> +
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - alphascale,asm9260-auart
> +then:
> +  required:
> +    - clocks
> +    - clock-names
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - dmas
> +  - dma-names
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    aliases {
> +        serial0 = &auart0;
> +    };
> +
> +    auart0: serial@8006a000 {
> +        compatible = "fsl,imx28-auart";
> +        reg = <0x8006a000 0x2000>;
> +        interrupts = <112>;
> +        dmas = <&dma_apbx 8>, <&dma_apbx 9>;
> +        dma-names = "rx", "tx";
> +        clocks = <&clks 45>;
> +    };
> -- 
> 2.7.4
>
Anson Huang Aug. 18, 2020, 3:08 a.m. UTC | #2
Hi, Rob


> Subject: Re: [PATCH V2 4/5] dt-bindings: serial: Convert MXS auart to
> json-schema
> 
> On Wed, Aug 12, 2020 at 04:51:23PM +0800, Anson Huang wrote:
> > Convert the MXS auart binding to DT schema format using json-schema.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> > changes since V1:
> > 	- update examples to align with i.MX23/i.MX28 clock bindings;
> > 	- add minItem to clocks/clock-names property as i.MX23/i.MX28 have
> optional clocks
> > 	  property with one item.
> > ---
> >  .../devicetree/bindings/serial/fsl-mxs-auart.txt   | 53 -------------
> >  .../devicetree/bindings/serial/fsl-mxs-auart.yaml  | 91
> > ++++++++++++++++++++++
> >  2 files changed, 91 insertions(+), 53 deletions(-)  delete mode
> > 100644 Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
> >  create mode 100644
> > Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
> >
> > diff --git
> > a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
> > b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
> > deleted file mode 100644
> > index 5c96d41..0000000
> > --- a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
> > +++ /dev/null
> > @@ -1,53 +0,0 @@
> > -* Freescale MXS Application UART (AUART)
> > -
> > -Required properties for all SoCs:
> > -- compatible : Should be one of fallowing variants:
> > -	"fsl,imx23-auart" - Freescale i.MX23
> > -	"fsl,imx28-auart" - Freescale i.MX28
> > -	"alphascale,asm9260-auart" - Alphascale ASM9260
> > -- reg : Address and length of the register set for the device
> > -- interrupts : Should contain the auart interrupt numbers
> > -- dmas: DMA specifier, consisting of a phandle to DMA controller node
> > -  and AUART DMA channel ID.
> > -  Refer to dma.txt and fsl-mxs-dma.txt for details.
> > -- dma-names: "rx" for RX channel, "tx" for TX channel.
> > -
> > -Required properties for "alphascale,asm9260-auart":
> > -- clocks : the clocks feeding the watchdog timer. See
> > clock-bindings.txt
> > -- clock-names : should be set to
> > -	"mod" - source for tick counter.
> > -	"ahb" - ahb gate.
> > -
> > -Optional properties:
> > -- uart-has-rtscts : Indicate the UART has RTS and CTS lines
> > -  for hardware flow control,
> > -	it also means you enable the DMA support for this UART.
> > -- {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.
> > -
> > -Example:
> > -auart0: serial@8006a000 {
> > -	compatible = "fsl,imx28-auart", "fsl,imx23-auart";
> > -	reg = <0x8006a000 0x2000>;
> > -	interrupts = <112>;
> > -	dmas = <&dma_apbx 8>, <&dma_apbx 9>;
> > -	dma-names = "rx", "tx";
> > -	cts-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
> > -	dsr-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
> > -	dcd-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
> > -};
> > -
> > -Note: Each auart port should have an alias correctly numbered in "aliases"
> > -node.
> > -
> > -Example:
> > -
> > -aliases {
> > -	serial0 = &auart0;
> > -	serial1 = &auart1;
> > -	serial2 = &auart2;
> > -	serial3 = &auart3;
> > -	serial4 = &auart4;
> > -};
> > diff --git
> > a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
> > b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
> > new file mode 100644
> > index 0000000..5c4fa75
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
> > @@ -0,0 +1,91 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
> > +---
> > +$id:
> > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
> >
> +cetree.org%2Fschemas%2Fserial%2Ffsl-mxs-auart.yaml%23&amp;data=02%7
> C0
> >
> +1%7CAnson.Huang%40nxp.com%7Cab0ecefb1f8a405a777608d8431ceba7%
> 7C686ea1
> >
> +d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637333138774276608&amp;
> sdata=0eW
> > +q1Lnvv2PJcAlS2IThb6DYy9x55jopNRcz%2Fa5YGgc%3D&amp;reserved=0
> > +$schema:
> > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
> >
> +cetree.org%2Fmeta-schemas%2Fcore.yaml%23&amp;data=02%7C01%7CAns
> on.Hua
> >
> +ng%40nxp.com%7Cab0ecefb1f8a405a777608d8431ceba7%7C686ea1d3bc2
> b4c6fa92
> >
> +cd99c5c301635%7C0%7C0%7C637333138774286606&amp;sdata=77AsG1n
> Q%2BFl9x0
> > +XStFm6xHXXAO4MNVrkLgezkHni57Y%3D&amp;reserved=0
> > +
> > +title: Freescale MXS Application UART (AUART)
> > +
> > +maintainers:
> > +  - Kumar Gala <galak@codeaurora.org>
> 
> Why is Kumar maintainer and that's a really old email address?

I finally found the fist patch of this binding doc, Kumar ONLY did the moving of the file to different
folder, I will update the mainatainer to Fabio in V3.

commit 1ea6607d4cdc917987e7e6cfaafc4a630d97a297
Author: Fabio Estevam <fabio.estevam@freescale.com>
Date:   Mon Jun 18 10:06:09 2012 -0300

    serial: mxs-auart: Allow device tree probing

    Allow device tree probing.

    Cc: Grant Likely <grant.likely@secretlab.ca>
    Cc: Rob Herring <rob.herring@calxeda.com>
    Cc: Alan Cox <alan@linux.intel.com>
    Cc: <linux-serial@vger.kernel.org>
    Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
    Signed-off-by: Subodh Nijsure <snijsure@grid-net.com>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Thanks,
Anson
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
deleted file mode 100644
index 5c96d41..0000000
--- a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
+++ /dev/null
@@ -1,53 +0,0 @@ 
-* Freescale MXS Application UART (AUART)
-
-Required properties for all SoCs:
-- compatible : Should be one of fallowing variants:
-	"fsl,imx23-auart" - Freescale i.MX23
-	"fsl,imx28-auart" - Freescale i.MX28
-	"alphascale,asm9260-auart" - Alphascale ASM9260
-- reg : Address and length of the register set for the device
-- interrupts : Should contain the auart interrupt numbers
-- dmas: DMA specifier, consisting of a phandle to DMA controller node
-  and AUART DMA channel ID.
-  Refer to dma.txt and fsl-mxs-dma.txt for details.
-- dma-names: "rx" for RX channel, "tx" for TX channel.
-
-Required properties for "alphascale,asm9260-auart":
-- clocks : the clocks feeding the watchdog timer. See clock-bindings.txt
-- clock-names : should be set to
-	"mod" - source for tick counter.
-	"ahb" - ahb gate.
-
-Optional properties:
-- uart-has-rtscts : Indicate the UART has RTS and CTS lines
-  for hardware flow control,
-	it also means you enable the DMA support for this UART.
-- {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.
-
-Example:
-auart0: serial@8006a000 {
-	compatible = "fsl,imx28-auart", "fsl,imx23-auart";
-	reg = <0x8006a000 0x2000>;
-	interrupts = <112>;
-	dmas = <&dma_apbx 8>, <&dma_apbx 9>;
-	dma-names = "rx", "tx";
-	cts-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
-	dsr-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
-	dcd-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
-};
-
-Note: Each auart port should have an alias correctly numbered in "aliases"
-node.
-
-Example:
-
-aliases {
-	serial0 = &auart0;
-	serial1 = &auart1;
-	serial2 = &auart2;
-	serial3 = &auart3;
-	serial4 = &auart4;
-};
diff --git a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
new file mode 100644
index 0000000..5c4fa75
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml
@@ -0,0 +1,91 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serial/fsl-mxs-auart.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale MXS Application UART (AUART)
+
+maintainers:
+  - Kumar Gala <galak@codeaurora.org>
+
+allOf:
+  - $ref: "serial.yaml"
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx23-auart
+      - fsl,imx28-auart
+      - alphascale,asm9260-auart
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  dmas:
+    items:
+      - description: DMA controller phandle and request line for RX
+      - description: DMA controller phandle and request line for TX
+
+  dma-names:
+    items:
+      - const: rx
+      - const: tx
+
+  clocks:
+    items:
+      - description: mod clock
+      - description: ahb clock
+    minItems: 1
+
+  clock-names:
+    items:
+      - const: mod
+      - const: ahb
+    minItems: 1
+
+  uart-has-rtscts: true
+  rts-gpios: true
+  cts-gpios: true
+  dtr-gpios: true
+  dsr-gpios: true
+  rng-gpios: true
+  dcd-gpios: true
+
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - alphascale,asm9260-auart
+then:
+  required:
+    - clocks
+    - clock-names
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - dmas
+  - dma-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    aliases {
+        serial0 = &auart0;
+    };
+
+    auart0: serial@8006a000 {
+        compatible = "fsl,imx28-auart";
+        reg = <0x8006a000 0x2000>;
+        interrupts = <112>;
+        dmas = <&dma_apbx 8>, <&dma_apbx 9>;
+        dma-names = "rx", "tx";
+        clocks = <&clks 45>;
+    };