From 95a5724b19c0c1281a7f72ad1812079a53a52dbc Mon Sep 17 00:00:00 2001 From: mattis fjallstrom Date: Wed, 15 Oct 2014 03:40:52 +0200 Subject: Adding memtest and build-time flag for SPL serial boot Change-Id: Iaf14e63498c3cdca4e2125b8217195b90caf842b --- arch/arm/cpu/armv7/omap3/board.c | 11 +++++++++++ arch/arm/include/asm/arch-omap3/spl.h | 1 + common/spl/spl.c | 13 ++++++++++++- config.mk | 3 +++ include/configs/omap3_h1.h | 11 +++++++++-- spl/Makefile | 6 ++++++ 6 files changed, 42 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c index 29228160c..2cd2df519 100644 --- a/arch/arm/cpu/armv7/omap3/board.c +++ b/arch/arm/cpu/armv7/omap3/board.c @@ -56,7 +56,18 @@ const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx; * We would not typically need to save these parameters in regular * U-Boot. This is needed only in SPL at the moment. */ + +/* + * We need two different builds, one for UART and one for NAND. + * In the future, consider changing this to make NAND the default, + * and if it isn't there or isn't working, try UART. + */ + +#ifdef SPL_BOOT_DEVICE_UART +u32 omap3_boot_device = BOOT_DEVICE_UART; +#else u32 omap3_boot_device = BOOT_DEVICE_NAND; +#endif /* auto boot mode detection is not possible for OMAP3 - hard code */ u32 spl_boot_mode(void) diff --git a/arch/arm/include/asm/arch-omap3/spl.h b/arch/arm/include/asm/arch-omap3/spl.h index 2ec319c08..e9c33d981 100644 --- a/arch/arm/include/asm/arch-omap3/spl.h +++ b/arch/arm/include/asm/arch-omap3/spl.h @@ -14,6 +14,7 @@ #define BOOT_DEVICE_MMC2 5 /*emmc*/ #define BOOT_DEVICE_MMC1 6 #define BOOT_DEVICE_XIPWAIT 7 +#define BOOT_DEVICE_UART 8 #define BOOT_DEVICE_MMC2_2 0xFF #define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC2 diff --git a/common/spl/spl.c b/common/spl/spl.c index 2c7ca16dc..c294b1ef4 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -129,6 +129,7 @@ static void spl_ram_load_image(void) } #endif + void board_init_r(gd_t *dummy1, ulong dummy2) { u32 boot_device; @@ -151,7 +152,17 @@ void board_init_r(gd_t *dummy1, ulong dummy2) spl_board_init(); #endif + /* If we want to boot from UART, for OMAP3630, we hardcode boot_device + * to BOOT_DEVICE_UART. Same thing in + * arch/arm/cpu/armv7/omap3/board.c. --mfj + */ + +#ifdef SPL_BOOT_DEVICE_UART + boot_device = BOOT_DEVICE_UART; /* spl_boot_device(); */ +#else boot_device = spl_boot_device(); +#endif /* SPL_BOOT_DEVICE_UART */ + debug("boot device - %d\n", boot_device); switch (boot_device) { #ifdef CONFIG_SPL_RAM_DEVICE @@ -210,7 +221,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) #endif #ifdef CONFIG_SPL_USBETH_SUPPORT case BOOT_DEVICE_USBETH: - debug("Booting from USB ETHER\"); + debug("Booting from USB ETHER\n"); spl_net_load_image("usb_ether"); break; #endif diff --git a/config.mk b/config.mk index b824bb346..d63267ea9 100644 --- a/config.mk +++ b/config.mk @@ -240,6 +240,9 @@ CPPFLAGS += -DCONFIG_SPL_BUILD ifeq ($(CONFIG_TPL_BUILD),y) CPPFLAGS += -DCONFIG_TPL_BUILD endif +ifeq ($(CONFIG_SPL_BOOT_DEVICE),uart) +CPPFLAGS += -DSPL_BOOT_DEVICE_UART +endif endif # Does this architecture support generic board init? diff --git a/include/configs/omap3_h1.h b/include/configs/omap3_h1.h index dfc2783e4..f1d852bfe 100644 --- a/include/configs/omap3_h1.h +++ b/include/configs/omap3_h1.h @@ -218,6 +218,7 @@ /* Boot Argument Buffer Size */ #define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE) +#define CONFIG_CMD_MEMTEST 1 /* needed for memtest */ #define CONFIG_SYS_ALT_MEMTEST 1 #define CONFIG_SYS_MEMTEST_START (0x82000000) /* memtest */ /* defaults */ @@ -284,7 +285,12 @@ #define CONFIG_SPL #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_NAND_SIMPLE -#define CONFIG_SPL_TEXT_BASE 0x40200800 + +/* SPL TEXT BASE needs to be 0x40200000 for booting from bootrom. + * If you're using the debugger other values are possible. + */ + +#define CONFIG_SPL_TEXT_BASE 0x40200000 #define CONFIG_SPL_MAX_SIZE (54 * 1024) /* 8 KB for stack */ #define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK @@ -305,6 +311,7 @@ #define CONFIG_SPL_POWER_SUPPORT #define CONFIG_SPL_OMAP3_ID_NAND #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds" +#define CONFIG_SPL_YMODEM_SUPPORT /* NAND boot config */ #define CONFIG_SYS_NAND_5_ADDR_CYCLE @@ -317,7 +324,7 @@ 10, 11, 12, 13} #define CONFIG_SYS_NAND_ECCSIZE 512 #define CONFIG_SYS_NAND_ECCBYTES 3 -#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_HAM1_CODE_SW +#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_HAM1_CODE_HW #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000 diff --git a/spl/Makefile b/spl/Makefile index 5e5472d97..f94931102 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -22,6 +22,12 @@ export CONFIG_TPL_BUILD SPL_BIN := u-boot-tpl else SPL_BIN := u-boot-spl +# SPL_BIN_UART := u-boot-spl-uart TODO - build NAND and UART at once. +endif + +ifdef BOOT_DEVICE_UART +CONFIG_SPL_BOOT_DEVICE=uart +export CONFIG_SPL_BOOT_DEVICE endif include $(TOPDIR)/config.mk -- cgit v1.2.3-70-g09d2