mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/5] ARM: i.MX51 babbage: use mc13xxx_register_callback to initialize PMIC
Date: Thu,  8 May 2014 09:31:38 +0200	[thread overview]
Message-ID: <1399534299-27051-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1399534299-27051-1-git-send-email-s.hauer@pengutronix.de>

This makes sure the PMIC is initialized once it's available. Move the
initcall to coredevice_initcall to make sure we initialize the PMIC
before the FEC driver is initialized. The ethernet phy needs vgen3
enabled in the PMIC initialization.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/freescale-mx51-babbage/board.c | 27 ++++++++++++--------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/arch/arm/boards/freescale-mx51-babbage/board.c b/arch/arm/boards/freescale-mx51-babbage/board.c
index bfe5338..11c901c 100644
--- a/arch/arm/boards/freescale-mx51-babbage/board.c
+++ b/arch/arm/boards/freescale-mx51-babbage/board.c
@@ -14,6 +14,8 @@
  *
  */
 
+#define pr_fmt(fmt) "babbage: " fmt
+
 #include <common.h>
 #include <init.h>
 #include <environment.h>
@@ -44,17 +46,10 @@
 
 #define MX51_CCM_CACRR 0x10
 
-static void babbage_power_init(void)
+static void babbage_power_init(struct mc13xxx *mc13xxx)
 {
-	struct mc13xxx *mc13xxx;
 	u32 val;
 
-	mc13xxx = mc13xxx_get();
-	if (!mc13xxx) {
-		printf("could not get PMIC\n");
-		return;
-	}
-
 	/* Write needed to Power Gate 2 register */
 	mc13xxx_reg_read(mc13xxx, MC13892_REG_POWER_MISC, &val);
 	val &= ~0x10000;
@@ -149,21 +144,23 @@ static void babbage_power_init(void)
 	mc13xxx_reg_write(mc13xxx, MC13892_REG_MODE_1, val);
 
 	udelay(200);
+
+	pr_info("initialized PMIC\n");
+
+	console_flush();
+	imx51_init_lowlevel(800);
+	clock_notifier_call_chain();
 }
 
 extern char flash_header_imx51_babbage_start[];
 extern char flash_header_imx51_babbage_end[];
 
-static int imx51_babbage_late_init(void)
+static int imx51_babbage_init(void)
 {
 	if (!of_machine_is_compatible("fsl,imx51-babbage"))
 		return 0;
 
-	babbage_power_init();
-
-	console_flush();
-	imx51_init_lowlevel(800);
-	clock_notifier_call_chain();
+	mc13xxx_register_callback(babbage_power_init);
 
 	armlinux_set_architecture(MACH_TYPE_MX51_BABBAGE);
 
@@ -173,4 +170,4 @@ static int imx51_babbage_late_init(void)
 
 	return 0;
 }
-late_initcall(imx51_babbage_late_init);
+coredevice_initcall(imx51_babbage_init);
-- 
2.0.0.rc0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-05-08  7:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08  7:31 [PATCH] fix i.MX51 babbage ethernet Sascha Hauer
2014-05-08  7:31 ` [PATCH 1/5] mfd: mc13xxx: Allow to set callback for mc13xxx Sascha Hauer
2014-05-18 23:14   ` Marc Reilly
2014-05-19  6:40     ` Sascha Hauer
2014-05-08  7:31 ` [PATCH 2/5] spi: i.MX: Move to coredevice_initcall Sascha Hauer
2014-05-11 18:49   ` Alexander Shiyan
2014-05-12 10:38     ` Sascha Hauer
2014-05-14 17:57       ` Alexander Shiyan
2014-05-19  8:47         ` Sascha Hauer
2014-05-08  7:31 ` [PATCH 3/5] mfd: mc13xxx: move " Sascha Hauer
2014-05-08  7:31 ` Sascha Hauer [this message]
2014-05-08  7:31 ` [PATCH 5/5] ARM: dts: i.MX51 babbage: overwrite upstream FEC iomux settings Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399534299-27051-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox