From patchwork Mon Oct 31 16:23:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Schwarz X-Patchwork-Id: 122883 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 1DFCBB6F72 for ; Tue, 1 Nov 2011 03:24:51 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0201292BC; Mon, 31 Oct 2011 17:24:49 +0100 (CET) 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 2VHcaKWs0r+9; Mon, 31 Oct 2011 17:24:49 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 24E2D292AD; Mon, 31 Oct 2011 17:24:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3035F2929F for ; Mon, 31 Oct 2011 17:24:46 +0100 (CET) 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 yNGO6F2i1K4g for ; Mon, 31 Oct 2011 17:24:45 +0100 (CET) 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 mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by theia.denx.de (Postfix) with ESMTPS id C092229224 for ; Mon, 31 Oct 2011 17:24:44 +0100 (CET) Received: by faas12 with SMTP id s12so5810637faa.3 for ; Mon, 31 Oct 2011 09:24:43 -0700 (PDT) Received: by 10.223.58.146 with SMTP id g18mr30508511fah.13.1320078216212; Mon, 31 Oct 2011 09:23:36 -0700 (PDT) Received: from localhost.localdomain (DSL01.212.114.252.242.ip-pool.NEFkom.net. [212.114.252.242]) by mx.google.com with ESMTPS id j5sm38783162faf.14.2011.10.31.09.23.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 31 Oct 2011 09:23:35 -0700 (PDT) From: Simon Schwarz To: u-boot@lists.denx.de Date: Mon, 31 Oct 2011 17:23:05 +0100 Message-Id: <1320078187-28423-4-git-send-email-simonschwarzcor@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1320078187-28423-1-git-send-email-simonschwarzcor@gmail.com> References: <1317284033-16188-1-git-send-email-simonschwarzcor@gmail.com> <1320078187-28423-1-git-send-email-simonschwarzcor@gmail.com> Organization: Corscience GmbH & Co. KG Cc: Simon Schwarz Subject: [U-Boot] [PATCH V7 3/5] omap-common/spl: Add linux boot to SPL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Simon Schwarz This adds Linux booting to the SPL This depends on CONFIG_MACH_TYPE patch by Igor Grinberg (http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105809) Related CONFIGs: CONFIG_SPL_OS_BOOT Activates/Deactivates the OS booting feature CONFIG_SPL_OS_BOOT_KEY defines the IO-pin number u-boot switch - if pressed u-boot is booted CONFIG_SYS_NAND_SPL_KERNEL_OFFS Offset in NAND of direct boot kernel image to use in SPL CONFIG_SYS_SPL_ARGS_ADDR Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100 Signed-off-by: Simon Schwarz --- V2 changes: nothing V3 changes: nothing V4 changes: CHG Using CONFIG_MACH_TYPE now. DEL CONFIG_SYS_SPL_MACHID CHG Use CONFIG_MACH_TYPE for machine id config - This makes the patch depending on the patch linked above V5 changes: FIX compile errors for OMAP4 REBASE u-boot-ti adapted new general gpio interface V6 changes: nothing V7 changes: FIX multiline comment style (http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113501) --- arch/arm/cpu/armv7/omap-common/spl.c | 51 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 9 ++++- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index d37ca0f..bafddfb 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -35,6 +35,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -63,6 +64,26 @@ void board_init_f(ulong dummy) relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE); } +/* + * Return the value of the U-boot key + * + * RETURN + * 0 if not pressed + * positiv if pressed + */ +#ifdef CONFIG_SPL_OS_BOOT +int spl_uboot_key(void) +{ + int val = 0; + if (!gpio_request(CONFIG_SPL_OS_BOOT_KEY, "U-Boot key")) { + gpio_direction_input(CONFIG_SPL_OS_BOOT_KEY); + val = gpio_get_value(CONFIG_SPL_OS_BOOT_KEY); + gpio_free(CONFIG_SPL_OS_BOOT_KEY); + } + return !val; +} +#endif + void spl_parse_image_header(const struct image_header *header) { u32 header_size = sizeof(struct image_header); @@ -90,7 +111,26 @@ void spl_parse_image_header(const struct image_header *header) } } -static void jump_to_image_no_args(void) +/* + * This function jumps to an image with argument. Normally an FDT or ATAGS + * image. + * arg: Pointer to paramter image in RAM + */ +#ifdef CONFIG_SPL_OS_BOOT +void jump_to_image_linux(void *arg) +{ + debug("Entering kernel arg pointer: 0x%X\n", arg); + typedef void (*image_entry_arg_t)(int, int, void *) + __attribute__ ((noreturn)); + image_entry_arg_t image_entry = + (image_entry_arg_t) spl_image.entry_point; + /* cleanup_before_linux(); */ /*write SPL function for that*/ + image_entry(0, CONFIG_MACH_TYPE, arg); +} +void jump_to_image_linux(void *) __attribute__ ((noreturn)); +#endif + +void jump_to_image_no_args(void) { typedef void (*image_entry_noargs_t)(void)__attribute__ ((noreturn)); image_entry_noargs_t image_entry = @@ -99,8 +139,8 @@ static void jump_to_image_no_args(void) debug("image entry point: 0x%X\n", spl_image.entry_point); image_entry(); } - void jump_to_image_no_args(void) __attribute__ ((noreturn)); + void board_init_r(gd_t *id, ulong dummy) { u32 boot_device; @@ -137,6 +177,13 @@ void board_init_r(gd_t *id, ulong dummy) debug("Jumping to U-Boot\n"); jump_to_image_no_args(); break; +#ifdef CONFIG_SPL_OS_BOOT + case IH_OS_LINUX: + debug("Jumping to Linux\n"); + spl_board_prepare_for_linux(); + jump_to_image_linux((void *)CONFIG_SYS_SPL_ARGS_ADDR); + break; +#endif default: puts("Unsupported OS image.. Jumping nevertheless..\n"); jump_to_image_no_args(); diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index f603f55..a848f4d 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -37,7 +37,9 @@ #define CONFIG_OMAP3430 1 /* which is in a 3430 */ #define CONFIG_OMAP3_DEVKIT8000 1 /* working with DevKit8000 */ -#define CONFIG_SYS_TEXT_BASE 0x80008000 +#define CONFIG_MACH_TYPE MACH_TYPE_DEVKIT8000 + +#define CONFIG_SYS_TEXT_BASE 0x80100000 #define CONFIG_SDRC /* The chip has SDRC controller */ @@ -333,7 +335,7 @@ #define CONFIG_SPL_MAX_SIZE 0xB400 /* 45 K */ #define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK -#define CONFIG_SPL_BSS_START_ADDR 0x80000000 /*CONFIG_SYS_SDRAM_BASE*/ +#define CONFIG_SPL_BSS_START_ADDR 0x80000500 /* leave space for bootargs*/ #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* NAND boot config */ @@ -366,6 +368,9 @@ #define CONFIG_CMD_SPL_WRITE_SIZE 0x400 /* 1024 byte */ #define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000) +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 26 + #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 #define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100) #endif /* __CONFIG_H */