Patchwork [U-Boot,V3,1/9] nhk8815: change the order of initialization

login
register
mail settings
Submitter Alessandro Rubini
Date Dec. 5, 2009, 12:39 p.m.
Message ID <57d4517fac7e0f38b1eb4f6158a807f21ea14b87.1260016056.git.rubini@unipv.it>
Download mbox | patch
Permalink /patch/71687/
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Comments

Alessandro Rubini - Dec. 5, 2009, 12:39 p.m.
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(-)

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;
+}
+