2022-04-05 02:33:01

by Chuanhong Guo

[permalink] [raw]
Subject: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

Add device-tree binding documentation for Mediatek SPI-NAND Flash
Interface.

Signed-off-by: Chuanhong Guo <[email protected]>
---
Changes since v1:
1. add a blank line between properties in dt binding doc
2. rename ecc-engine to nand-ecc-engine for the generic properties

Change since v2: none

.../bindings/spi/mediatek,spi-mtk-snfi.yaml | 88 +++++++++++++++++++
1 file changed, 88 insertions(+)
create mode 100644 Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml

diff --git a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
new file mode 100644
index 000000000000..7d57570ad617
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/mediatek,spi-mtk-snfi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SPI-NAND flash controller for MediaTek ARM SoCs
+
+maintainers:
+ - Chuanhong Guo <[email protected]>
+
+description: |
+ The Mediatek SPI-NAND flash controller is an extended version of
+ the Mediatek NAND flash controller. It can perform standard SPI
+ instructions with one continuous write and one read for up-to 0xa0
+ bytes. It also supports typical SPI-NAND page cache operations
+ in single, dual or quad IO mode with piplined ECC encoding/decoding
+ using the accompanying ECC engine. There should be only one spi
+ slave device following generic spi bindings.
+
+allOf:
+ - $ref: /schemas/spi/spi-controller.yaml#
+
+properties:
+ compatible:
+ enum:
+ - mediatek,mt7622-snand
+ - mediatek,mt7629-snand
+
+ reg:
+ items:
+ - description: core registers
+
+ interrupts:
+ items:
+ - description: NFI interrupt
+
+ clocks:
+ items:
+ - description: clock used for the controller
+ - description: clock used for the SPI bus
+
+ clock-names:
+ items:
+ - const: nfi_clk
+ - const: pad_clk
+
+ nand-ecc-engine:
+ description: device-tree node of the accompanying ECC engine.
+ $ref: /schemas/types.yaml#/definitions/phandle
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - clocks
+ - clock-names
+ - ecc-engine
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/clock/mt7622-clk.h>
+ soc {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ snfi: spi@1100d000 {
+ compatible = "mediatek,mt7622-snand";
+ reg = <0 0x1100d000 0 0x1000>;
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
+ clocks = <&pericfg CLK_PERI_NFI_PD>, <&pericfg CLK_PERI_SNFI_PD>;
+ clock-names = "nfi_clk", "pad_clk";
+ nand-ecc-engine = <&bch>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ flash@0 {
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-tx-bus-width = <4>;
+ spi-rx-bus-width = <4>;
+ nand-ecc-engine = <&snfi>;
+ };
+ };
+ };
--
2.35.1


2022-04-05 02:39:38

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

On 04/04/2022 15:18, Chuanhong Guo wrote:
> Add device-tree binding documentation for Mediatek SPI-NAND Flash
> Interface.
>
> Signed-off-by: Chuanhong Guo <[email protected]>
> ---
> Changes since v1:
> 1. add a blank line between properties in dt binding doc
> 2. rename ecc-engine to nand-ecc-engine for the generic properties
>
> Change since v2: none
>
> .../bindings/spi/mediatek,spi-mtk-snfi.yaml | 88 +++++++++++++++++++
> 1 file changed, 88 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
>
> diff --git a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> new file mode 100644
> index 000000000000..7d57570ad617
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> @@ -0,0 +1,88 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/spi/mediatek,spi-mtk-snfi.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: SPI-NAND flash controller for MediaTek ARM SoCs
> +
> +maintainers:
> + - Chuanhong Guo <[email protected]>
> +
> +description: |
> + The Mediatek SPI-NAND flash controller is an extended version of
> + the Mediatek NAND flash controller. It can perform standard SPI
> + instructions with one continuous write and one read for up-to 0xa0
> + bytes. It also supports typical SPI-NAND page cache operations
> + in single, dual or quad IO mode with piplined ECC encoding/decoding
> + using the accompanying ECC engine. There should be only one spi
> + slave device following generic spi bindings.
> +
> +allOf:
> + - $ref: /schemas/spi/spi-controller.yaml#
> +
> +properties:
> + compatible:
> + enum:
> + - mediatek,mt7622-snand
> + - mediatek,mt7629-snand
> +
> + reg:
> + items:
> + - description: core registers
> +
> + interrupts:
> + items:
> + - description: NFI interrupt
> +
> + clocks:
> + items:
> + - description: clock used for the controller
> + - description: clock used for the SPI bus
> +
> + clock-names:
> + items:
> + - const: nfi_clk
> + - const: pad_clk
> +
> + nand-ecc-engine:
> + description: device-tree node of the accompanying ECC engine.
> + $ref: /schemas/types.yaml#/definitions/phandle
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - clocks
> + - clock-names
> + - ecc-engine

Slightly slow down resends (max 1 per day). You sent v3 without giving a
chance to review this.

Wrong name here.


Best regards,
Krzysztof

2022-04-05 02:46:27

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

On Mon, 04 Apr 2022 21:18:17 +0800, Chuanhong Guo wrote:
> Add device-tree binding documentation for Mediatek SPI-NAND Flash
> Interface.
>
> Signed-off-by: Chuanhong Guo <[email protected]>
> ---
> Changes since v1:
> 1. add a blank line between properties in dt binding doc
> 2. rename ecc-engine to nand-ecc-engine for the generic properties
>
> Change since v2: none
>
> .../bindings/spi/mediatek,spi-mtk-snfi.yaml | 88 +++++++++++++++++++
> 1 file changed, 88 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
>

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dt.yaml: spi@1100d000: 'ecc-engine' is a required property
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dt.yaml:0:0: /example-0/soc/spi@1100d000/flash@0: failed to match any schema with compatible: ['spi-nand']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.

2022-04-05 03:15:12

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

On Mon, Apr 04, 2022 at 03:52:19PM +0200, Krzysztof Kozlowski wrote:
> On 04/04/2022 15:18, Chuanhong Guo wrote:

> > +required:
> > + - compatible
> > + - reg
> > + - interrupts
> > + - clocks
> > + - clock-names
> > + - ecc-engine

> Slightly slow down resends (max 1 per day). You sent v3 without giving a
> chance to review this.

> Wrong name here.

Please delete unneeded context from mails when replying. Doing this
makes it much easier to find your reply in the message, helping ensure
it won't be missed by people scrolling through the irrelevant quoted
material.


Attachments:
(No filename) (600.00 B)
signature.asc (499.00 B)
Download all attachments

2022-04-05 03:53:21

by Chuanhong Guo

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

Hi Rob!

On Tue, Apr 5, 2022 at 12:09 AM Rob Herring <[email protected]> wrote:
> [...]
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dt.yaml: spi@1100d000: 'ecc-engine' is a required property
> From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dt.yaml:0:0: /example-0/soc/spi@1100d000/flash@0: failed to match any schema with compatible: ['spi-nand']

I ran the tests myself and it's only complaining about the ecc-engine name:

/home/user/src/kernels/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dtb:
spi@1100d000: 'ecc-engine' is a required property
From schema: /home/user/src/kernels/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml

It says nothing about the spi-nand part.
I'd like to keep the flash@0 node in the example to demonstrate the
nand-ecc-engine usage. What should I do?
--
Regards,
Chuanhong Guo

2022-04-05 20:42:21

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

Hello,

[email protected] wrote on Tue, 5 Apr 2022 10:55:51 +0800:

> Hi Rob!
>
> On Tue, Apr 5, 2022 at 12:09 AM Rob Herring <[email protected]> wrote:
> > [...]
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> >
> > yamllint warnings/errors:
> >
> > dtschema/dtc warnings/errors:
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dt.yaml: spi@1100d000: 'ecc-engine' is a required property
> > From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> > Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dt.yaml:0:0: /example-0/soc/spi@1100d000/flash@0: failed to match any schema with compatible: ['spi-nand']
>
> I ran the tests myself and it's only complaining about the ecc-engine name:
>
> /home/user/src/kernels/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dtb:
> spi@1100d000: 'ecc-engine' is a required property
> From schema: /home/user/src/kernels/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
>
> It says nothing about the spi-nand part.
> I'd like to keep the flash@0 node in the example to demonstrate the
> nand-ecc-engine usage. What should I do?

You can try including spi-nand.yaml (like you do with
spi-controller.yaml). You should no longer need to define
nand-ecc-engine then as it is already described there?

Thanks,
Miquèl

2022-04-06 10:05:02

by Chuanhong Guo

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

Hi!

On Tue, Apr 5, 2022 at 11:52 PM Rob Herring <[email protected]> wrote:
> > You can try including spi-nand.yaml (like you do with
> > spi-controller.yaml). You should no longer need to define
> > nand-ecc-engine then as it is already described there?
>
> Including spi-nand.yaml is wrong. If that just landed, then this may
> have run before the base moved to v5.18-rc1.

spi-nand.yaml is in v5.18 only and I'm able to reproduce the
spi-nand complaint by cherry-picking the commit to v5.17 and
running the check.
This means I don't need to do anything with the spi-nand error
then.
Thanks for the hint.

--
Regards,
Chuanhong Guo

2022-04-06 11:28:46

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

On Tue, Apr 05, 2022 at 09:20:24AM +0200, Miquel Raynal wrote:
> Hello,
>
> [email protected] wrote on Tue, 5 Apr 2022 10:55:51 +0800:
>
> > Hi Rob!
> >
> > On Tue, Apr 5, 2022 at 12:09 AM Rob Herring <[email protected]> wrote:
> > > [...]
> > > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > >
> > > yamllint warnings/errors:
> > >
> > > dtschema/dtc warnings/errors:
> > > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dt.yaml: spi@1100d000: 'ecc-engine' is a required property
> > > From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> > > Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dt.yaml:0:0: /example-0/soc/spi@1100d000/flash@0: failed to match any schema with compatible: ['spi-nand']
> >
> > I ran the tests myself and it's only complaining about the ecc-engine name:
> >
> > /home/user/src/kernels/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dtb:
> > spi@1100d000: 'ecc-engine' is a required property
> > From schema: /home/user/src/kernels/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
> >
> > It says nothing about the spi-nand part.

Did you use 'DT_CHECKER_FLAGS=-m' as it says above?

> > I'd like to keep the flash@0 node in the example to demonstrate the
> > nand-ecc-engine usage. What should I do?
>
> You can try including spi-nand.yaml (like you do with
> spi-controller.yaml). You should no longer need to define
> nand-ecc-engine then as it is already described there?

Including spi-nand.yaml is wrong. If that just landed, then this may
have run before the base moved to v5.18-rc1.

Rob

2022-04-06 12:06:31

by Chuanhong Guo

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] dt-bindings: spi: add binding doc for spi-mtk-snfi

Hi!

On Tue, Apr 5, 2022 at 3:20 PM Miquel Raynal <[email protected]> wrote:
> You can try including spi-nand.yaml (like you do with
> spi-controller.yaml). You should no longer need to define
> nand-ecc-engine then as it is already described there?

This doesn't work. I added
- $ref: /schemas/mtd/spi-nand.yaml#
to the allOf property and dt_binding_check complains the following:

Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.example.dtb:
spi@1100d000: compatible:0: 'spi-nand' was expected
From schema: /home/user/src/kernels/linux/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml

BTW I still can't get dt_binding_check to complain anything about
spi-nand. Here's the command I used:

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- DT_CHECKER_FLAGS=-m
dt_binding_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml

--
Regards,
Chuanhong Guo