Patchwork [U-Boot,07/11] MX5: mx53evk: use new pmic driver

login
register
mail settings
Submitter Stefano Babic
Date Oct. 8, 2011, 10:07 a.m.
Message ID <1318068428-3453-8-git-send-email-sbabic@denx.de>
Download mbox | patch
Permalink /patch/118526/
State Changes Requested
Headers show

Comments

Stefano Babic - Oct. 8, 2011, 10:07 a.m.
Switch to new pmic generic driver.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Jason Liu <jason.hui@linaro.org>
---
 board/freescale/mx53evk/mx53evk.c |   15 +++++++++------
 include/configs/mx53evk.h         |    5 +++--
 2 files changed, 12 insertions(+), 8 deletions(-)
Jason Liu - Oct. 9, 2011, 8:40 a.m.
Hi, Stefano,

On Sat, Oct 8, 2011 at 6:07 PM, Stefano Babic <sbabic@denx.de> wrote:
> Switch to new pmic generic driver.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Jason Liu <jason.hui@linaro.org>
> ---
>  board/freescale/mx53evk/mx53evk.c |   15 +++++++++------
>  include/configs/mx53evk.h         |    5 +++--
>  2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/board/freescale/mx53evk/mx53evk.c b/board/freescale/mx53evk/mx53evk.c
> index fd821c0..af0948f 100644
> --- a/board/freescale/mx53evk/mx53evk.c
> +++ b/board/freescale/mx53evk/mx53evk.c
> @@ -32,6 +32,7 @@
>  #include <i2c.h>
>  #include <mmc.h>
>  #include <fsl_esdhc.h>
> +#include <pmic.h>
>  #include <fsl_pmic.h>
>  #include <asm/gpio.h>
>  #include <mc13892.h>
> @@ -124,12 +125,13 @@ static void setup_i2c(unsigned int port_number)
>  void power_init(void)
>  {
>        unsigned int val;
> +       struct pmic *p = get_pmic();
>
>        /* Set VDDA to 1.25V */
> -       val = pmic_reg_read(REG_SW_2);
> +       pmic_reg_read(p, REG_SW_2, &val);
>        val &= ~SWX_OUT_MASK;
>        val |= SWX_OUT_1_25;
> -       pmic_reg_write(REG_SW_2, val);
> +       pmic_reg_write(p, REG_SW_2, val);
>
>        /*
>         * Need increase VCC and VDDA to 1.3V
> @@ -137,16 +139,16 @@ void power_init(void)
>         */
>        if (is_soc_rev(CHIP_REV_2_0) == 0) {
>                /* Set VCC to 1.3V for TO2 */
> -               val = pmic_reg_read(REG_SW_1);
> +               pmic_reg_read(p, REG_SW_1, &val);
>                val &= ~SWX_OUT_MASK;
>                val |= SWX_OUT_1_30;
> -               pmic_reg_write(REG_SW_1, val);
> +               pmic_reg_write(p, REG_SW_1, val);
>
>                /* Set VDDA to 1.3V for TO2 */
> -               val = pmic_reg_read(REG_SW_2);
> +               pmic_reg_read(p, REG_SW_2, &val);
>                val &= ~SWX_OUT_MASK;
>                val |= SWX_OUT_1_30;
> -               pmic_reg_write(REG_SW_2, val);
> +               pmic_reg_write(p, REG_SW_2, val);
>        }
>  }
>
> @@ -364,6 +366,7 @@ int board_init(void)
>  int board_late_init(void)
>  {
>        setup_i2c(1);
> +       pmic_init();
>        power_init();
>
>        return 0;
> diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
> index b127b06..dfe07bf 100644
> --- a/include/configs/mx53evk.h
> +++ b/include/configs/mx53evk.h
> @@ -59,8 +59,9 @@
>  #define CONFIG_SYS_I2C_SLAVE            0xfe
>
>  /* PMIC Configs */
> -#define CONFIG_FSL_PMIC
> -#define CONFIG_FSL_PMIC_I2C
> +#define CONFIG_PMIC
> +#define CONFIG_PMIC_I2C
> +#define CONFIG_PMIC_FSL
>  #define CONFIG_SYS_FSL_PMIC_I2C_ADDR    8
>
>  /* MMC Configs */

Acked-by: Jason Liu <jason.hui@linaro.org>

> --
> 1.7.1
>
>

Patch

diff --git a/board/freescale/mx53evk/mx53evk.c b/board/freescale/mx53evk/mx53evk.c
index fd821c0..af0948f 100644
--- a/board/freescale/mx53evk/mx53evk.c
+++ b/board/freescale/mx53evk/mx53evk.c
@@ -32,6 +32,7 @@ 
 #include <i2c.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
+#include <pmic.h>
 #include <fsl_pmic.h>
 #include <asm/gpio.h>
 #include <mc13892.h>
@@ -124,12 +125,13 @@  static void setup_i2c(unsigned int port_number)
 void power_init(void)
 {
 	unsigned int val;
+	struct pmic *p = get_pmic();
 
 	/* Set VDDA to 1.25V */
-	val = pmic_reg_read(REG_SW_2);
+	pmic_reg_read(p, REG_SW_2, &val);
 	val &= ~SWX_OUT_MASK;
 	val |= SWX_OUT_1_25;
-	pmic_reg_write(REG_SW_2, val);
+	pmic_reg_write(p, REG_SW_2, val);
 
 	/*
 	 * Need increase VCC and VDDA to 1.3V
@@ -137,16 +139,16 @@  void power_init(void)
 	 */
 	if (is_soc_rev(CHIP_REV_2_0) == 0) {
 		/* Set VCC to 1.3V for TO2 */
-		val = pmic_reg_read(REG_SW_1);
+		pmic_reg_read(p, REG_SW_1, &val);
 		val &= ~SWX_OUT_MASK;
 		val |= SWX_OUT_1_30;
-		pmic_reg_write(REG_SW_1, val);
+		pmic_reg_write(p, REG_SW_1, val);
 
 		/* Set VDDA to 1.3V for TO2 */
-		val = pmic_reg_read(REG_SW_2);
+		pmic_reg_read(p, REG_SW_2, &val);
 		val &= ~SWX_OUT_MASK;
 		val |= SWX_OUT_1_30;
-		pmic_reg_write(REG_SW_2, val);
+		pmic_reg_write(p, REG_SW_2, val);
 	}
 }
 
@@ -364,6 +366,7 @@  int board_init(void)
 int board_late_init(void)
 {
 	setup_i2c(1);
+	pmic_init();
 	power_init();
 
 	return 0;
diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
index b127b06..dfe07bf 100644
--- a/include/configs/mx53evk.h
+++ b/include/configs/mx53evk.h
@@ -59,8 +59,9 @@ 
 #define CONFIG_SYS_I2C_SLAVE            0xfe
 
 /* PMIC Configs */
-#define CONFIG_FSL_PMIC
-#define CONFIG_FSL_PMIC_I2C
+#define CONFIG_PMIC
+#define CONFIG_PMIC_I2C
+#define CONFIG_PMIC_FSL
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR    8
 
 /* MMC Configs */