
Sam Song writes:
Yuli> No, they aren't. First of all, on big-endian systems Yuli> __LITTLE_ENDIAN is never defined and on little-endian systems Yuli> it's always defined automatically while CFG_FLASH_CFI_SWAP Yuli> must be defined manually if your board has such a flash. On Yuli> little-endian systems, the driver should work without the need Yuli> to define CFG_FLASH_CFI_SWAP. Also, there are places in the Yuli> code for __LITTLE_ENDIAN only, not for CFG_FLASH_CFI_SWAP.
Sam> Seems your explaination is not the same as your patch:-).
Yes, the explanation is in English and the patch is in C:) The meaning is the same though.
Sam> I hope I weren't clear this time.
Sam> In your patch, CFG_FLASH_CFI_SWAP is automatically defined in Sam> __LITTLE_ENDIAN case. So on __LITTLE_ENDIAN system, Sam> CFG_FLASH_CFI_SWAP MUST BE ENABLED by default.
So it's exactly what I explained: little-endian systems work automatically without the need to define CFG_FLASH_CFI_SWAP. I meant, you don't have to #define CFG_FLASH_CFI_SWAP in the board configuration file to have working little-endian system. It's defined automatically when needed. Sorry if it wasn't clear enough.
Sam> +#if defined(__LITTLE_ENDIAN) && !defined(CFG_FLASH_CFI_SWAP) Sam> +#define CFG_FLASH_CFI_SWAP Sam> +#endif
If it makes things simpler, it's possible to replace
#ifdef CFG_FLASH_CFI_SWAP
by
#if defined(__LITTLE_ENDIAN) || defined(CFG_FLASH_CFI_SWAP)
and remove the above mentioned definition of CFG_FLASH_CFI_SWAP.