2024-04-02 21:00:28

by Arseniy Krasnov

[permalink] [raw]
Subject: [PATCH v1 0/2] Meson: R/W support for pages used by boot ROM

Amlogic's boot ROM code needs that some pages on NAND must be written
in special "short" ECC mode with scrambling enabled. Such pages:
1) Contain some metadata about hardware.
2) Located with some interval starting from 0 offset, until some
specified offset. Interval and second offset are set in the
device tree.

This patchset adds R/W support for such pages. To enable it we can setup
it in dts:

nand-is-boot-medium;
meson,boot-page-last = <1024>;
meson,boot-page-step = <128>;

It means that each 128th page in range 0 to 1024 pages will be accessed
in special mode ("short" ECC + scrambling). In practice this feature is
needed when we want to update first block of NAND - driver will enable
required mode by itself using value from device tree.

Arseniy Krasnov (2):
dt-bindings: mtd: amlogic,meson-nand: support fields for boot ROM code
mtd: rawnand: meson: support R/W mode for boot ROM

.../bindings/mtd/amlogic,meson-nand.yaml | 16 ++++
drivers/mtd/nand/raw/meson_nand.c | 88 +++++++++++++------
2 files changed, 75 insertions(+), 29 deletions(-)

--
2.35.0



2024-04-02 21:00:44

by Arseniy Krasnov

[permalink] [raw]
Subject: [PATCH v1 1/2] dt-bindings: mtd: amlogic,meson-nand: support fields for boot ROM code

Boot ROM code on Meson requires that some pages on NAND must be written
in special mode: "short" ECC mode where each block is 384 bytes and
scrambling mode is on. Such pages located with the specified interval
within specified offset. Both interval and offset are located in the
device tree and used by driver if 'nand-is-boot-medium' is set for
NAND chip.

Signed-off-by: Arseniy Krasnov <[email protected]>
---
.../bindings/mtd/amlogic,meson-nand.yaml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
index 57b6957c8415..f49819ee76b8 100644
--- a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
+++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
@@ -64,11 +64,27 @@ patternProperties:
items:
maximum: 0

+ meson,boot-page-last:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ The NFC driver needs this information to select ECC
+ algorithms supported by the boot ROM.
+ Only used in combination with 'nand-is-boot-medium'.
+
+ meson,boot-page-step:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ The NFC driver needs this information to select ECC
+ algorithms supported by the boot ROM.
+ Only used in combination with 'nand-is-boot-medium'.
+
unevaluatedProperties: false

dependencies:
nand-ecc-strength: [nand-ecc-step-size]
nand-ecc-step-size: [nand-ecc-strength]
+ meson,boot-page-last: [nand-is-boot-medium]
+ meson,boot-page-step: [nand-is-boot-medium]


required:
--
2.35.0


2024-04-03 17:04:23

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] dt-bindings: mtd: amlogic,meson-nand: support fields for boot ROM code

On Tue, Apr 02, 2024 at 11:27:04PM +0300, Arseniy Krasnov wrote:
> Boot ROM code on Meson requires that some pages on NAND must be written
> in special mode: "short" ECC mode where each block is 384 bytes and
> scrambling mode is on. Such pages located with the specified interval
> within specified offset. Both interval and offset are located in the
> device tree and used by driver if 'nand-is-boot-medium' is set for
> NAND chip.
>
> Signed-off-by: Arseniy Krasnov <[email protected]>
> ---
> .../bindings/mtd/amlogic,meson-nand.yaml | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> index 57b6957c8415..f49819ee76b8 100644
> --- a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> +++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> @@ -64,11 +64,27 @@ patternProperties:
> items:
> maximum: 0
>
> + meson,boot-page-last:

'meson' is not a valid vendor.

> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + The NFC driver needs this information to select ECC
> + algorithms supported by the boot ROM.
> + Only used in combination with 'nand-is-boot-medium'.

No need to state what's captured with constraints.

> +
> + meson,boot-page-step:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + The NFC driver needs this information to select ECC
> + algorithms supported by the boot ROM.
> + Only used in combination with 'nand-is-boot-medium'.

step is in blocks/pages/bytes?

> +
> unevaluatedProperties: false
>
> dependencies:
> nand-ecc-strength: [nand-ecc-step-size]
> nand-ecc-step-size: [nand-ecc-strength]
> + meson,boot-page-last: [nand-is-boot-medium]
> + meson,boot-page-step: [nand-is-boot-medium]

I assume both properties must be present? If so:

meson,boot-page-last: ['meson,boot-page-step']
meson,boot-page-step: ['meson,boot-page-last']

Rob