
Dear Graeme,
in message d66caabb0811231324q5bcf3076p698840e2f73c0564@mail.gmail.com you wrote:
Do you mean to instance the ecc_control struct at a specific memory location and use writel(0x000, &ptr->ecc_config);? If so, why not
Yes - this, and all other blocks of registers.
simply use ptr->ecc_config = 0x0000?
Because in general it will not work. You may make it work in many situations by making sure that the poointer has the "volatile" attribute, but depending on CPu propoerties and/or compiler opti- mization this may or may not be sufficient. Please see for example Documentation/volatile-considered-harmful.txt in the Linux kernel tree.
The only clean and portable and thus reliable way is to use the (CPU specific) accessor macros or functions.
and replacing: write_mmcr_byte(SC520_DRCCTL, \ (read_mmcr_byte(SC520_DRCCTL) & 0xcf) | (val<<4)); with: mmcrptr->drcctl = (mmcrptr->drcctl & 0xcf) | (val<<4);
Is this appropriate?
Probably not. Check what the Linux kenrel is doing (but then, x86 may be a poor example; these processors are simply not advanced enough).
Best regards,
Wolfgang Denk