power: pmic: sunxi: add AXP717 SPL support
authorAndre Przywara <andre.przywara@arm.com>
Thu, 9 May 2024 23:43:18 +0000 (00:43 +0100)
committerAndre Przywara <andre.przywara@arm.com>
Mon, 15 Jul 2024 17:11:13 +0000 (18:11 +0100)
On boards using the AXP717 PMIC, the DRAM rail is often not setup
correctly at reset time, so we have to program the PMIC very early in
the SPL, before running the DRAM initialisation.

Using the new generic AXP SPL driver, add the Kconfig options and
platform bits needed to support an AXP717 PMIC chip in I2C mode.
This allows to set up the correct voltage for the DRAM chips and the
CPU cores.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Ryan Walklin <ryan@testtoast.com>
arch/arm/mach-sunxi/pmic_bus.c
board/sunxi/board.c
drivers/power/Kconfig
drivers/power/Makefile

index 87df312..8e19324 100644 (file)
@@ -19,6 +19,7 @@
 #define AXP152_I2C_ADDR                        0x30
 
 #define AXP209_I2C_ADDR                        0x34
+#define AXP717_I2C_ADDR                        0x34
 
 #define AXP305_I2C_ADDR                        0x36
 #define AXP313_I2C_ADDR                        0x36
@@ -36,6 +37,8 @@ static int pmic_i2c_address(void)
                return AXP305_I2C_ADDR;
        if (IS_ENABLED(CONFIG_AXP313_POWER))
                return AXP313_I2C_ADDR;
+       if (IS_ENABLED(CONFIG_AXP717_POWER))
+               return AXP717_I2C_ADDR;
 
        /* Other AXP2xx and AXP8xx variants */
        return AXP209_I2C_ADDR;
index ed86f1d..9928069 100644 (file)
@@ -562,7 +562,7 @@ void sunxi_board_init(void)
 #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || \
        defined CONFIG_AXP221_POWER || defined CONFIG_AXP305_POWER || \
        defined CONFIG_AXP809_POWER || defined CONFIG_AXP818_POWER || \
-       defined CONFIG_AXP313_POWER
+       defined CONFIG_AXP313_POWER || defined CONFIG_AXP717_POWER
        power_failed = axp_init();
 
        if (IS_ENABLED(CONFIG_AXP_DISABLE_BOOT_ON_POWERON) && !power_failed) {
index 33b8bc1..5556a22 100644 (file)
@@ -109,6 +109,13 @@ config AXP313_POWER
        Select this to enable support for the AXP313 PMIC found on some
        H616 boards.
 
+config AXP717_POWER
+       bool "axp717 pmic support"
+       select AXP_PMIC_BUS
+       select CMD_POWEROFF
+       ---help---
+       Select this to enable support for the AXP717 PMIC found on some boards.
+
 config AXP809_POWER
        bool "axp809 pmic support"
        depends on MACH_SUN9I
@@ -151,10 +158,11 @@ config AXP_DCDC1_VOLT
 
 config AXP_DCDC2_VOLT
        int "axp pmic dcdc2 voltage"
-       depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER
+       depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER || AXP717_POWER
        default 900 if AXP818_POWER
        default 1400 if AXP152_POWER || AXP209_POWER
        default 1000 if AXP313_POWER
+       default 1000 if AXP717_POWER
        default 1200 if MACH_SUN6I
        default 1100 if MACH_SUN8I
        default 0 if MACH_SUN9I
@@ -167,11 +175,11 @@ config AXP_DCDC2_VOLT
        On A80 boards dcdc2 powers the GPU and can be left off.
        On A83T boards dcdc2 is used for VDD-CPUA(cluster 0) and should be 0.9V.
        On R40 boards dcdc2 is VDD-CPU and should be 1.1V
-       On boards using the AXP313 it's often VDD-CPU.
+       On boards using the AXP313 or AXP717 it's often VDD-CPU.
 
 config AXP_DCDC3_VOLT
        int "axp pmic dcdc3 voltage"
-       depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER
+       depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER || AXP717_POWER
        default 900 if AXP809_POWER || AXP818_POWER
        default 1500 if AXP152_POWER
        default 1250 if AXP209_POWER
@@ -188,7 +196,8 @@ config AXP_DCDC3_VOLT
        On A80 boards dcdc3 is used for VDD-CPUA(cluster 0) and should be 0.9V.
        On A83T boards dcdc3 is used for VDD-CPUB(cluster 1) and should be 0.9V.
        On R40 boards dcdc3 is VDD-SYS and VDD-GPU and should be 1.1V.
-       On boards using the AXP313 it's often VDD-DRAM and should be 1.1V for LPDDR4.
+       On boards using the AXP313 or AXP717 it's often VDD-DRAM and should
+       be 1.1V for LPDDR4.
 
 config AXP_DCDC4_VOLT
        int "axp pmic dcdc4 voltage"
index 99a8aa8..67161b3 100644 (file)
@@ -14,6 +14,7 @@ obj-$(CONFIG_AXP152_POWER)    += axp152.o
 obj-$(CONFIG_AXP209_POWER)     += axp209.o
 obj-$(CONFIG_AXP305_POWER)     += axp305.o
 obj-$(CONFIG_AXP313_POWER)     += axp313.o
+obj-$(CONFIG_AXP717_POWER)     += axp_spl.o
 obj-$(CONFIG_AXP809_POWER)     += axp809.o
 obj-$(CONFIG_AXP818_POWER)     += axp818.o
 endif