Wind River Support Network

HomeDefectsLIN1018-5434
Fixed

LIN1018-5434 : MTD device erase block size incorrectly set to 256KiB in RCPL16

Created: Dec 9, 2019    Updated: Feb 15, 2020
Resolved Date: Dec 15, 2019
Previous ID: LIN10-6816
Found In Version: 10.18.44.12
Fix Version: 10.18.44.14
Severity: Critical
Applicable for: Wind River Linux LTS 17
Component/s: Kernel

Description

The s25fl129p1 nor flash should have an erase block size of 64 KB, according to the datasheet: http://www.spansion.com/Support/Datasheets/S25FL129P_00.pdf

... and the spi-nor driver itself:

wrlinux-lts-17/linux-yocto-4.12/blob/standard/intel-socfpga/drivers/mtd/spi-nor/spi-nor.c#L1343
{ "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },

But when booting the board, mtdinfo displays a eraseblock size of 256KB:

asp-6c:~# mtdinfo /dev/mtd3
mtd3
Name: board certificates
Type: nor
Eraseblock size: 262144 bytes, 256.0 KiB
Amount of eraseblocks: 1 (458752 bytes, 448.0 KiB)
Minimum input/output unit size: 1 byte
Sub-page size: 1 byte
Character device major/minor: 90:6
Bad blocks are allowed: false
Device is writable: false

This makes the flash unwritable as the driver forces read-only mode:

[ 6.295137] m25p80 spi1.0: s25fl129p1 (16384 Kbytes)
[ 6.302468] 9 ofpart partitions found on MTD device spi1.0
[ 6.307995] Creating 9 MTD partitions on "spi1.0":
[ 6.312792] 0x000000000000-0x000000080000 : "crtm creds"
[ 6.322867] 0x000000080000-0x0000000f0000 : "board certificates"
[ 6.328883] mtd: partition "board certificates" doesn't end on an erase block -- force read-only
[ 6.342297] 0x0000000f0000-0x000000100000 : "board inventory"
[ 6.348031] mtd: partition "board inventory" doesn't start on an erase block boundary -- force read-only

Steps to Reproduce

Compile a LTS17 project based on the Stratix10 machine, apply the patches ffrom LIN10-6262 to the kernel, deploy on the board.

root@stratix10-abil:~# mtd_debug read /dev/mtd0 0x0 0x5f0000 file.bin
Copied 6225920 bytes from address 0x00000000 in flash to file.bin
root@stratix10-abil:~# flashcp file.bin /dev/mtd10
File does not seem to match flash data. First mismatch at 0x00000000-0x00002800
root@stratix10-abil:~#  mtd_debug read /dev/mtd10 0x0 0x5f0000 file2.bin
Copied 6225920 bytes from address 0x00000000 in flash to file2.bin
root@stratix10-abil:~# md5sum *.bin
142490fec9c19ab4076eda4720adcd70  file.bin
886e8bd880335e81ac4256210dcfff24  file2.bin
Live chat
Online