diff --git a/arch/arm/mach-sunxi/pmic_bus.c b/arch/arm/mach-sunxi/pmic_bus.c index 8e19324c8ac..c77dc538456 100644 --- a/arch/arm/mach-sunxi/pmic_bus.c +++ b/arch/arm/mach-sunxi/pmic_bus.c @@ -16,33 +16,10 @@ #include #include -#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 - #define AXP221_CHIP_ADDR 0x68 #if CONFIG_IS_ENABLED(PMIC_AXP) static struct udevice *pmic; -#else -static int pmic_i2c_address(void) -{ - if (IS_ENABLED(CONFIG_AXP152_POWER)) - return AXP152_I2C_ADDR; - if (IS_ENABLED(CONFIG_AXP305_POWER)) - 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; -} #endif int pmic_bus_init(void) @@ -88,7 +65,7 @@ int pmic_bus_read(u8 reg, u8 *data) if (IS_ENABLED(CONFIG_SYS_I2C_SUN8I_RSB)) return rsb_read(AXP_PMIC_PRI_RUNTIME_ADDR, reg, data); - return i2c_read(pmic_i2c_address(), reg, 1, data, 1); + return i2c_read(CONFIG_AXP_I2C_ADDRESS, reg, 1, data, 1); #endif } @@ -102,7 +79,7 @@ int pmic_bus_write(u8 reg, u8 data) if (IS_ENABLED(CONFIG_SYS_I2C_SUN8I_RSB)) return rsb_write(AXP_PMIC_PRI_RUNTIME_ADDR, reg, data); - return i2c_write(pmic_i2c_address(), reg, 1, &data, 1); + return i2c_write(CONFIG_AXP_I2C_ADDRESS, reg, 1, &data, 1); #endif } diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 5c73bc75a15..eed65058e66 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -148,6 +148,16 @@ config SY8106A_POWER endchoice +config AXP_I2C_ADDRESS + hex "AXP PMIC I2C address" + depends on ARCH_SUNXI && !SUNXI_NO_PMIC + default 0x36 if AXP305_POWER + default 0x36 if AXP313_POWER + default 0x30 if AXP152_POWER + default 0x34 + ---help--- + I2C address of the AXP PMIC, used for the SPL only. + config AXP_DCDC1_VOLT int "axp pmic dcdc1 voltage" depends on AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP803_POWER