diff mbox series

[v11,1/2] dt-bindings: mtd: Add Loongson-1 NAND Controller

Message ID 20241217-loongson1-nand-v11-1-b692c58988bb@gmail.com (mailing list archive)
State New
Headers show
Series Add support for Loongson-1 NAND | expand

Commit Message

Keguang Zhang via B4 Relay Dec. 17, 2024, 10:16 a.m. UTC
From: Keguang Zhang <keguang.zhang@gmail.com>

Add devicetree binding document for Loongson-1 NAND controller.

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
---
Changes in v11:
- Remove the requirement for 'nand-use-soft-ecc-engine' and 'nand-ecc-algo'.
- Add 'reg-names' to support DMA address.

Changes in v10:
- None

Changes in v9:
- Change the compatible to 'loongson,ls1*-nand-controller'.
- Rename the file to loongson,ls1b-nand-controller.yaml
- Some minor adjustments.

Changes in v8:
- Add a description part.
- Adjust the compatible because the match data for ls1c-nfc differs from ls1b-nfc.
- Mark 'nand-use-soft-ecc-engine' and 'nand-ecc-algo' as mandatory.
- Delete the superfluous blank lines.

Changes in v7:
- rename the file to loongson,ls1b-nfc.yaml

Changes in v6:
- A newly added patch
---
 .../mtd/loongson,ls1b-nand-controller.yaml         | 71 ++++++++++++++++++++++
 1 file changed, 71 insertions(+)

Comments

Krzysztof Kozlowski Dec. 18, 2024, 9:01 a.m. UTC | #1
On Tue, Dec 17, 2024 at 06:16:49PM +0800, Keguang Zhang wrote:
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - enum:
> +          - loongson,ls1b-nand-controller
> +          - loongson,ls1c-nand-controller
> +      - items:
> +          - enum:
> +              - loongson,ls1a-nand-controller
> +          - const: loongson,ls1b-nand-controller
> +
> +  reg:
> +    maxItems: 2
> +
> +  reg-names:
> +    items:
> +      - const: nand
> +      - const: nand-dma

Are you sure these are separate address spaces?
<0x1fe78000 0x24>, <0x1fe78040 0x4>
spacing/distance of !4 words...

Best regards,
Krzysztof
Keguang Zhang Dec. 18, 2024, 9:31 a.m. UTC | #2
On Wed, Dec 18, 2024 at 5:01 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On Tue, Dec 17, 2024 at 06:16:49PM +0800, Keguang Zhang wrote:
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - enum:
> > +          - loongson,ls1b-nand-controller
> > +          - loongson,ls1c-nand-controller
> > +      - items:
> > +          - enum:
> > +              - loongson,ls1a-nand-controller
> > +          - const: loongson,ls1b-nand-controller
> > +
> > +  reg:
> > +    maxItems: 2
> > +
> > +  reg-names:
> > +    items:
> > +      - const: nand
> > +      - const: nand-dma
>
> Are you sure these are separate address spaces?
> <0x1fe78000 0x24>, <0x1fe78040 0x4>
> spacing/distance of !4 words...
>
Sure. That’s exactly what the user manual states.

> Best regards,
> Krzysztof
>



--
Best regards,

Keguang Zhang
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1b-nand-controller.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nand-controller.yaml
new file mode 100644
index 000000000000..f6530d64dc54
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nand-controller.yaml
@@ -0,0 +1,71 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/loongson,ls1b-nand-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson-1 NAND Controller
+
+maintainers:
+  - Keguang Zhang <keguang.zhang@gmail.com>
+
+description:
+  The Loongson-1 NAND controller abstracts all supported operations,
+  meaning it does not support low-level access to raw NAND flash chips.
+  Moreover, the controller is paired with the DMA engine to perform
+  READ and PROGRAM functions.
+
+allOf:
+  - $ref: nand-controller.yaml
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - loongson,ls1b-nand-controller
+          - loongson,ls1c-nand-controller
+      - items:
+          - enum:
+              - loongson,ls1a-nand-controller
+          - const: loongson,ls1b-nand-controller
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: nand
+      - const: nand-dma
+
+  dmas:
+    maxItems: 1
+
+  dma-names:
+    const: rxtx
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - dmas
+  - dma-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    nand-controller@1fe78000 {
+        compatible = "loongson,ls1b-nand-controller";
+        reg = <0x1fe78000 0x24>, <0x1fe78040 0x4>;
+        reg-names = "nand", "nand-dma";
+        dmas = <&dma 0>;
+        dma-names = "rxtx";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        nand@0 {
+            reg = <0>;
+            nand-use-soft-ecc-engine;
+            nand-ecc-algo = "hamming";
+        };
+    };