Patchwork [U-Boot] mx31pdk: Add MC13783 PMIC support

login
register
mail settings
Submitter Fabio Estevam
Date Oct. 24, 2011, 3:32 p.m.
Message ID <1319470348-6865-1-git-send-email-fabio.estevam@freescale.com>
Download mbox | patch
Permalink /patch/121374/
State Accepted
Commit 1f83d009e4fb086c3ee210f78b2ca601fd2cd0dc
Delegated to: Stefano Babic
Headers show

Comments

Fabio Estevam - Oct. 24, 2011, 3:32 p.m.
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 |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Stefano Babic - Oct. 25, 2011, 7:58 a.m.
On 10/24/2011 05:32 PM, Fabio Estevam wrote:
> 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 |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
> index 0e7e0ce..9f8bc53 100644
> --- a/board/freescale/mx31pdk/mx31pdk.c
> +++ b/board/freescale/mx31pdk/mx31pdk.c
> @@ -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

Applied to u-boot-imx (fix), thanks.

Best regards,
Stefano Babic

Patch

diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
index 0e7e0ce..9f8bc53 100644
--- a/board/freescale/mx31pdk/mx31pdk.c
+++ b/board/freescale/mx31pdk/mx31pdk.c
@@ -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