board/BuR/common: cosmetic: move 'overwrite_console' up to more related stuff
[pandora-u-boot.git] / board / BuR / common / common.c
index f3eae5c..28ebb84 100644 (file)
  */
 #include <version.h>
 #include <common.h>
-#include <environment.h>
-#include <errno.h>
-#include <asm/arch/cpu.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/omap.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/arch/mmc_host_def.h>
-#include <asm/io.h>
-#include <asm/gpio.h>
+#include <fdtdec.h>
 #include <i2c.h>
-#include <power/tps65217.h>
 #include <lcd.h>
 #include "bur_common.h"
-#include "../../../drivers/video/am335x-fb.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 /* --------------------------------------------------------------------------*/
 #if defined(CONFIG_LCD) && defined(CONFIG_AM335X_LCD) && \
        !defined(CONFIG_SPL_BUILD)
+#include <asm/arch/hardware.h>
+#include <asm/arch/cpu.h>
+#include <asm/gpio.h>
+#include <power/tps65217.h>
+#include "../../../drivers/video/am335x-fb.h"
+
 void lcdbacklight(int on)
 {
        unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
@@ -181,6 +175,7 @@ void br_summaryscreen(void)
 void lcdpower(int on)
 {
        u32 pin, swval, i;
+       char buf[16] = { 0 };
 
        pin = env_get_ulong("ds1_pwr", 16, ~0UL);
 
@@ -191,6 +186,12 @@ void lcdpower(int on)
 
        for (i = 0; i < 3; i++) {
                if (pin != 0) {
+                       snprintf(buf, sizeof(buf), "ds1_pwr#%d", i);
+                       if (gpio_request(pin & 0x7F, buf) != 0) {
+                               printf("%s: not able to request gpio %s",
+                                      __func__, buf);
+                               continue;
+                       }
                        swval = pin & 0x80 ? 0 : 1;
                        if (on)
                                gpio_direction_output(pin & 0x7F, swval);
@@ -265,17 +266,28 @@ int ft_board_setup(void *blob, bd_t *bd)
        return 0;
 }
 
-#ifdef CONFIG_SPL_BUILD
+int overwrite_console(void)
+{
+       return 1;
+}
+
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_AM33XX)
+#include <asm/arch/hardware.h>
+#include <asm/arch/omap.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <power/tps65217.h>
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
-void pmicsetup(u32 mpupll)
+void pmicsetup(u32 mpupll, unsigned int bus)
 {
        int mpu_vdd;
        int usb_cur_lim;
 
-       if (i2c_probe(TPS65217_CHIP_PM)) {
-               puts("PMIC (0x24) not found! skip further initalization.\n");
+       if (power_tps65217_init(bus)) {
+               printf("WARN: cannot setup PMIC 0x24 @ bus #%d, not found!.\n",
+                      bus);
                return;
        }
 
@@ -351,9 +363,4 @@ void set_mux_conf_regs(void)
        enable_board_pin_mux();
 }
 
-#endif /* CONFIG_SPL_BUILD */
-
-int overwrite_console(void)
-{
-       return 1;
-}
+#endif /* CONFIG_SPL_BUILD && CONFIG_AM33XX */