diff options
Diffstat (limited to 'board/lg/sniper/sniper.c')
-rw-r--r-- | board/lg/sniper/sniper.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c index 9d0959f294e..8664d036568 100644 --- a/board/lg/sniper/sniper.c +++ b/board/lg/sniper/sniper.c @@ -10,6 +10,7 @@ #include <env.h> #include <fastboot.h> #include <init.h> +#include <asm/gpio.h> #include <asm/global_data.h> #include <linux/ctype.h> #include <linux/usb/musb.h> @@ -17,6 +18,7 @@ #include <asm/arch/sys_proto.h> #include <asm/arch/mem.h> #include <asm/io.h> +#include <linux/delay.h> #include <twl4030.h> #include "sniper.h" @@ -66,6 +68,53 @@ void get_board_mem_timings(struct board_sdrc_timings *timings) void spl_board_init(void) { + struct udevice *lp8720_dev; + u8 value; + int ret; + + /* + * In order to boot from MMC1 (microsd card), the LP8720 LDO1 (3.0V_MMC + * regulator has to be enabled. The LP8720 is accessed through I2C3. + * + * Enabling TWL4030 VAUX2 (3.0V_MOTION) and TWL4030 VDAC + * (1.8V_MOTION_VIO) is required to power the sensors that are slaves + * on I2C3. When not powered, these sensors cause I2C3 SCK to stay low. + */ + + /* TWL4030 VAUX2 (3.0V_MOTION) to 2.8V */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, + TWL4030_PM_RECEIVER_VAUX2_VSEL_28, + TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); + + /* TWL4030 VDAC (1.8V_MOTION_VIO) to 1.8V */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VDAC_DEDICATED, + TWL4030_PM_RECEIVER_VDAC_VSEL_18, + TWL4030_PM_RECEIVER_VDAC_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); + + /* Ramp-up delay. */ + mdelay(100); + + /* PMIC GPIO enable. */ + gpio_request(SNIPER_GPIO_CAM_SUBPM_EN, "cam_subpm_en"); + gpio_direction_output(SNIPER_GPIO_CAM_SUBPM_EN, 1); + + ret = i2c_get_chip_for_busnum(2, LP8720_ADDRESS_IDSEL_GND, 1, + &lp8720_dev); + if (ret) { + printf("Failed to find LP8720 PMIC!\n"); + return; + } + + /* LP8720 LDO1 to 3.0V. */ + value = LP8720_LDO1235_V_30 | (LP8720_DELAY_0 << LP8720_DELAY_SHIFT); + dm_i2c_write(lp8720_dev, LP8720_LDO1_SETTINGS, &value, 1); + + /* LP8720 LDO1 enable. */ + value = LP8720_LDO1_EN; + dm_i2c_write(lp8720_dev, LP8720_ENABLE_BITS, &value, 1); + twl4030_power_mmc_init(1); } #endif |