[U-Boot-Users] [RFC] CFI Driver Little-Endian write Issue

Yuli Barcohen yuli at arabellasw.com
Tue Aug 8 15:47:01 CEST 2006


>>>>> Li Yang writes:

    Li> Please ignore my last question.  Lately, I find out in your .c
    Li> file that there are still some places using __LITTLE_ENDIAN.

    Li> However, I still have a question that in which condition
    Li> CFG_FLASH_CFI_SWAP is required to set?

As I mentioned, it's for byte lanes swapping. If you connect a 16-bit
flash chip to a PPC, you need to connect only two byte lanes of the PPC
data bus i.e. lines D0-D15. For PPC, D0 is MSB and D15 is LSB. For the
flash, D0 is LSB and D15 is MSB. So, you can connect D0 to D15, D1 to
D14, and so on. Another possibility D0-D7 of PPC to D7-D0 of the flash
and D8-D15 of PPC to D15-D8 of the flash. The latter case is the case of
swapped byte lanes because PPC's most significant byte goes always to
D0-D7 and thus to the least significant byte of the flash. So, in the
latter case, you have to define CFG_FLASH_CFI_SWAP. Without
CFG_FLASH_CFI_SWAP, any flash command (which is always single byte) will
go to PPC's D8-D15 and consequently to the most significant byte of the
flash. This won't work because the commands must go to the flash's least
significant byte. Of course, PPC is only an example, the same problem
can occur with other CPUs too, it only depends on the bus architecture.

-- 
========================================================================
 Yuli Barcohen       | Phone +972-9-765-1788 |  Software Project Leader
 yuli at arabellasw.com | Fax   +972-9-765-7494 | Arabella Software, Israel
========================================================================




More information about the U-Boot mailing list