[U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug.

Timur Tabi timur at freescale.com
Thu Jan 25 17:10:18 CET 2007


Zhang Wei-r63237 wrote:
> Hi, Wolfgang,
> 
> It's so pity that the flash got wrong 'num_erase_regions' issue is still
> in u-boot 1.2.0.
> 
> The byte by byte accessing is not preferred. But the flash_read_ushort()
> and flash_read_long() in drivers/cfi_flash.c are both implemented by
> byte accessing. How about it?
> 
> Can the instruction '
> 	retval = (addr[0] << 16) | (addr[(info->portwidth)] << 24) |
> 		(addr[(2 * info->portwidth)]) | (addr[(3 *
> info->portwidth)] << 8);'
> In flash_read_long() be replaced by memcpy() function?

I really don't think we should be using mempcy().  You're not supposed 
to care about the internal implementation of mempcy(), so if we start 
using it for specific-sized reads, then we start caring about how it's 
implemented.

If you want to read 32 bits at one time, then just do a 32-bit read!

	retval = * (ulong *) addr;

Looking at the code, I don't understand why it's so complicated.  If 
portwidth is 2, then retval above will be a conglomeration of addr[0], 
addr[2], addr[4], and addr[6].  Why isn't it just reading from 
[0][1][2][3]??





More information about the U-Boot mailing list