[U-Boot] [PATCH 06/10] sunxi: Group cpu core related controls together

Chen-Yu Tsai wens at csie.org
Tue May 24 18:06:07 CEST 2016


On Tue, May 24, 2016 at 4:15 PM, Marc Zyngier <marc.zyngier at 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 at 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.

Thanks.

ChenYu


More information about the U-Boot mailing list