From 861a86f46047c22af505d7fb27b2c68df0f54323 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 13 Aug 2012 11:37:56 -0700 Subject: omap-common: SPL: Add CONFIG_SPL_DISPLAY_PRINT / spl_display_print() Only omap4/5 currently have a meaningful set of display text and overo had been adding a function to display nothing. Change how this works to be opt-in and only turned on for omap4/5 now. Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/spl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'arch/arm/cpu/armv7/omap-common/spl.c') diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index 4d1ac85..b10832a 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -219,10 +219,7 @@ void preloader_console_init(void) printf("\nU-Boot SPL %s (%s - %s)\n", u_boot_rev, U_BOOT_DATE, U_BOOT_TIME); - omap_rev_string(); -} - -void __weak omap_rev_string() -{ - printf("Texas Instruments Revision detection unimplemented\n"); +#ifdef CONFIG_SPL_DISPLAY_PRINT + spl_display_print(); +#endif } -- cgit v1.1 From 8e1b836ec54846bedd0cabefc1cf6fbb1e3ae2e3 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 13 Aug 2012 12:53:23 -0700 Subject: ARM: SPL: Rename omap_boot_device to spl_boot_device Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm/cpu/armv7/omap-common/spl.c') diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index b10832a..4d33f99 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -156,7 +156,7 @@ void board_init_r(gd_t *id, ulong dummy) spl_board_init(); #endif - boot_device = omap_boot_device(); + boot_device = spl_boot_device(); debug("boot device - %d\n", boot_device); switch (boot_device) { #ifdef CONFIG_SPL_MMC_SUPPORT -- cgit v1.1 From 24dafad5c42018ea11c0d12f747a7eb337229f5a Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 13 Aug 2012 14:13:07 -0700 Subject: ARM: SPL: Only call mem_malloc_init if configured We can only attempt to setup a malloc pool if CONFIG_SYS_SPL_MALLOC_START is defined, and not all boards require it. Make the call depend on the define. Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/spl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/arm/cpu/armv7/omap-common/spl.c') diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index 4d33f99..71a467e 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -149,8 +149,10 @@ void board_init_r(gd_t *id, ulong dummy) u32 boot_device; debug(">>spl:board_init_r()\n"); +#ifdef CONFIG_SYS_SPL_MALLOC_START mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START, CONFIG_SYS_SPL_MALLOC_SIZE); +#endif #ifdef CONFIG_SPL_BOARD_INIT spl_board_init(); -- cgit v1.1 From 55cdbb8d4e8508dcdb95400f6dfcb928220ffc70 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 14 Aug 2012 08:50:58 -0700 Subject: ARM: SPL: Add and Move the SPL prototypes from into and add for arch specific portions of CONFIG_SPL_FRAMEWORK. Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm/cpu/armv7/omap-common/spl.c') diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index 71a467e..81991b2 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -23,6 +23,7 @@ * MA 02111-1307 USA */ #include +#include #include #include #include @@ -30,7 +31,6 @@ #include #include #include -#include #include #include #include -- cgit v1.1 From 026b2fe32c3d5658befb54521dcfed46444e6bf8 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 14 Aug 2012 12:06:43 -0700 Subject: ARM: SPL: Clean up spl.c / spl_nand.c slightly - Remove includes we don't need - Switch some printf statements to puts - Convert some printf statements to debug, introduce new puts statements - In most cases saying just "No mkimage signature, assuming u-boot.bin" or similar is sufficient. This also means the non-DEBUG case doesn't need printf, in the core of SPL. - The other case here is that PLAIN_VERSION provided what we wanted already, so just use it. Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/spl.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'arch/arm/cpu/armv7/omap-common/spl.c') diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index 81991b2..3a1029f 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -26,12 +26,9 @@ #include #include #include -#include #include -#include #include #include -#include #include #include #include @@ -78,8 +75,8 @@ void board_init_f(ulong dummy) #ifdef CONFIG_SPL_OS_BOOT __weak int spl_start_uboot(void) { - printf("SPL: Please implement spl_start_uboot() for your board\n"); - printf("SPL: Direct Linux boot not active!\n"); + puts("SPL: Please implement spl_start_uboot() for your board\n"); + puts("SPL: Direct Linux boot not active!\n"); return 1; } #endif @@ -99,9 +96,9 @@ void spl_parse_image_header(const struct image_header *header) spl_image.name, spl_image.load_addr, spl_image.size); } else { /* Signature not found - assume u-boot.bin */ - printf("mkimage signature not found - ih_magic = %x\n", + puts("mkimage signature not found, assuming u-boot.bin ..\n"); + debug("mkimage signature not found - ih_magic = %x\n", header->ih_magic); - debug("Assuming u-boot.bin ..\n"); /* Let's assume U-Boot will not be more than 200 KB */ spl_image.size = 200 * 1024; spl_image.entry_point = CONFIG_SYS_TEXT_BASE; @@ -179,7 +176,8 @@ void board_init_r(gd_t *id, ulong dummy) break; #endif default: - printf("SPL: Un-supported Boot Device - %d!!!\n", boot_device); + puts("SPL: Un-supported Boot Device\n"); + debug("Found: %d\n", boot_device); hang(); break; } @@ -205,8 +203,6 @@ void board_init_r(gd_t *id, ulong dummy) /* This requires UART clocks to be enabled */ void preloader_console_init(void) { - const char *u_boot_rev = U_BOOT_VERSION; - gd = &gdata; gd->bd = &bdata; gd->flags |= GD_FLG_RELOC; @@ -216,11 +212,8 @@ void preloader_console_init(void) gd->have_console = 1; - /* Avoid a second "U-Boot" coming from this string */ - u_boot_rev = &u_boot_rev[7]; - - printf("\nU-Boot SPL %s (%s - %s)\n", u_boot_rev, U_BOOT_DATE, - U_BOOT_TIME); + puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \ + U_BOOT_TIME ")\n"); #ifdef CONFIG_SPL_DISPLAY_PRINT spl_display_print(); #endif -- cgit v1.1 From d4c4e0e11710f26904c288ad1bf05d8b73abddf7 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 14 Aug 2012 12:25:23 -0700 Subject: ARM: SPL: Start hooking in the current SPI SPL support Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/spl.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/arm/cpu/armv7/omap-common/spl.c') diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index 3a1029f..dc26750 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -175,6 +175,11 @@ void board_init_r(gd_t *id, ulong dummy) spl_ymodem_load_image(); break; #endif +#ifdef CONFIG_SPL_SPI_SUPPORT + case BOOT_DEVICE_SPI: + spi_boot(); + break; +#endif default: puts("SPL: Un-supported Boot Device\n"); debug("Found: %d\n", boot_device); -- cgit v1.1 From 47f7bcae8c0de8b2a8af7ca309744f041a6d1424 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 13 Aug 2012 12:03:19 -0700 Subject: SPL: Move the omap SPL framework to common/spl Add a new flag, CONFIG_SPL_FRAMEWORK to opt into the common/spl SPL framework, enable on all of the previously using boards. We move the spl_ymodem.c portion to common/ and spl_mmc.c to drivers/mmc/. We leave the NAND one in-place as we plan to replace it later in this series. We use common/spl to avoid linker problems with respect to merging constant strings in objects. Otherwise all strings in common/ will be linked in and kept which grows SPL in size too much. Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/spl.c | 225 ----------------------------------- 1 file changed, 225 deletions(-) delete mode 100644 arch/arm/cpu/armv7/omap-common/spl.c (limited to 'arch/arm/cpu/armv7/omap-common/spl.c') diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c deleted file mode 100644 index dc26750..0000000 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * (C) Copyright 2010 - * Texas Instruments, - * - * Aneesh V - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -DECLARE_GLOBAL_DATA_PTR; - -u32* boot_params_ptr = NULL; -struct spl_image_info spl_image; - -/* Define global data structure pointer to it*/ -static gd_t gdata __attribute__ ((section(".data"))); -static bd_t bdata __attribute__ ((section(".data"))); - -inline void hang(void) -{ - puts("### ERROR ### Please RESET the board ###\n"); - for (;;) - ; -} - -void board_init_f(ulong dummy) -{ - /* - * We call relocate_code() with relocation target same as the - * CONFIG_SYS_SPL_TEXT_BASE. This will result in relocation getting - * skipped. Instead, only .bss initialization will happen. That's - * all we need - */ - debug(">>board_init_f()\n"); - relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE); -} - -/* - * Default function to determine if u-boot or the OS should - * be started. This implementation always returns 1. - * - * Please implement your own board specific funcion to do this. - * - * RETURN - * 0 to not start u-boot - * positive if u-boot should start - */ -#ifdef CONFIG_SPL_OS_BOOT -__weak int spl_start_uboot(void) -{ - puts("SPL: Please implement spl_start_uboot() for your board\n"); - puts("SPL: Direct Linux boot not active!\n"); - return 1; -} -#endif - -void spl_parse_image_header(const struct image_header *header) -{ - u32 header_size = sizeof(struct image_header); - - if (__be32_to_cpu(header->ih_magic) == IH_MAGIC) { - spl_image.size = __be32_to_cpu(header->ih_size) + header_size; - spl_image.entry_point = __be32_to_cpu(header->ih_load); - /* Load including the header */ - spl_image.load_addr = spl_image.entry_point - header_size; - spl_image.os = header->ih_os; - spl_image.name = (const char *)&header->ih_name; - debug("spl: payload image: %s load addr: 0x%x size: %d\n", - spl_image.name, spl_image.load_addr, spl_image.size); - } else { - /* Signature not found - assume u-boot.bin */ - puts("mkimage signature not found, assuming u-boot.bin ..\n"); - debug("mkimage signature not found - ih_magic = %x\n", - header->ih_magic); - /* Let's assume U-Boot will not be more than 200 KB */ - spl_image.size = 200 * 1024; - spl_image.entry_point = CONFIG_SYS_TEXT_BASE; - spl_image.load_addr = CONFIG_SYS_TEXT_BASE; - spl_image.os = IH_OS_U_BOOT; - spl_image.name = "U-Boot"; - } -} - -/* - * 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 -static void __noreturn jump_to_image_linux(void *arg) -{ - debug("Entering kernel arg pointer: 0x%p\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(); - image_entry(0, CONFIG_MACH_TYPE, arg); -} -#endif - -static void __noreturn jump_to_image_no_args(void) -{ - typedef void __noreturn (*image_entry_noargs_t)(u32 *); - image_entry_noargs_t image_entry = - (image_entry_noargs_t) spl_image.entry_point; - - debug("image entry point: 0x%X\n", spl_image.entry_point); - /* Pass the saved boot_params from rom code */ -#if defined(CONFIG_VIRTIO) || defined(CONFIG_ZEBU) - image_entry = (image_entry_noargs_t)0x80100000; -#endif - u32 boot_params_ptr_addr = (u32)&boot_params_ptr; - image_entry((u32 *)boot_params_ptr_addr); -} - -void board_init_r(gd_t *id, ulong dummy) -{ - u32 boot_device; - debug(">>spl:board_init_r()\n"); - -#ifdef CONFIG_SYS_SPL_MALLOC_START - mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START, - CONFIG_SYS_SPL_MALLOC_SIZE); -#endif - -#ifdef CONFIG_SPL_BOARD_INIT - spl_board_init(); -#endif - - boot_device = spl_boot_device(); - debug("boot device - %d\n", boot_device); - switch (boot_device) { -#ifdef CONFIG_SPL_MMC_SUPPORT - case BOOT_DEVICE_MMC1: - case BOOT_DEVICE_MMC2: - case BOOT_DEVICE_MMC2_2: - spl_mmc_load_image(); - break; -#endif -#ifdef CONFIG_SPL_NAND_SUPPORT - case BOOT_DEVICE_NAND: - spl_nand_load_image(); - break; -#endif -#ifdef CONFIG_SPL_YMODEM_SUPPORT - case BOOT_DEVICE_UART: - spl_ymodem_load_image(); - break; -#endif -#ifdef CONFIG_SPL_SPI_SUPPORT - case BOOT_DEVICE_SPI: - spi_boot(); - break; -#endif - default: - puts("SPL: Un-supported Boot Device\n"); - debug("Found: %d\n", boot_device); - hang(); - break; - } - - switch (spl_image.os) { - case IH_OS_U_BOOT: - 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(); - } -} - -/* This requires UART clocks to be enabled */ -void preloader_console_init(void) -{ - gd = &gdata; - gd->bd = &bdata; - gd->flags |= GD_FLG_RELOC; - gd->baudrate = CONFIG_BAUDRATE; - - serial_init(); /* serial communications setup */ - - gd->have_console = 1; - - puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \ - U_BOOT_TIME ")\n"); -#ifdef CONFIG_SPL_DISPLAY_PRINT - spl_display_print(); -#endif -} -- cgit v1.1