diff mbox series

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

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

Commit Message

Keguang Zhang via B4 Relay Aug. 8, 2024, 11:22 a.m. UTC
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 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
---
 .../devicetree/bindings/mtd/loongson,ls1b-nfc.yaml | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)

Comments

Conor Dooley Aug. 8, 2024, 3:37 p.m. UTC | #1
On Thu, Aug 08, 2024 at 07:22:19PM +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 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
> ---
>  .../devicetree/bindings/mtd/loongson,ls1b-nfc.yaml | 75 ++++++++++++++++++++++
>  1 file changed, 75 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml
> new file mode 100644
> index 000000000000..7ce335324a29
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml

When I first read "nfc" here I thought it was a copy-paste mistake, as
"nfc" is a technology of it's own. I think it would make sense to rename
to "loongson,ls1b-nand-controller" etc to remove that sort of confusion.
These devices might not implement NFC, but what's to say that a future
device will not?

Cheers,
Conor.

> @@ -0,0 +1,75 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mtd/loongson,ls1b-nfc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Loongson-1 NAND Controller
> +
> +maintainers:
> +  - Keguang Zhang <keguang.zhang@gmail.com>
> +
> +description: |

This | is not needed.

> +  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-nfc
> +          - loongson,ls1c-nfc
> +      - items:
> +          - enum:
> +              - loongson,ls1a-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
> +
> +    required:
> +      - nand-use-soft-ecc-engine
> +      - nand-ecc-algo
> +
> +    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.43.0
> 
>
Keguang Zhang Aug. 9, 2024, 6:47 a.m. UTC | #2
On Thu, Aug 8, 2024 at 11:37 PM Conor Dooley <conor@kernel.org> wrote:
>
> On Thu, Aug 08, 2024 at 07:22:19PM +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 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
> > ---
> >  .../devicetree/bindings/mtd/loongson,ls1b-nfc.yaml | 75 ++++++++++++++++++++++
> >  1 file changed, 75 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml
> > new file mode 100644
> > index 000000000000..7ce335324a29
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml
>
> When I first read "nfc" here I thought it was a copy-paste mistake, as
> "nfc" is a technology of it's own. I think it would make sense to rename
> to "loongson,ls1b-nand-controller" etc to remove that sort of confusion.
> These devices might not implement NFC, but what's to say that a future
> device will not?
>
Sorry for the confusion.
The string "loongson,ls1b-nand-controller" might be too long.
May I rename it to "loongson,ls1b-nand"?

> Cheers,
> Conor.
>
> > @@ -0,0 +1,75 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/mtd/loongson,ls1b-nfc.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Loongson-1 NAND Controller
> > +
> > +maintainers:
> > +  - Keguang Zhang <keguang.zhang@gmail.com>
> > +
> > +description: |
>
> This | is not needed.
>
Will remove |.
Thanks!

> > +  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-nfc
> > +          - loongson,ls1c-nfc
> > +      - items:
> > +          - enum:
> > +              - loongson,ls1a-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
> > +
> > +    required:
> > +      - nand-use-soft-ecc-engine
> > +      - nand-ecc-algo
> > +
> > +    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.43.0
> >
> >



--
Best regards,

Keguang Zhang
Conor Dooley Aug. 9, 2024, 2:49 p.m. UTC | #3
On Fri, Aug 09, 2024 at 02:47:53PM +0800, Keguang Zhang wrote:
> On Thu, Aug 8, 2024 at 11:37 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > On Thu, Aug 08, 2024 at 07:22:19PM +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 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
> > > ---
> > >  .../devicetree/bindings/mtd/loongson,ls1b-nfc.yaml | 75 ++++++++++++++++++++++
> > >  1 file changed, 75 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml
> > > new file mode 100644
> > > index 000000000000..7ce335324a29
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml
> >
> > When I first read "nfc" here I thought it was a copy-paste mistake, as
> > "nfc" is a technology of it's own. I think it would make sense to rename
> > to "loongson,ls1b-nand-controller" etc to remove that sort of confusion.
> > These devices might not implement NFC, but what's to say that a future
> > device will not?
> >
> Sorry for the confusion.
> The string "loongson,ls1b-nand-controller" might be too long.

It "might"? Why do you think it is too long?

> May I rename it to "loongson,ls1b-nand"?

Sure.
Miquel Raynal Aug. 14, 2024, 7:12 a.m. UTC | #4
Hi,

> > > When I first read "nfc" here I thought it was a copy-paste mistake, as
> > > "nfc" is a technology of it's own. I think it would make sense to rename
> > > to "loongson,ls1b-nand-controller" etc to remove that sort of confusion.
> > > These devices might not implement NFC, but what's to say that a future
> > > device will not?

I believe the nfc (also, nc) abbreviation pre-dates the NFC spec. But I
agree, it may be misleading. Even though I don't foresee any NAND
controller with NFC coming, it's probably bad for newcomers/people who
are not already deeply into the mtd details to use these confusing
letters, especially in a binding.

So, Ack.

> > Sorry for the confusion.
> > The string "loongson,ls1b-nand-controller" might be too long.  
> 
> It "might"? Why do you think it is too long?

Yeah, why would it be too long? Let's call a cat a cat. This is a
compatible for a NAND controller. So I expect the string to mention
it's a NAND controller because it's clearer. For quite some time there
has been a confusion between the NAND controller and the NAND
flash/chip, but these are two different hardware components.

> > May I rename it to "loongson,ls1b-nand"?  

For the above reason, no :)

Thanks,
Miquèl
Conor Dooley Aug. 14, 2024, 2:23 p.m. UTC | #5
On Wed, Aug 14, 2024 at 09:12:31AM +0200, Miquel Raynal wrote:
> Hi,
> 
> > > > When I first read "nfc" here I thought it was a copy-paste mistake, as
> > > > "nfc" is a technology of it's own. I think it would make sense to rename
> > > > to "loongson,ls1b-nand-controller" etc to remove that sort of confusion.
> > > > These devices might not implement NFC, but what's to say that a future
> > > > device will not?
> 
> I believe the nfc (also, nc) abbreviation pre-dates the NFC spec. But I
> agree, it may be misleading. Even though I don't foresee any NAND
> controller with NFC coming,

Hm, I think you misunderstood - I meant loongsoon SoCs that had nfc
controllers and nand controllers - not nand controllers with nfc!
Miquel Raynal Aug. 14, 2024, 2:48 p.m. UTC | #6
Hi Conor,

conor@kernel.org wrote on Wed, 14 Aug 2024 15:23:23 +0100:

> On Wed, Aug 14, 2024 at 09:12:31AM +0200, Miquel Raynal wrote:
> > Hi,
> >   
> > > > > When I first read "nfc" here I thought it was a copy-paste mistake, as
> > > > > "nfc" is a technology of it's own. I think it would make sense to rename
> > > > > to "loongson,ls1b-nand-controller" etc to remove that sort of confusion.
> > > > > These devices might not implement NFC, but what's to say that a future
> > > > > device will not?  
> > 
> > I believe the nfc (also, nc) abbreviation pre-dates the NFC spec. But I
> > agree, it may be misleading. Even though I don't foresee any NAND
> > controller with NFC coming,  
> 
> Hm, I think you misunderstood - I meant loongsoon SoCs that had nfc
> controllers and nand controllers - not nand controllers with nfc!

Ah! Well, yes, it may be even more misleading then :-)

Cheers,
Miquèl
Keguang Zhang Aug. 19, 2024, 2:51 a.m. UTC | #7
On Wed, Aug 14, 2024 at 3:12 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi,
>
> > > > When I first read "nfc" here I thought it was a copy-paste mistake, as
> > > > "nfc" is a technology of it's own. I think it would make sense to rename
> > > > to "loongson,ls1b-nand-controller" etc to remove that sort of confusion.
> > > > These devices might not implement NFC, but what's to say that a future
> > > > device will not?
>
> I believe the nfc (also, nc) abbreviation pre-dates the NFC spec. But I
> agree, it may be misleading. Even though I don't foresee any NAND
> controller with NFC coming, it's probably bad for newcomers/people who
> are not already deeply into the mtd details to use these confusing
> letters, especially in a binding.
>
> So, Ack.
>
> > > Sorry for the confusion.
> > > The string "loongson,ls1b-nand-controller" might be too long.
> >
> > It "might"? Why do you think it is too long?
>
> Yeah, why would it be too long? Let's call a cat a cat. This is a
> compatible for a NAND controller. So I expect the string to mention
> it's a NAND controller because it's clearer. For quite some time there
> has been a confusion between the NAND controller and the NAND
> flash/chip, but these are two different hardware components.
>
> > > May I rename it to "loongson,ls1b-nand"?
>
> For the above reason, no :)

Will change it to "loongson,ls1b-nand-controller" and rename the
filename accordingly.
Thanks!
>
> Thanks,
> Miquèl
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml
new file mode 100644
index 000000000000..7ce335324a29
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/loongson,ls1b-nfc.yaml
@@ -0,0 +1,75 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/loongson,ls1b-nfc.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-nfc
+          - loongson,ls1c-nfc
+      - items:
+          - enum:
+              - loongson,ls1a-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
+
+    required:
+      - nand-use-soft-ecc-engine
+      - nand-ecc-algo
+
+    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";
+        };
+    };