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

Tolunay Orkun
2007-01-29T11:29:21Z

Zhang Wei-r63237 wrote:
>> Because the data we are interested in is only available in every
>> other byte?
>>
> Does it means if we need other byte data we can access them byte by byte? If we needn't we should not access them?
>
> Thanks!
> Zhang Wei

The current code works because most CPU Bus Interface Unit will execute
buswide cycles and discard the unused byte(s).

I understand that you would like to convert this code to use memcpy()
and pick various bytes from local ram instead of directly from flash.
Right? What exactly you are experiencing when you use current code.
Could you refresh my memory?

I do not like memcpy() as it is a black box. It could be implemented at
low level using string instructions, it could do various things for
different cpu architectures and various sizes so it could lead to very
hard to find issues.

My proposal for you to try: Do not depend on bus interface unit doing
buswide reads, explicitly read buswide chunks after doing the bus-wide
read into a temporary variable, pick the usable bytes from that
temporary variable. This should eliminate the bus interface unit
dependency of the CPU and possible board designer interfacing gimmicks.

Let us know how it goes (can you post your patch too so I can verify it).

Tolunay