[U-Boot-Users] .../board/fads/flash.c confuses me - give me a hint

Tolunay Orkun
2005-01-12T21:03:48Z

Peter Asemann wrote:
> Nghiem, Tien wrote:
>
>> Hi,
>>
>> You can you use the CFI driver in /u-boot-1.1.1/drivers/cfi_flash.c.
>> it's generic and working. I have used it with these boards:
>> IceCube(MPC5200) and EP8260 without modification.
>
>
> Ahh... thanks for the hint. But anyway... the u-boot readme says an own
> flash.c was a minimum requirement for a port. If the generic driver
> works, why do people write customs flash.c's at all? All modern flash
> chips seem to support CFI anyway. Is there an example for a port that
> "only" uses the cfi_flash.c so I can take a look on it?

I'll jump in. Initially, each board had its own flash.c. cfi_flash.c
came later and some board maintainers switched to it and others did not
update their implementation for some reason. If your board can be
supported by cfi_flash.c and works well, it is probably not a good idea
to develop a custom flash driver.

Also, some hardware may have mapped their flash in a way that is not
compatible with cfi_flash.c or there may be other board specific issues
so a custom flash.c might be preferable. For example we use cfi_flash.c
on csb272 and csb472 boards. On csb272 it works well. On csb472 after
"cp" command the flash is left in command mode and I have to issue a
"protect on" or "protect off" command to put it to read mode again (we
use physical sector protection). One of these days, I'll debug the
problem (or hopefully another user of csb472 will do) but it was
determined by manager that this is not a critical issue for us and I
better spend my time on more pressing matters.