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

Wolfgang Denk wd at denx.de
Thu Jan 25 21:33:51 CET 2007


In message <45B8D66A.6080209 at freescale.com> you wrote:
>
> > 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?

INHO: no, it cannot.

> If you want to read 32 bits at one time, then just do a 32-bit read!
> 
> 	retval = * (ulong *) addr;

You assume that we want to read four contiguous bytes, which may,  or
may not, be the case.

> 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]??

Because the data we are interested in  is  only  available  in  every
other byte?

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The Gates in my computer are AND, OR and NOT; they are not Bill.




More information about the U-Boot mailing list