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

Michal Suchanek hramrach at gmail.com
Wed Apr 15 10:01:54 CEST 2015


On 15 April 2015 at 09:35, Hans de Goede <hdegoede at redhat.com> wrote:
> 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.

So you mean that

ARCH_SUN6I is
!defined(MACH_SUN4I) && !defined(MACH_SUN5I) && !defined(MACH_SUN7I) &&
(defined(MACH_SUN6I) || defined(MACH_SUN8I) || defined(MACH_SUN9I))

Now that is ugly.

This probably needs a better name then.

Thanks

Michal


More information about the U-Boot mailing list