[U-Boot] [u-boot][RFC v1] sdp4430: Enable Falcon boot mode for mmc (RAW and FAT)
Oleksandr Tyshchenko
oleksandr.tyshchenko at ti.com
Tue Aug 6 13:05:05 CEST 2013
Add support to boot Linux directly from U-Boot SPL via eMMC
(or RAW SD Cards) and FAT SD Cards. Jump into full U-Boot if
a corresponding button is pressed.
Also define new CONFIG_BOOTCOMMAND to add ability for full U-Boot
to boot Linux via eMMC (or RAW SD cards) and FAT SD Cards in
case of using CONFIG_SPL_OS_BOOT feature. Set MMCDEV_DEFAULT to 1
in CONFIG_EXTRA_ENV_SETTINGS, since the target device is mmc1 (eMMC).
Also enable the spl command in the full U-Boot so the kernel
parameter area snapshot can be created.
Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko at ti.com>
---
board/ti/sdp4430/sdp.c | 23 ++++++++++++++
board/ti/sdp4430/sdp4430_mux_data.h | 5 +++
include/configs/omap4_common.h | 57 +++++++++++++++++++++++++++++++++--
include/configs/omap4_sdp4430.h | 10 +++++-
4 files changed, 92 insertions(+), 3 deletions(-)
diff --git a/board/ti/sdp4430/sdp.c b/board/ti/sdp4430/sdp.c
index 9f457e7..66ee574 100644
--- a/board/ti/sdp4430/sdp.c
+++ b/board/ti/sdp4430/sdp.c
@@ -26,6 +26,7 @@
#include <twl6030.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/mmc_host_def.h>
+#include <asm/gpio.h>
#include "sdp4430_mux_data.h"
@@ -69,6 +70,28 @@ int misc_init_r(void)
return 0;
}
+#ifdef CONFIG_SPL_OS_BOOT
+/*
+ * SDP4430 specific implementation of spl_start_uboot()
+ *
+ * RETURN
+ * 0 if the button is not pressed
+ * 1 if the button is pressed
+ */
+int spl_start_uboot(void)
+{
+ int val = 0;
+
+ if (!gpio_request(SPL_OS_BOOT_KEY, "U-Boot key")) {
+ gpio_direction_input(SPL_OS_BOOT_KEY);
+ val = gpio_get_value(SPL_OS_BOOT_KEY);
+ gpio_free(SPL_OS_BOOT_KEY);
+ }
+
+ return val;
+}
+#endif
+
void set_muxconf_regs_essential(void)
{
do_set_mux((*ctrl)->control_padconf_core_base,
diff --git a/board/ti/sdp4430/sdp4430_mux_data.h b/board/ti/sdp4430/sdp4430_mux_data.h
index 0760dad..6ddd22d 100644
--- a/board/ti/sdp4430/sdp4430_mux_data.h
+++ b/board/ti/sdp4430/sdp4430_mux_data.h
@@ -65,6 +65,9 @@ const struct pad_conf_entry core_padconf_array_essential[] = {
{USBA0_OTG_CE, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* usba0_otg_ce */
{USBA0_OTG_DP, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dp */
{USBA0_OTG_DM, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dm */
+#ifdef CONFIG_SPL_OS_BOOT
+{GPMC_A22, (IEN | M3)}, /* gpio_46 */
+#endif
};
const struct pad_conf_entry wkup_padconf_array_essential[] = {
@@ -96,7 +99,9 @@ const struct pad_conf_entry core_padconf_array_non_essential[] = {
{GPMC_A19, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row7 */
{GPMC_A20, (IEN | M3)}, /* gpio_44 */
{GPMC_A21, (M3)}, /* gpio_45 */
+#ifndef CONFIG_SPL_OS_BOOT
{GPMC_A22, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col6 */
+#endif
{GPMC_A23, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col7 */
{GPMC_A24, (PTD | M3)}, /* gpio_48 */
{GPMC_A25, (PTD | M3)}, /* gpio_49 */
diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
index 2fa4382..da3a62f 100644
--- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h
@@ -145,6 +145,16 @@
#define CONFIG_ENV_OVERWRITE
+#ifdef CONFIG_SPL_OS_BOOT
+#define CONFIG_SYS_DEVICE_NULLDEV 1 /* include nulldev device */
+#define CONFIG_SILENT_CONSOLE 1 /* needed to silence "fatinfo mmc 0" */
+#define CONFIG_BOOTCOMMAND CONFIG_RAW_FAT_BOOTCOMMAND
+#define MMCDEV_DEFAULT "1"
+#else
+#define CONFIG_BOOTCOMMAND CONFIG_COMMON_BOOTCOMMAND
+#define MMCDEV_DEFAULT "0"
+#endif
+
#define CONFIG_EXTRA_ENV_SETTINGS \
"loadaddr=0x82000000\0" \
"console=ttyO2,115200n8\0" \
@@ -156,7 +166,7 @@
"bootfile=zImage\0" \
"usbtty=cdc_acm\0" \
"vram=16M\0" \
- "mmcdev=0\0" \
+ "mmcdev="MMCDEV_DEFAULT"\0" \
"mmcroot=/dev/mmcblk0p2 rw\0" \
"mmcrootfstype=ext3 rootwait\0" \
"mmcargs=setenv bootargs console=${console} " \
@@ -186,7 +196,7 @@
"echo WARNING: Could not determine device tree to use; fi; \0" \
"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
-#define CONFIG_BOOTCOMMAND \
+#define CONFIG_COMMON_BOOTCOMMAND \
"run findfdt; " \
"mmc dev ${mmcdev}; if mmc rescan; then " \
"echo SD/MMC found on device ${mmcdev};" \
@@ -207,6 +217,34 @@
"fi; " \
"fi"
+#define CONFIG_RAW_FAT_BOOTCOMMAND \
+ "mmc dev ${mmcdev}; if mmc rescan; then " \
+ "echo SD/MMC found on device ${mmcdev}; " \
+ "setenv stdout nulldev; " \
+ "if fatinfo mmc ${mmcdev}; then " \
+ "setenv stdout serial; " \
+ "if run loadbootscript; then " \
+ "run bootscript; " \
+ "else " \
+ "echo Booting from mmc ${mmcdev} ...; " \
+ "fatload mmc ${mmcdev} 0x81000000 uImage; " \
+ "fatload mmc ${mmcdev} 0x82000000 args; " \
+ "bootm 81000000 - 82000000; " \
+ "fi;" \
+ "else " \
+ "setenv stdout serial; " \
+ "mmc read 0x82000000 0x700 0x1FF; " \
+ "if iminfo 0x82000000; then " \
+ "run bootscript; " \
+ "else " \
+ "echo Booting from mmc ${mmcdev} ...; " \
+ "mmc read 0x81000000 0x900 0x10000; " \
+ "mmc read 0x82000000 0x80 0x80; " \
+ "bootm 81000000 - 82000000; " \
+ "fi; " \
+ "fi; " \
+ "fi"
+
#define CONFIG_AUTO_COMPLETE 1
/*
@@ -291,6 +329,21 @@
#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION 1
#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME "u-boot.img"
+#ifdef CONFIG_SPL_OS_BOOT
+/* fat */
+#define CONFIG_SPL_FAT_LOAD_KERNEL_NAME "uImage"
+#define CONFIG_SPL_FAT_LOAD_ARGS_NAME "args"
+#define CONFIG_SYS_SPL_ARGS_ADDR 0x82000000
+
+/* raw mmc */
+#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x900 /* address 0x120000 */
+#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x80 /* address 0x10000 */
+#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x80 /* 64KiB */
+
+/* spl export command */
+#define CONFIG_CMD_SPL
+#endif
+
#define CONFIG_SPL_LIBCOMMON_SUPPORT
#define CONFIG_SPL_LIBDISK_SUPPORT
#define CONFIG_SPL_I2C_SUPPORT
diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h
index 9a4dea0..baa4f48 100644
--- a/include/configs/omap4_sdp4430.h
+++ b/include/configs/omap4_sdp4430.h
@@ -35,6 +35,12 @@
#define CONFIG_4430SDP 1 /* working with SDP */
#define CONFIG_MACH_TYPE MACH_TYPE_OMAP_4430SDP
+/* activate Falcon mode */
+#define CONFIG_SPL_OS_BOOT
+
+/* GPIO used to select between U-Boot and kernel */
+#define SPL_OS_BOOT_KEY 46
+
#include <configs/omap4_common.h>
/* Battery Charger */
@@ -43,9 +49,11 @@
#endif
/* ENV related config options */
-#define CONFIG_ENV_IS_IN_MMC 1
+#define CONFIG_ENV_IS_NOWHERE 1 /* for now */
+#ifdef CONFIG_ENV_IS_IN_MMC
#define CONFIG_SYS_MMC_ENV_DEV 1 /* SLOT2: eMMC(1) */
#define CONFIG_ENV_OFFSET 0xE0000
+#endif
#define CONFIG_CMD_SAVEENV
#define CONFIG_SYS_PROMPT "OMAP4430 SDP # "
--
1.7.9.5
More information about the U-Boot
mailing list