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

Jerry Van Baren gerald.vanbaren at ge.com
Tue Apr 29 23:16:49 CEST 2008


Adrian Filipi wrote:
> On Tue, 29 Apr 2008, Wolfgang Denk wrote:
> 
>> In message <alpine.DEB.1.10.0804291604250.32753 at pmy.adscville> you wrote:
>>>  	I narrowed down the source of the problem to the loss of the
>>> volatile qualifier on the addr pointer in flash_write_cmd().  Adding the
>>> qualifier gets rid of the corruption.  In the older 1.2.0 sources, addr was
>>> declared as "volatile cfiptr_t addr;".
>> The volatile should not be needed - the CFI driver should use correct
>> accessor macros instead. See
>> Documentation/volatile-considered-harmful.txt in your Linux kernel
>> source tree...
>>
>> Best regards,
>>
>> Wolfgang Denk
> 
>  	Sure, reducing the reliance on volatile is a good idea, but I'm at 
> a loss for anything better to do.
> 
>  	I'm seeing a real problem that is only fixed by qualifying the 
> container of the pointer as volatile, i.e. "void *volatile".  "volatile 
> void *" has no effect as expected given that the read/write accessors are 
> used now.
> 
>  	The old data type was essentially "volatile void *volatile addr" 
> and the new type is simply "void *addr".  I seem to need at least "void 
> *volatile addr" for things to work.
> 
>  	Note, I'm only seeing this problem on our PXA250 boards.
> 
>  	Adrian

Hi Adrian,

Please bottom post.

It may be useful to disassemble cfi_flash.o file (objdump -S) and see 
what the two different configurations of flash_write_cmd() get turned 
into in assembly.

Best regards,
gvb




More information about the U-Boot mailing list