[U-Boot-Users] CFI: flash accessor functions used for source read too

Wolfgang Denk wd at denx.de
Wed Jan 9 12:22:34 CET 2008


Dear Haavard,

in message <20080104154223.1b874a41 at dhcp-252-066.norway.atmel.com> you wrote:
> 
> > Wolfgang just noticed that we (you in your original patches and myself in the 
> > latest patch) use flash_read8() (etc.) to read from source location too. 
> > Since this source is normally not located in FLASH, I'm not so sure anymore 
> > if we should use these accessors here too.
> 
> Right. I did that just to introduce as few surprises as possible --
> originally, the source data was accessed through a volatile pointer, so
> converting it to use the accessor functions seemed like the natural
> thing to do.
> 
> I don't think it's really necessary though. The source data isn't
> supposed to change underneath us, so accessing it through a regular,
> non-volatile pointer should work just fine.

I'm biased - flash_read*() might, for example, contain bank switching
code on processors (like MPC5200) which have limitations on the flash
sizes thay can directly address. So for copying from flash  to  flash
it  might  actually  be  a  good  idea to use flash_read*(). But then
flash_read*() must also work when accessing RAM or PCI memory or ...

I  think  we  should  at  least   document   the   requirements   for
flash_read*()  - i. e. that it must be capable of reading *arbitrary*
memory areas, not only flash memory.

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
There is nothing in this world constant but inconstancy.      - Swift




More information about the U-Boot mailing list