[U-Boot-Users] cfi_flash.c and lost volatile qualifier

Scott Wood scottwood at freescale.com
Wed Apr 30 18:02:19 CEST 2008


On Wed, Apr 30, 2008 at 05:34:56PM +0200, Joakim Tjernlund wrote:
> 
> On Wed, 2008-04-30 at 10:21 -0500, Scott Wood wrote:
> > On Wed, Apr 30, 2008 at 05:11:09PM +0200, Joakim Tjernlund wrote:
> > > Yet the in_bex()/out_bex() functions in PowerPC linux uses sync and all
> > > SOC drivers are encouraged to use them. What a waste :(
> > 
> > sync is needed in some of the cases, to sync I/O accesses with DMA buffer
> > accesses.  Ideally, we could trust the driver writers to put
> > synchronization in where needed, but it seems Linux has too much x86
> > heritage for that.
> 
> Perhaps, is sync needed in this case for non-smp too? or is eieio
> enough?

Yes, sync is needed -- eieio doesn't order between stores to cacheable
memory and stores to cache-inhibited memory.

> Anyway, just have a look at ucc_geth 

Do I have to? :-)

> and you will see that most such accesses are just about getting the
> endian right.

If you mean the descriptor accesses, ordering is relevant there as well.

> > There should at least be raw alternatives, though...
> 
> There need be a get-the-endian-right-but-no-sync.

Agreed.  There's cpu_to_be32, etc., but that doesn't fit well with
load/store endian-swapping instructions.

> After all 2.4 managed well without using the in/out be() functions.

I see in/out_be32() in 2.4...  and the significant chunks of code that
use volatile pointers instead, I wouldn't consider to be managing "well";
they just happen to work most of the time.

-Scott




More information about the U-Boot mailing list