[U-Boot] u-boot hangs when attaching an mtd to ubi using spinor flash, MX25L51245G

Davis Roman davis.roman84 at gmail.com
Fri Jan 20 02:15:16 CET 2017


Hello,

I'm seeing unusual behavior when u-boot attempts to attach an mtd
partition to a ubi device using a spi-nor flash (MX25L51245G).

When the mtd partition size is set to less than 15MiB, the attach
works, however when the mtd partition size is increased to 16MB or
greater, u-boot displays the message"ubi0: attaching mtd1" and hangs
indefinately.

I've searched through the u-boot mailing archives but I have yet to
find anything that might shed some light on this issue.

Here are the steps to reproduce:

$ git clone https://github.com/linux4sam/u-boot-at91.git -b u-boot-2016.03-at91

$ cd u-boot-at91/

Patch the following config file: include/configs/at91sam9x5ek_spiflash_defconfig

--- include/configs/at91sam9x5ek_spiflash_defconfig     2017-01-19
19:08:50.257475024 -0500
+++ include/configs/at91sam9x5ek_spiflash_defconfig     2017-01-19
19:12:37.045475024 -0500
@@ -1,7 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_AT91=y
 CONFIG_TARGET_AT91SAM9X5EK=y
-CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_SPIFLASH"
 CONFIG_SYS_PROMPT="U-Boot> "
 # CONFIG_CMD_IMI is not set
@@ -10,4 +9,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_SPI_FLASH=y
-CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_SPI_FLASH_ABOVE_16MB=y
+CONFIG_SPI_FLASH_4B_OPCODES=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_MTD=y

$ make at91sam9x5ek_spiflash_defconfig

$ make

Copy u-boot.bin onto the board

1) The following is the case where the rootfs mtd partition attaches
successfully and it's value is set to 15MB

U-Boot> setenv mtdparts
'mtdparts=spi32766.0:64k(bootstrap),512k(uboot),15M(rootfs)'
U-Boot> setenv mtdids 'nor0=spi32766.0'
U-Boot> sf probe 0
U-Boot> ubi part rootfs
SF: Detected MX25L51235F with page size 256 Bytes, erase size 64 KiB,
total 64 MiB
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=2", size 15 MiB)
ubi0: PEB size: 65536 bytes (64 KiB), LEB size: 65408 bytes
ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
ubi0: VID header offset: 64 (aligned 64), data offset: 128
ubi0: good PEBs: 240, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence
number: 943000472
ubi0: available PEBs: 236, total reserved PEBs: 4, PEBs reserved for
bad PEB handling: 0
U-Boot>

2) The following is the case where the rootfs mtd partition fails to
attach. It's size is set to 16MB

U-Boot> setenv mtdparts
'mtdparts=spi32766.0:64k(bootstrap),512k(uboot),16M(rootfs)'
U-Boot> setenv mtdids 'nor0=spi32766.0'
U-Boot> sf probe 0
U-Boot> ubi part rootfs
SF: Detected MX25L51235F with page size 256 Bytes, erase size 64 KiB,
total 64 MiB
ubi0: attaching mtd1


At this point, u-boot is now hung and the only difference between case
1 and case 2 is the size of the rootfs mtd partition changed from 15MB
to 16MB

I would greatly appreciate any ideas. Unfortunately at this point, I'm
stuck on this issue.

Thank you,

Davis


More information about the U-Boot mailing list