[U-Boot] [PATCH v3 1/4] arm: Tegra2: Add basic NVIDIA Tegra2 SoC support

Graeme Russ graeme.russ at gmail.com
Fri Jan 21 01:13:54 CET 2011


On Fri, Jan 21, 2011 at 9:50 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Tom Warren,
>
> In message <AANLkTimcTq74=jz0HJcMSUMYe3Tf2zeUY9R9f7QVtVBV at mail.gmail.com> you wrote:
>>
>> I'll take a look at the ARM asm code generated, but you are probably right.
>> But shouldn't the compiler have complained if I wasn't passing the
>> struct address?
>
> I'm surprised about this, too.  But then, current mainline code still
> has the horrible "(*(volatile unsigned int *)(a) = (v))" definition,
> so the cast will eat all potential warnings :-(
>

Yes, I noticed this with x86 - I can do something like the following
without the compiler warning me:

typdef struct blah {
  u32 foo;
  u16 bar;
} blah_t;

blah_t *fred = 0x00001000;

writel(1, &fred->foo);
writel(1, &fred->bar);
writew(1, &fred->foo);
writew(1, &fred->bar);



This is particularly nasty with the sc520's Memory Mapped Control
Registers - I have found a few here and there where longs were being
written to words and visa-versa

Regards,

Graeme


More information about the U-Boot mailing list