Patchwork [U-Boot,v2] da850evm: Move LPSC configuration to board_early_init_f()

login
register
mail settings
Submitter Christian Riesch
Date Sept. 5, 2011, 10:08 a.m.
Message ID <1315217338-6911-1-git-send-email-christian.riesch@omicron.at>
Download mbox | patch
Permalink /patch/113335/
State Accepted
Delegated to: Sandeep Paulraj
Headers show

Comments

Christian Riesch - Sept. 5, 2011, 10:08 a.m.
Since commit f1d2b313c9eb6808d30c16a9eb5251240452a56c the serial
port of the da850evm is accessed before the UART2 peripheral of
the SoC is powered on in the function board_init() in
board/davinci/da8xxevm/da850evm.c.

When u-boot is used in conjunction with the UBL (user boot loader, see
doc/README.davinci) on this board, the UART2 peripheral is already
turned on by UBL at the time u-boot is started. Hence, the wrong 
initialization sequence is not noticed by most users. However, if UBL is not
used, u-boot must power on the peripheral before using it.

This patch adds a board_early_init_f() function for the LPSC
configuration to the da850evm board configuration.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Cc: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Cc: Sandeep Paulraj <s-paulraj@ti.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Ben Gardiner <bengardiner@nanometrics.ca>
---

Changes for v2: 
	- rebased

Hi,
Since a number of da850 related patches have been merged during the weekend,
my original patch did not apply anymore. v2 is rebased on top of the
master branch of mainline u-boot.

I understand that most people use u-boot on the da850evm in conjunction
with the UBL and so this patch is rather unimportant to them. UBL will
initialize the LPSC and the wrong initialization sequence in u-boot will
not be noticed. But I think this should be corrected nevertheless and it
also helps people like me who are not using the UBL. I am not sure if this
is the correct way to fix the LPSC initialization so I am looking forward 
to your comments.

Cheers, Christian

 board/davinci/da8xxevm/da850evm.c |   23 ++++++++++++++---------
 include/configs/da850evm.h        |    1 +
 2 files changed, 15 insertions(+), 9 deletions(-)

Patch

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 2f950e7..886af6c 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -278,6 +278,20 @@  u32 get_board_rev(void)
 	return rev;
 }
 
+int board_early_init_f(void)
+{
+	/*
+	 * Power on required peripherals
+	 * ARM does not have access by default to PSC0 and PSC1
+	 * assuming here that the DSP bootloader has set the IOPU
+	 * such that PSC access is available to ARM
+	 */
+	if (da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc)))
+		return 1;
+
+	return 0;
+}
+
 int board_init(void)
 {
 	u32 val;
@@ -308,15 +322,6 @@  int board_init(void)
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
 
-	/*
-	 * Power on required peripherals
-	 * ARM does not have access by default to PSC0 and PSC1
-	 * assuming here that the DSP bootloader has set the IOPU
-	 * such that PSC access is available to ARM
-	 */
-	if (da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc)))
-		return 1;
-
 	/* setup the SUSPSRC for ARM to control emulation suspend */
 	writel(readl(&davinci_syscfg_regs->suspsrc) &
 	       ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index f6068a2..74e8d4c 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -161,6 +161,7 @@ 
  * U-Boot general configuration
  */
 #define CONFIG_MISC_INIT_R
+#define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
 #define CONFIG_SYS_PROMPT	"U-Boot > " /* Command Prompt */
 #define CONFIG_SYS_CBSIZE	1024 /* Console I/O Buffer Size	*/