[PATCH v3 1/2] mtd: spi-nor: issi: is25wp256: Init flash based on SFDP

Tudor Ambarus tudor.ambarus at linaro.org
Tue Dec 20 23:03:01 PST 2022



On 21.12.2022 02:30, Guenter Roeck wrote:
> Hi,

Hi, Guenter,

Thanks for the report.

> 
> On Tue, Sep 20, 2022 at 07:48:07PM +0100, Sudip Mukherjee wrote:
>> The datasheet of is25wp256 says it supports SFDP. Get rid of the static
>> initialization of the flash parameters and init them when parsing SFDP.
>>
>> Testing showed the flash using SPINOR_OP_READ_1_1_4_4B 0x6c,
>> SPINOR_OP_PP_4B 0x12 and SPINOR_OP_BE_4K_4B 0x21 before enabling SFDP.
>> After this patch, it parses the SFDP information and still uses the
>> same opcodes.
>>
>> Signed-off-by: Sudip Mukherjee <sudip.mukherjee at sifive.com>
> 
> With this patch in place, qemu emulations with is25wp256 fail to
> instantiate the flash. Specifically, this affects the qemu sifive_u
> emulation. The resulting error message is:
> 
> spi-nor spi0.0: BFPT parsing failed. Please consider using SPI_NOR_SKIP_SFDP when declaring the flash
> spi-nor: probe of spi0.0 failed with error -22
> 
> qemu command line:
> 
> qemu-system-riscv64 -M sifive_u -m 512M \
>       -no-reboot -kernel arch/riscv/boot/Image -snapshot \
>       -drive file=flash.8Vtb7,format=raw,if=mtd -bios default \
>       -append "root=/dev/mtdblock0 mtdparts=spi0.0:- console=ttySIF0,115200 earlycon" \
>       -nographic -monitor none
> 
> Reverting this patch fixes the problem.

I need some more debug info in order to have both flavors of the flash
work correctly. Would you please revert the patch locally and do the
tests from below? Thanks!

ta

---
# dd if=/dev/urandom of=./qspi_test bs=1M count=6
6+0 records in
6+0 records out

# mtd_debug write /dev/mtd4 0 6291456 qspi_test
Copied 6291456 bytes from qspi_test to address 0x00000000 in flash

# mtd_debug erase /dev/mtd4 0 6291456
Erased 6291456 bytes from address 0x00000000 in flash

# mtd_debug read /dev/mtd4 0 6291456 qspi_read
Copied 6291456 bytes from address 0x00000000 in flash to qspi_read

# hexdump qspi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*

0600000

# mtd_debug write /dev/mtd4 0 6291456 qspi_test
Copied 6291456 bytes from qspi_test to address 0x00000000 in flash

# mtd_debug read /dev/mtd4 0 6291456 qspi_read
Copied 6291456 bytes from address 0x00000000 in flash to qspi_read

# sha1sum qspi_test qspi_read
57f8d4fee65622104e24276e865f662844f12242  qspi_test
57f8d4fee65622104e24276e865f662844f12242  qspi_read

# cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
is25wp256

# cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
9d7019

# cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
issi

# xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450060101ff00060110300000ff9d05010380000002ffffffffffff
ffffffffffffffffffffffffffffffffffffe520f9ffffffff0f44eb086b
083b80bbfeffffffffff00ffffff44eb0c200f5210d800ff234ac90082d8
11cecccd68467a757a75f7aed55c4a422cfff030faa9ffffffffffffffff
ffffffffffffffff501950169ff9c0648fefffff

# md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
ba14818b9ec42713f24d94d66bb90ba0  /sys/bus/spi/devices/spi0.0/spi-nor/sfdp



More information about the linux-mtd mailing list