Using imx8mmevk 4.14.78 release and noticed when evk boots kernel reports:
[ 1.333714] fsl-flexspi 30bb0000.flexspi: mt25qu256 (16384 Kbytes)
.... which is only half of the SPI NOR's flash size of 32MB.
U-Boot appears to detect the correct size:
SF: Detected n25q256a with page size 256 Bytes, erase size 4 KiB, total 32 MiB
Anyone know the why?
Regards,
Brian
Update. When I saw the following kernel output after adding some mtd partitions to flexspi device tree:
[ 1.028473] fsl-flexspi 30bb0000.flexspi: mt25qu256 (16384 Kbytes)
[ 1.034692] 5 ofpart partitions found on MTD device 30bb0000.flexspi
[ 1.041067] Creating 5 MTD partitions on "30bb0000.flexspi":
[ 1.046745] 0x000000000000-0x000000200000 : "U-Boot"
[ 1.052345] 0x000000200000-0x000000201000 : "U-Boot Env"
[ 1.057679] mtd: partition "U-Boot Env" doesn't end on an erase/write block -- force read-only
[ 1.066784] 0x000000210000-0x00000021b000 : "Kernel dtb"
[ 1.072112] mtd: partition "Kernel dtb" doesn't end on an erase/write block -- force read-only
[ 1.081217] 0x00000021b000-0x000000a1b000 : "Linux Kernel"
[ 1.086717] mtd: partition "Linux Kernel" doesn't start on an erase/write block boundary -- force read-only
... I saw the "mt25qu256 (16384 Kbytes)" and thought it was telling me I was writing beyond the end of the flash device.
Turns out, u-boot is built with #define CONFIG_SPI_FLASH_USE_4K_SECTORS 1
... but the Kernel was built without CONFIG_MTD_SPI_NOR_USE_4K_SECTORS being set. Once I rebuilt kernel with CONFIG_MTD_SPI_NOR_USE_4K_SECTORS turned on the above messages went away.
Still not sure why the device is being reported as 16MB when it is 32MB.
Hello,
Thanks for sharing the results after the implementation you made. The wrong size may be due because the device is not actually working on the proper mode for the transfer bandwidth, so please check your device tree configuration.
Please check below information from reference manual which may be helpful you to comprehend this:
"3.5.2 Hardware Operation
On some boards, the Quad SPI NOR - N25Q256A is equipped, while on some other
boards S25FL128S is equipped. Check the Quad SPI NOR type on the boards and then
configure it properly.
The N25Q256A is a high-performance multiple input/output serial Flash memory device.
The innovative, high-performance, dual and quad input/output instructions enable double
or quadruple the transfer bandwidth for READ and PROGRAM operations. The memory
is organized as 512 (64 KB) main sectors and can be erased 64 KB sectors at a time. The
device features 3-byte or 4-byte address modes to access memory beyond 128 MB. When
4-byte address mode is enabled, all commands requiring an address must be entered and
exited with a 4-byte address mode command: ENTER 4-BYTE ADDRESS MODE
command and EXIT 4-BYTE ADDRESS MODE command. The 4-byte address mode
can also be enabled through the nonvolatile configuration register. The memory can be
operated with three different protocols:Extended SPI (standard SPI protocol upgraded
with dual and quad operations), Dual I/O SPI and Quad I/O SPI. Each protocol contains
unique commands to perform READ operations in DTR mode. This enables high data
throughput while running at lower clock frequencies."
Hope it helps!
BR,
Ivan.