
On 24/05/16 17:06, Chen-Yu Tsai wrote:
On Tue, May 24, 2016 at 4:15 PM, Marc Zyngier marc.zyngier@arm.com wrote:
On 23/05/16 13:41, Chen-Yu Tsai wrote:
Instead of listing individual registers for controls to each processor core, list them as an array of registers. This makes accessing controls by core index easier.
Also rename "cpucfg_sun6i.h" (which was unused anyway) to the more generic "cpucfg.h".
Signed-off-by: Chen-Yu Tsai wens@csie.org
.../asm/arch-sunxi/{cpucfg_sun6i.h => cpucfg.h} | 31 +++++++++------------- arch/arm/include/asm/arch-sunxi/prcm.h | 6 ++--- 2 files changed, 14 insertions(+), 23 deletions(-) rename arch/arm/include/asm/arch-sunxi/{cpucfg_sun6i.h => cpucfg.h} (69%)
diff --git a/arch/arm/include/asm/arch-sunxi/cpucfg_sun6i.h b/arch/arm/include/asm/arch-sunxi/cpucfg.h similarity index 69% rename from arch/arm/include/asm/arch-sunxi/cpucfg_sun6i.h rename to arch/arm/include/asm/arch-sunxi/cpucfg.h index e2a29cb1818e..b9084b3968cd 100644 --- a/arch/arm/include/asm/arch-sunxi/cpucfg_sun6i.h +++ b/arch/arm/include/asm/arch-sunxi/cpucfg.h @@ -11,33 +11,26 @@
#ifndef __ASSEMBLY__
+struct sunxi_cpucfg_cpu {
u32 rst; /* base + 0x0 */
u32 ctrl; /* base + 0x4 */
u32 status; /* base + 0x8 */
u8 res[0x34]; /* base + 0xc */
+};
Please use the "packed" attribute. Even if you declared your structure in a way that makes sure no padding will be introduced, this also serves as a reminder that this is not your usual memory.
Same goes for the other structures in the file.
OK.
Somewhat related, it seems we use (struct foo*) for accessing registers in U-boot, while in the kernel we use (void * + some offset). Could someone explain the trade-offs or preferences on this? struct foo doesn't work in assembly afaik.
I personally hate the use of structures to access MMIO, because it gives people the idea that they can manipulate this just like memory. Which means that they are probably going to miss crucial barriers (on ARM), or do something completely wrong on some other architectures (have a look at SPARC and its ASIs).
But that's just my personal taste, and I don't mind people doing one or the other in code that I don't have to maintain... ;-)
Thanks,
M.