From: Keguang Zhang <keguang.zhang@gmail.com>
Add devicetree binding document for Loongson-1 NAND Controller.
Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
---
Changes in v6:
- A newly added patch
---
.../devicetree/bindings/mtd/loongson,ls1x-nfc.yaml | 66 ++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml
new file mode 100644
index 000000000000..2494c7b3b506
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/loongson,ls1x-nfc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson-1 NAND Controller
+
+maintainers:
+ - Keguang Zhang <keguang.zhang@gmail.com>
+
+allOf:
+ - $ref: nand-controller.yaml
+
+properties:
+ compatible:
+ oneOf:
+ - const: loongson,ls1b-nfc
+ - items:
+ - enum:
+ - loongson,ls1a-nfc
+ - loongson,ls1c-nfc
+ - const: loongson,ls1b-nfc
+
+ reg:
+ maxItems: 1
+
+ dmas:
+ maxItems: 1
+
+ dma-names:
+ const: rxtx
+
+patternProperties:
+ "^nand@[0-3]$":
+ type: object
+ $ref: raw-nand-chip.yaml
+
+ unevaluatedProperties: false
+
+required:
+ - compatible
+ - reg
+ - dmas
+ - dma-names
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ nand-controller@1fe78000 {
+ compatible = "loongson,ls1b-nfc";
+ reg = <0x1fe78000 0x40>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ dmas = <&dma 0>;
+ dma-names = "rxtx";
+
+ nand@0 {
+ reg = <0>;
+ nand-use-soft-ecc-engine;
+ nand-ecc-algo = "hamming";
+ };
+ };
--
2.40.1
On Wed, Mar 27, 2024 at 06:43:59PM +0800, Keguang Zhang via B4 Relay wrote:
> From: Keguang Zhang <keguang.zhang@gmail.com>
>
> Add devicetree binding document for Loongson-1 NAND Controller.
>
> Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> ---
> Changes in v6:
> - A newly added patch
> ---
> .../devicetree/bindings/mtd/loongson,ls1x-nfc.yaml | 66 ++++++++++++++++++++++
> 1 file changed, 66 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml
> new file mode 100644
> index 000000000000..2494c7b3b506
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml
> @@ -0,0 +1,66 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mtd/loongson,ls1x-nfc.yaml#
Please make the filename match the compatible.
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Loongson-1 NAND Controller
> +
> +maintainers:
> + - Keguang Zhang <keguang.zhang@gmail.com>
> +
> +allOf:
> + - $ref: nand-controller.yaml
> +
> +properties:
> + compatible:
> + oneOf:
> + - const: loongson,ls1b-nfc
> + - items:
> + - enum:
> + - loongson,ls1a-nfc
> + - loongson,ls1c-nfc
> + - const: loongson,ls1b-nfc
> +
> + reg:
> + maxItems: 1
> +
> + dmas:
> + maxItems: 1
> +
> + dma-names:
> + const: rxtx
If you only have one dma, why do you need a dma-names entry for it?
Looks fine to me otherwise though,
COnor.
> +
> +patternProperties:
> + "^nand@[0-3]$":
> + type: object
> + $ref: raw-nand-chip.yaml
> +
> + unevaluatedProperties: false
> +
> +required:
> + - compatible
> + - reg
> + - dmas
> + - dma-names
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + nand-controller@1fe78000 {
> + compatible = "loongson,ls1b-nfc";
> + reg = <0x1fe78000 0x40>;
> +
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + dmas = <&dma 0>;
> + dma-names = "rxtx";
> +
> + nand@0 {
> + reg = <0>;
> + nand-use-soft-ecc-engine;
> + nand-ecc-algo = "hamming";
> + };
> + };
>
> --
> 2.40.1
>
>
On Thu, Mar 28, 2024 at 12:23 AM Conor Dooley <conor@kernel.org> wrote:
>
> On Wed, Mar 27, 2024 at 06:43:59PM +0800, Keguang Zhang via B4 Relay wrote:
> > From: Keguang Zhang <keguang.zhang@gmail.com>
> >
> > Add devicetree binding document for Loongson-1 NAND Controller.
> >
> > Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> > ---
> > Changes in v6:
> > - A newly added patch
> > ---
> > .../devicetree/bindings/mtd/loongson,ls1x-nfc.yaml | 66 ++++++++++++++++++++++
> > 1 file changed, 66 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml
> > new file mode 100644
> > index 000000000000..2494c7b3b506
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml
> > @@ -0,0 +1,66 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/mtd/loongson,ls1x-nfc.yaml#
>
> Please make the filename match the compatible.
>
Got it. I'll rename it to loongson,ls1-nfc.yaml and change the
compatible as follows.
compatible:
items:
- enum:
- loongson,ls1a-nfc
- loongson,ls1b-nfc
- loongson,ls1c-nfc
- const: loongson,ls1-nfc
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Loongson-1 NAND Controller
> > +
> > +maintainers:
> > + - Keguang Zhang <keguang.zhang@gmail.com>
> > +
> > +allOf:
> > + - $ref: nand-controller.yaml
> > +
> > +properties:
> > + compatible:
> > + oneOf:
> > + - const: loongson,ls1b-nfc
> > + - items:
> > + - enum:
> > + - loongson,ls1a-nfc
> > + - loongson,ls1c-nfc
> > + - const: loongson,ls1b-nfc
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + dmas:
> > + maxItems: 1
> > +
> > + dma-names:
> > + const: rxtx
>
> If you only have one dma, why do you need a dma-names entry for it?
>
Without "dma-names", the following error will come out when doing
dt_binding_check.
nand-controller@1fe78000: 'dma-names' is a required property
In addition, loongson1_nand.c calls dma_request_chan(). Then
dma_request_chan() calls of_dma_request_slave_channel(), in which the
'dma-names' is necessary.
struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
const char *name)
{
...
count = of_property_count_strings(np, "dma-names");
if (count < 0) {
pr_err("%s: dma-names property of node '%pOF' missing
or empty\n",
__func__, np);
return ERR_PTR(-ENODEV);
}
...
}
Thanks for your review!
> Looks fine to me otherwise though,
> COnor.
>
> > +
> > +patternProperties:
> > + "^nand@[0-3]$":
> > + type: object
> > + $ref: raw-nand-chip.yaml
> > +
> > + unevaluatedProperties: false
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - dmas
> > + - dma-names
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > + - |
> > + nand-controller@1fe78000 {
> > + compatible = "loongson,ls1b-nfc";
> > + reg = <0x1fe78000 0x40>;
> > +
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > +
> > + dmas = <&dma 0>;
> > + dma-names = "rxtx";
> > +
> > + nand@0 {
> > + reg = <0>;
> > + nand-use-soft-ecc-engine;
> > + nand-ecc-algo = "hamming";
> > + };
> > + };
> >
> > --
> > 2.40.1
> >
> >
--
Best regards,
Keguang Zhang
On Thu, Mar 28, 2024 at 04:54:59PM +0800, Keguang Zhang wrote: > On Thu, Mar 28, 2024 at 12:23 AM Conor Dooley <conor@kernel.org> wrote: > > > > On Wed, Mar 27, 2024 at 06:43:59PM +0800, Keguang Zhang via B4 Relay wrote: > > > From: Keguang Zhang <keguang.zhang@gmail.com> > > > > > > Add devicetree binding document for Loongson-1 NAND Controller. > > > > > > Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com> > > > --- > > > Changes in v6: > > > - A newly added patch > > > --- > > > .../devicetree/bindings/mtd/loongson,ls1x-nfc.yaml | 66 ++++++++++++++++++++++ > > > 1 file changed, 66 insertions(+) > > > > > > diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml > > > new file mode 100644 > > > index 000000000000..2494c7b3b506 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/mtd/loongson,ls1x-nfc.yaml > > > @@ -0,0 +1,66 @@ > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/mtd/loongson,ls1x-nfc.yaml# > > > > Please make the filename match the compatible. > > > Got it. I'll rename it to loongson,ls1-nfc.yaml and change the > compatible as follows. > compatible: > items: > - enum: > - loongson,ls1a-nfc > - loongson,ls1b-nfc > - loongson,ls1c-nfc > - const: loongson,ls1-nfc No, please do not do this. Just call the file "ls1b-nfc". Thanks, Conor.
© 2016 - 2026 Red Hat, Inc.