aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kocialkowski2024-07-29 18:27:43 +0200
committerPaul Kocialkowski2024-07-29 21:00:26 +0200
commitbc882257c235641085f65f1e276686d2d31072cf (patch)
tree31311b35ef57b3dc7f1d073b8861c4d5b5d4dbae
parent2b9aa64e82c9a30c1a73a3c0cc178d481d29130d (diff)
omap3: sniper: Enable MMC1 boot with crude LP8720 PMIC support
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--arch/arm/dts/omap3-sniper-u-boot.dtsi9
-rw-r--r--board/lg/sniper/sniper.c49
-rw-r--r--board/lg/sniper/sniper.h12
-rw-r--r--configs/sniper_defconfig5
4 files changed, 71 insertions, 4 deletions
diff --git a/arch/arm/dts/omap3-sniper-u-boot.dtsi b/arch/arm/dts/omap3-sniper-u-boot.dtsi
index d467f533a12..8fa17d6aed4 100644
--- a/arch/arm/dts/omap3-sniper-u-boot.dtsi
+++ b/arch/arm/dts/omap3-sniper-u-boot.dtsi
@@ -14,3 +14,12 @@
&i2c1 {
clock-frequency = <400000>;
};
+
+&i2c2 {
+ bootph-pre-ram;
+};
+
+&i2c3 {
+ bootph-pre-ram;
+ clock-frequency = <400000>;
+};
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
diff --git a/board/lg/sniper/sniper.h b/board/lg/sniper/sniper.h
index db71ad86d88..5b4e21a5c7b 100644
--- a/board/lg/sniper/sniper.h
+++ b/board/lg/sniper/sniper.h
@@ -10,6 +10,18 @@
#include <asm/arch/mux.h>
+#define SNIPER_GPIO_CAM_SUBPM_EN 37
+
+#define LP8720_ADDRESS_IDSEL_GND 0x7d
+
+#define LP8720_LDO1_SETTINGS 0x01
+#define LP8720_ENABLE_BITS 0x08
+
+#define LP8720_LDO1_EN (1 << 0)
+#define LP8720_LDO1235_V_30 0x1D
+#define LP8720_DELAY_0 0
+#define LP8720_DELAY_SHIFT 5
+
#define MUX_SNIPER() \
/* SDRC */ \
MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)) /* sdrc_d0 */\
diff --git a/configs/sniper_defconfig b/configs/sniper_defconfig
index 06e9b2ae2fa..966514a9605 100644
--- a/configs/sniper_defconfig
+++ b/configs/sniper_defconfig
@@ -6,15 +6,12 @@ CONFIG_TARGET_SNIPER=y
CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
CONFIG_SPL=y
CONFIG_DISTRO_DEFAULTS=y
-CONFIG_BOOTCOMMAND="setenv boot_mmc_part ${kernel_mmc_part}; if test reboot-${reboot-mode} = reboot-r; then echo recovery; setenv boot_mmc_part ${recovery_mmc_part}; fi; if test reboot-${reboot-mode} = reboot-b; then echo fastboot; fastboot 0; fi; part start mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_start; part size mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_size; mmc dev ${boot_mmc_dev}; mmc read ${kernel_addr_r} ${boot_mmc_start} ${boot_mmc_size} && bootm ${kernel_addr_r};"
+CONFIG_BOOTCOMMAND="sysboot mmc 0 any"
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
CONFIG_SPL_BOARD_INIT=y
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
CONFIG_SPL_SYS_MALLOC=y
CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=2
# CONFIG_SPL_FS_EXT4 is not set
# CONFIG_SPL_NAND_SUPPORT is not set
CONFIG_CMD_GPIO=y