[RFC] MTD m25p80 3-byte addressing and boot problem

Mark Marshall markmarshall14 at gmail.com
Mon Sep 1 04:48:25 PDT 2014


We had the same problem here, but luckily our Flash also supported a
different read command that took the larger address.  I made a (small)
modification to the m25p80 driver to use this command when the flash
supported it.

I've attached the two patches that come from my tree that are
relevant.  The first one (42)  just changes to the page size used to
access the flash, and is only needed so that you don;t get conflicts
wit the second.  The second patch (45) is the one of interest.  These
patches are against v3.2.52-rt73 from the real-time tree, and there
are (obviously) other patches either side of them, but they should
show what I have done.  At some point (!) I'll try to push these
up-stream, but as ou can see, we are well behind the curve at the
moment, which makes this harder.


Mark Marshall.

On our original prototype hardware we had no reset line connected to
the flash, so even a hard reset wouldn't get things back to how they
should be when Linux was changing the bank register!  I think that the
longer commands should be used if the flash chip supports them in
preference to either bank switching or "converting" the small commands
to longer ones.

On 1 September 2014 11:43, Matteo Fortini <matteo.fortini at gmail.com> wrote:
> If a Linux/Barebox system is using an SPI flash of size >= 16 MB, the driver
> is switching to 3-byte addressing to be able to use linear access to the
> whole memory.
> This leads to the impossibility to boot a board after a warm reset, because
> all bootloaders use the standard 2-byte addressing (if the board doesn't
> physically reset the flash or do something similar).
> Some documentation in the following links:
> http://www.at91.com/discussions/viewtopic.php/f,30/t,22849.html
> https://community.freescale.com/docs/DOC-93632
> The solution proposed on freescale forums is not final: it involves
> switching back to 2-byte addressing after every access, which still leaves a
> small window in which a warm reset would be fatal.
> One solution would be to use the bank command in the flash, using each 16MB
> bank linearly, and changing bank depending on the address. This would be
> messy for accesses which are crossing the boundary, but it is doable.
> I'm asking here for comments before I start patching the code. Right now I
> resorted to stick to 2-byte addressing and leave half of my NOR (32MB)
> unused.
> TIA,
> M
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0042-m25p80-Use-a-512-byte-page-size-for-Spansion-flash-s.patch
Type: text/x-patch
Size: 1941 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20140901/65b70d33/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0045-m25p80-Use-the-4-byte-address-read-command.patch
Type: text/x-patch
Size: 4285 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20140901/65b70d33/attachment-0003.bin>

More information about the barebox mailing list