[PATCH 4/4] ARM: i.MX51 efikasb: register init callback for PMIC init

Sascha Hauer s.hauer at pengutronix.de
Tue Nov 11 23:21:23 PST 2014


So that the PMIC initialisation is called once it's available.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/boards/efika-mx-smartbook/board.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boards/efika-mx-smartbook/board.c b/arch/arm/boards/efika-mx-smartbook/board.c
index 02fce4b..99efd66 100644
--- a/arch/arm/boards/efika-mx-smartbook/board.c
+++ b/arch/arm/boards/efika-mx-smartbook/board.c
@@ -64,16 +64,9 @@ static inline int machine_is_efikasb(void)
 	return 1;
 }
 
-static int efikamx_power_init(void)
+static void efikamx_power_init(struct mc13xxx *mc)
 {
 	unsigned int val;
-	struct mc13xxx *mc;
-
-	mc = mc13xxx_get();
-	if (!mc) {
-		printf("could not get mc13892\n");
-		return -ENODEV;
-	}
 
 	/* Write needed to Power Gate 2 register */
 	mc13xxx_reg_read(mc, MC13892_REG_POWER_MISC, &val);
@@ -178,8 +171,6 @@ static int efikamx_power_init(void)
 	mc13xxx_reg_write(mc, MC13892_REG_POWER_CTL2, val);
 
 	udelay(2500);
-
-	return 0;
 }
 
 static int efikamx_usb_init(void)
@@ -189,6 +180,8 @@ static int efikamx_usb_init(void)
 
 	barebox_set_hostname("efikasb");
 
+	mc13xxx_register_init_callback(efikamx_power_init);
+
 	gpio_direction_output(GPIO_BLUETOOTH, 0);
 	gpio_direction_output(GPIO_WIFI_ENABLE, 1);
 	gpio_direction_output(GPIO_WIFI_RESET, 0);
@@ -246,8 +239,6 @@ static int efikamx_late_init(void)
 	if (!of_machine_is_compatible("genesi,imx51-sb"))
 		return 0;
 
-	efikamx_power_init();
-
 	defaultenv_append_directory(defaultenv_efikasb);
 
 	gpio_direction_output(GPIO_BACKLIGHT_POWER, 1);
-- 
2.1.1




More information about the barebox mailing list