[U-Boot] [PATCH 3/4] ARM: AM33xx: Move s_init to a common place

Heiko Schocher hs at denx.de
Mon Jun 24 21:17:41 CEST 2013


Hello Lokesh,

Am 24.06.2013 15:15, schrieb Lokesh Vutla:
> From: Heiko Schocher <hs at denx.de>
> 
> s_init has the same outline for all the AM33xx based
> board. So making it generic.
> This also helps in addition of new Soc with minimal changes.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla at ti.com>
> Signed-off-by: Heiko Schocher <hs at denx.de>
> Signed-off-by: Tom Rini <trini at ti.com>
> ---
>  arch/arm/cpu/armv7/am33xx/board.c                |   46 +++++++++++++--
>  arch/arm/cpu/armv7/am33xx/clock_ti814x.c         |    6 ++
>  arch/arm/cpu/armv7/am33xx/emif4.c                |    6 +-
>  arch/arm/include/asm/arch-am33xx/clocks_am33xx.h |    6 +-
>  arch/arm/include/asm/arch-am33xx/sys_proto.h     |    5 +-
>  board/isee/igep0033/board.c                      |   49 +++-------------
>  board/phytec/pcm051/board.c                      |   48 +++-------------
>  board/ti/am335x/board.c                          |   52 +++--------------
>  board/ti/ti814x/evm.c                            |   67 +++-------------------
>  9 files changed, 90 insertions(+), 195 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c
> index 1d743d6..3d08673 100644
> --- a/arch/arm/cpu/armv7/am33xx/board.c
> +++ b/arch/arm/cpu/armv7/am33xx/board.c
> @@ -145,7 +145,7 @@ int arch_misc_init(void)
>  }
>  
>  #ifdef CONFIG_SPL_BUILD
> -void rtc32k_enable(void)
> +static void rtc32k_enable(void)
>  {
>  	struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE;
>  
> @@ -161,11 +161,7 @@ void rtc32k_enable(void)
>  	writel((1 << 3) | (1 << 6), &rtc->osc);
>  }
>  
> -#define UART_RESET		(0x1 << 1)
> -#define UART_CLK_RUNNING_MASK	0x1
> -#define UART_SMART_IDLE_EN	(0x1 << 0x3)
> -
> -void uart_soft_reset(void)
> +static void uart_soft_reset(void)
>  {
>  	struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;
>  	u32 regval;
> @@ -182,4 +178,42 @@ void uart_soft_reset(void)
>  	regval |= UART_SMART_IDLE_EN;
>  	writel(regval, &uart_base->uartsyscfg);
>  }
> +
> +static void watchdog_disable(void)
> +{
> +	struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
> +
> +	writel(0xAAAA, &wdtimer->wdtwspr);
> +	while (readl(&wdtimer->wdtwwps) != 0x0)
> +		;
> +	writel(0x5555, &wdtimer->wdtwspr);
> +	while (readl(&wdtimer->wdtwwps) != 0x0)
> +		;
> +}
>  #endif
> +
> +void s_init(void)
> +{
> +	/*
> +	 * Save the boot parameters passed from romcode.
> +	 * We cannot delay the saving further than this,
> +	 * to prevent overwrites.
> +	 */
> +#ifdef CONFIG_SPL_BUILD
> +	save_omap_boot_params();
> +	watchdog_disable();
> +	timer_init();
> +	set_uart_mux_conf();
> +	setup_clocks_for_console();
> +	uart_soft_reset();
> +
> +	gd = &gdata;
> +	preloader_console_init();
> +
> +	prcm_init();
> +	set_mux_conf_regs();
> +	/* Enable RTC32K clock */
> +	rtc32k_enable();

I tried your patches on my three boards. The board with the
rtc32k_enable() problem, did not work with them too :-(

Maybe we make rtc32k_enable() weak in common code, and so
I can make a board specific (dummy) function?

[...]

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list