[U-Boot] [PATCH v3 3/3] ARM:AM33XX: Add SPL support for AM335X EVM

Igor Grinberg
2012-01-03T08:34:23Z

Hi Chandan,

On 01/03/12 10:18, Kumar Nath, Chandan wrote:
>
>> On 01/03/12 08:42, Chandan Nath wrote:
>>> This patch is added to support SPL feature on AM335X
>>> platform. In this patch, MMC1 is configured as boot
>>> device for SPL and support for other devices will be
>>> added in the next patch series.
>>>
>>> Signed-off-by: Chandan Nath <chandan.nath@ti.com>
>>> Signed-off-by: Tom Rini <trini@ti.com>
>>> ---
>>> Changes since v2:
>>> - Added missing omap.h file
>>>
>>> Changes since v1:
>>> - Rebased to master branch
>>> - Replaced am33xx lowleve_init.S with omap-common lowlevel_init.S
>>> in order to use common code for omap_bootmode.

[...]

>>> diff --git a/arch/arm/cpu/armv7/am33xx/board.c
>> b/arch/arm/cpu/armv7/am33xx/board.c
>>> index 312643c..2a45933 100644
>>> --- a/arch/arm/cpu/armv7/am33xx/board.c
>>> +++ b/arch/arm/cpu/armv7/am33xx/board.c
>>> @@ -19,19 +19,45 @@
>>> #include <common.h>
>>> #include <asm/arch/cpu.h>
>>> #include <asm/arch/hardware.h>
>>> +#include <asm/arch/omap.h>
>>> #include <asm/arch/ddr_defs.h>
>>> #include <asm/arch/clock.h>
>>> +#include <asm/arch/mmc_host_def.h>
>>> +#include <asm/arch/common_def.h>
>>> #include <asm/io.h>
>>> +#include <asm/omap_common.h>
>>>
>>> DECLARE_GLOBAL_DATA_PTR;
>>>
>>> struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
>>> struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
>>> +struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;
>>> +
>>> +struct omap_boot_parameters boot_params __attribute__
>> ((section(".data")));
>>> +
>>> +#ifdef CONFIG_SPL_BUILD
>>> +u32 omap_bootmode = MMCSD_MODE_FAT;
>>> +
>>> +u32 omap_boot_device(void)
>>> +{
>>> + return (u32) (boot_params.omap_bootdevice);
>>> +}
>>> +
>>> +u32 omap_boot_mode(void)
>>> +{
>>> + return omap_bootmode;
>>> +}
>>> +
>>
>> can't arch/arm/cpu/armv7/omap-common/hwinit-common.c be used for this?
>
> I tried using hwinit-common.c file, but there are some other functions defined
> which are not required. Could you tell me if there is any method to use only
> Above functions from hwinit-common.c file.

At least two ways, I can think of:
The less pretty, is introduce ifdefs in that file.
Another and IMO better option is split the file into
common and "less" common content and then reuse the right one.
With the later, you prevent the needless ifdeffery, but need to
be careful not to break any existing platforms.

--
Regards,
Igor.