[PATCH 3/6] dts: synquacer: Add partition information to the spi-nor

Masami Hiramatsu masami.hiramatsu at linaro.org
Fri Jul 9 13:27:18 CEST 2021


Hi Marek,

2021年7月9日(金) 19:54 Marek Behún <marek.behun at nic.cz>:
>
> On Fri,  9 Jul 2021 19:50:27 +0900
> Masami Hiramatsu <masami.hiramatsu at linaro.org> wrote:
>
> > Add partition information to the spi-nor flash.
> > This is required for accessing NOR flash via mtdparts.
> >
> > Signed-off-by: Masami Hiramatsu <masami.hiramatsu at linaro.org>
> > ---
> >  .../dts/synquacer-sc2a11-developerbox-u-boot.dtsi  |   42
> > ++++++++++++++++++++ 1 file changed, 42 insertions(+)
> >
> > diff --git a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi
> > b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi index
> > 2f13a42235..245ebcda01 100644 ---
> > a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi +++
> > b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi @@ -31,6
> > +31,48 @@ spi-max-frequency = <31250000>;
> >                       spi-rx-bus-width = <0x1>;
> >                       spi-tx-bus-width = <0x1>;
> > +
> > +                     partitions {
> > +                             compatible = "fixed-partitions";
> > +                             #address-cells = <1>;
> > +                             #size-cells = <1>;
> > +
> > +                             partition at 0 {
> > +                                     label = "BootStrap-BL1";
> > +                                     reg = <0x0 0x70000>;
> > +                                     read-only;
> > +                             };
> > +                             partition at 70000 {
> > +                                     label = "Flash-Writer";
> > +                                     reg = <0x70000 0x90000>;
> > +                                     read-only;
> > +                             };
> > +                             partition at 100000 {
> > +                                     label = "SCP-BL2";
> > +                                     reg = <0x100000 0x80000>;
> > +                                     read-only;
> > +                             };
> > +                             partition at 180000 {
> > +                                     label = "FIP-TFA";
> > +                                     reg = <0x180000 0x78000>;
> > +                             };
> > +                             partition at 1f8000 {
> > +                                     label = "Stage2Tables";
> > +                                     reg = <0x1f8000 0x8000>;
> > +                             };
> > +                             partition at 200000 {
> > +                                     label = "U-Boot";
> > +                                     reg = <0x200000 0x100000>;
> > +                             };
> > +                             partition at 300000 {
> > +                                     label = "UBoot-Env";
> > +                                     reg = <0x300000 0x100000>;
> > +                             };
> > +                             partition at 500000 {
> > +                                     label = "Ex-OPTEE";
> > +                                     reg = <0x500000 0x200000>;
> > +                             };
> > +                     };
> >               };
> >       };
> >
> >
>
> Just a style hint: the individual partition nodes should be IMO
> separated by an additional newline character, i.e.:

Ah, OK.

>
>                                 partition at 0 {
>                                         label = "BootStrap-BL1";
>                                         reg = <0x0 0x70000>;
>                                         read-only;
>                                 };
>
>                                 partition at 70000 {
>                                         label = "Flash-Writer";
>                                         reg = <0x70000 0x90000>;
>                                         read-only;
>                                 };
>
>                                 partition at 100000 {
>                                         label = "SCP-BL2";
>                                         reg = <0x100000 0x80000>;
>                                         read-only;
>                                 };
>
> Other than that:
>
> Reviewed-by: Marek Behún <marek.behun at nic.cz>
>
> Btw, did you test this? Does this work correctly with mtd command?

Yes, I've tested that, and mtd list works. But it seems "mtd erase"
commands don't work well.
See the log below;

-------
=> log level 7
=> mtd list
List of MTD devices:
* mx66u51235f
  - device: spi-flash at 0
  - parent: spi at 54800000
  - driver: jedec_spi_nor
  - path: /spi at 54800000/spi-flash at 0
  - type: NOR flash
  - block size: 0x1000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "mx66u51235f"
          - 0x000000000000-0x000000070000 : "BootStrap-BL1"
          - 0x000000070000-0x000000100000 : "Flash-Writer"
          - 0x000000100000-0x000000180000 : "SCP-BL2"
          - 0x000000180000-0x0000001f8000 : "FIP-TFA"
          - 0x0000001f8000-0x000000200000 : "Stage2Tables"
          - 0x000000200000-0x000000400000 : "EDK2"
          - 0x000000400000-0x000000500000 : "EDK2-Env"
          - 0x000000500000-0x000000700000 : "Ex-OPTEE"
          - 0x000000700000-0x000000800000 : "UBoot-Env"
          - 0x000000800000-0x000000900000 : "U-Boot"
=> mtd erase Ex-OPTEE
Erasing 0x00000000 ... 0x001fffff (512 eraseblock(s))
jedec_spi_nor spi-flash at 0: at 0x500000, len 4096
=> mtd dump E
  EDK2 EDK2-Env Ex-OPTEE
=> mtd dump Ex-OPTEE 0 10
Reading 16 byte(s) at offset 0x00000000
jedec_spi_nor spi-flash at 0: from 0x00500000, len 16

Dump 16 data bytes from 0x0:
0x00000000:     ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
=> mtd dump Ex-OPTEE 1000 10
Reading 16 byte(s) at offset 0x00001000
jedec_spi_nor spi-flash at 0: from 0x00501000, len 16

Dump 16 data bytes from 0x1000:
0x00001000:     00 00 00 14 1f 20 03 d5  1f 20 03 d5 1f 20 03 d5
=>
-------

So it seems first 4k block is cleared, but other blocks are not erased.
I think that is not a devicetree issue, but mtd subsystem issue.

Thank you,

-- 
Masami Hiramatsu


More information about the U-Boot mailing list