
In message 45B8D66A.6080209@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