[U-Boot] [PATCH] arm, am33xx: move s_init to a common place

Tom Rini trini at ti.com
Thu Jun 13 17:53:37 CEST 2013


On Thu, Jun 13, 2013 at 05:53:17AM +0200, Heiko Schocher wrote:

> move s_init from every board code to a common place.
> 
> Signed-off-by: Heiko Schocher <hs at denx.de>
> Cc: Tom Rini <trini at ti.com>
> Cc: Matt Porter <mporter at ti.com>
> Cc: Lars Poeschel <poeschel at lemonage.de>
> Cc: Tom Rini <trini at ti.com>
> Cc: Enric Balletbo i Serra <eballetbo at iseebcn.com>
> 
> ---
> This patch is based on the following patches:
> 
> - [U-Boot,v2] arm, am33xx: move rtc32k_enable() to common place
>   http://patchwork.ozlabs.org/patch/248908/
> 
> - [U-Boot] arm, am33xx: move uart soft reset code to common place
>   http://patchwork.ozlabs.org/patch/248508/

These two apply best to u-boot-ti, and with them this patch doesn't
apply cleanly.  Please sort that out.

The following adds moving ti814x_evm into the mix and I've sent Matt
some binaries to give a whirl to test on the board:

diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c
index 80b65fb..13b086a 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -151,6 +151,8 @@ int arch_misc_init(void)
 }
 
 #ifdef CONFIG_SPL_BUILD
+static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
+
 void rtc32k_enable(void)
 {
 	struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE;
@@ -190,9 +192,6 @@ void uart_soft_reset(void)
 }
 #endif
 
-#ifndef CONFIG_TI81XX
-static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
-
 void s_init(void)
 {
 	/*
@@ -202,7 +201,9 @@ void s_init(void)
 	 */
 	save_omap_boot_params();
 
-	/* WDT1 is already running when the bootloader gets control
+#ifdef CONFIG_SPL_BUILD
+	/*
+	 * WDT1 is already running when the bootloader gets control
 	 * Disable it to avoid "random" resets
 	 */
 	writel(0xAAAA, &wdtimer->wdtwspr);
@@ -212,7 +213,6 @@ void s_init(void)
 	while (readl(&wdtimer->wdtwwps) != 0x0)
 		;
 
-#ifdef CONFIG_SPL_BUILD
 	/* Setup the PLLs and the clocks for the peripherals */
 	pll_init();
 
@@ -231,4 +231,3 @@ void s_init(void)
 	sdram_init();
 #endif
 }
-#endif
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
index 6ad3dd8..08daee4 100644
--- a/board/ti/ti814x/evm.c
+++ b/board/ti/ti814x/evm.c
@@ -35,30 +35,10 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_SPL_BUILD
-static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
-#endif
-
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
 /* UART Defines */
 #ifdef CONFIG_SPL_BUILD
-static void uart_enable(void)
-{
-	/* UART softreset */
-	uart_soft_reset();
-}
-
-static void wdt_disable(void)
-{
-	writel(0xAAAA, &wdtimer->wdtwspr);
-	while (readl(&wdtimer->wdtwwps) != 0x0)
-		;
-	writel(0x5555, &wdtimer->wdtwspr);
-	while (readl(&wdtimer->wdtwwps) != 0x0)
-		;
-}
-
 static const struct cmd_control evm_ddr2_cctrl_data = {
 	.cmd0csratio	= 0x80,
 	.cmd0dldiff	= 0x04,
@@ -108,37 +88,12 @@ static const struct ddr_data evm_ddr2_data = {
 	.datauserank0delay	= 1,
 	.datadldiff0		= 0x4,
 };
-#endif
 
 /*
  * early system init of muxing and clocks.
  */
-void s_init(void)
+void board_enable_early_pinmux(void)
 {
-#ifdef CONFIG_SPL_BUILD
-	/*
-	 * 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();
-#endif
-
-	/* WDT1 is already running when the bootloader gets control
-	 * Disable it to avoid "random" resets
-	 */
-	wdt_disable();
-
-	/* Enable timer */
-	timer_init();
-
-	/* Setup the PLLs and the clocks for the peripherals */
-	pll_init();
-
-	/* Enable RTC32K clock */
-	rtc32k_enable();
-
 	/* Set UART pins */
 	enable_uart0_pin_mux();
 
@@ -147,22 +102,18 @@ void s_init(void)
 
 	/* Set Ethernet pins */
 	enable_enet_pin_mux();
+}
 
-	/* Enable UART */
-	uart_enable();
-
-	gd = &gdata;
-
-	preloader_console_init();
-
+void sdram_init(void)
+{
 	config_dmm(&evm_lisa_map_regs);
 
 	config_ddr(0, 0, &evm_ddr2_data, &evm_ddr2_cctrl_data,
 		   &evm_ddr2_emif0_regs, 0);
 	config_ddr(0, 0, &evm_ddr2_data, &evm_ddr2_cctrl_data,
 		   &evm_ddr2_emif1_regs, 1);
-#endif
 }
+#endif
 
 /*
  * Basic board specific setup.  Pinmux has been handled already.

Please fold into v2

Signed-off-by: Tom Rini <trini at ti.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130613/e395b50f/attachment.pgp>


More information about the U-Boot mailing list