[v2,2/5] dt-bindings: serial: Convert sprd-uart to json-schema
diff mbox series

Message ID 20191111090230.3402-3-chunyan.zhang@unisoc.com
State Accepted
Headers show
Series
  • Add Unisoc's SC9863A support
Related show

Checks

Context Check Description
robh/dt-meta-schema fail build log
robh/checkpatch warning "total: 0 errors, 2 warnings, 69 lines checked"

Commit Message

Chunyan Zhang Nov. 11, 2019, 9:02 a.m. UTC
Convert the sprd-uart binding to DT schema using json-schema.

Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
 .../devicetree/bindings/serial/sprd-uart.txt  | 32 ---------
 .../devicetree/bindings/serial/sprd-uart.yaml | 69 +++++++++++++++++++
 2 files changed, 69 insertions(+), 32 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/sprd-uart.txt
 create mode 100644 Documentation/devicetree/bindings/serial/sprd-uart.yaml

Comments

Rob Herring Nov. 14, 2019, 8:52 p.m. UTC | #1
On Mon, Nov 11, 2019 at 05:02:27PM +0800, Chunyan Zhang wrote:
> 
> Convert the sprd-uart binding to DT schema using json-schema.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---
>  .../devicetree/bindings/serial/sprd-uart.txt  | 32 ---------
>  .../devicetree/bindings/serial/sprd-uart.yaml | 69 +++++++++++++++++++
>  2 files changed, 69 insertions(+), 32 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/serial/sprd-uart.txt
>  create mode 100644 Documentation/devicetree/bindings/serial/sprd-uart.yaml
> 
> diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.txt b/Documentation/devicetree/bindings/serial/sprd-uart.txt
> deleted file mode 100644
> index 9607dc616205..000000000000
> --- a/Documentation/devicetree/bindings/serial/sprd-uart.txt
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -* Spreadtrum serial UART
> -
> -Required properties:
> -- compatible: must be one of:
> -  * "sprd,sc9836-uart"
> -  * "sprd,sc9860-uart", "sprd,sc9836-uart"
> -
> -- reg: offset and length of the register set for the device
> -- interrupts: exactly one interrupt specifier
> -- clock-names: Should contain following entries:
> -  "enable" for UART module enable clock,
> -  "uart" for UART clock,
> -  "source" for UART source (parent) clock.
> -- clocks: Should contain a clock specifier for each entry in clock-names.
> -  UART clock and source clock are optional properties, but enable clock
> -  is required.
> -
> -Optional properties:
> -- dma-names: Should contain "rx" for receive and "tx" for transmit channels.
> -- dmas: A list of dma specifiers, one for each entry in dma-names.
> -
> -Example:
> -	uart0: serial@0 {
> -		compatible = "sprd,sc9860-uart",
> -			     "sprd,sc9836-uart";
> -		reg = <0x0 0x100>;
> -		interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
> -		dma-names = "rx", "tx";
> -		dmas = <&ap_dma 19>, <&ap_dma 20>;
> -		clock-names = "enable", "uart", "source";
> -		clocks = <&clk_ap_apb_gates 9>, <&clk_uart0>, <&ext_26m>;
> -	};
> diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.yaml b/Documentation/devicetree/bindings/serial/sprd-uart.yaml
> new file mode 100644
> index 000000000000..0cc4668a9b9c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/serial/sprd-uart.yaml
> @@ -0,0 +1,69 @@
> +# SPDX-License-Identifier: GPL-2.0

Dual license please. If you are okay with that on both patches, I can 
fix them and apply patches 1-4.

Rob
Chunyan Zhang Nov. 15, 2019, 1:34 a.m. UTC | #2
On Fri, 15 Nov 2019 at 04:52, Rob Herring <robh@kernel.org> wrote:
>
> On Mon, Nov 11, 2019 at 05:02:27PM +0800, Chunyan Zhang wrote:
> >
> > Convert the sprd-uart binding to DT schema using json-schema.
> >
> > Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> > ---
> >  .../devicetree/bindings/serial/sprd-uart.txt  | 32 ---------
> >  .../devicetree/bindings/serial/sprd-uart.yaml | 69 +++++++++++++++++++
> >  2 files changed, 69 insertions(+), 32 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/serial/sprd-uart.txt
> >  create mode 100644 Documentation/devicetree/bindings/serial/sprd-uart.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.txt b/Documentation/devicetree/bindings/serial/sprd-uart.txt
> > deleted file mode 100644
> > index 9607dc616205..000000000000
> > --- a/Documentation/devicetree/bindings/serial/sprd-uart.txt
> > +++ /dev/null
> > @@ -1,32 +0,0 @@
> > -* Spreadtrum serial UART
> > -
> > -Required properties:
> > -- compatible: must be one of:
> > -  * "sprd,sc9836-uart"
> > -  * "sprd,sc9860-uart", "sprd,sc9836-uart"
> > -
> > -- reg: offset and length of the register set for the device
> > -- interrupts: exactly one interrupt specifier
> > -- clock-names: Should contain following entries:
> > -  "enable" for UART module enable clock,
> > -  "uart" for UART clock,
> > -  "source" for UART source (parent) clock.
> > -- clocks: Should contain a clock specifier for each entry in clock-names.
> > -  UART clock and source clock are optional properties, but enable clock
> > -  is required.
> > -
> > -Optional properties:
> > -- dma-names: Should contain "rx" for receive and "tx" for transmit channels.
> > -- dmas: A list of dma specifiers, one for each entry in dma-names.
> > -
> > -Example:
> > -     uart0: serial@0 {
> > -             compatible = "sprd,sc9860-uart",
> > -                          "sprd,sc9836-uart";
> > -             reg = <0x0 0x100>;
> > -             interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
> > -             dma-names = "rx", "tx";
> > -             dmas = <&ap_dma 19>, <&ap_dma 20>;
> > -             clock-names = "enable", "uart", "source";
> > -             clocks = <&clk_ap_apb_gates 9>, <&clk_uart0>, <&ext_26m>;
> > -     };
> > diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.yaml b/Documentation/devicetree/bindings/serial/sprd-uart.yaml
> > new file mode 100644
> > index 000000000000..0cc4668a9b9c
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/serial/sprd-uart.yaml
> > @@ -0,0 +1,69 @@
> > +# SPDX-License-Identifier: GPL-2.0
>
> Dual license please. If you are okay with that on both patches, I can
> fix them and apply patches 1-4.

Sure, thanks for your help.

Chunyan

>
> Rob
Rob Herring Nov. 15, 2019, 1:49 a.m. UTC | #3
On Thu, Nov 14, 2019 at 7:35 PM Chunyan Zhang <zhang.lyra@gmail.com> wrote:
>
> On Fri, 15 Nov 2019 at 04:52, Rob Herring <robh@kernel.org> wrote:
> >
> > On Mon, Nov 11, 2019 at 05:02:27PM +0800, Chunyan Zhang wrote:
> > >
> > > Convert the sprd-uart binding to DT schema using json-schema.
> > >
> > > Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> > > ---
> > >  .../devicetree/bindings/serial/sprd-uart.txt  | 32 ---------
> > >  .../devicetree/bindings/serial/sprd-uart.yaml | 69 +++++++++++++++++++
> > >  2 files changed, 69 insertions(+), 32 deletions(-)
> > >  delete mode 100644 Documentation/devicetree/bindings/serial/sprd-uart.txt
> > >  create mode 100644 Documentation/devicetree/bindings/serial/sprd-uart.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.txt b/Documentation/devicetree/bindings/serial/sprd-uart.txt
> > > deleted file mode 100644
> > > index 9607dc616205..000000000000
> > > --- a/Documentation/devicetree/bindings/serial/sprd-uart.txt
> > > +++ /dev/null
> > > @@ -1,32 +0,0 @@
> > > -* Spreadtrum serial UART
> > > -
> > > -Required properties:
> > > -- compatible: must be one of:
> > > -  * "sprd,sc9836-uart"
> > > -  * "sprd,sc9860-uart", "sprd,sc9836-uart"
> > > -
> > > -- reg: offset and length of the register set for the device
> > > -- interrupts: exactly one interrupt specifier
> > > -- clock-names: Should contain following entries:
> > > -  "enable" for UART module enable clock,
> > > -  "uart" for UART clock,
> > > -  "source" for UART source (parent) clock.
> > > -- clocks: Should contain a clock specifier for each entry in clock-names.
> > > -  UART clock and source clock are optional properties, but enable clock
> > > -  is required.
> > > -
> > > -Optional properties:
> > > -- dma-names: Should contain "rx" for receive and "tx" for transmit channels.
> > > -- dmas: A list of dma specifiers, one for each entry in dma-names.
> > > -
> > > -Example:
> > > -     uart0: serial@0 {
> > > -             compatible = "sprd,sc9860-uart",
> > > -                          "sprd,sc9836-uart";
> > > -             reg = <0x0 0x100>;
> > > -             interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
> > > -             dma-names = "rx", "tx";
> > > -             dmas = <&ap_dma 19>, <&ap_dma 20>;
> > > -             clock-names = "enable", "uart", "source";
> > > -             clocks = <&clk_ap_apb_gates 9>, <&clk_uart0>, <&ext_26m>;
> > > -     };
> > > diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.yaml b/Documentation/devicetree/bindings/serial/sprd-uart.yaml
> > > new file mode 100644
> > > index 000000000000..0cc4668a9b9c
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/serial/sprd-uart.yaml
> > > @@ -0,0 +1,69 @@
> > > +# SPDX-License-Identifier: GPL-2.0
> >
> > Dual license please. If you are okay with that on both patches, I can
> > fix them and apply patches 1-4.
>
> Sure, thanks for your help.

Thanks. Patches 1-4 applied.

Rob
Chunyan Zhang Nov. 15, 2019, 11:14 a.m. UTC | #4
Hi Rob,

On Mon, 11 Nov 2019 at 17:03, Chunyan Zhang <chunyan.zhang@unisoc.com> wrote:

[cut]

> +
> +examples:
> +  - |
> +    serial@0 {
> +      compatible = "sprd,sc9860-uart", "sprd,sc9836-uart";
> +      reg = <0x0 0x100>;
> +      interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;

Seems this setence cannot pass dt_binding_check, it need to be changed to:
interrupts = <0 2 4>;

Do you need me to send another patch, or you can help to fix that on
your tree :)

Thanks,
Chunyan
Rob Herring Nov. 15, 2019, 1:31 p.m. UTC | #5
On Fri, Nov 15, 2019 at 5:15 AM Chunyan Zhang <zhang.lyra@gmail.com> wrote:
>
> Hi Rob,
>
> On Mon, 11 Nov 2019 at 17:03, Chunyan Zhang <chunyan.zhang@unisoc.com> wrote:
>
> [cut]
>
> > +
> > +examples:
> > +  - |
> > +    serial@0 {
> > +      compatible = "sprd,sc9860-uart", "sprd,sc9836-uart";
> > +      reg = <0x0 0x100>;
> > +      interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
>
> Seems this setence cannot pass dt_binding_check, it need to be changed to:
> interrupts = <0 2 4>;
>
> Do you need me to send another patch, or you can help to fix that on
> your tree :)

I've fixed it up. You need the include file.

Rob

Patch
diff mbox series

diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.txt b/Documentation/devicetree/bindings/serial/sprd-uart.txt
deleted file mode 100644
index 9607dc616205..000000000000
--- a/Documentation/devicetree/bindings/serial/sprd-uart.txt
+++ /dev/null
@@ -1,32 +0,0 @@ 
-* Spreadtrum serial UART
-
-Required properties:
-- compatible: must be one of:
-  * "sprd,sc9836-uart"
-  * "sprd,sc9860-uart", "sprd,sc9836-uart"
-
-- reg: offset and length of the register set for the device
-- interrupts: exactly one interrupt specifier
-- clock-names: Should contain following entries:
-  "enable" for UART module enable clock,
-  "uart" for UART clock,
-  "source" for UART source (parent) clock.
-- clocks: Should contain a clock specifier for each entry in clock-names.
-  UART clock and source clock are optional properties, but enable clock
-  is required.
-
-Optional properties:
-- dma-names: Should contain "rx" for receive and "tx" for transmit channels.
-- dmas: A list of dma specifiers, one for each entry in dma-names.
-
-Example:
-	uart0: serial@0 {
-		compatible = "sprd,sc9860-uart",
-			     "sprd,sc9836-uart";
-		reg = <0x0 0x100>;
-		interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
-		dma-names = "rx", "tx";
-		dmas = <&ap_dma 19>, <&ap_dma 20>;
-		clock-names = "enable", "uart", "source";
-		clocks = <&clk_ap_apb_gates 9>, <&clk_uart0>, <&ext_26m>;
-	};
diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.yaml b/Documentation/devicetree/bindings/serial/sprd-uart.yaml
new file mode 100644
index 000000000000..0cc4668a9b9c
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/sprd-uart.yaml
@@ -0,0 +1,69 @@ 
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2019 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/serial/sprd-uart.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Spreadtrum serial UART
+
+maintainers:
+  - Orson Zhai <orsonzhai@gmail.com>
+  - Baolin Wang <baolin.wang7@gmail.com>
+  - Chunyan Zhang <zhang.lyra@gmail.com>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - sprd,sc9860-uart
+          - const: sprd,sc9836-uart
+      - const: sprd,sc9836-uart
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+    maxItems: 3
+
+  clock-names:
+    description: "enable" for UART module enable clock, "uart" for UART
+      clock, "source" for UART source (parent) clock.
+    items:
+      - const: enable
+      - const: uart
+      - const: source
+
+  dmas:
+    minItems: 1
+    maxItems: 2
+
+  dma-names:
+    minItems: 1
+    items:
+      - const: rx
+      - const: tx
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    serial@0 {
+      compatible = "sprd,sc9860-uart", "sprd,sc9836-uart";
+      reg = <0x0 0x100>;
+      interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+      dma-names = "rx", "tx";
+      dmas = <&ap_dma 19>, <&ap_dma 20>;
+      clock-names = "enable", "uart", "source";
+      clocks = <&clk_ap_apb_gates 9>, <&clk_uart0>, <&ext_26m>;
+    };
+
+...