spi-nor dummy bytes for fast read command

Bin Meng bmeng.cn at gmail.com
Tue Jan 12 21:06:45 EST 2021


Hi,

It seems both U-Boot and Linux kernel spi-nor drivers have the same
assumption on dummy cycles required in a fast read command.

In U-Boot spi_nor_read_data(), there is a logic to calculate the dummy
bytes needed for fast read command:

    /* convert the dummy cycles to the number of bytes */
    op.dummy.nbytes = (nor->read_dummy * op.dummy.buswidth) / 8;

This logic assumes the (nor->read_dummy * op.dummy.buswidth) is a
multiple of 8, otherwise this won't work.

In Linux, the same logic exists in spi_nor_spimem_read_data().

Note on most flashes this is not a problem, however on some flashes
the dummy cycles for the fast read command is configurable. If the
dummy cycle is configured to some odd value which makes this
assumption false, then we get a non-working driver.

Regards,
Bin



More information about the linux-mtd mailing list