
Dear Wolfgang,
2009/5/14 Wolfgang Denk wd@denx.de:
I see. PowerPC in Linux uses C structs too. But there are still a lot of code that uses registers offsets in Linux, so my arguments are the same: requirement to convert offsets to C struct brings additional difficulties to porting (and maintaining already ported) drivers from Linux.
I understand your argument, but the decision has been made. We want to get rid of this pointer stuff in U-Boot, and do not accept any new code like this any more.
After having browsed some powerpc code I can find two different ways the struct-thing is used: Variant A, all members declared volatile: struct controller_reg { volatile uint32_t reg1; volatile uint32_t reg2; }
struct controller_reg *controller = 0xCAFE0000;
Or variant B: struct controller_reg { uint32_t reg1; uint32_t reg2; }
volatile struct controller_reg *controller = 0xCAFE0000;
Also, is it OK to access the registers using reg = controller->reg1 or should we use reg = readl(&controller->reg1)?
I ask this since I don't want to iterate the patches on the mailing list too many times...
Regards, Magnus