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

Rajat Srivastava rajat.srivastava at nxp.com
Fri Oct 26 09:59:50 UTC 2018


> -----Original Message-----
> From: York Sun
> Sent: Thursday, October 25, 2018 9:20 PM
> To: Stefan Roese <sr at denx.de>
> Cc: u-boot at lists.denx.de; Jagan Teki <jagan at openedev.com>; Rajat
> Srivastava <rajat.srivastava at nxp.com>; simon.k.r.goldschmidt at gmail.com;
> Ashish Kumar <ashish.kumar at nxp.com>
> Subject: Re: [U-Boot] [PATCH v3] sf: Add auto detection of 4-byte mode (vs
> standard 3-byte mode)
> 
> Guys,
> 
> Let get back to the original thread. Since Rajat's first reply, the
> message id has been changed. All the comments were not captured by
> patchwork.
> 
> On 10/11/18 07:50, Stefan Roese wrote:
> > Some SPI NOR chips only support 4-byte mode addressing. Here the
> default
> > 3-byte mode does not work and leads to incorrect accesses. This patch
> > now reads the 4-byte mode status bit (in this case in the CR register
> > of the Macronix SPI NOR) and configures the SPI transfers accordingly.
> >
> > This was noticed on the LinkIt Smart 7688 modul, which is equipped with
> > an Macronix MX25L25635F device. But this device does *NOT* support
> > switching to 3-byte mode via the EX4B command.
> >
> > This should also work when the bootrom configures the SPI flash to
> > 4-byte mode and runs U-Boot after this. U-Boot should dectect this
> > mode (if the 4-byte mode detection is available for this chip) and
> > use the correct OPs in this case.
> 
> From what I read, Rajat's method is to extend the controller driver to
> support read SFDP and default to 4-byte mode if supported, or
> overwritten by user's flag. Stefan's method is to read 4-byte status bit
> and doesn't change controller driver.
> 
> Is the default value of this 4-byte status bit valid and correct for all
> cases?
> 
> Rajat, without your patch set, does Stefan's solution work for your board?
> 
> York

No. Stefan's changes are specific to his boards and is not applicable on ours.
Stefan's patch is to support only certain flash that are factory strapped to work in 4-byte addressing modes only and will default to old method if such a flash is not found. The flashes on our boards (and also other vendor's board) will not work with Stefan's patch.

My patch can handle flashes with address widths of 3-byte, 4-byte or both. It also takes a more generic path (as opposed to supporting only specific flash models) by parsing SFDP standard parameters and then deciding what address width is to be used.

- Rajat


More information about the U-Boot mailing list