AnsweredAssumed Answered

MTDparts in UBOOT using NAND flash?

Question asked by Peter Bruintjes on Apr 5, 2018
Latest reply on Apr 6, 2018 by igorpadykov

Can someone show me what I might be missing or doing wrong with getting MTD to work in UBOOT using NAND flash?

 

It seems to work fine with QSPI Flash but I can't seem to get it to work in NAND Flash. My flash itself is working fine, I can read/write to nand and boot a kernel from nand

Here is my uboot output using qspi mtd parts:

 

U-Boot 2017.03 (Mar 19 2018 - 13:10:05 +0100)

CPU:   Freescale i.MX7D rev1.2 996 MHz (running at 792 MHz)
CPU:   Commercial temperature grade (0C to 95C) at 30C
Reset cause: POR
Model: Freescale i.MX7D SabreSD Board
Board: i.MX7D SABRESD RevD in secure mode
DRAM:  1 GiB
Setup FEC
Setup NAND
Setup QSPI
Setup Board IO
PMIC: PFUZE3000 DEV_ID=0x30 REV_ID=0x11
NAND:  1024 MiB
MMC:   FSL_SDHC: 0
Display: TFT43AB (480x272)
Video: 480x272x24
In:    serial
Out:   serial
Err:   serial
switch to partitions #0, OK
mmc0 is current device
Net:   eth0: ethernet@30be0000 [PRIME], eth1: ethernet@30bf0000
Normal Boot
Hit any key to stop autoboot:  0
=> sf probe
SF: Detected mx25l51235f with page size 256 Bytes, erase size 64 KiB, total 64 MiB
=> setenv mtdids nor0=30bb0000.qspi
=> setenv mtdparts mtdparts=30bb0000.qspi:1m(U-Boot),512k(Env),512k(DTB),2m(User_FS),12m(Data_FS),4m(Factory_FS),34m(Ramdisk),10m(Linux)
=> mtd

device nor0 <30bb0000.qspi>, # parts = 8
 #: name                size            offset          mask_flags
 0: U-Boot              0x00100000      0x00000000      0
 1: Env                 0x00080000      0x00100000      0
 2: DTB                 0x00080000      0x00180000      0
 3: User_FS             0x00200000      0x00200000      0
 4: Data_FS             0x00c00000      0x00400000      0
 5: Factory_FS          0x00400000      0x01000000      0
 6: Ramdisk             0x02200000      0x01400000      0
 7: Linux               0x00a00000      0x03600000      0

active partition: nor0,0 - (U-Boot) 0x00100000 @ 0x00000000

defaults:
mtdids  : none
mtdparts: none

Changing mtd to Nand:

 

=> nand device

Device 0: nand0, sector size 256 KiB
  Page size       4096 b
  OOB size         224 b
  Erase size    262144 b
  subpagesize     4096 b
  options     0x     200
  bbt options 0x       0
=> nand info

Device 0: nand0, sector size 256 KiB
  Page size       4096 b
  OOB size         224 b
  Erase size    262144 b
  subpagesize     4096 b
  options     0x     200
  bbt options 0x       0
=> setenv mtdids nand0=33002000.gpmi-nand
=> setenv mtdparts mtdparts=33002000.gpmi-nand:8m(U-Boot),1m(Env),1m(DTB),4m(User_FS),32m(Data_FS),4m(Factory_FS),64m(Ramdisk),14m(Linux)
=> mtd
Device nand0 not found!

 

I tried the latest uboot, also loading from flash is working fine as can been seen below

 

U-Boot 2018.03 (Apr 05 2018 - 13:26:38 +0200)

CPU:   Freescale i.MX7D rev1.2 1000 MHz (running at 792 MHz)
CPU:   Commercial temperature grade (0C to 95C) at 34C
Reset cause: POR
Model: Freescale i.MX7 SabreSD Board
Board: i.MX7D SABRESD in non-secure mode
DRAM:  1 GiB
PMIC: PFUZE3000 DEV_ID=0x30 REV_ID=0x11
NAND:  1024 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from NAND... OK
Video: MXSFB: 'videomode' variable not set!
In:    serial
Out:   serial
Err:   serial
Net:   FEC0
Hit any key to stop autoboot:  0
=> setenv mtdids nand0=33002000.gpmi-nand
=> setenv mtdparts mtdparts=33002000.gpmi-nand:8m(U-Boot),1m(Env),1m(DTB),4m(User_FS),32m(Data_FS),4m(Factory_FS),64m(Ramdisk),14m(Linux)
=> nand read ${loadaddr} ${kernel_addr_nand} 0x00800000

NAND read: device 0 offset 0x7200000, size 0x800000
 8388608 bytes read: OK
=> nand read ${fdt_addr} ${fdt_addr_nand} 0x00100000

NAND read: device 0 offset 0x900000, size 0x100000
 1048576 bytes read: OK
=> bootz ${loadaddr} - ${fdt_addr};
Kernel image @ 0x80800000 [ 0x000000 - 0x6118f0 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Loading Device Tree to bdf2d000, end bdf3b789 ... OK

Starting kernel ...

 

Outcomes