Patchwork [U-Boot] mx53loco: Fix PMIC name

login
register
mail settings
Submitter Fabio Estevam
Date Dec. 11, 2012, 4:36 p.m.
Message ID <1355243818-23962-1-git-send-email-fabio.estevam@freescale.com>
Download mbox | patch
Permalink /patch/205273/
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Comments

Fabio Estevam - Dec. 11, 2012, 4:36 p.m.
commit c73368150 (pmic: Extend PMIC framework to support multiple instances 
of PMIC devices) has incorrectly passed the PMIC name under the FSL PMIC case.

Fix that by passing "FSL_PMIC" as the parameter of pmic_get.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 board/freescale/mx53loco/mx53loco.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Stefano Babic - Dec. 13, 2012, 8:25 a.m.
On 11/12/2012 17:36, Fabio Estevam wrote:
> commit c73368150 (pmic: Extend PMIC framework to support multiple instances 
> of PMIC devices) has incorrectly passed the PMIC name under the FSL PMIC case.
> 
> Fix that by passing "FSL_PMIC" as the parameter of pmic_get.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  board/freescale/mx53loco/mx53loco.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
> index 81c511c..2c8cb7a 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -374,7 +374,7 @@ static int power_init(void)
>  		if (retval)
>  			return retval;
>  
> -		p = pmic_get("DIALOG_PMIC");
> +		p = pmic_get("FSL_PMIC");
>  		if (!p)
>  			return -ENODEV;
>  
> 

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic
robertcnelson@gmail.com - Dec. 20, 2012, 10:04 p.m.
On Tue, Dec 11, 2012 at 10:36 AM, Fabio Estevam
<fabio.estevam@freescale.com> wrote:
> commit c73368150 (pmic: Extend PMIC framework to support multiple instances
> of PMIC devices) has incorrectly passed the PMIC name under the FSL PMIC case.
>
> Fix that by passing "FSL_PMIC" as the parameter of pmic_get.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  board/freescale/mx53loco/mx53loco.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
> index 81c511c..2c8cb7a 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -374,7 +374,7 @@ static int power_init(void)
>                 if (retval)
>                         return retval;
>
> -               p = pmic_get("DIALOG_PMIC");
> +               p = pmic_get("FSL_PMIC");
>                 if (!p)
>                         return -ENODEV;
>
> --
> 1.7.9.5

Hi Fabio,

It looks like we need one more fixup after commit c73368150 on the
first run/older (non R, Dialog, bug wired extra Capacitor) version of
this board..  Do you happen to have any in your lab?

U-Boot 2013.01-rc2-dirty (Dec 20 2012 - 15:55:01)

Board: MX53 LOCO
I2C:   ready
DRAM:  1 GiB
pmic_alloc: No available memory for allocation!
pmic_init: POWER allocation error!
CPU:   Freescale i.MX53 family rev2.0 at 800 MHz
Reset cause: POR
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

(and it just keeps on resetting)

It looks to be failing after calloc...
http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/power/power_core.c#l100

 100         p = calloc(sizeof(*p), 1);
 101         if (!p) {
 102                 printf("%s: No available memory for
allocation!\n", __func__);
 103                 return NULL;
 104         }

Regards,
Fabio Estevam - Dec. 22, 2012, 12:51 p.m.
Hi Robert,

On Thu, Dec 20, 2012 at 8:04 PM, Robert Nelson <robertcnelson@gmail.com> wrote:

> Hi Fabio,
>
> It looks like we need one more fixup after commit c73368150 on the
> first run/older (non R, Dialog, bug wired extra Capacitor) version of
> this board..  Do you happen to have any in your lab?

Thanks for reporting this issue. I will try to get access to mx53qsb
dialog next week to investigate this further.

Regards,

Fabio Estevam
Fabio Estevam - Dec. 26, 2012, 3:02 p.m.
Robert,

On Thu, Dec 20, 2012 at 8:04 PM, Robert Nelson <robertcnelson@gmail.com> wrote:

> Hi Fabio,
>
> It looks like we need one more fixup after commit c73368150 on the
> first run/older (non R, Dialog, bug wired extra Capacitor) version of
> this board..  Do you happen to have any in your lab?
>
> U-Boot 2013.01-rc2-dirty (Dec 20 2012 - 15:55:01)
>
> Board: MX53 LOCO
> I2C:   ready
> DRAM:  1 GiB
> pmic_alloc: No available memory for allocation!
> pmic_init: POWER allocation error!
> CPU:   Freescale i.MX53 family rev2.0 at 800 MHz
> Reset cause: POR
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> *** Warning - bad CRC, using default environment
>
> (and it just keeps on resetting)
>
> It looks to be failing after calloc...
> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/power/power_core.c#l100
>
>  100         p = calloc(sizeof(*p), 1);
>  101         if (!p) {
>  102                 printf("%s: No available memory for
> allocation!\n", __func__);
>  103                 return NULL;
>  104         }

I can reproduce this issue using top of head U-boot tree.

It seems indeed to be caused by:

Author: Łukasz Majewski <l.majewski@samsung.com>
Date:   Tue Nov 13 03:21:55 2012 +0000
commit c7336815078ff3745e3130aeff35991e3e98e61e
Author: Łukasz Majewski <l.majewski@samsung.com>
Date:   Tue Nov 13 03:21:55 2012 +0000

    pmic: Extend PMIC framework to support multiple instances of PMIC devices

    The PMIC framework has been extended to support multiple instances of
    the variety of devices responsible for power management.
    This change allows supporting of e.g. fuel gauge, charger, MUIC (Micro USB
    Interface Circuit).
    Power related includes have been moved to ./include/power directory.
    This is a first of a series of patches - in the future "pmic" will be
    replaced with "power".

    Two important issues:
    1. The PMIC needs to be initialized just after malloc is configured
    2. It uses list to hold information about available PMIC devices

    Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
    Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
    Cc: Stefano Babic <sbabic@denx.de>

I am Ccing Lukasz/Stefano in case they have any suggestion.

With the new PMIC framework: is it safe to call the PMIC API from
board_init function?

Regards,

Fabio Estevam
Fabio Estevam - Dec. 26, 2012, 3:07 p.m.
On Wed, Dec 26, 2012 at 1:02 PM, Fabio Estevam <festevam@gmail.com> wrote:

> With the new PMIC framework: is it safe to call the PMIC API from
> board_init function?

Calling it from board_late_init fixes the issue for me.

Will send the patch soon.

Regards,

Fabio Estevam

Patch

diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index 81c511c..2c8cb7a 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -374,7 +374,7 @@  static int power_init(void)
 		if (retval)
 			return retval;
 
-		p = pmic_get("DIALOG_PMIC");
+		p = pmic_get("FSL_PMIC");
 		if (!p)
 			return -ENODEV;