[OpenWrt-Devel] Issues backporting 4-byte opcode support for w25q256 fix to 4.14 kernel and Lima board

Chuanhong Guo gch981213 at gmail.com
Fri May 1 11:16:06 EDT 2020


On Fri, May 1, 2020 at 9:48 PM Aleksander Morgado
<aleksander at aleksander.es> wrote:
> Hey Mantas,
> I'm working on porting your 4-byte opcode support fix for the w25q256
> (in openwrt git master, 4745969ad7c0cb65f55c8de1f05eba786ca27f71) to
> the 4.14 kernel used in 19.07 for the Lima board.
> The port is relatively easy just adding the post-bfpt parsing hook,
> but I'm stuck much earlier than that. In the Lima board I'm testing
> with (with a w25q256jv), the BFPT parsing is not even done. I've added
> several logs along the spi-nor codebase to see why that happened, and
> surprisingly the SFDP header version check done in
> spi_nor_parse_sfdp() is failing; the header version read is 0xff000010
> (??)
> [    0.862552] m25p80 spi0.0: found w25q256, expected m25p80
> [    0.868205] m25p80 spi0.0: running spi_nor_init_params...
> [    0.873799] m25p80 spi0.0: info->flags SPI_NOR_DUAL_READ |
> [    0.881522] m25p80 spi0.0: info->flags !SPI_NOR_SKIP_SFDP: yes
> [    0.887553] m25p80 spi0.0: will parse SFDP
> [    0.891780] m25p80 spi0.0: parsing SFDP...
> [    0.896047] m25p80 spi0.0: SFDP header version check failed...
> signature 0xff000010 (!= 0x50444653), major 0 (!= 1)
> [    0.916268] m25p80 spi0.0: running spi_nor_setup...
> [    0.921319] m25p80 spi0.0: enabling 4 byte addressing mode...
> [    0.927294] m25p80 spi0.0: w25q256 (32768 Kbytes)
> The outcome is that the 4-byte opcode is not enabled and the spi-nor
> ends up running in 4-byte addressing mode instead. Any idea or hint
> why this could be happening? Does the 0xff000010 header version value
> ring any bell?

That's the first word of flash content, not sfdp header. You are hit
by a flash reading patch for ath79-spi driver.[0]
spi_flash_read interface is used by both flash data reading and
SFDP reading. However this patch only handles the former case
and returns flash data when reading SFDP table.
To fix this problem, you need to check opcode in
ath79_spi_read_flash_data and return -ENOTSUPP on SFDP
reading request.

[0] https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch;h=7c24fc5e14e593e8945789c2ac3e37bd14ad92be;hb=33732f4a9c17921b782167a0dcaba9703d4e6753
Chuanhong Guo

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list