[U-Boot] [PATCH 03/10] sunxi: Introduce a hidden ARCH_SUN6I Kconfig bool

Hans de Goede hdegoede at redhat.com
Wed Apr 15 09:35:56 CEST 2015


Hi,

On 15-04-15 08:51, Michal Suchanek wrote:
> On 14 April 2015 at 18:06, Hans de Goede <hdegoede at redhat.com> wrote:
>> sun6i and newer (derived) SoCs such as the sun8i-a23, sun8i-a33 and sun9i
>> have a various things in common, like having separate ahb reset control
>> registers, the SID living inside the pmic, custom pmic busses, new style
>> watchdog, etc.
>>
>> This commit introduces a new hidden ARCH_SUN6I Kconfig bool which can be
>> used to check for these features avoiding the need for an ever growing list
>> of "#if defined CONFIG_MACH_SUN?I" conditionals as we add support for more
>> "new style" sunxi SoCs.
>>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>>   arch/arm/cpu/armv7/sunxi/board.c            | 18 +++++++++---------
>>   arch/arm/cpu/armv7/sunxi/cpu_info.c         |  2 +-
>>   arch/arm/cpu/armv7/sunxi/usbc.c             |  4 ++--
>>   arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 12 ++++++------
>>   arch/arm/include/asm/arch-sunxi/mmc.h       |  3 +--
>>   arch/arm/include/asm/arch-sunxi/timer.h     |  8 ++++----
>>   board/sunxi/Kconfig                         |  9 +++++++++
>>   board/sunxi/gmac.c                          |  6 +++---
>>   drivers/mmc/sunxi_mmc.c                     |  3 +--
>>   drivers/video/sunxi_display.c               | 10 +++++-----
>>   10 files changed, 41 insertions(+), 34 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
>> index 6471c6b..30d5974 100644
>> --- a/arch/arm/cpu/armv7/sunxi/board.c
>> +++ b/arch/arm/cpu/armv7/sunxi/board.c
>> @@ -173,7 +173,15 @@ void board_init_f(ulong dummy)
>>
>>   void reset_cpu(ulong addr)
>>   {
>> -#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN5I) || defined(CONFIG_MACH_SUN7I)
>> +#ifdef CONFIG_ARCH_SUN6I
>
> Hello,
>
> this looks wrong.
>
> Either this is ARCH_SUNXI and it coverts all or it's ARCH_SUN6I and
> then SUN4I and SUN5I should still be checked separately.

Look closer, the blocks before / after the #else are swapped to avoid needing
to use #ifndef without good reason as that is ugly.

>
>
>> diff --git a/arch/arm/include/asm/arch-sunxi/timer.h b/arch/arm/include/asm/arch-sunxi/timer.h
>> index 9a5e488..a6cc443 100644
>> --- a/arch/arm/include/asm/arch-sunxi/timer.h
>> +++ b/arch/arm/include/asm/arch-sunxi/timer.h
>> @@ -67,7 +67,10 @@ struct sunxi_timer_reg {
>>          struct sunxi_timer timer[6];    /* We have 6 timers */
>>          u8 res2[16];
>>          struct sunxi_avs avs;
>> -#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN5I) || defined(CONFIG_MACH_SUN7I)
>> +#ifdef CONFIG_ARCH_SUN6I

Same here.

Regards,

Hans


More information about the U-Boot mailing list