omap: fix gpio related build breaks
[oweals/u-boot.git] / board / pandora / pandora.c
index 460ed123595bec1d25c8e504f859961bf0c682ae..0df45702c7c508c6b43869f7a16831b2bac20346 100644 (file)
 #include <twl4030.h>
 #include <asm/io.h>
 #include <asm/arch/mux.h>
+#include <asm/arch/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-types.h>
 #include "pandora.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
+#define TWL4030_BB_CFG_BBCHEN          (1 << 4)
+#define TWL4030_BB_CFG_BBSEL_3200MV    (3 << 2)
+#define TWL4030_BB_CFG_BBISEL_500UA    2
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
  */
 int board_init(void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
        /* board id for Linux */
        gd->bd->bi_arch_number = MACH_TYPE_OMAP3_PANDORA;
@@ -65,8 +70,7 @@ int misc_init_r(void)
        struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
        struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
 
-       twl4030_power_init();
-       twl4030_led_init();
+       twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
 
        /* Configure GPIOs to output */
        writel(~(GPIO14 | GPIO15 | GPIO16 | GPIO23), &gpio1_base->oe);
@@ -79,6 +83,11 @@ int misc_init_r(void)
        writel(GPIO28, &gpio5_base->setdataout);
        writel(GPIO4, &gpio6_base->setdataout);
 
+       /* Enable battery backup capacitor (3.2V, 0.5mA charge current) */
+       twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER,
+               TWL4030_BB_CFG_BBCHEN | TWL4030_BB_CFG_BBSEL_3200MV |
+               TWL4030_BB_CFG_BBISEL_500UA, TWL4030_PM_RECEIVER_BB_CFG);
+
        dieid_num_r();
 
        return 0;