diff mbox series

[1/2] dt-bindings: mtd: nuvoton,ma35d1-nand: add new bindings

Message ID 20240812030045.20831-2-hpchen0nvt@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add support for nuvoton ma35 nand controller | expand

Commit Message

Hui-Ping Chen Aug. 12, 2024, 3 a.m. UTC
Add dt-bindings for the Nuvoton MA35 SoC NAND Controller.

Signed-off-by: Hui-Ping Chen <hpchen0nvt@gmail.com>
---
 .../bindings/mtd/nuvoton,ma35d1-nand.yaml     | 97 +++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml

Comments

Krzysztof Kozlowski Aug. 12, 2024, 6:25 a.m. UTC | #1
On 12/08/2024 05:00, Hui-Ping Chen wrote:
> Add dt-bindings for the Nuvoton MA35 SoC NAND Controller.
> 
> Signed-off-by: Hui-Ping Chen <hpchen0nvt@gmail.com>
> ---
>  .../bindings/mtd/nuvoton,ma35d1-nand.yaml     | 97 +++++++++++++++++++
>  1 file changed, 97 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml b/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml
> new file mode 100644
> index 000000000000..988c43bc6e99
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml
> @@ -0,0 +1,97 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mtd/nuvoton,ma35d1-nand.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Nuvoton MA35D1 NAND Flash Interface (NFI) Controller
> +
> +allOf:
> +  - $ref: nand-controller.yaml#

allOf goes usually just before properties.

> +
> +maintainers:
> +  - Hui-Ping Chen <hpchen0nvt@gmail.com>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - nuvoton,ma35d1-nand
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    minItems: 1

This cannot be min only. It's unconstrained. maxItems instead. There is
no existing code like this so this should make you wonder...

> +
> +patternProperties:
> +  "^nand@[a-f0-9]$":
> +    type: object
> +    $ref: raw-nand-chip.yaml
> +    properties:
> +      nand-ecc-mode:
> +        const: hw

No, drop the property. It does not make sense to have it const.
Compatible defines it.

> +
> +      nand-ecc-step-size:
> +        enum: [512, 1024]

No defaults? So is this required?

> +
> +      nand-ecc-strength:
> +        enum: [8, 12, 24]

No defaults? So is this required?

> +
> +      nand-bus-width:
> +        const: 8

Drop property.

> +
> +    unevaluatedProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/clock/nuvoton,ma35d1-clk.h>
> +
> +    soc {
> +        #address-cells = <2>;
> +        #size-cells = <2>;
> +
> +        nand-controller@401A0000 {
> +            compatible = "nuvoton,ma35d1-nand";
> +            reg = <0x0 0x401A0000 0x0 0x1000>;
> +            interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
> +            clocks = <&clk NAND_GATE>;
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +
> +            nand@0 {
> +                reg = <0>;
> +
> +                nand-on-flash-bbt;
> +                nand-ecc-mode = "hw";

Drop

> +                nand-ecc-step-size = <512>;
> +                nand-ecc-strength = <8>;
> +                nand-bus-width = <8>;

Drop

> +
> +                partitions {
> +                    compatible = "fixed-partitions";
> +                    #address-cells = <1>;
> +                    #size-cells = <1>;
> +
> +                    uboot@0 {
> +                        label = "nand-uboot";
> +                        read-only;
> +                        reg = <0x0 0x300000>;
> +                    };
> +                };
> +            };
> +        };
> +    };
> +
> +...

Best regards,
Krzysztof
Hui-Ping Chen Aug. 12, 2024, 9:02 a.m. UTC | #2
Dear Krzysztof,

Thank you for your reply.



On 2024/8/12 下午 02:25, Krzysztof Kozlowski wrote:
> On 12/08/2024 05:00, Hui-Ping Chen wrote:
>> Add dt-bindings for the Nuvoton MA35 SoC NAND Controller.
>>
>> Signed-off-by: Hui-Ping Chen <hpchen0nvt@gmail.com>
>> ---
>>   .../bindings/mtd/nuvoton,ma35d1-nand.yaml     | 97 +++++++++++++++++++
>>   1 file changed, 97 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml b/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml
>> new file mode 100644
>> index 000000000000..988c43bc6e99
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml
>> @@ -0,0 +1,97 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/mtd/nuvoton,ma35d1-nand.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Nuvoton MA35D1 NAND Flash Interface (NFI) Controller
>> +
>> +allOf:
>> +  - $ref: nand-controller.yaml#
> allOf goes usually just before properties.

Okay. I will modify this order.



>> +
>> +maintainers:
>> +  - Hui-Ping Chen <hpchen0nvt@gmail.com>
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - nuvoton,ma35d1-nand
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  clocks:
>> +    minItems: 1
> This cannot be min only. It's unconstrained. maxItems instead. There is
> no existing code like this so this should make you wonder...

Yes, it should be `maxItems`. I will correct this mistake.



>> +
>> +patternProperties:
>> +  "^nand@[a-f0-9]$":
>> +    type: object
>> +    $ref: raw-nand-chip.yaml
>> +    properties:
>> +      nand-ecc-mode:
>> +        const: hw
> No, drop the property. It does not make sense to have it const.
> Compatible defines it.

Okay. I will remove it.



>> +
>> +      nand-ecc-step-size:
>> +        enum: [512, 1024]
> No defaults? So is this required?

This is required, but I will also add a default.



>> +
>> +      nand-ecc-strength:
>> +        enum: [8, 12, 24]
> No defaults? So is this required?

This is required, but I will also add a default.



>> +
>> +      nand-bus-width:
>> +        const: 8
> Drop property.

Okay. I will remove it.



>> +
>> +    unevaluatedProperties: false
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +  - clocks
>> +
>> +unevaluatedProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
>> +    #include <dt-bindings/clock/nuvoton,ma35d1-clk.h>
>> +
>> +    soc {
>> +        #address-cells = <2>;
>> +        #size-cells = <2>;
>> +
>> +        nand-controller@401A0000 {
>> +            compatible = "nuvoton,ma35d1-nand";
>> +            reg = <0x0 0x401A0000 0x0 0x1000>;
>> +            interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
>> +            clocks = <&clk NAND_GATE>;
>> +            #address-cells = <1>;
>> +            #size-cells = <0>;
>> +
>> +            nand@0 {
>> +                reg = <0>;
>> +
>> +                nand-on-flash-bbt;
>> +                nand-ecc-mode = "hw";
> Drop

Okay. I will remove it.



>> +                nand-ecc-step-size = <512>;
>> +                nand-ecc-strength = <8>;
>> +                nand-bus-width = <8>;
> Drop

Okay. I will remove it.



>> +
>> +                partitions {
>> +                    compatible = "fixed-partitions";
>> +                    #address-cells = <1>;
>> +                    #size-cells = <1>;
>> +
>> +                    uboot@0 {
>> +                        label = "nand-uboot";
>> +                        read-only;
>> +                        reg = <0x0 0x300000>;
>> +                    };
>> +                };
>> +            };
>> +        };
>> +    };
>> +
>> +...
> Best regards,
> Krzysztof


Best regards,

Hui-Ping Chen
Krzysztof Kozlowski Aug. 12, 2024, 9:12 a.m. UTC | #3
On 12/08/2024 11:02, Hui-Ping Chen wrote:
> 
> 
>>> +
>>> +      nand-ecc-step-size:
>>> +        enum: [512, 1024]
>> No defaults? So is this required?
> 
> This is required, but I will also add a default.

If this is required and should be in required: list. Default does not
make sense then... it contradicts the point of being required.

> 
> 
> 
>>> +
>>> +      nand-ecc-strength:
>>> +        enum: [8, 12, 24]
>> No defaults? So is this required?
> 
> This is required, but I will also add a default.

Ditto


Best regards,
Krzysztof
Hui-Ping Chen Aug. 12, 2024, 9:39 a.m. UTC | #4
Dear Krzysztof,

Thank you for your reply.



On 2024/8/12 下午 05:12, Krzysztof Kozlowski wrote:
> On 12/08/2024 11:02, Hui-Ping Chen wrote:
>>
>>>> +
>>>> +      nand-ecc-step-size:
>>>> +        enum: [512, 1024]
>>> No defaults? So is this required?
>> This is required, but I will also add a default.
> If this is required and should be in required: list. Default does not
> make sense then... it contradicts the point of being required.

I will add it to the required list.



>>
>>
>>>> +
>>>> +      nand-ecc-strength:
>>>> +        enum: [8, 12, 24]
>>> No defaults? So is this required?
>> This is required, but I will also add a default.
> Ditto

I will add it to the required list.



>
> Best regards,
> Krzysztof


Best regards,

Hui-Ping Chen
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml b/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml
new file mode 100644
index 000000000000..988c43bc6e99
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/nuvoton,ma35d1-nand.yaml
@@ -0,0 +1,97 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/nuvoton,ma35d1-nand.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton MA35D1 NAND Flash Interface (NFI) Controller
+
+allOf:
+  - $ref: nand-controller.yaml#
+
+maintainers:
+  - Hui-Ping Chen <hpchen0nvt@gmail.com>
+
+properties:
+  compatible:
+    enum:
+      - nuvoton,ma35d1-nand
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+
+patternProperties:
+  "^nand@[a-f0-9]$":
+    type: object
+    $ref: raw-nand-chip.yaml
+    properties:
+      nand-ecc-mode:
+        const: hw
+
+      nand-ecc-step-size:
+        enum: [512, 1024]
+
+      nand-ecc-strength:
+        enum: [8, 12, 24]
+
+      nand-bus-width:
+        const: 8
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/nuvoton,ma35d1-clk.h>
+
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        nand-controller@401A0000 {
+            compatible = "nuvoton,ma35d1-nand";
+            reg = <0x0 0x401A0000 0x0 0x1000>;
+            interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
+            clocks = <&clk NAND_GATE>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            nand@0 {
+                reg = <0>;
+
+                nand-on-flash-bbt;
+                nand-ecc-mode = "hw";
+                nand-ecc-step-size = <512>;
+                nand-ecc-strength = <8>;
+                nand-bus-width = <8>;
+
+                partitions {
+                    compatible = "fixed-partitions";
+                    #address-cells = <1>;
+                    #size-cells = <1>;
+
+                    uboot@0 {
+                        label = "nand-uboot";
+                        read-only;
+                        reg = <0x0 0x300000>;
+                    };
+                };
+            };
+        };
+    };
+
+...