summaryrefslogtreecommitdiff
path: root/board/sunxi/board.c
diff options
context:
space:
mode:
authorHenrik Nordstrom <henrik@henriknordstrom.net>2014-06-13 22:55:50 +0200
committerIan Campbell <ijc@hellion.org.uk>2014-07-18 19:42:10 +0100
commit14bc66bd9a1d8073a12c6e785ab379909f620356 (patch)
tree6c3afe5e3736d14bae914b2f2b03996122233f2b /board/sunxi/board.c
parent6620377e4b8be3c232c59d673efcd673c30bc69f (diff)
downloadu-boot-imx-14bc66bd9a1d8073a12c6e785ab379909f620356.zip
u-boot-imx-14bc66bd9a1d8073a12c6e785ab379909f620356.tar.gz
u-boot-imx-14bc66bd9a1d8073a12c6e785ab379909f620356.tar.bz2
sunxi: Add axp209 pmic support
Add support for the x-powers axp209 pmic which is found on most A10, A13 and A20 boards. And enable AXP209 support for the Cubietruck and Cubieboard boards. Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'board/sunxi/board.c')
-rw-r--r--board/sunxi/board.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 543b809..8375711 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -12,6 +12,9 @@
*/
#include <common.h>
+#ifdef CONFIG_AXP209_POWER
+#include <axp209.h>
+#endif
#include <asm/arch/clock.h>
#include <asm/arch/dram.h>
#include <asm/arch/gpio.h>
@@ -116,12 +119,31 @@ void i2c_init_board(void)
#ifdef CONFIG_SPL_BUILD
void sunxi_board_init(void)
{
+ int power_failed = 0;
unsigned long ramsize;
+#ifdef CONFIG_AXP209_POWER
+ power_failed |= axp209_init();
+ power_failed |= axp209_set_dcdc2(1400);
+ power_failed |= axp209_set_dcdc3(1250);
+ power_failed |= axp209_set_ldo2(3000);
+ power_failed |= axp209_set_ldo3(2800);
+ power_failed |= axp209_set_ldo4(2800);
+#endif
+
printf("DRAM:");
ramsize = sunxi_dram_init();
printf(" %lu MiB\n", ramsize >> 20);
if (!ramsize)
hang();
+
+ /*
+ * Only clock up the CPU to full speed if we are reasonably
+ * assured it's being powered with suitable core voltage
+ */
+ if (!power_failed)
+ clock_set_pll1(CONFIG_CLK_FULL_SPEED);
+ else
+ printf("Failed to set core voltage! Can't set CPU frequency\n");
}
#endif