diff mbox

[U-Boot] mx53loco: Fix PMIC name

Message ID CAOMZO5DNafGp9korkz63RMCYxt7D7Ca3oLNCGmmWGrB6B-tTww@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Fabio Estevam Dec. 26, 2012, 3:21 p.m. UTC
Robert,

On Wed, Dec 26, 2012 at 1:07 PM, Fabio Estevam <festevam@gmail.com> wrote:
> 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.

Can you try the patch below?

board/freescale/mx53loco/mx53loco.c |   10 ++++++++--
 include/configs/mx53loco.h          |    1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Robert Nelson Dec. 26, 2012, 3:51 p.m. UTC | #1
Hi Fabio,

On Wed, Dec 26, 2012 at 9:21 AM, Fabio Estevam <festevam@gmail.com> wrote:
> Robert,
>
> On Wed, Dec 26, 2012 at 1:07 PM, Fabio Estevam <festevam@gmail.com> wrote:
>> 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.
>
> Can you try the patch below?

Thanks for taking a look at this..

>
> board/freescale/mx53loco/mx53loco.c |   10 ++++++++--
>  include/configs/mx53loco.h          |    1 +
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/board/freescale/mx53loco/mx53loco.c
> b/board/freescale/mx53loco/mx53loco.c
> index 2c8cb7a..63a4f8b 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -462,12 +462,18 @@ int board_init(void)
>
>         mxc_set_sata_internal_clock();
>         setup_iomux_i2c();
> +
> +       lcd_enable();
> +
> +       return 0;
> +}
> +
> +int board_late_init(void)
> +{
>         if (!power_init())
>                 clock_1GHz();
>         print_cpuinfo();
>
> -       lcd_enable();
> -
>         return 0;
>  }
>
> diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
> index e30502b..c4181bd 100644
> --- a/include/configs/mx53loco.h
> +++ b/include/configs/mx53loco.h
> @@ -39,6 +39,7 @@
>  #define CONFIG_SYS_MALLOC_LEN          (10 * 1024 * 1024)
>
>  #define CONFIG_BOARD_EARLY_INIT_F
> +#define CONFIG_BOARD_LATE_INIT

Ah, i was missing this when heading down the "board_late_init" road on friday..

>  #define CONFIG_MXC_GPIO
>  #define CONFIG_REVISION_TAG
>
> --
> 1.7.9.5
>
>
> It boots now, but I get resets now:
>
> U-Boot 2013.01-rc2-00172-gf8cfcf1-dirty (Dec 26 2012 - 13:13:28)
>
> Board: MX53 LOCO
> I2C:   ready
> DRAM:  1 GiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> In:    serial
> Out:   serial
> Err:   serial
> CPU:   Freescale i.MX53 family rev2.1 at 1000 MHz
> Reset cause: WDOG
> Net:   FEC
> Warning: FEC using MAC address from net device

Interesting, I'm still only getting this far on the old Dialog board..

U-Boot 2013.01-rc2-00173-gd781d95-dirty (Dec 26 2012 - 09:42:43)

Board: MX53 LOCO
I2C:   ready
DRAM:  1 GiB

I'm going to start printf'ing:
http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/power/power_dialog.c
 as we aren't getting the memory error, so it should be atleast past
that...


> Hit any key to stop autoboot:  0
> data abort
>
>     MAYBE you should read doc/README.arm-unaligned-accesses
>
> pc : [<aff72220>]          lr : [<aff721fc>]
> sp : af565e20  ip : af566918     fp : 00000000
> r10: 00000003  r9 : affabb5b     r8 : af565f58
> r7 : 00000000  r6 : 36747fff     r5 : af5668e8  r4 : 36747fff
> r3 : af5668ec  r2 : af5668eb     r1 : 00000000  r0 : af5668e8
> Flags: NzcV  IRQs off  FIQs off  Mode SVC_32
> Resetting CPU ...
>
> resetting ...

I've reverted this just to double check (no change for me...):
http://git.denx.de/?p=u-boot.git;a=commit;h=28e5ac2d974547bde0c72aa0c1d66fd22c6ef3ad


> U-Boot 2013.01-rc2-00172-gf8cfcf1-dirty (Dec 26 2012 - 13:13:28)
>
> Board: MX53 LOCO
> I2C:   ready
> DRAM:  1 GiB
>
>
> but it looks like a separate issue?

Regards,
Fabio Estevam Dec. 26, 2012, 3:54 p.m. UTC | #2
On Wed, Dec 26, 2012 at 1:51 PM, Robert Nelson <robertcnelson@gmail.com> wrote:

> Interesting, I'm still only getting this far on the old Dialog board..
>
> U-Boot 2013.01-rc2-00173-gd781d95-dirty (Dec 26 2012 - 09:42:43)
>
> Board: MX53 LOCO
> I2C:   ready
> DRAM:  1 GiB

I tested with 2 mx53loco boards here: one with FSL PMIC and one with Dialog.

I recall we had 2 versions of boards with Dialog PMIC, but at least
with the one I have here it boots fine now after applying the patch I
just sent.

If you have any news, just let us know.

Thanks,

Fabio Estevam
Robert Nelson Dec. 26, 2012, 4:04 p.m. UTC | #3
On Wed, Dec 26, 2012 at 9:54 AM, Fabio Estevam <festevam@gmail.com> wrote:
> On Wed, Dec 26, 2012 at 1:51 PM, Robert Nelson <robertcnelson@gmail.com> wrote:
>
>> Interesting, I'm still only getting this far on the old Dialog board..
>>
>> U-Boot 2013.01-rc2-00173-gd781d95-dirty (Dec 26 2012 - 09:42:43)
>>
>> Board: MX53 LOCO
>> I2C:   ready
>> DRAM:  1 GiB
>
> I tested with 2 mx53loco boards here: one with FSL PMIC and one with Dialog.
>
> I recall we had 2 versions of boards with Dialog PMIC, but at least
> with the one I have here it boots fine now after applying the patch I
> just sent.

Okay, good to hear it works with the Dialog PMIC you have, as that
should cover a majority of the Dialog based boards customers actually
have. As the one I have here was one of the very first ones and i know
something changed later in production...

Regards,
Fabio Estevam Dec. 26, 2012, 4:50 p.m. UTC | #4
On Wed, Dec 26, 2012 at 2:04 PM, Robert Nelson <robertcnelson@gmail.com> wrote:

> Okay, good to hear it works with the Dialog PMIC you have, as that
> should cover a majority of the Dialog based boards customers actually
> have. As the one I have here was one of the very first ones and i know
> something changed later in production...

Yes, but not happy to see a regression with your board and also the
resets that started to happen now.

Which toolchain did you use? I am using gcc 4.6.3. If you have a
chance to try the same toolchain to make sure we got the same results,
that would be nice.

Regards,

Fabio Estevam
Robert Nelson Dec. 26, 2012, 5:08 p.m. UTC | #5
On Wed, Dec 26, 2012 at 10:50 AM, Fabio Estevam <festevam@gmail.com> wrote:
> On Wed, Dec 26, 2012 at 2:04 PM, Robert Nelson <robertcnelson@gmail.com> wrote:
>
>> Okay, good to hear it works with the Dialog PMIC you have, as that
>> should cover a majority of the Dialog based boards customers actually
>> have. As the one I have here was one of the very first ones and i know
>> something changed later in production...
>
> Yes, but not happy to see a regression with your board and also the
> resets that started to happen now.

I'll keep debugging it here, did reverting this commit, help with the resets?
http://git.denx.de/?p=u-boot.git;a=commit;h=28e5ac2d974547bde0c72aa0c1d66fd22c6ef3ad

> Which toolchain did you use? I am using gcc 4.6.3. If you have a
> chance to try the same toolchain to make sure we got the same results,
> that would be nice.

That build was with Linaro's 4.7.1 2012.04 release, from:
https://launchpad.net/linaro-toolchain-binaries/

./arm-linux-gnueabi-gcc --version
arm-linux-gnueabi-gcc (crosstool-NG linaro-1.13.1-2012.04-20120426 -
Linaro GCC 2012.04) 4.7.1 20120402 (prerelease)

Regards,
Fabio Estevam Dec. 26, 2012, 5:21 p.m. UTC | #6
On Wed, Dec 26, 2012 at 3:08 PM, Robert Nelson <robertcnelson@gmail.com> wrote:

> I'll keep debugging it here, did reverting this commit, help with the resets?
> http://git.denx.de/?p=u-boot.git;a=commit;h=28e5ac2d974547bde0c72aa0c1d66fd22c6ef3ad

Tried reverting it and still see the data-aborts.

I am also testing on my mx53loco board with the mc34708 pmic and I see
that it hangs on boot about 10% of the attempts:
U-Boot 2013.01-rc2-00172-gf8cfcf1-dirty (Dec 26 2012 - 15:15:27)

Board: MX53 LOCO
I2C:   ready
DRAM:  1 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1

This did not happen prior to commit c73368150 (pmic: Extend PMIC
framework to support multiple instances
of PMIC devices).

Regards,

Fabio Estevam
Robert Nelson Dec. 26, 2012, 5:51 p.m. UTC | #7
On Wed, Dec 26, 2012 at 11:21 AM, Fabio Estevam <festevam@gmail.com> wrote:
> On Wed, Dec 26, 2012 at 3:08 PM, Robert Nelson <robertcnelson@gmail.com> wrote:
>
>> I'll keep debugging it here, did reverting this commit, help with the resets?
>> http://git.denx.de/?p=u-boot.git;a=commit;h=28e5ac2d974547bde0c72aa0c1d66fd22c6ef3ad
>
> Tried reverting it and still see the data-aborts.
>
> I am also testing on my mx53loco board with the mc34708 pmic and I see
> that it hangs on boot about 10% of the attempts:
> U-Boot 2013.01-rc2-00172-gf8cfcf1-dirty (Dec 26 2012 - 15:15:27)
>
> Board: MX53 LOCO
> I2C:   ready
> DRAM:  1 GiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
>
> This did not happen prior to commit c73368150 (pmic: Extend PMIC
> framework to support multiple instances
> of PMIC devices).

Okay, now we are on the same page, upgraded to:
 "arm-linux-gnueabihf-gcc (crosstool-NG
linaro-1.13.1-4.7-2012.12-20121214 - Linaro GCC 2012.12) 4.7.3
20121205 (prerelease)"..

With your Dialog patch, it is properly setting 1Ghz, and just keeps
rebooting.. :)

U-Boot 2013.01-rc2-00173-ga0d04f3 (Dec 26 2012 - 11:47:34)

Board: MX53 LOCO
I2C:   ready
DRAM:  1 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment
In:    serial
Out:   serial
Err:   serial
CPU:   Freescale i.MX53 family rev2.0 at 1000 MHz
Reset cause: WDOG
Net:   FEC
Warning: FEC using MAC address from net device

Hit any key to stop autoboot:  0

data abort
    MAYBE you should read doc/README.arm-unaligned-accesses
pc : [<aff72250>]	   lr : [<aff72228>]
sp : af565d68  ip : fffffff4	 fp : 00000000
r10: 00000003  r9 : affab8d9	 r8 : af565f58
r7 : 00000000  r6 : e5bc345d	 r5 : af6df330  r4 : e5bc345d
r3 : af6df334  r2 : af6df333	 r1 : 00000000  r0 : af6df330
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32

Resetting CPU ...
resetting ...

U-Boot 2013.01-rc2-00173-ga0d04f3 (Dec 26 2012 - 11:47:34)

Board: MX53 LOCO
I2C:   ready
DRAM:  1 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment
In:    serial
Out:   serial
Err:   serial
CPU:   Freescale i.MX53 family rev2.0 at 1000 MHz

Reset cause: WDOG

Regards,
Robert Nelson Jan. 2, 2013, 6:27 p.m. UTC | #8
On Wed, Dec 26, 2012 at 11:51 AM, Robert Nelson <robertcnelson@gmail.com> wrote:
> On Wed, Dec 26, 2012 at 11:21 AM, Fabio Estevam <festevam@gmail.com> wrote:
>> On Wed, Dec 26, 2012 at 3:08 PM, Robert Nelson <robertcnelson@gmail.com> wrote:
>>
>>> I'll keep debugging it here, did reverting this commit, help with the resets?
>>> http://git.denx.de/?p=u-boot.git;a=commit;h=28e5ac2d974547bde0c72aa0c1d66fd22c6ef3ad
>>
>> Tried reverting it and still see the data-aborts.
>>
>> I am also testing on my mx53loco board with the mc34708 pmic and I see
>> that it hangs on boot about 10% of the attempts:
>> U-Boot 2013.01-rc2-00172-gf8cfcf1-dirty (Dec 26 2012 - 15:15:27)
>>
>> Board: MX53 LOCO
>> I2C:   ready
>> DRAM:  1 GiB
>> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
>>
>> This did not happen prior to commit c73368150 (pmic: Extend PMIC
>> framework to support multiple instances
>> of PMIC devices).
>
> Okay, now we are on the same page, upgraded to:
>  "arm-linux-gnueabihf-gcc (crosstool-NG
> linaro-1.13.1-4.7-2012.12-20121214 - Linaro GCC 2012.12) 4.7.3
> 20121205 (prerelease)"..
>
> With your Dialog patch, it is properly setting 1Ghz, and just keeps
> rebooting.. :)
>
> U-Boot 2013.01-rc2-00173-ga0d04f3 (Dec 26 2012 - 11:47:34)
>
> Board: MX53 LOCO
> I2C:   ready
> DRAM:  1 GiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> *** Warning - bad CRC, using default environment
> In:    serial
> Out:   serial
> Err:   serial
> CPU:   Freescale i.MX53 family rev2.0 at 1000 MHz
> Reset cause: WDOG
> Net:   FEC
> Warning: FEC using MAC address from net device
>
> Hit any key to stop autoboot:  0
>
> data abort
>     MAYBE you should read doc/README.arm-unaligned-accesses
> pc : [<aff72250>]          lr : [<aff72228>]
> sp : af565d68  ip : fffffff4     fp : 00000000
> r10: 00000003  r9 : affab8d9     r8 : af565f58
> r7 : 00000000  r6 : e5bc345d     r5 : af6df330  r4 : e5bc345d
> r3 : af6df334  r2 : af6df333     r1 : 00000000  r0 : af6df330
> Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
>
> Resetting CPU ...
> resetting ...

Okay success on another bisect run to find what was causing the Data
Abort with linaro's gcc toolchain..
gcc version 4.7.3 20121205 (prerelease) (crosstool-NG
linaro-1.13.1-4.7-2012.12-20121214 - Linaro GCC 2012.12)

Reverting, Troy's last 4 imximage changes:

ab857f2613be39274d0870768720067ff9d859c0 (imximage: make
set_imx_hdr_v1/v2 easier to read)
ad0826dcd81ba6cf4cc93a4ca8337e1bc676c238 (imximage: change parameters
to set_imx_hdr)
243319825fa6e79885d57b6b78e72f3fe10ef69c (imximage: delay setting of image size)
348ca8efb79652d2b259fbd0ed6d317a77a8cbb9 (imximage: fix size of image
to load.) (this was the first bad bisect, the previous 3 are needed
for a clean revert)

Along with Fabio's "mx53loco: Call PMIC related functions from
board_late_init()"

The Dialog based mx53loco is no operating correctly with linaro's toolchain...

U-Boot 2013.01-rc2-00176-gbc67175-dirty (Jan 02 2013 - 12:14:51)

Board: MX53 LOCO
I2C:   ready
DRAM:  1 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
CPU:   Freescale i.MX53 family rev2.0 at 1000 MHz
Reset cause: POR
Net:   FEC
Warning: FEC using MAC address from net device

Hit any key to stop autoboot:  0
mmc0 is current device
** Unrecognized filesystem type **
** Unrecognized filesystem type **
Booting from net ...
BOOTP broadcast 1

Regards,
Fabio Estevam Jan. 2, 2013, 6:33 p.m. UTC | #9
On Wed, Jan 2, 2013 at 4:27 PM, Robert Nelson <robertcnelson@gmail.com> wrote:

> Okay success on another bisect run to find what was causing the Data
> Abort with linaro's gcc toolchain..
> gcc version 4.7.3 20121205 (prerelease) (crosstool-NG
> linaro-1.13.1-4.7-2012.12-20121214 - Linaro GCC 2012.12)
>
> Reverting, Troy's last 4 imximage changes:
>
> ab857f2613be39274d0870768720067ff9d859c0 (imximage: make
> set_imx_hdr_v1/v2 easier to read)
> ad0826dcd81ba6cf4cc93a4ca8337e1bc676c238 (imximage: change parameters
> to set_imx_hdr)
> 243319825fa6e79885d57b6b78e72f3fe10ef69c (imximage: delay setting of image size)
> 348ca8efb79652d2b259fbd0ed6d317a77a8cbb9 (imximage: fix size of image
> to load.) (this was the first bad bisect, the previous 3 are needed
> for a clean revert)
>
> Along with Fabio's "mx53loco: Call PMIC related functions from
> board_late_init()"
>
> The Dialog based mx53loco is no operating correctly with linaro's toolchain...
>
> U-Boot 2013.01-rc2-00176-gbc67175-dirty (Jan 02 2013 - 12:14:51)
>
> Board: MX53 LOCO
> I2C:   ready
> DRAM:  1 GiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> *** Warning - bad CRC, using default environment
>
> In:    serial
> Out:   serial
> Err:   serial
> CPU:   Freescale i.MX53 family rev2.0 at 1000 MHz
> Reset cause: POR
> Net:   FEC
> Warning: FEC using MAC address from net device
>
> Hit any key to stop autoboot:  0
> mmc0 is current device
> ** Unrecognized filesystem type **
> ** Unrecognized filesystem type **
> Booting from net ...
> BOOTP broadcast 1

Thanks for bisecting, Robert.

Troy/Stefano,

Any suggestions about this? It would be really nice if we could keep
mx53loco functional when using gcc 4.6.2.

Regards,

Fabio Estevam
diff mbox

Patch

diff --git a/board/freescale/mx53loco/mx53loco.c
b/board/freescale/mx53loco/mx53loco.c
index 2c8cb7a..63a4f8b 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -462,12 +462,18 @@  int board_init(void)

 	mxc_set_sata_internal_clock();
 	setup_iomux_i2c();
+
+	lcd_enable();
+
+	return 0;
+}
+
+int board_late_init(void)
+{
 	if (!power_init())
 		clock_1GHz();
 	print_cpuinfo();

-	lcd_enable();
-
 	return 0;
 }

diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index e30502b..c4181bd 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -39,6 +39,7 @@ 
 #define CONFIG_SYS_MALLOC_LEN		(10 * 1024 * 1024)

 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT
 #define CONFIG_MXC_GPIO
 #define CONFIG_REVISION_TAG