From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chen-Yu Tsai Date: Wed, 25 May 2016 00:06:07 +0800 Subject: [U-Boot] [PATCH 06/10] sunxi: Group cpu core related controls together In-Reply-To: <57440D8D.80208@arm.com> References: <1464007306-30269-1-git-send-email-wens@csie.org> <1464007306-30269-7-git-send-email-wens@csie.org> <57440D8D.80208@arm.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, May 24, 2016 at 4:15 PM, Marc Zyngier 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 >> --- >> .../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. Thanks. ChenYu