From patchwork Tue Aug 6 11:05:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 265021 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2D6832C0084 for ; Tue, 6 Aug 2013 21:09:44 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3BBD94A0F7; Tue, 6 Aug 2013 13:08:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dcyXDTja98xu; Tue, 6 Aug 2013 13:08:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E8FDE4A08E; Tue, 6 Aug 2013 13:08:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2476B4A090 for ; Tue, 6 Aug 2013 13:07:55 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2xPHcmHAC5LH for ; Tue, 6 Aug 2013 13:07:50 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by theia.denx.de (Postfix) with ESMTPS id 43CE24A03F for ; Tue, 6 Aug 2013 13:05:08 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r76B57qr026560 for ; Tue, 6 Aug 2013 06:05:07 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r76B56cO020521 for ; Tue, 6 Aug 2013 06:05:07 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Tue, 6 Aug 2013 06:05:06 -0500 Received: from uglx0186693.ucm2.emeaucm.ext.ti.com (uglx0186693.ucm2.emeaucm.ext.ti.com [10.167.145.77]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r76B55A4022220 for ; Tue, 6 Aug 2013 06:05:06 -0500 From: Oleksandr Tyshchenko To: Date: Tue, 6 Aug 2013 14:05:05 +0300 Message-ID: <1375787105-15546-1-git-send-email-oleksandr.tyshchenko@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Subject: [U-Boot] [u-boot][RFC v1] sdp4430: Enable Falcon boot mode for mmc (RAW and FAT) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- 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 #include #include +#include #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 /* 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 # "