diff options
Diffstat (limited to 'arch/arm/cpu')
| -rw-r--r-- | arch/arm/cpu/arm1176/bcm2835/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/cpu/arm1176/bcm2835/init.c | 24 | ||||
| -rw-r--r-- | arch/arm/cpu/arm1176/cpu.c | 7 | ||||
| -rw-r--r-- | arch/arm/cpu/arm926ejs/davinci/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/cpu/arm926ejs/davinci/config.mk | 16 | ||||
| -rw-r--r-- | arch/arm/cpu/arm926ejs/davinci/spl.c | 72 | ||||
| -rw-r--r-- | arch/arm/cpu/arm926ejs/start.S | 2 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/am33xx/board.c | 4 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/Makefile | 13 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/boot-common.c | 27 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/hwinit-common.c | 10 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 6 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/spl.c | 228 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/spl_mmc.c | 150 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/spl_nand.c | 111 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/spl_ymodem.c | 76 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap-common/u-boot-spl.lds | 6 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/omap3/board.c | 32 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/start.S | 13 | 
19 files changed, 147 insertions, 654 deletions
| diff --git a/arch/arm/cpu/arm1176/bcm2835/Makefile b/arch/arm/cpu/arm1176/bcm2835/Makefile index 4ea6d6b89..95da6a822 100644 --- a/arch/arm/cpu/arm1176/bcm2835/Makefile +++ b/arch/arm/cpu/arm1176/bcm2835/Makefile @@ -17,7 +17,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(SOC).o  SOBJS	:= lowlevel_init.o -COBJS	:= reset.o timer.o +COBJS	:= init.o reset.o timer.o  SRCS	:= $(SOBJS:.o=.c) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/arch/arm/cpu/arm1176/bcm2835/init.c b/arch/arm/cpu/arm1176/bcm2835/init.c new file mode 100644 index 000000000..e90d3bba1 --- /dev/null +++ b/arch/arm/cpu/arm1176/bcm2835/init.c @@ -0,0 +1,24 @@ +/* + * (C) Copyright 2012 Stephen Warren + * + * 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 + * version 2 as published by the Free Software Foundation. + * + * 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. + */ + +#include <common.h> + +int arch_cpu_init(void) +{ +	icache_enable(); + +	return 0; +} diff --git a/arch/arm/cpu/arm1176/cpu.c b/arch/arm/cpu/arm1176/cpu.c index 532a90b54..c0fd114e1 100644 --- a/arch/arm/cpu/arm1176/cpu.c +++ b/arch/arm/cpu/arm1176/cpu.c @@ -65,10 +65,3 @@ static void cache_flush (void)  	/* mem barrier to sync things */  	asm ("mcr p15, 0, %0, c7, c10, 4": :"r" (0));  } - -int arch_cpu_init(void) -{ -	icache_enable(); - -	return 0; -} diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile index c91928e71..dec7bfbfa 100644 --- a/arch/arm/cpu/arm926ejs/davinci/Makefile +++ b/arch/arm/cpu/arm926ejs/davinci/Makefile @@ -37,7 +37,7 @@ COBJS-$(CONFIG_SOC_DA850)	+= da850_pinmux.o  COBJS-$(CONFIG_DRIVER_TI_EMAC)	+= lxt972.o dp83848.o et1011c.o ksz8873.o  ifdef CONFIG_SPL_BUILD -COBJS-y	+= spl.o +COBJS-$(CONFIG_SPL_FRAMEWORK)	+= spl.o  COBJS-$(CONFIG_SOC_DM365)	+= dm365_lowlevel.o  COBJS-$(CONFIG_SOC_DA8XX)	+= da850_lowlevel.o  endif diff --git a/arch/arm/cpu/arm926ejs/davinci/config.mk b/arch/arm/cpu/arm926ejs/davinci/config.mk new file mode 100644 index 000000000..745231547 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/davinci/config.mk @@ -0,0 +1,16 @@ +# +# Copyright (C) 2012, Texas Instruments, Incorporated - http://www.ti.com/ +# +# 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 "as is" WITHOUT ANY WARRANTY of any +# kind, whether express or implied; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. +# +ifndef CONFIG_SPL_BUILD +ALL-$(CONFIG_SPL_FRAMEWORK)	+= $(obj)u-boot.ais +endif diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c index 03c85c87f..714fa9284 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c @@ -21,6 +21,8 @@   * MA 02111-1307 USA   */  #include <common.h> +#include <config.h> +#include <spl.h>  #include <asm/u-boot.h>  #include <asm/utils.h>  #include <nand.h> @@ -30,15 +32,9 @@  #include <spi_flash.h>  #include <mmc.h> -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT -  DECLARE_GLOBAL_DATA_PTR; -/* Define global data structure pointer to it*/ -static gd_t gdata __attribute__ ((section(".data"))); -static bd_t bdata __attribute__ ((section(".data"))); - -#else +#ifndef CONFIG_SPL_LIBCOMMON_SUPPORT  void puts(const char *str)  {  	while (*str) @@ -52,53 +48,49 @@ void putc(char c)  	NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c);  } -  #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */ -inline void hang(void) -{ -	puts("### ERROR ### Please RESET the board ###\n"); -	for (;;) -		; -} -  void board_init_f(ulong dummy)  { +	/* First, setup our stack pointer. */ +	asm volatile("mov sp, %0\n" : : "r"(CONFIG_SPL_STACK)); + +	/* Second, perform our low-level init. */  #ifdef CONFIG_SOC_DM365  	dm36x_lowlevel_init(0);  #endif  #ifdef CONFIG_SOC_DA8XX  	arch_cpu_init();  #endif -	relocate_code(CONFIG_SPL_STACK, NULL, CONFIG_SPL_TEXT_BASE); -} -void board_init_r(gd_t *id, ulong dummy) -{ -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN, -			CONFIG_SYS_MALLOC_LEN); +	/* Third, we clear the BSS. */ +	memset(__bss_start, 0, __bss_end__ - __bss_start); +	/* Finally, setup gd and move to the next step. */  	gd = &gdata; -	gd->bd = &bdata; -	gd->flags |= GD_FLG_RELOC; -	gd->baudrate = CONFIG_BAUDRATE; -	serial_init();          /* serial communications setup */ -	gd->have_console = 1; +	board_init_r(NULL, 0); +} -#endif +void spl_board_init(void) +{ +	preloader_console_init(); +} -#ifdef CONFIG_SPL_NAND_LOAD -	nand_init(); -	puts("Nand boot...\n"); -	nand_boot(); -#endif -#ifdef CONFIG_SPL_SPI_LOAD -	puts("SPI boot...\n"); -	spi_boot(); -#endif -#ifdef CONFIG_SPL_MMC_LOAD -	puts("MMC boot...\n"); -	spl_mmc_load(); +u32 spl_boot_mode(void) +{ +	return MMCSD_MODE_RAW; +} + +u32 spl_boot_device(void) +{ +#ifdef CONFIG_SPL_NAND_SIMPLE +	return BOOT_DEVICE_NAND; +#elif defined(CONFIG_SPL_SPI_LOAD) +	return BOOT_DEVICE_SPI; +#elif defined(CONFIG_SPL_MMC_LOAD) +	return BOOT_DEVICE_MMC1; +#else +	puts("Unknown boot device\n"); +	hang();  #endif  } diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S index 6f05f1ac4..521d46290 100644 --- a/arch/arm/cpu/arm926ejs/start.S +++ b/arch/arm/cpu/arm926ejs/start.S @@ -215,6 +215,7 @@ call_board_init_f:  /*------------------------------------------------------------------------------*/ +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_NAND_SPL)  /*   * void relocate_code (addr_sp, gd, addr_moni)   * @@ -344,6 +345,7 @@ _rel_dyn_end_ofs:  	.word __rel_dyn_end - _start  _dynsym_start_ofs:  	.word __dynsym_start - _start +#endif  /*   ************************************************************************* diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index ecc26717c..978b184fb 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -18,6 +18,7 @@  #include <common.h>  #include <errno.h> +#include <spl.h>  #include <asm/arch/cpu.h>  #include <asm/arch/hardware.h>  #include <asm/arch/omap.h> @@ -27,7 +28,6 @@  #include <asm/arch/mmc_host_def.h>  #include <asm/arch/sys_proto.h>  #include <asm/io.h> -#include <asm/omap_common.h>  #include <asm/emif.h>  #include <asm/gpio.h>  #include <i2c.h> @@ -166,6 +166,8 @@ void s_init(void)  	regVal |= UART_SMART_IDLE_EN;  	writel(regVal, &uart_base->uartsyscfg); +	gd = &gdata; +  	preloader_console_init();  	/* Initalize the board header */ diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile index d37b22d98..1f2fa027c 100644 --- a/arch/arm/cpu/armv7/omap-common/Makefile +++ b/arch/arm/cpu/armv7/omap-common/Makefile @@ -42,19 +42,6 @@ COBJS	+= boot-common.o  SOBJS	+= lowlevel_init.o  endif -ifdef CONFIG_SPL_BUILD -COBJS	+= spl.o -ifdef CONFIG_SPL_NAND_SUPPORT -COBJS	+= spl_nand.o -endif -ifdef CONFIG_SPL_MMC_SUPPORT -COBJS	+= spl_mmc.o -endif -ifdef CONFIG_SPL_YMODEM_SUPPORT -COBJS	+= spl_ymodem.o -endif -endif -  ifndef CONFIG_SPL_BUILD  ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)  COBJS	+= mem-common.o diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c index f211f7670..0f19141cc 100644 --- a/arch/arm/cpu/armv7/omap-common/boot-common.c +++ b/arch/arm/cpu/armv7/omap-common/boot-common.c @@ -17,8 +17,10 @@   */  #include <common.h> +#include <spl.h>  #include <asm/omap_common.h>  #include <asm/arch/omap.h> +#include <asm/arch/mmc_host_def.h>  /*   * This is used to verify if the configuration header @@ -37,13 +39,34 @@ struct omap_boot_parameters boot_params __attribute__ ((section(".data")));   */  u32 omap_bootmode = MMCSD_MODE_FAT; -u32 omap_boot_device(void) +u32 spl_boot_device(void)  {  	return (u32) (boot_params.omap_bootdevice);  } -u32 omap_boot_mode(void) +u32 spl_boot_mode(void)  {  	return omap_bootmode;  } + +void spl_board_init(void) +{ +#ifdef CONFIG_SPL_NAND_SUPPORT +	gpmc_init(); +#endif +} + +int board_mmc_init(bd_t *bis) +{ +	switch (spl_boot_device()) { +	case BOOT_DEVICE_MMC1: +		omap_mmc_init(0, 0, 0); +		break; +	case BOOT_DEVICE_MMC2: +	case BOOT_DEVICE_MMC2_2: +		omap_mmc_init(1, 0, 0); +		break; +	} +	return 0; +}  #endif diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c b/arch/arm/cpu/armv7/omap-common/hwinit-common.c index 459ebb55e..9ef10bdf2 100644 --- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c +++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c @@ -28,10 +28,10 @@   * MA 02111-1307 USA   */  #include <common.h> +#include <spl.h>  #include <asm/arch/sys_proto.h>  #include <asm/sizes.h>  #include <asm/emif.h> -#include <asm/omap_common.h>  DECLARE_GLOBAL_DATA_PTR; @@ -92,6 +92,11 @@ static void init_boot_params(void)  {  	boot_params_ptr = (u32 *) &boot_params;  } + +void spl_display_print(void) +{ +	omap_rev_string(); +}  #endif  /* @@ -119,6 +124,9 @@ void s_init(void)  	set_mux_conf_regs();  #ifdef CONFIG_SPL_BUILD  	setup_clocks_for_console(); + +	gd = &gdata; +  	preloader_console_init();  	do_io_settings();  #endif diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S index 1ece07363..9766563d0 100644 --- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S @@ -52,18 +52,18 @@ ENTRY(save_boot_params)  	ldr	r1, =boot_params  	str	r0, [r1]  #ifdef CONFIG_SPL_BUILD -	/* Store the boot device in omap_boot_device */ +	/* Store the boot device in spl_boot_device */  	ldrb	r2, [r0, #BOOT_DEVICE_OFFSET]	@ r1 <- value of boot device  	and	r2, #BOOT_DEVICE_MASK  	ldr	r3, =boot_params -	strb	r2, [r3, #BOOT_DEVICE_OFFSET]	@ omap_boot_device <- r1 +	strb	r2, [r3, #BOOT_DEVICE_OFFSET]	@ spl_boot_device <- r1  	/* boot mode is passed only for devices that can raw/fat mode */  	cmp	r2, #2  	blt	2f  	cmp	r2, #7  	bgt	2f -	/* Store the boot mode (raw/FAT) in omap_boot_mode */ +	/* Store the boot mode (raw/FAT) in omap_bootmode */  	ldr	r2, [r0, #DEV_DESC_PTR_OFFSET]	@ get the device descriptor ptr  	ldr	r2, [r2, #DEV_DATA_PTR_OFFSET]	@ get the pDeviceData ptr  	ldr	r2, [r2, #BOOT_MODE_OFFSET]	@ get the boot mode 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 4d1ac85d0..000000000 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * (C) Copyright 2010 - * Texas Instruments, <www.ti.com> - * - * Aneesh V <aneesh@ti.com> - * - * 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 <common.h> -#include <asm/u-boot.h> -#include <asm/utils.h> -#include <asm/arch/sys_proto.h> -#include <nand.h> -#include <mmc.h> -#include <fat.h> -#include <version.h> -#include <asm/omap_common.h> -#include <asm/arch/mmc_host_def.h> -#include <i2c.h> -#include <image.h> -#include <malloc.h> -#include <linux/compiler.h> - -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) -{ -	printf("SPL: Please implement spl_start_uboot() for your board\n"); -	printf("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 */ -		printf("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; -		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"); - -	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START, -			CONFIG_SYS_SPL_MALLOC_SIZE); - -#ifdef CONFIG_SPL_BOARD_INIT -	spl_board_init(); -#endif - -	boot_device = omap_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 -	default: -		printf("SPL: Un-supported Boot Device - %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) -{ -	const char *u_boot_rev = U_BOOT_VERSION; - -	gd = &gdata; -	gd->bd = &bdata; -	gd->flags |= GD_FLG_RELOC; -	gd->baudrate = CONFIG_BAUDRATE; - -	serial_init();		/* serial communications setup */ - -	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); -	omap_rev_string(); -} - -void __weak omap_rev_string() -{ -	printf("Texas Instruments Revision detection unimplemented\n"); -} diff --git a/arch/arm/cpu/armv7/omap-common/spl_mmc.c b/arch/arm/cpu/armv7/omap-common/spl_mmc.c deleted file mode 100644 index 2f921bb07..000000000 --- a/arch/arm/cpu/armv7/omap-common/spl_mmc.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * (C) Copyright 2010 - * Texas Instruments, <www.ti.com> - * - * Aneesh V <aneesh@ti.com> - * - * 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 <common.h> -#include <asm/u-boot.h> -#include <asm/utils.h> -#include <asm/arch/sys_proto.h> -#include <mmc.h> -#include <fat.h> -#include <version.h> -#include <asm/omap_common.h> -#include <asm/arch/mmc_host_def.h> - -DECLARE_GLOBAL_DATA_PTR; - -#ifdef CONFIG_GENERIC_MMC -int board_mmc_init(bd_t *bis) -{ -	switch (omap_boot_device()) { -	case BOOT_DEVICE_MMC1: -		omap_mmc_init(0, 0, 0); -		break; -	case BOOT_DEVICE_MMC2: -	case BOOT_DEVICE_MMC2_2: -		omap_mmc_init(1, 0, 0); -		break; -	} -	return 0; -} -#endif - -static void mmc_load_image_raw(struct mmc *mmc) -{ -	u32 image_size_sectors, err; -	const struct image_header *header; - -	header = (struct image_header *)(CONFIG_SYS_TEXT_BASE - -						sizeof(struct image_header)); - -	/* read image header to find the image size & load address */ -	err = mmc->block_dev.block_read(0, -			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, 1, -			(void *)header); - -	if (err <= 0) -		goto end; - -	spl_parse_image_header(header); - -	/* convert size to sectors - round up */ -	image_size_sectors = (spl_image.size + MMCSD_SECTOR_SIZE - 1) / -				MMCSD_SECTOR_SIZE; - -	/* Read the header too to avoid extra memcpy */ -	err = mmc->block_dev.block_read(0, -			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, -			image_size_sectors, (void *)spl_image.load_addr); - -end: -	if (err <= 0) { -		printf("spl: mmc blk read err - %d\n", err); -		hang(); -	} -} - -static void mmc_load_image_fat(struct mmc *mmc) -{ -	s32 err; -	struct image_header *header; - -	header = (struct image_header *)(CONFIG_SYS_TEXT_BASE - -						sizeof(struct image_header)); - -	err = fat_register_device(&mmc->block_dev, -				CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION); -	if (err) { -		printf("spl: fat register err - %d\n", err); -		hang(); -	} - -	err = file_fat_read(CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME, -				(u8 *)header, sizeof(struct image_header)); -	if (err <= 0) -		goto end; - -	spl_parse_image_header(header); - -	err = file_fat_read(CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME, -				(u8 *)spl_image.load_addr, 0); - -end: -	if (err <= 0) { -		printf("spl: error reading image %s, err - %d\n", -			CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME, err); -		hang(); -	} -} - -void spl_mmc_load_image(void) -{ -	struct mmc *mmc; -	int err; -	u32 boot_mode; - -	mmc_initialize(gd->bd); -	/* We register only one device. So, the dev id is always 0 */ -	mmc = find_mmc_device(0); -	if (!mmc) { -		puts("spl: mmc device not found!!\n"); -		hang(); -	} - -	err = mmc_init(mmc); -	if (err) { -		printf("spl: mmc init failed: err - %d\n", err); -		hang(); -	} -	boot_mode = omap_boot_mode(); -	if (boot_mode == MMCSD_MODE_RAW) { -		debug("boot mode - RAW\n"); -		mmc_load_image_raw(mmc); -	} else if (boot_mode == MMCSD_MODE_FAT) { -		debug("boot mode - FAT\n"); -		mmc_load_image_fat(mmc); -	} else { -		puts("spl: wrong MMC boot mode\n"); -		hang(); -	} -} diff --git a/arch/arm/cpu/armv7/omap-common/spl_nand.c b/arch/arm/cpu/armv7/omap-common/spl_nand.c deleted file mode 100644 index 8cf55c9a1..000000000 --- a/arch/arm/cpu/armv7/omap-common/spl_nand.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2011 - * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de> - * - * 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 <common.h> -#include <asm/u-boot.h> -#include <asm/utils.h> -#include <asm/arch/sys_proto.h> -#include <asm/io.h> -#include <nand.h> -#include <version.h> -#include <asm/omap_common.h> - -void spl_nand_load_image(void) -{ -	struct image_header *header; -	int *src __attribute__((unused)); -	int *dst __attribute__((unused)); - -	switch (omap_boot_mode()) { -	case NAND_MODE_HW_ECC: -		debug("spl: nand - using hw ecc\n"); -		gpmc_init(); -		nand_init(); -		break; -	default: -		puts("spl: ERROR: This bootmode is not implemented - hanging"); -		hang(); -	} - -	/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ -	header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); -#ifdef CONFIG_SPL_OS_BOOT -	if (!spl_start_uboot()) { -		/* -		 * load parameter image -		 * load to temp position since nand_spl_load_image reads -		 * a whole block which is typically larger than -		 * CONFIG_CMD_SPL_WRITE_SIZE therefore may overwrite -		 * following sections like BSS -		 */ -		nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS, -			CONFIG_CMD_SPL_WRITE_SIZE, -			(void *)CONFIG_SYS_TEXT_BASE); -		/* copy to destintion */ -		for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR, -				src = (int *)CONFIG_SYS_TEXT_BASE; -				src < (int *)(CONFIG_SYS_TEXT_BASE + -				CONFIG_CMD_SPL_WRITE_SIZE); -				src++, dst++) { -			writel(readl(src), dst); -		} - -		/* load linux */ -		nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, -			CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); -		spl_parse_image_header(header); -		if (header->ih_os == IH_OS_LINUX) { -			/* happy - was a linux */ -			nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, -				spl_image.size, (void *)spl_image.load_addr); -			nand_deselect(); -			return; -		} else { -			printf("The Expected Linux image was not" -				"found. Please check your NAND" -				"configuration.\n"); -			printf("Trying to start u-boot now...\n"); -		} -	} -#endif -#ifdef CONFIG_NAND_ENV_DST -	nand_spl_load_image(CONFIG_ENV_OFFSET, -		CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); -	spl_parse_image_header(header); -	nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size, -		(void *)spl_image.load_addr); -#ifdef CONFIG_ENV_OFFSET_REDUND -	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, -		CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); -	spl_parse_image_header(header); -	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size, -		(void *)spl_image.load_addr); -#endif -#endif -	/* Load u-boot */ -	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, -		CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); -	spl_parse_image_header(header); -	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, -		spl_image.size, (void *)spl_image.load_addr); -	nand_deselect(); -} diff --git a/arch/arm/cpu/armv7/omap-common/spl_ymodem.c b/arch/arm/cpu/armv7/omap-common/spl_ymodem.c deleted file mode 100644 index 47663f7ed..000000000 --- a/arch/arm/cpu/armv7/omap-common/spl_ymodem.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * (C) Copyright 2011 - * Texas Instruments, <www.ti.com> - * - * Matt Porter <mporter@ti.com> - * - * 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 <common.h> -#include <xyzModem.h> -#include <asm/u-boot.h> -#include <asm/utils.h> -#include <asm/arch/sys_proto.h> -#include <asm/omap_common.h> - -#define BUF_SIZE 1024 - -static int getcymodem(void) { -	if (tstc()) -		return (getc()); -	return -1; -} - -void spl_ymodem_load_image(void) -{ -	int size = 0; -	int err; -	int res; -	int ret; -	connection_info_t info; -	char buf[BUF_SIZE]; -	ulong store_addr = ~0; -	ulong addr = 0; - -	info.mode = xyzModem_ymodem; -	ret = xyzModem_stream_open(&info, &err); - -	if (!ret) { -		while ((res = -			xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0) { -			if (addr == 0) -				spl_parse_image_header((struct image_header *)buf); -			store_addr = addr + spl_image.load_addr; -			size += res; -			addr += res; -			memcpy((char *)(store_addr), buf, res); -		} -	} else { -		printf("spl: ymodem err - %s\n", xyzModem_error(err)); -		hang(); -	} - -	xyzModem_stream_close(&err); -	xyzModem_stream_terminate(false, &getcymodem); - -	printf("Loaded %d bytes\n", size); -} diff --git a/arch/arm/cpu/armv7/omap-common/u-boot-spl.lds b/arch/arm/cpu/armv7/omap-common/u-boot-spl.lds index 8867e0604..1d8efb213 100644 --- a/arch/arm/cpu/armv7/omap-common/u-boot-spl.lds +++ b/arch/arm/cpu/armv7/omap-common/u-boot-spl.lds @@ -37,9 +37,9 @@ SECTIONS  {  	.text      :  	{ -	__start = .; -	  arch/arm/cpu/armv7/start.o	(.text) -	  *(.text*) +		__start = .; +		arch/arm/cpu/armv7/start.o	(.text) +		*(.text*)  	} >.sram  	. = ALIGN(4); diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c index f2e52e9ce..9cee1d9b4 100644 --- a/arch/arm/cpu/armv7/omap3/board.c +++ b/arch/arm/cpu/armv7/omap3/board.c @@ -33,6 +33,7 @@   * MA 02111-1307 USA   */  #include <common.h> +#include <spl.h>  #include <asm/io.h>  #include <asm/arch/sys_proto.h>  #include <asm/arch/mem.h> @@ -40,9 +41,12 @@  #include <asm/armv7.h>  #include <asm/arch/gpio.h>  #include <asm/omap_common.h> +#include <asm/arch/mmc_host_def.h>  #include <i2c.h>  #include <linux/compiler.h> +DECLARE_GLOBAL_DATA_PTR; +  /* Declarations */  extern omap3_sysinfo sysinfo;  static void omap3_setup_aux_cr(void); @@ -69,30 +73,44 @@ const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;  u32 omap3_boot_device = BOOT_DEVICE_NAND;  /* auto boot mode detection is not possible for OMAP3 - hard code */ -u32 omap_boot_mode(void) +u32 spl_boot_mode(void)  { -	switch (omap_boot_device()) { +	switch (spl_boot_device()) {  	case BOOT_DEVICE_MMC2:  		return MMCSD_MODE_RAW;  	case BOOT_DEVICE_MMC1:  		return MMCSD_MODE_FAT;  		break; -	case BOOT_DEVICE_NAND: -		return NAND_MODE_HW_ECC; -		break;  	default:  		puts("spl: ERROR:  unknown device - can't select boot mode\n");  		hang();  	}  } -u32 omap_boot_device(void) +u32 spl_boot_device(void)  {  	return omap3_boot_device;  } +int board_mmc_init(bd_t *bis) +{ +	switch (spl_boot_device()) { +	case BOOT_DEVICE_MMC1: +		omap_mmc_init(0, 0, 0); +		break; +	case BOOT_DEVICE_MMC2: +	case BOOT_DEVICE_MMC2_2: +		omap_mmc_init(1, 0, 0); +		break; +	} +	return 0; +} +  void spl_board_init(void)  { +#ifdef CONFIG_SPL_NAND_SUPPORT +	gpmc_init(); +#endif  #ifdef CONFIG_SPL_I2C_SUPPORT  	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);  #endif @@ -236,6 +254,8 @@ void s_init(void)  #endif  #ifdef CONFIG_SPL_BUILD +	gd = &gdata; +  	preloader_console_init();  	timer_init(); diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 32658eb7a..f26308df1 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -164,6 +164,7 @@ call_board_init_f:  /*------------------------------------------------------------------------------*/ +#ifndef CONFIG_SPL_BUILD  /*   * void relocate_code (addr_sp, gd, addr_moni)   * @@ -194,7 +195,6 @@ copy_loop:  	cmp	r0, r2			/* until source end address [r2]    */  	blo	copy_loop -#ifndef CONFIG_SPL_BUILD  	/*  	 * fix .rel.dyn relocations  	 */ @@ -241,20 +241,12 @@ _rel_dyn_end_ofs:  _dynsym_start_ofs:  	.word __dynsym_start - _start -#endif	/* #ifndef CONFIG_SPL_BUILD */ -  clear_bss: -#ifdef CONFIG_SPL_BUILD -	/* No relocation for SPL */ -	ldr	r0, =__bss_start -	ldr	r1, =__bss_end__ -#else  	ldr	r0, _bss_start_ofs  	ldr	r1, _bss_end_ofs  	mov	r4, r6			/* reloc addr */  	add	r0, r0, r4  	add	r1, r1, r4 -#endif  	mov	r2, #0x00000000		/* clear			    */  clbss_l:cmp	r0, r1			/* clear loop... */ @@ -281,12 +273,10 @@ jump_2_ram:   * Move vector table   */  #if !defined(CONFIG_TEGRA20) -#if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD))  	/* Set vector address in CP15 VBAR register */  	ldr     r0, =_start  	add     r0, r0, r9  	mcr     p15, 0, r0, c12, c0, 0  @Set VBAR -#endif  #endif /* !Tegra20 */  	ldr	r0, _board_init_r_ofs @@ -302,6 +292,7 @@ jump_2_ram:  _board_init_r_ofs:  	.word board_init_r - _start  ENDPROC(relocate_code) +#endif  /*************************************************************************   * |