diff mbox series

[v3,1/2] dt-bindings: mtd: amlogic,meson-nand: support fields for boot ROM code

Message ID 20240409181025.55504-2-avkrasnov@salutedevices.com (mailing list archive)
State New, archived
Headers show
Series Meson: R/W support for pages used by boot ROM | expand

Commit Message

Arseniy Krasnov April 9, 2024, 6:10 p.m. UTC
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 <avkrasnov@salutedevices.com>
---
 .../bindings/mtd/amlogic,meson-nand.yaml           | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Miquel Raynal April 10, 2024, 10:23 a.m. UTC | #1
Hi Arseniy,

avkrasnov@salutedevices.com wrote on Tue, 9 Apr 2024 21:10:24 +0300:

> 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 <avkrasnov@salutedevices.com>
> ---
>  .../bindings/mtd/amlogic,meson-nand.yaml           | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> index 57b6957c8415..b86a1953056b 100644
> --- a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> +++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> @@ -64,11 +64,25 @@ patternProperties:
>          items:
>            maximum: 0
>  
> +      amlogic,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.

Shall we have a length rather than the last page?

> +
> +      amlogic,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 (in pages).
> +
>      unevaluatedProperties: false
>  
>      dependencies:
>        nand-ecc-strength: [nand-ecc-step-size]
>        nand-ecc-step-size: [nand-ecc-strength]
> +      amlogic,boot-page-last: [nand-is-boot-medium, "amlogic,boot-page-step"]
> +      amlogic,boot-page-step: [nand-is-boot-medium, "amlogic,boot-page-last"]
>  
>  
>  required:


Thanks,
Miquèl
Arseniy Krasnov April 10, 2024, 2:48 p.m. UTC | #2
Hi,

On 10.04.2024 13:23, Miquel Raynal wrote:
> Hi Arseniy,
> 
> avkrasnov@salutedevices.com wrote on Tue, 9 Apr 2024 21:10:24 +0300:
> 
>> 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 <avkrasnov@salutedevices.com>
>> ---
>>  .../bindings/mtd/amlogic,meson-nand.yaml           | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
>> index 57b6957c8415..b86a1953056b 100644
>> --- a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
>> +++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
>> @@ -64,11 +64,25 @@ patternProperties:
>>          items:
>>            maximum: 0
>>  
>> +      amlogic,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.
> 
> Shall we have a length rather than the last page?

You mean rename it to "amlogic,boot-pages-length" or something like that ? But I think
length in bytes is useless here:
1) boot rom needs that only some single pages are written in special mode (and as I see in
   vendor's driver it also works in pages).
2) NAND driver operates in pages during write/read such pages.

So length in bytes will be converted to pages anyway.

What do You think ?

Thanks, Arseniy

> 
>> +
>> +      amlogic,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 (in pages).
>> +
>>      unevaluatedProperties: false
>>  
>>      dependencies:
>>        nand-ecc-strength: [nand-ecc-step-size]
>>        nand-ecc-step-size: [nand-ecc-strength]
>> +      amlogic,boot-page-last: [nand-is-boot-medium, "amlogic,boot-page-step"]
>> +      amlogic,boot-page-step: [nand-is-boot-medium, "amlogic,boot-page-last"]
>>  
>>  
>>  required:
> 
> 
> Thanks,
> Miquèl
Arseniy Krasnov April 10, 2024, 2:51 p.m. UTC | #3
On 10.04.2024 18:00, Miquel Raynal wrote:
> Hi Arseniy,
> 
> avkrasnov@salutedevices.com wrote on Wed, 10 Apr 2024 17:48:02 +0300:
> 
>> Hi,
>>
>> On 10.04.2024 13:23, Miquel Raynal wrote:
>>> Hi Arseniy,
>>>
>>> avkrasnov@salutedevices.com wrote on Tue, 9 Apr 2024 21:10:24 +0300:
>>>   
>>>> 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 <avkrasnov@salutedevices.com>
>>>> ---
>>>>  .../bindings/mtd/amlogic,meson-nand.yaml           | 14 ++++++++++++++
>>>>  1 file changed, 14 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
>>>> index 57b6957c8415..b86a1953056b 100644
>>>> --- a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
>>>> +++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
>>>> @@ -64,11 +64,25 @@ patternProperties:
>>>>          items:
>>>>            maximum: 0
>>>>  
>>>> +      amlogic,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.  
>>>
>>> Shall we have a length rather than the last page?  
>>
>> You mean rename it to "amlogic,boot-pages-length" or something like that ? But I think
>> length in bytes is useless here:
>> 1) boot rom needs that only some single pages are written in special mode (and as I see in
>>    vendor's driver it also works in pages).
>> 2) NAND driver operates in pages during write/read such pages.
>>
>> So length in bytes will be converted to pages anyway.
>>
>> What do You think ?
> 
> I didn't talk about units :-)
> 
> Maybe: amlogic,boot-pages would make sense? But pointing at the last
> page seems weird.

Ah ok I see. Got it!

Thanks, Arseniy

> 
> Miquèl
Miquel Raynal April 10, 2024, 3 p.m. UTC | #4
Hi Arseniy,

avkrasnov@salutedevices.com wrote on Wed, 10 Apr 2024 17:48:02 +0300:

> Hi,
> 
> On 10.04.2024 13:23, Miquel Raynal wrote:
> > Hi Arseniy,
> > 
> > avkrasnov@salutedevices.com wrote on Tue, 9 Apr 2024 21:10:24 +0300:
> >   
> >> 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 <avkrasnov@salutedevices.com>
> >> ---
> >>  .../bindings/mtd/amlogic,meson-nand.yaml           | 14 ++++++++++++++
> >>  1 file changed, 14 insertions(+)
> >>
> >> diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> >> index 57b6957c8415..b86a1953056b 100644
> >> --- a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> >> +++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
> >> @@ -64,11 +64,25 @@ patternProperties:
> >>          items:
> >>            maximum: 0
> >>  
> >> +      amlogic,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.  
> > 
> > Shall we have a length rather than the last page?  
> 
> You mean rename it to "amlogic,boot-pages-length" or something like that ? But I think
> length in bytes is useless here:
> 1) boot rom needs that only some single pages are written in special mode (and as I see in
>    vendor's driver it also works in pages).
> 2) NAND driver operates in pages during write/read such pages.
> 
> So length in bytes will be converted to pages anyway.
> 
> What do You think ?

I didn't talk about units :-)

Maybe: amlogic,boot-pages would make sense? But pointing at the last
page seems weird.

Miquèl
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
index 57b6957c8415..b86a1953056b 100644
--- a/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
+++ b/Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
@@ -64,11 +64,25 @@  patternProperties:
         items:
           maximum: 0
 
+      amlogic,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.
+
+      amlogic,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 (in pages).
+
     unevaluatedProperties: false
 
     dependencies:
       nand-ecc-strength: [nand-ecc-step-size]
       nand-ecc-step-size: [nand-ecc-strength]
+      amlogic,boot-page-last: [nand-is-boot-medium, "amlogic,boot-page-step"]
+      amlogic,boot-page-step: [nand-is-boot-medium, "amlogic,boot-page-last"]
 
 
 required: