diff mbox series

dt-bindings: nvmem: Convert UniPhier eFuse bindings to json-schema

Message ID 1624413058-17338-1-git-send-email-hayashi.kunihiko@socionext.com
State Superseded
Headers show
Series dt-bindings: nvmem: Convert UniPhier eFuse bindings to json-schema | expand

Commit Message

Kunihiko Hayashi June 23, 2021, 1:50 a.m. UTC
Convert the UniPhier eFuse binding to DT schema format.

Cc: Keiji Hayashibara <hayashibara.keiji@socionext.com>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

---
 .../bindings/nvmem/socionext,uniphier-efuse.yaml   | 109 +++++++++++++++++++++
 .../devicetree/bindings/nvmem/uniphier-efuse.txt   |  49 ---------
 2 files changed, 109 insertions(+), 49 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml
 delete mode 100644 Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt

-- 
2.7.4

Comments

Rob Herring (Arm) July 14, 2021, 6:59 p.m. UTC | #1
On Wed, Jun 23, 2021 at 10:50:58AM +0900, Kunihiko Hayashi wrote:
> Convert the UniPhier eFuse binding to DT schema format.

> 

> Cc: Keiji Hayashibara <hayashibara.keiji@socionext.com>

> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

> ---

>  .../bindings/nvmem/socionext,uniphier-efuse.yaml   | 109 +++++++++++++++++++++

>  .../devicetree/bindings/nvmem/uniphier-efuse.txt   |  49 ---------

>  2 files changed, 109 insertions(+), 49 deletions(-)

>  create mode 100644 Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml

>  delete mode 100644 Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt

> 

> diff --git a/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml b/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml

> new file mode 100644

> index 0000000..e03c1ed

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml

> @@ -0,0 +1,109 @@

> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

> +%YAML 1.2

> +---

> +$id: http://devicetree.org/schemas/nvmem/socionext,uniphier-efuse.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> +

> +title: Socionext UniPhier eFuse bindings

> +

> +maintainers:

> +  - Keiji Hayashibara <hayashibara.keiji@socionext.com>

> +  - Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

> +

> +allOf:

> +  - $ref: "nvmem.yaml#"

> +

> +properties:

> +  "#address-cells": true

> +  "#size-cells": true

> +

> +  compatible:

> +    const: socionext,uniphier-efuse

> +

> +  reg:

> +    maxItems: 1

> +

> +patternProperties:

> +  "^.*@[0-9a-f]+,[0-9]+$":


nvmem.yaml has a different definition. Though it doesn't handle 
overlapping addresses. You should extend nvmem.yaml like you have here. 
The last part should be optional though.

> +    type: object

> +

> +    properties:

> +      reg:

> +        maxItems: 1

> +

> +      bits:

> +        maxItems: 1

> +

> +    required:

> +      - reg


All this is already defined in nvmem.yaml.

> +

> +required:

> +  - compatible

> +  - reg

> +

> +additionalProperties: false


Use 'unevaluatedProperties: false' and then you don't need to redefine 
anything common here.

> +

> +examples:

> +  - |

> +    // The UniPhier eFuse should be a subnode of a "soc-glue" node.

> +

> +    soc-glue@5f900000 {

> +        compatible = "simple-mfd";

> +        #address-cells = <1>;

> +        #size-cells = <1>;

> +        ranges = <0x0 0x5f900000 0x2000>;

> +

> +        efuse@100 {

> +            compatible = "socionext,uniphier-efuse";

> +            reg = <0x100 0x28>;

> +        };

> +

> +        efuse@200 {

> +            compatible = "socionext,uniphier-efuse";

> +            reg = <0x200 0x68>;

> +            #address-cells = <1>;

> +            #size-cells = <1>;

> +

> +            /* Data cells */

> +            usb_rterm0: trim@54,4 {

> +                reg = <0x54 1>;

> +                bits = <4 2>;

> +            };

> +            usb_rterm1: trim@55,4 {

> +                reg = <0x55 1>;

> +                bits = <4 2>;

> +            };

> +            usb_rterm2: trim@58,4 {

> +                reg = <0x58 1>;

> +                bits = <4 2>;

> +            };

> +            usb_rterm3: trim@59,4 {

> +                reg = <0x59 1>;

> +                bits = <4 2>;

> +            };

> +            usb_sel_t0: trim@54,0 {

> +                reg = <0x54 1>;

> +                bits = <0 4>;

> +            };

> +            usb_sel_t1: trim@55,0 {

> +                reg = <0x55 1>;

> +                bits = <0 4>;

> +            };

> +            usb_sel_t2: trim@58,0 {

> +                reg = <0x58 1>;

> +                bits = <0 4>;

> +            };

> +            usb_sel_t3: trim@59,0 {

> +                reg = <0x59 1>;

> +                bits = <0 4>;

> +            };

> +            usb_hs_i0: trim@56,0 {

> +                reg = <0x56 1>;

> +                bits = <0 4>;

> +            };

> +            usb_hs_i2: trim@5a,0 {

> +                reg = <0x5a 1>;

> +                bits = <0 4>;

> +            };

> +        };

> +    };

> diff --git a/Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt b/Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt

> deleted file mode 100644

> index eccf490..0000000

> --- a/Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt

> +++ /dev/null

> @@ -1,49 +0,0 @@

> -= UniPhier eFuse device tree bindings =

> -

> -This UniPhier eFuse must be under soc-glue.

> -

> -Required properties:

> -- compatible: should be "socionext,uniphier-efuse"

> -- reg: should contain the register location and length

> -

> -= Data cells =

> -Are child nodes of efuse, bindings of which as described in

> -bindings/nvmem/nvmem.txt

> -

> -Example:

> -

> -	soc-glue@5f900000 {

> -		compatible = "socionext,uniphier-ld20-soc-glue-debug",

> -			     "simple-mfd";

> -		#address-cells = <1>;

> -		#size-cells = <1>;

> -		ranges = <0x0 0x5f900000 0x2000>;

> -

> -		efuse@100 {

> -			compatible = "socionext,uniphier-efuse";

> -			reg = <0x100 0x28>;

> -		};

> -

> -		efuse@200 {

> -			compatible = "socionext,uniphier-efuse";

> -			reg = <0x200 0x68>;

> -			#address-cells = <1>;

> -			#size-cells = <1>;

> -

> -			/* Data cells */

> -			usb_mon: usb-mon@54 {

> -				reg = <0x54 0xc>;

> -			};

> -		};

> -	};

> -

> -= Data consumers =

> -Are device nodes which consume nvmem data cells.

> -

> -Example:

> -

> -	usb {

> -		...

> -		nvmem-cells = <&usb_mon>;

> -		nvmem-cell-names = "usb_mon";

> -	}

> -- 

> 2.7.4

> 

>
Kunihiko Hayashi July 16, 2021, 10:34 a.m. UTC | #2
Hi Rob,
Thank you for checking.

On 2021/07/15 3:59, Rob Herring wrote:
> On Wed, Jun 23, 2021 at 10:50:58AM +0900, Kunihiko Hayashi wrote:

>> Convert the UniPhier eFuse binding to DT schema format.

>>

>> Cc: Keiji Hayashibara <hayashibara.keiji@socionext.com>

>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

>> ---

>>   .../bindings/nvmem/socionext,uniphier-efuse.yaml   | 109 +++++++++++++++++++++

>>   .../devicetree/bindings/nvmem/uniphier-efuse.txt   |  49 ---------

>>   2 files changed, 109 insertions(+), 49 deletions(-)

>>   create mode 100644 Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml

>>   delete mode 100644 Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt

>>

>> diff --git a/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml b/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml

>> new file mode 100644

>> index 0000000..e03c1ed

>> --- /dev/null

>> +++ b/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml

>> @@ -0,0 +1,109 @@

>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

>> +%YAML 1.2

>> +---

>> +$id: http://devicetree.org/schemas/nvmem/socionext,uniphier-efuse.yaml#

>> +$schema: http://devicetree.org/meta-schemas/core.yaml#

>> +

>> +title: Socionext UniPhier eFuse bindings

>> +

>> +maintainers:

>> +  - Keiji Hayashibara <hayashibara.keiji@socionext.com>

>> +  - Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

>> +

>> +allOf:

>> +  - $ref: "nvmem.yaml#"

>> +

>> +properties:

>> +  "#address-cells": true

>> +  "#size-cells": true

>> +

>> +  compatible:

>> +    const: socionext,uniphier-efuse

>> +

>> +  reg:

>> +    maxItems: 1

>> +

>> +patternProperties:

>> +  "^.*@[0-9a-f]+,[0-9]+$":

> 

> nvmem.yaml has a different definition. Though it doesn't handle

> overlapping addresses. You should extend nvmem.yaml like you have here.

> The last part should be optional though.


I understand. I'll try to expand the optional pattern to nvmem.yaml.

>> +    type: object

>> +

>> +    properties:

>> +      reg:

>> +        maxItems: 1

>> +

>> +      bits:

>> +        maxItems: 1

>> +

>> +    required:

>> +      - reg

> 

> All this is already defined in nvmem.yaml.


I see. I'll remove them.

>> +

>> +required:

>> +  - compatible

>> +  - reg

>> +

>> +additionalProperties: false

> 

> Use 'unevaluatedProperties: false' and then you don't need to redefine

> anything common here.


Okay, I'll use this keyword for that.

Thank you,

---
Best Regards
Kunihiko Hayashi
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml b/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml
new file mode 100644
index 0000000..e03c1ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml
@@ -0,0 +1,109 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/socionext,uniphier-efuse.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Socionext UniPhier eFuse bindings
+
+maintainers:
+  - Keiji Hayashibara <hayashibara.keiji@socionext.com>
+  - Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
+
+allOf:
+  - $ref: "nvmem.yaml#"
+
+properties:
+  "#address-cells": true
+  "#size-cells": true
+
+  compatible:
+    const: socionext,uniphier-efuse
+
+  reg:
+    maxItems: 1
+
+patternProperties:
+  "^.*@[0-9a-f]+,[0-9]+$":
+    type: object
+
+    properties:
+      reg:
+        maxItems: 1
+
+      bits:
+        maxItems: 1
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    // The UniPhier eFuse should be a subnode of a "soc-glue" node.
+
+    soc-glue@5f900000 {
+        compatible = "simple-mfd";
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges = <0x0 0x5f900000 0x2000>;
+
+        efuse@100 {
+            compatible = "socionext,uniphier-efuse";
+            reg = <0x100 0x28>;
+        };
+
+        efuse@200 {
+            compatible = "socionext,uniphier-efuse";
+            reg = <0x200 0x68>;
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            /* Data cells */
+            usb_rterm0: trim@54,4 {
+                reg = <0x54 1>;
+                bits = <4 2>;
+            };
+            usb_rterm1: trim@55,4 {
+                reg = <0x55 1>;
+                bits = <4 2>;
+            };
+            usb_rterm2: trim@58,4 {
+                reg = <0x58 1>;
+                bits = <4 2>;
+            };
+            usb_rterm3: trim@59,4 {
+                reg = <0x59 1>;
+                bits = <4 2>;
+            };
+            usb_sel_t0: trim@54,0 {
+                reg = <0x54 1>;
+                bits = <0 4>;
+            };
+            usb_sel_t1: trim@55,0 {
+                reg = <0x55 1>;
+                bits = <0 4>;
+            };
+            usb_sel_t2: trim@58,0 {
+                reg = <0x58 1>;
+                bits = <0 4>;
+            };
+            usb_sel_t3: trim@59,0 {
+                reg = <0x59 1>;
+                bits = <0 4>;
+            };
+            usb_hs_i0: trim@56,0 {
+                reg = <0x56 1>;
+                bits = <0 4>;
+            };
+            usb_hs_i2: trim@5a,0 {
+                reg = <0x5a 1>;
+                bits = <0 4>;
+            };
+        };
+    };
diff --git a/Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt b/Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt
deleted file mode 100644
index eccf490..0000000
--- a/Documentation/devicetree/bindings/nvmem/uniphier-efuse.txt
+++ /dev/null
@@ -1,49 +0,0 @@ 
-= UniPhier eFuse device tree bindings =
-
-This UniPhier eFuse must be under soc-glue.
-
-Required properties:
-- compatible: should be "socionext,uniphier-efuse"
-- reg: should contain the register location and length
-
-= Data cells =
-Are child nodes of efuse, bindings of which as described in
-bindings/nvmem/nvmem.txt
-
-Example:
-
-	soc-glue@5f900000 {
-		compatible = "socionext,uniphier-ld20-soc-glue-debug",
-			     "simple-mfd";
-		#address-cells = <1>;
-		#size-cells = <1>;
-		ranges = <0x0 0x5f900000 0x2000>;
-
-		efuse@100 {
-			compatible = "socionext,uniphier-efuse";
-			reg = <0x100 0x28>;
-		};
-
-		efuse@200 {
-			compatible = "socionext,uniphier-efuse";
-			reg = <0x200 0x68>;
-			#address-cells = <1>;
-			#size-cells = <1>;
-
-			/* Data cells */
-			usb_mon: usb-mon@54 {
-				reg = <0x54 0xc>;
-			};
-		};
-	};
-
-= Data consumers =
-Are device nodes which consume nvmem data cells.
-
-Example:
-
-	usb {
-		...
-		nvmem-cells = <&usb_mon>;
-		nvmem-cell-names = "usb_mon";
-	}