wandboard: Fix the DM_PMIC conversion
PATCH v2 1/3 wandboard: Fix the DM_PMIC conversion
Commit ec837c82d709 ("imx6: wandboard: convert to DM_PMIC") caused the following pmic_get() error:
CPU: Freescale i.MX6QP rev1.0 at 792 MHz Reset cause: POR DRAM: 2 GiB PMIC: pmic_get() ret -19
...
and since the PMIC presence is used to determine the board D1 revision, the following error is seen when booting a board rev D1:
WARNING: Could not determine dtb to use
and the kernel does not boot at all.
Fix the regression by passing "pfuze100 at 8" as the correct parameter to the pmic_get() function in the DM case.
---
Changes since v1:
- Remove a double 'the' in the Subject
board/wandboard/wandboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/wandboard/wandboard.c +1 -1
@@ -363,7 +363,7 @@ int power_init_board(void)puts ("PMIC: " ); - ret =pmic_get ("pfuze100" , &dev); + ret =pmic_get ("pfuze100 at 8" , &dev);if (ret <0 ) {printf ("pmic_get() ret %d\n" , ret);return 0 ;
Signature · 1 line
2.17.1
PATCH v2 2/3 wandboard: Propagate the error on PMIC function failure
When pmic_get() or pmic_reg_read() fail, the error code should be propagated instead of returning success.
---
Changes since v1:
- None
board/wandboard/wandboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
board/wandboard/wandboard.c +2 -2
@@ -366,13 +366,13 @@ int power_init_board(void) ret =pmic_get ("pfuze100 at 8" , &dev);if (ret <0 ) {printf ("pmic_get() ret %d\n" , ret); -return 0 ; +return ret; } reg =pmic_reg_read (dev,PFUZE100_DEVICEID );if (reg <0 ) {printf ("pmic_reg_read() ret %d\n" , reg); -return 0 ; +return ret; }printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); with_pmic = true;
Signature · 1 line
2.17.1
PATCH v2 2/3 wandboard: Propagate the error on PMIC function failure
board/wandboard/wandboard.c int power_init_board(void) · line 369
Quoted 10 lines · Fabio Estevam
board/wandboard/wandboard.c +1
-1@@ -366,13 +366,13 @@ int power_init_board(void) ret =pmic_get ("pfuze100 at 8" , &dev);if (ret <0 ) {printf ("pmic_get() ret %d\n" , ret); -return 0 ; +return ret;
Ops, we can't return error here because this causes issues on the boards without PMIC.
I will resend the series without this patch.
Quoted 13 lines
board/wandboard/wandboard.c +1
-2} reg =pmic_reg_read (dev,PFUZE100_DEVICEID );if (reg <0 ) {printf ("pmic_reg_read() ret %d\n" , reg); -return 0 ; +return ret; }printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); with_pmic = true; --2.17.1
PATCH v2 3/3 wandboard: Remove repeated PMIC string
In reply to Fabio EstevamAfter the conversion to DM_PMIC the following output is seen:
PMIC: PMIC: PFUZE100 ID=0x10
Remove the unnecessary PMIC string from the board file to avoid the repetead string.
---
Changes since v1:
- Make it part of a patch series
board/wandboard/wandboard.c | 2 -- 1 file changed, 2 deletions(-)
board/wandboard/wandboard.c +0 -2
@@ -361,8 +361,6 @@ int power_init_board(void)struct udevice *dev;int reg, ret; -puts ("PMIC: " ); - ret =pmic_get ("pfuze100 at 8" , &dev);if (ret <0 ) {printf ("pmic_get() ret %d\n" , ret);
Signature · 1 line
2.17.1