[U-Boot] [PATCH 04/10] sunxi: power: enabled support for axp818

Vishnu Patekar
2015-11-12T18:09:12Z

Enabled support for AXP818 in SPL and u-boot.
DCDC1, DCDC2, DCDC3 and DCSC5 are enabled.

Signed-off-by: Vishnu Patekar <vishnupatekar0510@gmail.com>
---
arch/arm/cpu/armv7/sunxi/Makefile | 1 +
arch/arm/cpu/armv7/sunxi/pmic_bus.c | 15 +++++++++++++++
board/sunxi/board.c | 8 ++++++++
include/configs/sunxi-common.h | 2 +-
4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/sunxi/Makefile b/arch/arm/cpu/armv7/sunxi/Makefile
index 459d5d8..929a933 100644
--- a/arch/arm/cpu/armv7/sunxi/Makefile
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_MACH_SUN6I) += tzpc.o
obj-$(CONFIG_AXP152_POWER) += pmic_bus.o
obj-$(CONFIG_AXP209_POWER) += pmic_bus.o
obj-$(CONFIG_AXP221_POWER) += pmic_bus.o
+obj-$(CONFIG_AXP818_POWER) += pmic_bus.o

ifndef CONFIG_SPL_BUILD
ifdef CONFIG_ARMV7_PSCI
diff --git a/arch/arm/cpu/armv7/sunxi/pmic_bus.c b/arch/arm/cpu/armv7/sunxi/pmic_bus.c
index 9e05127..838831d 100644
--- a/arch/arm/cpu/armv7/sunxi/pmic_bus.c
+++ b/arch/arm/cpu/armv7/sunxi/pmic_bus.c
@@ -26,6 +26,9 @@
#define AXP223_DEVICE_ADDR 0x3a3
#define AXP223_RUNTIME_ADDR 0x2d

+#define AXP818_DEVICE_ADDR 0x3a3
+#define AXP818_RUNTIME_ADDR 0x2d
+
int pmic_bus_init(void)
{
/* This cannot be 0 because it is used in SPL before BSS is ready */
@@ -49,6 +52,14 @@ int pmic_bus_init(void)
# endif
if (ret)
return ret;
+#elif defined CONFIG_AXP818_POWER
+ ret = rsb_init();
+ if (ret)
+ return ret;
+
+ ret = rsb_set_device_address(AXP818_DEVICE_ADDR, AXP818_RUNTIME_ADDR);
+ if (ret)
+ return ret;
#endif

needs_init = 0;
@@ -67,6 +78,8 @@ int pmic_bus_read(u8 reg, u8 *data)
# else
return rsb_read(AXP223_RUNTIME_ADDR, reg, data);
# endif
+#elif defined CONFIG_AXP818_POWER
+ return rsb_read(AXP818_RUNTIME_ADDR, reg, data);
#endif
}

@@ -82,6 +95,8 @@ int pmic_bus_write(u8 reg, u8 data)
# else
return rsb_write(AXP223_RUNTIME_ADDR, reg, data);
# endif
+#elif CONFIG_AXP818_POWER
+ return rsb_write(AXP818_RUNTIME_ADDR, reg, data);
#endif
}

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 6ac398c..ebfa94e 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -430,6 +430,14 @@ void sunxi_board_init(void)
int power_failed = 0;
unsigned long ramsize;

+#if defined CONFIG_AXP818_POWER
+ power_failed = axp_init();
+ power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
+ power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+ power_failed |= axp_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+ power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
+#endif
+
#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER
power_failed = axp_init();

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index ddcfe94..61af897 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -243,7 +243,7 @@ extern int soft_i2c_gpio_scl;
#endif

/* PMU */
-#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER
+#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER || defined CONFIG_AXP818_POWER
#define CONFIG_SPL_POWER_SUPPORT
#endif

--
1.9.1