diff mbox series

[1/5] dt-bindings: mtd: samsung-onenand: Add new binding

Message ID CY4PR04MB05678FDFC8BF8B15174ED639CBF69@CY4PR04MB0567.namprd04.prod.outlook.com
State New
Headers show
Series [1/5] dt-bindings: mtd: samsung-onenand: Add new binding | expand

Commit Message

Jonathan Bakker April 23, 2022, 3:45 a.m. UTC
Add a yaml binding document for the Samsung OneNAND controller.
It is found in several older Samsung SoC, notably the S5PV210.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
 .../bindings/mtd/samsung,onenand.yaml         | 89 +++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/samsung,onenand.yaml

Comments

Krzysztof Kozlowski April 24, 2022, 10:58 a.m. UTC | #1
On 23/04/2022 05:45, Jonathan Bakker wrote:
> Add a yaml binding document for the Samsung OneNAND controller.
> It is found in several older Samsung SoC, notably the S5PV210.
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> ---
>  .../bindings/mtd/samsung,onenand.yaml         | 89 +++++++++++++++++++
>  1 file changed, 89 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mtd/samsung,onenand.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mtd/samsung,onenand.yaml b/Documentation/devicetree/bindings/mtd/samsung,onenand.yaml
> new file mode 100644
> index 000000000000..25012248add6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mtd/samsung,onenand.yaml
> @@ -0,0 +1,89 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mtd/samsung,onenand.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Samsung OneNAND controller
> +
> +maintainers:
> +  - Jonathan Bakker <xc-racer2@live.ca>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - samsung,s3c6400-onenand
> +      - samsung,s3c6410-onenand
> +      - samsung,s5pv210-onenand
> +
> +  reg:
> +    maxItems: 3

Please describe the items or add reg-names.

> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clock-names:
> +    items:
> +      - const: bus
> +      - const: onenand
> +
> +  clocks:
> +    minItems: 2
> +    maxItems: 2

Drop minItems.

> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0

Don't need these, they come from nand-controller.

> +
> +allOf:
> +  - $ref: nand-controller.yaml
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - samsung,s5pv210-onenand
> +    then:
> +      required:
> +        - interrupts
> +        - clock-names
> +        - clocks

Others require it as well, don't they?

> +
> +patternProperties:
> +  "^nand@[a-f0-9]+$":
> +    type: object
> +    properties:
> +      reg:
> +        minimum: 0
> +        maximum: 1
> +
> +    additionalProperties: false

Also not needed.

> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false

With dropping all duplicated properties from nand-controller, this can
be unevaluatedProperties:false. Unless for some reason parts of
nand-controller schema are not valid here?

> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/s5pv210.h>
> +    onenand: nand-controller@b0600000 {
> +        compatible = "samsung,s5pv210-onenand";
> +        reg = <0xb0600000 0x2000>,
> +          <0xb0000000 0x20000>,
> +          <0xb0040000 0x20000>;

Align the entries with first <> entry.

> +        interrupt-parent = <&vic1>;
> +        interrupts = <31>;
> +        clocks = <&clocks CLK_NANDXL>, <&clocks DOUT_FLASH>;
> +        clock-names = "bus", "onenand";
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        nand@0 {
> +          reg = <0>;
> +        };
> +    };


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mtd/samsung,onenand.yaml b/Documentation/devicetree/bindings/mtd/samsung,onenand.yaml
new file mode 100644
index 000000000000..25012248add6
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/samsung,onenand.yaml
@@ -0,0 +1,89 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/samsung,onenand.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung OneNAND controller
+
+maintainers:
+  - Jonathan Bakker <xc-racer2@live.ca>
+
+properties:
+  compatible:
+    enum:
+      - samsung,s3c6400-onenand
+      - samsung,s3c6410-onenand
+      - samsung,s5pv210-onenand
+
+  reg:
+    maxItems: 3
+
+  interrupts:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: bus
+      - const: onenand
+
+  clocks:
+    minItems: 2
+    maxItems: 2
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+allOf:
+  - $ref: nand-controller.yaml
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - samsung,s5pv210-onenand
+    then:
+      required:
+        - interrupts
+        - clock-names
+        - clocks
+
+patternProperties:
+  "^nand@[a-f0-9]+$":
+    type: object
+    properties:
+      reg:
+        minimum: 0
+        maximum: 1
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/s5pv210.h>
+    onenand: nand-controller@b0600000 {
+        compatible = "samsung,s5pv210-onenand";
+        reg = <0xb0600000 0x2000>,
+          <0xb0000000 0x20000>,
+          <0xb0040000 0x20000>;
+        interrupt-parent = <&vic1>;
+        interrupts = <31>;
+        clocks = <&clocks CLK_NANDXL>, <&clocks DOUT_FLASH>;
+        clock-names = "bus", "onenand";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        nand@0 {
+          reg = <0>;
+        };
+    };