[U-Boot] [PATCH v3] sf: Add auto detection of 4-byte mode (vs standard 3-byte mode)

Stefan Roese sr at denx.de
Mon Oct 22 07:14:40 UTC 2018


Hi Rajat,

On 17.10.18 13:52, Rajat Srivastava wrote:
> Hi Stefan
> 
> Sorry for top-posting.
> 
> Why can't we read SFDP parameters from flash and auto-detect
> 3-byte/4-byte addressing mode?
> Using address width information we can support both types of flash
> i.e. flashes supporting 3-byte addressing mode as well as flashes
> supporting 4-byte addressing mode.

Our flash supports 3- and 4-byte addressing mode. But this special
chip is factory strapped to only support 4-byte mode, even though
its device ID tells us that it should support also 3-byte mode.
This current pretty simple patch enables the use of this flash
with very limited code additions. It also helps others (Simon on
SoCFPGA) with their issues regarding 3-byte vs 4-byte mode -
especially in regard to the bootrom and its setup.
  
> I've floated a similar patch in U-boot that reads and parses SFDP
> parameters from flash and auto-detects its addressing mode. It send
> commands according to the address width it detects.
> Please find the patch set at:
> https://patchwork.ozlabs.org/cover/985326/
> https://patchwork.ozlabs.org/patch/985327/
> https://patchwork.ozlabs.org/patch/985329/
> https://patchwork.ozlabs.org/patch/985328/

I've just applied your 3 patches and have added SFDP support for
our equipped SPI chip (with my patch not applied):

-       {"mx25l25635f",    INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
+       {"mx25l25635f",    INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP | SPI_FLASH_USE_SFDP) },

This does not seem to work though:

SF: Detected mx25l25635f with page size 0 Bytes, erase size 64 KiB, total 0 Bytes
*** Warning - bad CRC, using default environment

Please note that I'm not opposed to using your SFDP support. But
in our case it does not work - at least not without the
SPI_FLASH_USE_SFDP addition. And it needs some fixing as well to
fully detect the chip parameters. So I would prefer to go ahead
with my patch for now.

Thanks,
Stefan


More information about the U-Boot mailing list