diff mbox series

[2/2] dt-bindings: nvmem: Convert Sunplus OCOTP to json-schema

Message ID 1635743712-25358-3-git-send-email-vincent.shih@sunplus.com
State Changes Requested, archived
Headers show
Series Add OTP driver for Sunplus SP7021 SoC | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 1 warnings, 123 lines checked

Commit Message

Vincent Shih Nov. 1, 2021, 5:15 a.m. UTC
Convert Sunplus OCOTP to json-schema

Signed-off-by: Vincent Shih <vincent.shih@sunplus.com>
---
 .../bindings/nvmem/sunplus,sp7021-ocotp.yaml       | 116 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 2 files changed, 117 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml

Comments

Rob Herring (Arm) Nov. 12, 2021, 3:33 p.m. UTC | #1
On Mon, Nov 01, 2021 at 01:15:12PM +0800, Vincent Shih wrote:
> Convert Sunplus OCOTP to json-schema
> 
> Signed-off-by: Vincent Shih <vincent.shih@sunplus.com>

Author and Sob emails don't match.

> ---
>  .../bindings/nvmem/sunplus,sp7021-ocotp.yaml       | 116 +++++++++++++++++++++
>  MAINTAINERS                                        |   1 +
>  2 files changed, 117 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
> 
> diff --git a/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml b/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
> new file mode 100644
> index 0000000..2d18f38
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
> @@ -0,0 +1,116 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +# Copyright (C) Sunplus Co., Ltd. 2021
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/nvmem/sunplus,sp7021-ocotp.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: On-Chip OTP Memory for Sunplus sp7021
> +
> +maintainers:
> +  - Vincent Shih <vincent.shih@sunplus.com>
> +
> +allOf:
> +  - $ref: "nvmem.yaml#"
> +
> +properties:
> +  compatible:
> +    const: sunplus,sp7021-ocotp
> +
> +  reg:
> +    maxItems: 2
> +
> +  reg-names:
> +    items:
> +      - const: hb_gpio
> +      - const: otprx
> +
> +  clocks:
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 1
> +
> +  therm_calib:

s/_/-/ in node names.

> +    type: object
> +    description: thermal calibration values

> +    properties:
> +      reg:
> +        maxItems: 1
> +
> +    required:
> +      - reg

You can drop 'reg' as nvmem.yaml should cover that.

> +
> +  mac_addr0:
> +    type: object
> +    description: MAC address of ethernet port 0
> +    properties:
> +      reg:
> +        maxItems: 1
> +
> +    required:
> +      - reg
> +
> +  mac_addr1:
> +    type: object
> +    description: MAC address of ethernet port 1
> +    properties:
> +      reg:
> +        maxItems: 1
> +
> +    required:
> +      - reg
> +
> +  disc_vol:
> +    type: object
> +    description: disconnect voltages of usb2 port 0 and port 1
> +    properties:
> +      reg:
> +        maxItems: 1
> +
> +    required:
> +      - reg
> +
> +required:
> +  - compatible
> +  - reg
> +  - reg-names
> +  - clocks
> +  - resets
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/sp-sp7021.h>
> +    #include <dt-bindings/reset/sp-sp7021.h>
> +
> +    otp: otp@9C00AF00 {

Lowercase hex for unit-address

> +        compatible = "sunplus,sp7021-ocotp";
> +        reg = <0x9C00AF00 0x34>, <0x9C00AF80 0x58>;
> +        reg-names = "hb_gpio", "otprx";
> +        clocks = <&clks OTPRX>;
> +        resets = <&rstc RST_OTPRX>;
> +
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        therm_calib: therm_calib@14 {
> +          reg = <0x14 0x3>;
> +        };
> +        mac_addr0: mac_addr0@34 {
> +          reg = <0x34 0x6>;
> +        };
> +        mac_addr1: mac_addr1@3A {

Here too. If nvmem.yaml is not checking this, it should be.

> +          reg = <0x3A 0x6>;
> +        };
> +        disc_vol: disc_vol@18 {

Sort nodes in order of unit-address.

> +          reg = <0x18 0x2>;
> +        };
> +    };
> +...
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b7df2f1..c0ccc95 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -17950,6 +17950,7 @@ F:	drivers/net/ethernet/dlink/sundance.c
>  SUNPLUS OCOTP DRIVER
>  M:	Vincent Shih <vincent.shih@sunplus.com>
>  S:	Maintained
> +F:	Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
>  F:	drivers/nvmem/sunplus-ocotp.c
>  F:	drivers/nvmem/sunplus-ocotp.h
>  F:	drivers/nvmem/sunplus-ocotp0.c
> -- 
> 2.7.4
> 
>
Vincent Shih 施錕鴻 Nov. 15, 2021, 7:25 a.m. UTC | #2
hello

> -----Original Message-----
> From: Rob Herring <robh@kernel.org>
> Sent: Friday, November 12, 2021 11:34 PM
> To: Vincent Shih <vincent.sunplus@gmail.com>
> Cc: srinivas.kandagatla@linaro.org; linux-kernel@vger.kernel.org; devicetree@vger.kernel.org; Vincent
> Shih 施錕鴻 <vincent.shih@sunplus.com>
> Subject: Re: [PATCH 2/2] dt-bindings: nvmem: Convert Sunplus OCOTP to json-schema
> 
> On Mon, Nov 01, 2021 at 01:15:12PM +0800, Vincent Shih wrote:
> > Convert Sunplus OCOTP to json-schema
> >
> > Signed-off-by: Vincent Shih <vincent.shih@sunplus.com>
> 
> Author and Sob emails don't match.
> 
> > ---
> >  .../bindings/nvmem/sunplus,sp7021-ocotp.yaml       | 116 +++++++++++++++++++++
> >  MAINTAINERS                                        |   1 +
> >  2 files changed, 117 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
> >
> > diff --git
> > a/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
> > b/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
> > new file mode 100644
> > index 0000000..2d18f38
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam
> > +++ l
> > @@ -0,0 +1,116 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # Copyright
> > +(C) Sunplus Co., Ltd. 2021 %YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/nvmem/sunplus,sp7021-ocotp.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: On-Chip OTP Memory for Sunplus sp7021
> > +
> > +maintainers:
> > +  - Vincent Shih <vincent.shih@sunplus.com>
> > +
> > +allOf:
> > +  - $ref: "nvmem.yaml#"
> > +
> > +properties:
> > +  compatible:
> > +    const: sunplus,sp7021-ocotp
> > +
> > +  reg:
> > +    maxItems: 2
> > +
> > +  reg-names:
> > +    items:
> > +      - const: hb_gpio
> > +      - const: otprx
> > +
> > +  clocks:
> > +    maxItems: 1
> > +
> > +  resets:
> > +    maxItems: 1
> > +
> > +  "#address-cells":
> > +    const: 1
> > +
> > +  "#size-cells":
> > +    const: 1
> > +
> > +  therm_calib:
> 
> s/_/-/ in node names.
> 
> > +    type: object
> > +    description: thermal calibration values
> 
> > +    properties:
> > +      reg:
> > +        maxItems: 1
> > +
> > +    required:
> > +      - reg
> 
> You can drop 'reg' as nvmem.yaml should cover that.
> 
> > +
> > +  mac_addr0:
> > +    type: object
> > +    description: MAC address of ethernet port 0
> > +    properties:
> > +      reg:
> > +        maxItems: 1
> > +
> > +    required:
> > +      - reg
> > +
> > +  mac_addr1:
> > +    type: object
> > +    description: MAC address of ethernet port 1
> > +    properties:
> > +      reg:
> > +        maxItems: 1
> > +
> > +    required:
> > +      - reg
> > +
> > +  disc_vol:
> > +    type: object
> > +    description: disconnect voltages of usb2 port 0 and port 1
> > +    properties:
> > +      reg:
> > +        maxItems: 1
> > +
> > +    required:
> > +      - reg
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - reg-names
> > +  - clocks
> > +  - resets
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/clock/sp-sp7021.h>
> > +    #include <dt-bindings/reset/sp-sp7021.h>
> > +
> > +    otp: otp@9C00AF00 {
> 
> Lowercase hex for unit-address
> 
> > +        compatible = "sunplus,sp7021-ocotp";
> > +        reg = <0x9C00AF00 0x34>, <0x9C00AF80 0x58>;
> > +        reg-names = "hb_gpio", "otprx";
> > +        clocks = <&clks OTPRX>;
> > +        resets = <&rstc RST_OTPRX>;
> > +
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +        therm_calib: therm_calib@14 {
> > +          reg = <0x14 0x3>;
> > +        };
> > +        mac_addr0: mac_addr0@34 {
> > +          reg = <0x34 0x6>;
> > +        };
> > +        mac_addr1: mac_addr1@3A {
> 
> Here too. If nvmem.yaml is not checking this, it should be.
> 
> > +          reg = <0x3A 0x6>;
> > +        };
> > +        disc_vol: disc_vol@18 {
> 
> Sort nodes in order of unit-address.
> 
> > +          reg = <0x18 0x2>;
> > +        };
> > +    };
> > +...
> > diff --git a/MAINTAINERS b/MAINTAINERS index b7df2f1..c0ccc95 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -17950,6 +17950,7 @@ F:	drivers/net/ethernet/dlink/sundance.c
> >  SUNPLUS OCOTP DRIVER
> >  M:	Vincent Shih <vincent.shih@sunplus.com>
> >  S:	Maintained
> > +F:	Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
> >  F:	drivers/nvmem/sunplus-ocotp.c
> >  F:	drivers/nvmem/sunplus-ocotp.h
> >  F:	drivers/nvmem/sunplus-ocotp0.c
> > --
> > 2.7.4
> >
> >

Refer to your comments, I modified the statements shown below
...
...
  thermal-calibration:
    type: object
    description: thermal calibration values

  disconnect-voltage:
    type: object
    description: disconnect voltages of usb2 port 0 and port 1

  mac-address0:
    type: object
    description: MAC address of ethernet port 0

  mac-address1:
    type: object
    description: MAC address of ethernet port 1

required:
  - compatible
  - reg
  - reg-names
  - clocks
  - resets

Examples:
  - |
    #include <dt-bindings/clock/sp-sp7021.h>
    #include <dt-bindings/reset/sp-sp7021.h>

    otp: otp@9c00af00 {
      compatible = "sunplus,sp7021-ocotp";
      reg = <0x9c00af00 0x34>, <0x9c00af80, 0x58>;
      reg-names = "hb_gpio", "otprx";
      clocks = <&clks OTPRX>;
      resets = <&rstc, RST_OTPRX>;

      #address-cells = <1>;
      #size-cells = <1>;
      therm_calib: thermal-calibration@14 {
        reg = <0x14 0x3>;
      }
      disc_vol: disconnect-voltage@18 {
        reg = <0x18 0x2>;
      }
      mac_addr0: mac-address0@34 {
        reg = <0x34 0x6>;
      }
      mac_addr1: mac-address1@3a {
        reg = <0x3a 0x6>;
      };
    };
...

Is that correct?
Thank you for your review !
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml b/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
new file mode 100644
index 0000000..2d18f38
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
@@ -0,0 +1,116 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/sunplus,sp7021-ocotp.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: On-Chip OTP Memory for Sunplus sp7021
+
+maintainers:
+  - Vincent Shih <vincent.shih@sunplus.com>
+
+allOf:
+  - $ref: "nvmem.yaml#"
+
+properties:
+  compatible:
+    const: sunplus,sp7021-ocotp
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: hb_gpio
+      - const: otprx
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+  therm_calib:
+    type: object
+    description: thermal calibration values
+    properties:
+      reg:
+        maxItems: 1
+
+    required:
+      - reg
+
+  mac_addr0:
+    type: object
+    description: MAC address of ethernet port 0
+    properties:
+      reg:
+        maxItems: 1
+
+    required:
+      - reg
+
+  mac_addr1:
+    type: object
+    description: MAC address of ethernet port 1
+    properties:
+      reg:
+        maxItems: 1
+
+    required:
+      - reg
+
+  disc_vol:
+    type: object
+    description: disconnect voltages of usb2 port 0 and port 1
+    properties:
+      reg:
+        maxItems: 1
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+
+    otp: otp@9C00AF00 {
+        compatible = "sunplus,sp7021-ocotp";
+        reg = <0x9C00AF00 0x34>, <0x9C00AF80 0x58>;
+        reg-names = "hb_gpio", "otprx";
+        clocks = <&clks OTPRX>;
+        resets = <&rstc RST_OTPRX>;
+
+        #address-cells = <1>;
+        #size-cells = <1>;
+        therm_calib: therm_calib@14 {
+          reg = <0x14 0x3>;
+        };
+        mac_addr0: mac_addr0@34 {
+          reg = <0x34 0x6>;
+        };
+        mac_addr1: mac_addr1@3A {
+          reg = <0x3A 0x6>;
+        };
+        disc_vol: disc_vol@18 {
+          reg = <0x18 0x2>;
+        };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index b7df2f1..c0ccc95 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17950,6 +17950,7 @@  F:	drivers/net/ethernet/dlink/sundance.c
 SUNPLUS OCOTP DRIVER
 M:	Vincent Shih <vincent.shih@sunplus.com>
 S:	Maintained
+F:	Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
 F:	drivers/nvmem/sunplus-ocotp.c
 F:	drivers/nvmem/sunplus-ocotp.h
 F:	drivers/nvmem/sunplus-ocotp0.c