diff mbox

[U-Boot,1/7] nhk8815: change the order of initialization

Message ID f7a4e3c97cd4885b12b942b1c2d60eff67b42c3a.1271329355.git.rubini@unipv.it
State Not Applicable
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Alessandro Rubini April 15, 2010, 11:11 a.m. UTC
From: Alessandro Rubini <rubini@unipv.it>

Some inizialization was in board_late_init(), but to satisfy drivers
added in the next patches must be performed in normal board_init.
This patch leaves board_late_init() empty, but later patches fill it.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
---

 board/st/nhk8815/nhk8815.c |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/board/st/nhk8815/nhk8815.c b/board/st/nhk8815/nhk8815.c
index faef810..eadce40 100644
--- a/board/st/nhk8815/nhk8815.c
+++ b/board/st/nhk8815/nhk8815.c
@@ -60,22 +60,26 @@  int board_init(void)
 	writel(0x02100551, NOMADIK_FSMC_BASE + 0x04); /* FSMC_BTR0 */
 
 	icache_enable();
-	return 0;
-}
 
-int board_late_init(void)
-{
+	/*
+	 * Configure I2C pins, as we will use I2C in a later commit
+	 */
+
 	/* Set the two I2C gpio lines to be gpio high */
 	nmk_gpio_set(__SCL, 1);	nmk_gpio_set(__SDA, 1);
 	nmk_gpio_dir(__SCL, 1);	nmk_gpio_dir(__SDA, 1);
 	nmk_gpio_af(__SCL, GPIO_GPIO); nmk_gpio_af(__SDA, GPIO_GPIO);
 
-	/* Reset the I2C port expander, on GPIO77 */
-	nmk_gpio_af(77, GPIO_GPIO);
-	nmk_gpio_dir(77, 1);
-	nmk_gpio_set(77, 0);
-	udelay(10);
-	nmk_gpio_set(77, 1);
+	/* Put the two I2C port expanders out of reset, on GPIO77 and 79 */
+	{
+		int n[2]={77, 79};
+		int i;
+		for (i = 0; i < ARRAY_SIZE(n); i++) {
+			nmk_gpio_af(n[i], GPIO_GPIO);
+			nmk_gpio_dir(n[i], 1);
+			nmk_gpio_set(n[i], 1);
+		}
+	}
 
 	return 0;
 }
@@ -101,3 +105,10 @@  int board_eth_init(bd_t *bis)
 	return rc;
 }
 #endif
+
+/* Initialization callback, from lib_arm/board.c */
+int board_late_init(void)
+{
+	return 0;
+}
+