mx31pdk: Add MC13783 PMIC support
authorFabio Estevam <fabio.estevam@freescale.com>
Mon, 24 Oct 2011 05:32:28 +0000 (05:32 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Thu, 3 Nov 2011 21:56:18 +0000 (22:56 +0100)
Add MC13783 PMIC support.

Tested by using the 'date' command, which reads the MC13783 RTC registers:

MX31PDK U-Boot > date
Date: 1970-01-01 (Thursday)    Time:  2:22:35

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
board/freescale/mx31pdk/mx31pdk.c

index 0e7e0ce3477e32297be6b67dd558fcfddf3b6af7..9f8bc53e711c02fd40ed9f2b58b35417a24a277a 100644 (file)
@@ -30,6 +30,8 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
 #include <watchdog.h>
+#include <pmic.h>
+#include <fsl_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -79,6 +81,16 @@ int board_init(void)
 
 int board_late_init(void)
 {
+       u32 val;
+       struct pmic *p;
+
+       pmic_init();
+       p = get_pmic();
+
+       /* Enable RTC battery */
+       pmic_reg_read(p, REG_POWER_CTL0, &val);
+       pmic_reg_write(p, REG_POWER_CTL0, val | COINCHEN);
+       pmic_reg_write(p, REG_INT_STATUS1, RTCRSTI);
 #ifdef CONFIG_HW_WATCHDOG
        mxc_hw_watchdog_enable();
 #endif