Skip to contentSkip to conversation

power: pmic: sunxi: guard DCDC5 separately

PATCH In review Andre Przywara 2 participants 2 messages Dec 15, 2024 – Dec 16, 2024 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: pmic: sunxi: guard DCDC5 separately

So far all sunxi boards programming the DCDC1 power rail on the AXP PMIC also set the DCDC5 rail, so we could handle both with the same DCDC1 guard.
Some boards using the AXP313 will need to set DCDC1 now as well, and since the AXP313 only has three buck converters, there will be no DCDC5, so this trick is not going to work anymore.

Don't try to be too clever, and just protect programming the two DCDC rails with two separate guards.

This has the interesting side effect of fixing operation on A80 boards, using the AXP809 PMIC. Apparently programming DCDC5 right after DCDC1, but before the other three rails caused some glitch, which made the board hang during Linux boot, during the PSCI handler in U-Boot. Just keeping the old setup order (DCDC1,2,3,4,5) will make those boards boot to the Linux prompt again.

Fixes ffb02942fab024d4a9b6a ("sunxi: board: simplify early PMIC setup conditions")
---
 board/sunxi/board.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
board/sunxi/board.c +3 -1
index 824c322a0dc..9c340908a96 100644
@@ -577,7 +577,6 @@ void sunxi_board_init(void)
 
 #ifdef CONFIG_AXP_DCDC1_VOLT
 	power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
-	power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
 #endif
 #ifdef CONFIG_AXP_DCDC2_VOLT
 	power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
@@ -586,6 +585,9 @@ void sunxi_board_init(void)
 #ifdef CONFIG_AXP_DCDC4_VOLT
 	power_failed |= axp_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
 #endif
+#ifdef CONFIG_AXP_DCDC5_VOLT
+	power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
+#endif
 
 #ifdef CONFIG_AXP_ALDO1_VOLT
 	power_failed |= axp_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
Signature · 1 line
2.46.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Andre Przywara

So far all sunxi boards programming the DCDC1 power rail on the AXP PMIC also set the DCDC5 rail, so we could handle both with the same DCDC1 guard.
Some boards using the AXP313 will need to set DCDC1 now as well, and since the AXP313 only has three buck converters, there will be no DCDC5, so this trick is not going to work anymore.

Don't try to be too clever, and just protect programming the two DCDC rails with two separate guards.

This has the interesting side effect of fixing operation on A80 boards, using the AXP809 PMIC. Apparently programming DCDC5 right after DCDC1, but before the other three rails caused some glitch, which made the board hang during Linux boot, during the PSCI handler in U-Boot. Just keeping the old setup order (DCDC1,2,3,4,5) will make those boards boot to the Linux prompt again.

Quoted 3 lines
Fixes ffb02942fab024d4a9b6a ("sunxi: board: simplify early PMIC setup conditions")
Quoted 29 lines
---
 board/sunxi/board.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
board/sunxi/board.c +3 -2
index 824c322a0dc..9c340908a96 100644
@@ -577,7 +577,6 @@ void sunxi_board_init(void)
 
 #ifdef CONFIG_AXP_DCDC1_VOLT
        power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
-       power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
 #endif
 #ifdef CONFIG_AXP_DCDC2_VOLT
        power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
@@ -586,6 +585,9 @@ void sunxi_board_init(void)
 #ifdef CONFIG_AXP_DCDC4_VOLT
        power_failed |= axp_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
 #endif
+#ifdef CONFIG_AXP_DCDC5_VOLT
+       power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
+#endif
 
 #ifdef CONFIG_AXP_ALDO1_VOLT
        power_failed |= axp_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
--

2.46.2