SPL Linux boot
cover SPL Linux boot
This addds direct Linux boot to SPL. It implements a savebp command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
checkpatch whines about not using strict_strtoull - since this is not available I can't change this.
based on:
- The new SPL layout
- OMAP3 new SPL layout
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105260)
Related to:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Simon Schwarz (7):
arm: Add Prep subcommand support to bootm
Add savebp command
arm: Add savebp implementation for arm
omap-common/spl: Add linux boot to SPL
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common: Add NAND SPL linux booting
omap-common: fixes BSS overwriting problem
arch/arm/cpu/armv7/omap-common/spl.c | 49 +++++++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 63 +++++++++++---- arch/arm/include/asm/omap_common.h | 2 + arch/arm/include/asm/savebp.h | 27 ++++++ arch/arm/lib/Makefile | 1 + arch/arm/lib/bootm.c | 116 +++++++++++++++------------ arch/arm/lib/savebp.c | 92 +++++++++++++++++++++ board/timll/devkit8000/devkit8000.c | 33 ++++++-- common/Makefile | 1 + common/cmd_bootm.c | 2 +- common/cmd_savebp.c | 123 +++++++++++++++++++++++++++++ include/command.h | 5 + include/configs/devkit8000.h | 14 +++- 13 files changed, 446 insertions(+), 82 deletions(-) create mode 100644 arch/arm/include/asm/savebp.h create mode 100644 arch/arm/lib/savebp.c create mode 100644 common/cmd_savebp.c
Signature · 1 line
1.7.4.1
PATCH 1/7 arm: Add Prep subcommand support to bootm
Adds prep subcommand to bootm implementation of ARM. When bootm is called with the subcommand prep the function stops right after ATAGS creation and before announce_and_cleanup.
This is used in savebp command
--- arch/arm/lib/bootm.c | 116 +++++++++++++++++++++++++++---------------------- common/cmd_bootm.c | 2 +- 2 files changed, 65 insertions(+), 53 deletions(-)
arch/arm/lib/bootm.c +64 -52
@@ -1,4 +1,7 @@ -/* +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* - Added prep subcommand support +* * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Marius Groeger <[email protected]>
@@ -55,7 +58,7 @@ static struct tag *params;static ulong get_sp (void );#if defined(CONFIG_OF_LIBFDT ) -static int bootm_linux_fdt (int machid,bootm_headers_t *images); +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag);#endif void arch_lmb_reserve (struct lmb *lmb)
@@ -98,63 +101,67 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)bd_t *bd = gd->bd;char *s;int machid = bd->bi_arch_number; -void (*kernel_entry)(int zero,int arch,uint params); +void (*kernel_entry)(int zero,int arch,uint params) =NULL ;#ifdef CONFIG_CMDLINE_TAG char *commandline =getenv ("bootargs" );#endif - -if ((flag !=0 ) && (flag !=BOOTM_STATE_OS_GO )) -return 1 ; - - s =getenv ("machid" ); -if (s) { - machid =simple_strtoul (s,NULL ,16 ); -printf ("Using machid 0x%x from environment\n" , machid); - } - -show_boot_progress (15 ); +if ((flag !=0 ) && (!(flag &BOOTM_STATE_OS_GO || + flag &BOOTM_STATE_OS_PREP ))) +return 1 ;/* subcommand not implemented */ +else if ((flag ==0 ) || flag &BOOTM_STATE_OS_PREP ) { + s =getenv ("machid" ); +if (s) { +strict_strtoul (s,16 , (long unsigned int *) &machid); +printf ("Using machid 0x%x from environment\n" , machid); + } + +show_boot_progress (15 );#ifdef CONFIG_OF_LIBFDT -if (images->ft_len) -return bootm_linux_fdt (machid, images); +if (images->ft_len) +return bootm_linux_fdt (machid, images, flag);#endif - kernel_entry = (void (*)(int ,int ,uint ))images->ep; + kernel_entry = (void (*)(int ,int ,uint ))images->ep; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry);#if defined (CONFIG_SETUP_MEMORY_TAGS ) || \ defined (CONFIG_CMDLINE_TAG ) || \ defined (CONFIG_INITRD_TAG ) || \ defined (CONFIG_SERIAL_TAG ) || \ defined (CONFIG_REVISION_TAG ) -setup_start_tag (bd); +setup_start_tag (bd);#ifdef CONFIG_SERIAL_TAG -setup_serial_tag (¶ms); +setup_serial_tag (¶ms);#endif #ifdef CONFIG_REVISION_TAG -setup_revision_tag (¶ms); +setup_revision_tag (¶ms);#endif #ifdef CONFIG_SETUP_MEMORY_TAGS -setup_memory_tags (bd); +setup_memory_tags (bd);#endif #ifdef CONFIG_CMDLINE_TAG -setup_commandline_tag (bd, commandline); +setup_commandline_tag (bd, commandline);#endif #ifdef CONFIG_INITRD_TAG -if (images->rd_start && images->rd_end) -setup_initrd_tag (bd, images->rd_start, images->rd_end); +if (images->rd_start && images->rd_end) +setup_initrd_tag (bd, images->rd_start, images->rd_end);#endif -setup_end_tag (bd); +setup_end_tag (bd);#endif +if (flag &BOOTM_STATE_OS_PREP ) +return 0 ; + } -announce_and_cleanup (); - -kernel_entry (0 , machid, bd->bi_boot_params); -/* does not return */ +if (flag ==0 || flag &BOOTM_STATE_OS_GO ) { +announce_and_cleanup (); +kernel_entry (0 , machid, bd->bi_boot_params); +/* does not return */ + }return 1 ; }
@@ -174,10 +181,10 @@ static int fixup_memory_node(void *blob)return fdt_fixup_memory_banks (blob, start, size,CONFIG_NR_DRAM_BANKS ); } -static int bootm_linux_fdt (int machid,bootm_headers_t *images) +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag) {ulong rd_len; -void (*kernel_entry)(int zero,int dt_machid,void *dtblob); +void (*kernel_entry)(int zero,int dt_machid,void *dtblob) =NULL ;ulong of_size = images->ft_len;char **of_flat_tree = &images->ft_addr;ulong *initrd_start = &images->initrd_start;
@@ -185,34 +192,39 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images)struct lmb *lmb = &images->lmb;int ret; - kernel_entry = (void (*)(int ,int ,void *))images->ep; - -boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); +if ((flag ==0 ) || flag &BOOTM_STATE_OS_PREP ) { + kernel_entry = (void (*)(int ,int ,void *))images->ep; - rd_len = images->rd_end - images->rd_start; - ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, - initrd_start, initrd_end); -if (ret) -return ret; +boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); - ret =boot_relocate_fdt (lmb, of_flat_tree, &of_size); -if (ret) -return ret; + rd_len = images->rd_end - images->rd_start; + ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, + initrd_start, initrd_end); +if (ret) +return ret; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); + ret =boot_relocate_fdt (lmb, of_flat_tree, &of_size); +if (ret) +return ret; -fdt_chosen (*of_flat_tree,1 ); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry); -fixup_memory_node (*of_flat_tree); +fdt_chosen (*of_flat_tree,1 ); -fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); +fixup_memory_node (*of_flat_tree); -announce_and_cleanup (); +fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); -kernel_entry (0 , machid, *of_flat_tree); -/* does not return */ +if (flag &BOOTM_STATE_OS_PREP ) +return 0 ; + } +if (flag ==0 || flag &BOOTM_STATE_OS_GO ) { +announce_and_cleanup (); +kernel_entry (0 , machid, *of_flat_tree); +/* does not return */ + } return 1; }#endif
common/cmd_bootm.c +1 -1
@@ -156,7 +156,7 @@ static boot_os_fn *boot_os[] = {#endif }; -static bootm_headers_t images;/* pointers to os/initrd/fdt images */ +bootm_headers_t images;/* pointers to os/initrd/fdt images */ /* Allow for arch specific config before we boot */ void __arch_preboot_os (void )
Signature · 1 line
1.7.4.1
PATCH 2/7 Add savebp command
In reply to Simon SchwarzThis adds a savebp command to the u-boot.
Related config:CONFIG_CMD_SAVEBP
activate/deactivate the commandCONFIG_CMD_SAVEBP_NAND_OFS
Offset in NAND to useCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-begin + 0x100
--- common/Makefile | 1 + common/cmd_savebp.c | 123 ++++++++++++++++++++++++++++++++++++++++++ include/configs/devkit8000.h | 6 ++ 3 files changed, 130 insertions(+), 0 deletions(-) create mode 100644 common/cmd_savebp.c
common/Makefile +1 -0
@@ -158,6 +158,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SAVEBP) += cmd_savebp.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
common/cmd_savebp.c new file +123 -0
123 lines not on this page · raw message
include/configs/devkit8000.h +6 -0
@@ -353,4 +353,10 @@#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x200000 +/* SPL OS boot options */ +#define CONFIG_CMD_SAVEBP +#define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH 3/7 arm: Add savebp implementation for arm
In reply to Simon SchwarzThis adds the savebp implementation to the arm platform.
Related CONFIGs:CONFIG_CMD_SAVEBP_WRITE_SIZE defines the size of the image to write
--- arch/arm/include/asm/savebp.h | 27 ++++++++++++ arch/arm/lib/Makefile | 1 + arch/arm/lib/savebp.c | 92 +++++++++++++++++++++++++++++++++++++++++ include/command.h | 5 ++ include/configs/devkit8000.h | 1 + 5 files changed, 126 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/savebp.h create mode 100644 arch/arm/lib/savebp.c
arch/arm/include/asm/savebp.h new file +27 -0
@@ -0,0 +1,27 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ +#ifndef _SAVEBP_H_ +#define _SAVEBP_H_ + +extern bootm_headers_t images; + +#endif /* _SAVEBP_H_ */
arch/arm/lib/Makefile +1 -0
@@ -44,6 +44,7 @@ COBJS-y += cache-cp15.o COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o COBJS-y += interrupts.o COBJS-y += reset.o +COBJS-$(CONFIG_CMD_SAVEBP) += savebp.o SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o endif
arch/arm/lib/savebp.c new file +92 -0
92 lines not on this page · raw message
include/command.h +5 -0
@@ -101,6 +101,11 @@ extern int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);extern int do_bootm (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]);extern int do_reset (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]); +#ifdef CONFIG_CMD_SAVEBP +int do_savebp_atags (loff_t offset); +int do_savebp_fdt (loff_t offset); +#endif +#endif /* __ASSEMBLY__ */ /*
include/configs/devkit8000.h +1 -0
@@ -355,6 +355,7 @@/* SPL OS boot options */ #define CONFIG_CMD_SAVEBP +#define CONFIG_CMD_SAVEBP_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000)#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000
Signature · 1 line
1.7.4.1
PATCH 4/7 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzThis adds Linux booting to the SPL
Related CONFIGs:CONFIG_SPL_OS_BOOT
Activates/Deactivates the OS booting featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_SPL_MACHID
Machine ID of the used boardCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
--- arch/arm/cpu/armv7/omap-common/spl.c | 48 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 7 +++- 2 files changed, 51 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +46 -2
@@ -35,6 +35,7 @@#include <asm/arch/mmc_host_def.h> #include <i2c.h> #include <image.h> +#include <asm/omap_gpio.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -63,6 +64,25 @@ void board_init_f(ulong dummy)relocate_code (CONFIG_SPL_STACK , &gdata,CONFIG_SPL_TEXT_BASE ); } +#ifdef CONFIG_SPL_OS_BOOT +/* Return the value of the U-boot key +* +* RETURN +* 0 if not pressed +* positiv if pressed +*/ +int spl_uboot_key (void ) +{ +int val =0 ; +if (!omap_request_gpio (CONFIG_SPL_OS_BOOT_KEY )) { +omap_set_gpio_direction (CONFIG_SPL_OS_BOOT_KEY ,1 ); + val =omap_get_gpio_datain (CONFIG_SPL_OS_BOOT_KEY ); +omap_free_gpio (CONFIG_SPL_OS_BOOT_KEY ); + } +return !val; +} +#endif /* CONFIG_SPL_OS_BOOT */ +void spl_parse_image_header (const struct image_header *header) {u32 header_size =sizeof (struct image_header );
@@ -90,7 +110,25 @@ void spl_parse_image_header(const struct image_header *header) } } -static void jump_to_image_no_args (void ) +#ifdef CONFIG_SPL_OS_BOOT +/* This function jumps to an image with argument. Normally an FDT or ATAGS +* image. +* arg: Pointer to paramter image in RAM +*/ +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_SYS_SPL_MACHID , 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 +137,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;
@@ -134,6 +172,12 @@ 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" ); +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 ();
include/configs/devkit8000.h +5 -2
@@ -38,7 +38,7 @@#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_SYS_TEXT_BASE 0x80100000#define CONFIG_SDRC /* The chip has SDRC controller */
@@ -328,7 +328,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 */
@@ -358,6 +358,9 @@#define CONFIG_CMD_SAVEBP_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000) +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 26 +#define CONFIG_SYS_SPL_MACHID MACH_TYPE_DEVKIT8000#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH 5/7 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzLinux crashes if the GPMC isn't configured for the dm9000.
--- arch/arm/cpu/armv7/omap-common/spl.c | 1 + arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 33 ++++++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 9 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +1 -0
@@ -175,6 +175,7 @@ void board_init_r(gd_t *id, ulong dummy)#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
arch/arm/include/asm/omap_common.h +2 -0
@@ -77,6 +77,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +24 -9
@@ -62,6 +62,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -80,14 +92,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -119,7 +124,7 @@ void set_muxconf_regs(void)MUX_DEVKIT8000 (); } -#if defined(CONFIG_DRIVER_DM9000 ) & !defined(CONFIG_SPL_BUILD ) +#ifdef CONFIG_DRIVER_DM9000 /* * Routine: board_eth_init * Description: Setting up the Ethernet hardware.
@@ -129,3 +134,13 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* do board specific preperation before SPL +* Linux boot */ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH 6/7 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzThis implements booting of Linux from NAND in SPL
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 48 +++++++++++++++++++--------- 1 files changed, 32 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +32 -16
@@ -46,26 +46,42 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* load parameter image */ +nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS , +CONFIG_CMD_SAVEBP_WRITE_SIZE , + (void *)CONFIG_SYS_SPL_ARGS_ADDR ); +/* load linux */ +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , +CONFIG_SYS_NAND_PAGE_SIZE , (void *)header); +spl_parse_image_header (header); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH 7/7 omap-common: fixes BSS overwriting problem
In reply to Simon Schwarzspl_nand overwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +18 -3
@@ -24,6 +24,7 @@#include <asm/u-boot.h> #include <asm/utils.h> #include <asm/arch/sys_proto.h> +#include <asm/io.h> #include <nand.h> #include <timestamp_autogenerated.h> #include <version_autogenerated.h>
@@ -33,6 +34,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -49,16 +51,29 @@ void spl_nand_load_image(void)#ifdef CONFIG_SPL_OS_BOOT if (!spl_uboot_key ()) {/* load parameter image */ -nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS , +/* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_WRITE_SIZE therefore may overwrite +* following sections like BSS */ +nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS ,CONFIG_CMD_SAVEBP_WRITE_SIZE , - (void *)CONFIG_SYS_SPL_ARGS_ADDR ); + (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_SAVEBP_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);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header)); } else#endif {
Signature · 1 line
1.7.4.1
v2 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a savebp command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
checkpatch whines about not using strict_strtoull - since this is not available - I can't change this.
V2 changes:
FIX FDT creation
ADD Readme
based on:
- The new SPL layout
- OMAP3 new SPL layout
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105260)
Related to:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Simon Schwarz (8):
arm: Add Prep subcommand support to bootm
Add savebp command
arm: Add savebp implementation for arm
omap-common/spl: Add linux boot to SPL
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common: Add NAND SPL linux booting
omap-common: fixes BSS overwriting problem
savebp: added Readme
arch/arm/cpu/armv7/omap-common/spl.c | 49 +++++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 63 +++++++++--- arch/arm/include/asm/omap_common.h | 2 + arch/arm/include/asm/savebp.h | 27 +++++ arch/arm/lib/Makefile | 1 + arch/arm/lib/bootm.c | 116 ++++++++++++---------- arch/arm/lib/savebp.c | 91 ++++++++++++++++++ board/timll/devkit8000/devkit8000.c | 33 +++++-- common/Makefile | 1 + common/cmd_bootm.c | 2 +- common/cmd_savebp.c | 149 +++++++++++++++++++++++++++++ doc/README.commands.savebp | 28 ++++++ include/command.h | 5 + include/configs/devkit8000.h | 14 +++- 14 files changed, 499 insertions(+), 82 deletions(-) create mode 100644 arch/arm/include/asm/savebp.h create mode 100644 arch/arm/lib/savebp.c create mode 100644 common/cmd_savebp.c create mode 100644 doc/README.commands.savebp
Signature · 1 line
1.7.4.1
PATCH v2 1/8 arm: Add Prep subcommand support to bootm
Adds prep subcommand to bootm implementation of ARM. When bootm is called with the subcommand prep the function stops right after ATAGS creation and before announce_and_cleanup.
This is used in savebp command
----
V2 changes:
nothing
--- arch/arm/lib/bootm.c | 116 +++++++++++++++++++++++++++---------------------- common/cmd_bootm.c | 2 +- 2 files changed, 65 insertions(+), 53 deletions(-)
arch/arm/lib/bootm.c +64 -52
@@ -1,4 +1,7 @@ -/* +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* - Added prep subcommand support +* * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Marius Groeger <[email protected]>
@@ -55,7 +58,7 @@ static struct tag *params;static ulong get_sp (void );#if defined(CONFIG_OF_LIBFDT ) -static int bootm_linux_fdt (int machid,bootm_headers_t *images); +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag);#endif void arch_lmb_reserve (struct lmb *lmb)
@@ -98,63 +101,67 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)bd_t *bd = gd->bd;char *s;int machid = bd->bi_arch_number; -void (*kernel_entry)(int zero,int arch,uint params); +void (*kernel_entry)(int zero,int arch,uint params) =NULL ;#ifdef CONFIG_CMDLINE_TAG char *commandline =getenv ("bootargs" );#endif - -if ((flag !=0 ) && (flag !=BOOTM_STATE_OS_GO )) -return 1 ; - - s =getenv ("machid" ); -if (s) { - machid =simple_strtoul (s,NULL ,16 ); -printf ("Using machid 0x%x from environment\n" , machid); - } - -show_boot_progress (15 ); +if ((flag !=0 ) && (!(flag &BOOTM_STATE_OS_GO || + flag &BOOTM_STATE_OS_PREP ))) +return 1 ;/* subcommand not implemented */ +else if ((flag ==0 ) || flag &BOOTM_STATE_OS_PREP ) { + s =getenv ("machid" ); +if (s) { +strict_strtoul (s,16 , (long unsigned int *) &machid); +printf ("Using machid 0x%x from environment\n" , machid); + } + +show_boot_progress (15 );#ifdef CONFIG_OF_LIBFDT -if (images->ft_len) -return bootm_linux_fdt (machid, images); +if (images->ft_len) +return bootm_linux_fdt (machid, images, flag);#endif - kernel_entry = (void (*)(int ,int ,uint ))images->ep; + kernel_entry = (void (*)(int ,int ,uint ))images->ep; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry);#if defined (CONFIG_SETUP_MEMORY_TAGS ) || \ defined (CONFIG_CMDLINE_TAG ) || \ defined (CONFIG_INITRD_TAG ) || \ defined (CONFIG_SERIAL_TAG ) || \ defined (CONFIG_REVISION_TAG ) -setup_start_tag (bd); +setup_start_tag (bd);#ifdef CONFIG_SERIAL_TAG -setup_serial_tag (¶ms); +setup_serial_tag (¶ms);#endif #ifdef CONFIG_REVISION_TAG -setup_revision_tag (¶ms); +setup_revision_tag (¶ms);#endif #ifdef CONFIG_SETUP_MEMORY_TAGS -setup_memory_tags (bd); +setup_memory_tags (bd);#endif #ifdef CONFIG_CMDLINE_TAG -setup_commandline_tag (bd, commandline); +setup_commandline_tag (bd, commandline);#endif #ifdef CONFIG_INITRD_TAG -if (images->rd_start && images->rd_end) -setup_initrd_tag (bd, images->rd_start, images->rd_end); +if (images->rd_start && images->rd_end) +setup_initrd_tag (bd, images->rd_start, images->rd_end);#endif -setup_end_tag (bd); +setup_end_tag (bd);#endif +if (flag &BOOTM_STATE_OS_PREP ) +return 0 ; + } -announce_and_cleanup (); - -kernel_entry (0 , machid, bd->bi_boot_params); -/* does not return */ +if (flag ==0 || flag &BOOTM_STATE_OS_GO ) { +announce_and_cleanup (); +kernel_entry (0 , machid, bd->bi_boot_params); +/* does not return */ + }return 1 ; }
@@ -174,10 +181,10 @@ static int fixup_memory_node(void *blob)return fdt_fixup_memory_banks (blob, start, size,CONFIG_NR_DRAM_BANKS ); } -static int bootm_linux_fdt (int machid,bootm_headers_t *images) +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag) {ulong rd_len; -void (*kernel_entry)(int zero,int dt_machid,void *dtblob); +void (*kernel_entry)(int zero,int dt_machid,void *dtblob) =NULL ;ulong of_size = images->ft_len;char **of_flat_tree = &images->ft_addr;ulong *initrd_start = &images->initrd_start;
@@ -185,34 +192,39 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images)struct lmb *lmb = &images->lmb;int ret; - kernel_entry = (void (*)(int ,int ,void *))images->ep; - -boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); +if ((flag ==0 ) || flag &BOOTM_STATE_OS_PREP ) { + kernel_entry = (void (*)(int ,int ,void *))images->ep; - rd_len = images->rd_end - images->rd_start; - ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, - initrd_start, initrd_end); -if (ret) -return ret; +boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); - ret =boot_relocate_fdt (lmb, of_flat_tree, &of_size); -if (ret) -return ret; + rd_len = images->rd_end - images->rd_start; + ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, + initrd_start, initrd_end); +if (ret) +return ret; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); + ret =boot_relocate_fdt (lmb, of_flat_tree, &of_size); +if (ret) +return ret; -fdt_chosen (*of_flat_tree,1 ); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry); -fixup_memory_node (*of_flat_tree); +fdt_chosen (*of_flat_tree,1 ); -fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); +fixup_memory_node (*of_flat_tree); -announce_and_cleanup (); +fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); -kernel_entry (0 , machid, *of_flat_tree); -/* does not return */ +if (flag &BOOTM_STATE_OS_PREP ) +return 0 ; + } +if (flag ==0 || flag &BOOTM_STATE_OS_GO ) { +announce_and_cleanup (); +kernel_entry (0 , machid, *of_flat_tree); +/* does not return */ + } return 1; }#endif
common/cmd_bootm.c +1 -1
@@ -156,7 +156,7 @@ static boot_os_fn *boot_os[] = {#endif }; -static bootm_headers_t images;/* pointers to os/initrd/fdt images */ +bootm_headers_t images;/* pointers to os/initrd/fdt images */ /* Allow for arch specific config before we boot */ void __arch_preboot_os (void )
Signature · 1 line
1.7.4.1
PATCH v2 2/8 Add savebp command
In reply to Simon SchwarzThis adds a savebp command to the u-boot.
Related config:CONFIG_CMD_SAVEBP
activate/deactivate the commandCONFIG_CMD_SAVEBP_NAND_OFS
Offset in NAND to useCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
--- common/Makefile | 1 + common/cmd_savebp.c | 149 ++++++++++++++++++++++++++++++++++++++++++ include/configs/devkit8000.h | 6 ++ 3 files changed, 156 insertions(+), 0 deletions(-) create mode 100644 common/cmd_savebp.c
common/Makefile +1 -0
@@ -158,6 +158,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SAVEBP) += cmd_savebp.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
common/cmd_savebp.c new file +149 -0
149 lines not on this page · raw message
include/configs/devkit8000.h +6 -0
@@ -353,4 +353,10 @@#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x200000 +/* SPL OS boot options */ +#define CONFIG_CMD_SAVEBP +#define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v2 3/8 arm: Add savebp implementation for arm
In reply to Simon SchwarzThis adds the savebp implementation to the arm platform.
Related CONFIGs:CONFIG_CMD_SAVEBP_WRITE_SIZE defines the size of the image to write
---
V2 changes:
DEL _cosmetic_ old comment
--- arch/arm/include/asm/savebp.h | 27 ++++++++++++ arch/arm/lib/Makefile | 1 + arch/arm/lib/savebp.c | 91 +++++++++++++++++++++++++++++++++++++++++ include/command.h | 5 ++ include/configs/devkit8000.h | 1 + 5 files changed, 125 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/savebp.h create mode 100644 arch/arm/lib/savebp.c
arch/arm/include/asm/savebp.h new file +27 -0
@@ -0,0 +1,27 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ +#ifndef _SAVEBP_H_ +#define _SAVEBP_H_ + +extern bootm_headers_t images; + +#endif /* _SAVEBP_H_ */
arch/arm/lib/Makefile +1 -0
@@ -44,6 +44,7 @@ COBJS-y += cache-cp15.o COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o COBJS-y += interrupts.o COBJS-y += reset.o +COBJS-$(CONFIG_CMD_SAVEBP) += savebp.o SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o endif
arch/arm/lib/savebp.c new file +91 -0
91 lines not on this page · raw message
include/command.h +5 -0
@@ -101,6 +101,11 @@ extern int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);extern int do_bootm (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]);extern int do_reset (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]); +#ifdef CONFIG_CMD_SAVEBP +int do_savebp_atags (loff_t offset); +int do_savebp_fdt (loff_t offset); +#endif +#endif /* __ASSEMBLY__ */ /*
include/configs/devkit8000.h +1 -0
@@ -355,6 +355,7 @@/* SPL OS boot options */ #define CONFIG_CMD_SAVEBP +#define CONFIG_CMD_SAVEBP_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000)#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000
Signature · 1 line
1.7.4.1
PATCH v2 4/8 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzThis adds Linux booting to the SPL
Related CONFIGs:CONFIG_SPL_OS_BOOT
Activates/Deactivates the OS booting featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_SPL_MACHID
Machine ID of the used boardCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
V2 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl.c | 48 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 7 +++- 2 files changed, 51 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +46 -2
@@ -35,6 +35,7 @@#include <asm/arch/mmc_host_def.h> #include <i2c.h> #include <image.h> +#include <asm/omap_gpio.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -63,6 +64,25 @@ void board_init_f(ulong dummy)relocate_code (CONFIG_SPL_STACK , &gdata,CONFIG_SPL_TEXT_BASE ); } +#ifdef CONFIG_SPL_OS_BOOT +/* Return the value of the U-boot key +* +* RETURN +* 0 if not pressed +* positiv if pressed +*/ +int spl_uboot_key (void ) +{ +int val =0 ; +if (!omap_request_gpio (CONFIG_SPL_OS_BOOT_KEY )) { +omap_set_gpio_direction (CONFIG_SPL_OS_BOOT_KEY ,1 ); + val =omap_get_gpio_datain (CONFIG_SPL_OS_BOOT_KEY ); +omap_free_gpio (CONFIG_SPL_OS_BOOT_KEY ); + } +return !val; +} +#endif /* CONFIG_SPL_OS_BOOT */ +void spl_parse_image_header (const struct image_header *header) {u32 header_size =sizeof (struct image_header );
@@ -90,7 +110,25 @@ void spl_parse_image_header(const struct image_header *header) } } -static void jump_to_image_no_args (void ) +#ifdef CONFIG_SPL_OS_BOOT +/* This function jumps to an image with argument. Normally an FDT or ATAGS +* image. +* arg: Pointer to paramter image in RAM +*/ +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_SYS_SPL_MACHID , 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 +137,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;
@@ -134,6 +172,12 @@ 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" ); +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 ();
include/configs/devkit8000.h +5 -2
@@ -38,7 +38,7 @@#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_SYS_TEXT_BASE 0x80100000#define CONFIG_SDRC /* The chip has SDRC controller */
@@ -328,7 +328,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 */
@@ -358,6 +358,9 @@#define CONFIG_CMD_SAVEBP_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000) +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 26 +#define CONFIG_SYS_SPL_MACHID MACH_TYPE_DEVKIT8000#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v2 5/8 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzLinux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl.c | 1 + arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 33 ++++++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 9 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +1 -0
@@ -175,6 +175,7 @@ void board_init_r(gd_t *id, ulong dummy)#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
arch/arm/include/asm/omap_common.h +2 -0
@@ -77,6 +77,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +24 -9
@@ -62,6 +62,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -80,14 +92,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -119,7 +124,7 @@ void set_muxconf_regs(void)MUX_DEVKIT8000 (); } -#if defined(CONFIG_DRIVER_DM9000 ) & !defined(CONFIG_SPL_BUILD ) +#ifdef CONFIG_DRIVER_DM9000 /* * Routine: board_eth_init * Description: Setting up the Ethernet hardware.
@@ -129,3 +134,13 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* do board specific preperation before SPL +* Linux boot */ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH v2 6/8 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzThis implements booting of Linux from NAND in SPL
---
V2 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 48 +++++++++++++++++++--------- 1 files changed, 32 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +32 -16
@@ -46,26 +46,42 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* load parameter image */ +nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS , +CONFIG_CMD_SAVEBP_WRITE_SIZE , + (void *)CONFIG_SYS_SPL_ARGS_ADDR ); +/* load linux */ +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , +CONFIG_SYS_NAND_PAGE_SIZE , (void *)header); +spl_parse_image_header (header); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v2 7/8 omap-common: fixes BSS overwriting problem
In reply to Simon Schwarzspl_nand overwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!
---
V2 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +18 -3
@@ -24,6 +24,7 @@#include <asm/u-boot.h> #include <asm/utils.h> #include <asm/arch/sys_proto.h> +#include <asm/io.h> #include <nand.h> #include <timestamp_autogenerated.h> #include <version_autogenerated.h>
@@ -33,6 +34,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -49,16 +51,29 @@ void spl_nand_load_image(void)#ifdef CONFIG_SPL_OS_BOOT if (!spl_uboot_key ()) {/* load parameter image */ -nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS , +/* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_WRITE_SIZE therefore may overwrite +* following sections like BSS */ +nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS ,CONFIG_CMD_SAVEBP_WRITE_SIZE , - (void *)CONFIG_SYS_SPL_ARGS_ADDR ); + (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_SAVEBP_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);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header)); } else#endif {
Signature · 1 line
1.7.4.1
PATCH v2 8/8 savebp: added Readme
In reply to Simon SchwarzAdds a Readme for the savebp command
---
V2 changes:
ADDED in V2
--- doc/README.commands.savebp | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) create mode 100644 doc/README.commands.savebp
doc/README.commands.savebp new file +28 -0
@@ -0,0 +1,28 @@ +The savebp (=save boot parameters) is used to save a boot parameter image to +non-volatile memory. + +To execute the command everything has to be in place as if bootm should be +used. +(kernel image, initrd-image, fdt-image etc.) + +Call is: +savebp [ftd|atags] [nand_offset] [kernel_addr] [initrd_addr] [fdt_addr] + +Only the first parameter [ftd|atags] is mandatory if the others are left blank +standard values are used. + +e.g: +savebp fdt 0x680000 0x82000000 0x80000100 - +savebo atags + +typical call on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND */ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +savebp fdt 0x680000 0x82000000 0x80000100 - /* Save the image */ + +------------Behind the scene--------------- +Atm the implementation is that we have /common/cmd_savebp.c which implements +the command tself and the subcommand calls to bootm. +Then the arch specific implementation of do_save_atags or do_savebp_fdt +in /arch/arm/lib is called.
Signature · 1 line
1.7.4.1
v3 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a savebp command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
checkpatch whines about not using strict_strtoull - since this is not available - I can't change this.
V2 changes:
FIX FDT creation
ADD Readme
V3 changes:
FIX missing brackets
based on:
- The new SPL layout
- OMAP3 new SPL layout
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105260)
Related to:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Simon Schwarz (8):
arm: Add Prep subcommand support to bootm
Add savebp command
arm: Add savebp implementation for arm
omap-common/spl: Add linux boot to SPL
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common: Add NAND SPL linux booting
omap-common: fixes BSS overwriting problem
savebp: added Readme
arch/arm/cpu/armv7/omap-common/spl.c | 49 +++++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 63 +++++++++--- arch/arm/include/asm/omap_common.h | 2 + arch/arm/include/asm/savebp.h | 27 +++++ arch/arm/lib/Makefile | 1 + arch/arm/lib/bootm.c | 116 ++++++++++++---------- arch/arm/lib/savebp.c | 91 ++++++++++++++++++ board/timll/devkit8000/devkit8000.c | 33 +++++-- common/Makefile | 1 + common/cmd_bootm.c | 2 +- common/cmd_savebp.c | 149 +++++++++++++++++++++++++++++ doc/README.commands.savebp | 28 ++++++ include/command.h | 5 + include/configs/devkit8000.h | 14 +++- 14 files changed, 499 insertions(+), 82 deletions(-) create mode 100644 arch/arm/include/asm/savebp.h create mode 100644 arch/arm/lib/savebp.c create mode 100644 common/cmd_savebp.c create mode 100644 doc/README.commands.savebp
Signature · 1 line
1.7.4.1
PATCH v3 1/8 arm: Add Prep subcommand support to bootm
Adds prep subcommand to bootm implementation of ARM. When bootm is called with the subcommand prep the function stops right after ATAGS creation and before announce_and_cleanup.
This is used in savebp command
----
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/lib/bootm.c | 116 +++++++++++++++++++++++++++---------------------- common/cmd_bootm.c | 2 +- 2 files changed, 65 insertions(+), 53 deletions(-)
arch/arm/lib/bootm.c +64 -52
@@ -1,4 +1,7 @@ -/* +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* - Added prep subcommand support +* * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Marius Groeger <[email protected]>
@@ -55,7 +58,7 @@ static struct tag *params;static ulong get_sp (void );#if defined(CONFIG_OF_LIBFDT ) -static int bootm_linux_fdt (int machid,bootm_headers_t *images); +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag);#endif void arch_lmb_reserve (struct lmb *lmb)
@@ -98,63 +101,67 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)bd_t *bd = gd->bd;char *s;int machid = bd->bi_arch_number; -void (*kernel_entry)(int zero,int arch,uint params); +void (*kernel_entry)(int zero,int arch,uint params) =NULL ;#ifdef CONFIG_CMDLINE_TAG char *commandline =getenv ("bootargs" );#endif - -if ((flag !=0 ) && (flag !=BOOTM_STATE_OS_GO )) -return 1 ; - - s =getenv ("machid" ); -if (s) { - machid =simple_strtoul (s,NULL ,16 ); -printf ("Using machid 0x%x from environment\n" , machid); - } - -show_boot_progress (15 ); +if ((flag !=0 ) && (!(flag &BOOTM_STATE_OS_GO || + flag &BOOTM_STATE_OS_PREP ))) +return 1 ;/* subcommand not implemented */ +else if ((flag ==0 ) || flag &BOOTM_STATE_OS_PREP ) { + s =getenv ("machid" ); +if (s) { +strict_strtoul (s,16 , (long unsigned int *) &machid); +printf ("Using machid 0x%x from environment\n" , machid); + } + +show_boot_progress (15 );#ifdef CONFIG_OF_LIBFDT -if (images->ft_len) -return bootm_linux_fdt (machid, images); +if (images->ft_len) +return bootm_linux_fdt (machid, images, flag);#endif - kernel_entry = (void (*)(int ,int ,uint ))images->ep; + kernel_entry = (void (*)(int ,int ,uint ))images->ep; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry);#if defined (CONFIG_SETUP_MEMORY_TAGS ) || \ defined (CONFIG_CMDLINE_TAG ) || \ defined (CONFIG_INITRD_TAG ) || \ defined (CONFIG_SERIAL_TAG ) || \ defined (CONFIG_REVISION_TAG ) -setup_start_tag (bd); +setup_start_tag (bd);#ifdef CONFIG_SERIAL_TAG -setup_serial_tag (¶ms); +setup_serial_tag (¶ms);#endif #ifdef CONFIG_REVISION_TAG -setup_revision_tag (¶ms); +setup_revision_tag (¶ms);#endif #ifdef CONFIG_SETUP_MEMORY_TAGS -setup_memory_tags (bd); +setup_memory_tags (bd);#endif #ifdef CONFIG_CMDLINE_TAG -setup_commandline_tag (bd, commandline); +setup_commandline_tag (bd, commandline);#endif #ifdef CONFIG_INITRD_TAG -if (images->rd_start && images->rd_end) -setup_initrd_tag (bd, images->rd_start, images->rd_end); +if (images->rd_start && images->rd_end) +setup_initrd_tag (bd, images->rd_start, images->rd_end);#endif -setup_end_tag (bd); +setup_end_tag (bd);#endif +if (flag &BOOTM_STATE_OS_PREP ) +return 0 ; + } -announce_and_cleanup (); - -kernel_entry (0 , machid, bd->bi_boot_params); -/* does not return */ +if (flag ==0 || flag &BOOTM_STATE_OS_GO ) { +announce_and_cleanup (); +kernel_entry (0 , machid, bd->bi_boot_params); +/* does not return */ + }return 1 ; }
@@ -174,10 +181,10 @@ static int fixup_memory_node(void *blob)return fdt_fixup_memory_banks (blob, start, size,CONFIG_NR_DRAM_BANKS ); } -static int bootm_linux_fdt (int machid,bootm_headers_t *images) +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag) {ulong rd_len; -void (*kernel_entry)(int zero,int dt_machid,void *dtblob); +void (*kernel_entry)(int zero,int dt_machid,void *dtblob) =NULL ;ulong of_size = images->ft_len;char **of_flat_tree = &images->ft_addr;ulong *initrd_start = &images->initrd_start;
@@ -185,34 +192,39 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images)struct lmb *lmb = &images->lmb;int ret; - kernel_entry = (void (*)(int ,int ,void *))images->ep; - -boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); +if ((flag ==0 ) || flag &BOOTM_STATE_OS_PREP ) { + kernel_entry = (void (*)(int ,int ,void *))images->ep; - rd_len = images->rd_end - images->rd_start; - ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, - initrd_start, initrd_end); -if (ret) -return ret; +boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); - ret =boot_relocate_fdt (lmb, of_flat_tree, &of_size); -if (ret) -return ret; + rd_len = images->rd_end - images->rd_start; + ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, + initrd_start, initrd_end); +if (ret) +return ret; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); + ret =boot_relocate_fdt (lmb, of_flat_tree, &of_size); +if (ret) +return ret; -fdt_chosen (*of_flat_tree,1 ); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry); -fixup_memory_node (*of_flat_tree); +fdt_chosen (*of_flat_tree,1 ); -fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); +fixup_memory_node (*of_flat_tree); -announce_and_cleanup (); +fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); -kernel_entry (0 , machid, *of_flat_tree); -/* does not return */ +if (flag &BOOTM_STATE_OS_PREP ) +return 0 ; + } +if (flag ==0 || flag &BOOTM_STATE_OS_GO ) { +announce_and_cleanup (); +kernel_entry (0 , machid, *of_flat_tree); +/* does not return */ + } return 1; }#endif
common/cmd_bootm.c +1 -1
@@ -156,7 +156,7 @@ static boot_os_fn *boot_os[] = {#endif }; -static bootm_headers_t images;/* pointers to os/initrd/fdt images */ +bootm_headers_t images;/* pointers to os/initrd/fdt images */ /* Allow for arch specific config before we boot */ void __arch_preboot_os (void )
Signature · 1 line
1.7.4.1
PATCH v3 1/8 arm: Add Prep subcommand support to bootm
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 42 lines
Adds prep subcommand to bootm implementation of ARM. When bootm is called with the subcommand prep the function stops right after ATAGS creation and before
announce_and_cleanup.This is used in savebp command
Signed-off-by Simon Schwarz <[email protected]>----
V2 changes:
nothingV3 changes:
nothing--- arch/arm/lib/bootm.c | 116 +++++++++++++++++++++++++++---------------------- common/cmd_bootm.c | 2 +- 2 files changed, 65 insertions(+), 53 deletions(-)arch/arm/lib/bootm.c +5
-2@@ -1,4 +1,7 @@ -/* +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* - Added prep subcommand support +* * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Marius Groeger <[email protected]> @@ -55,7 +58,7 @@ static struct tag *params;static ulong get_sp (void );#if defined(CONFIG_OF_LIBFDT ) -static int bootm_linux_fdt (int machid,bootm_headers_t *images); +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag);#endif void arch_lmb_reserve (struct lmb *lmb)
arch/arm/lib/bootm.c int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) · line 104
Quoted 5 lines
arch/arm/lib/bootm.c +1
-1@@ -98,63 +101,67 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)bd_t *bd = gd->bd;char *s;int machid = bd->bi_arch_number; -void (*kernel_entry)(int zero,int arch,uint params); +void (*kernel_entry)(int zero,int arch,uint params) =NULL ;
This should not be necessary, kernel_entry would be on bss which should be initialized to zero by start.S.
Quoted 7 lines
arch/arm/lib/bootm.c +0
-3#ifdef CONFIG_CMDLINE_TAG char *commandline =getenv ("bootargs" );#endif - -if ((flag !=0 ) && (flag !=BOOTM_STATE_OS_GO )) -return 1 ;
arch/arm/lib/bootm.c int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) · line 110
Quoted 10 lines
arch/arm/lib/bootm.c +2
-8- - s =getenv ("machid" ); -if (s) { - machid =simple_strtoul (s,NULL ,16 ); -printf ("Using machid 0x%x from environment\n" , machid); - } - -show_boot_progress (15 ); +if ((flag !=0 ) && (!(flag &BOOTM_STATE_OS_GO || + flag &BOOTM_STATE_OS_PREP )))
switch'n'case would be much cleaner here. And seperating the functionality into functions would be nice too.
Quoted 56 lines
arch/arm/lib/bootm.c +22
-13+return 1 ;/* subcommand not implemented */ + else if ((flag == 0) || flag & BOOTM_STATE_OS_PREP) { + s =getenv ("machid" ); + if (s) { +strict_strtoul (s,16 , (long unsigned int *) &machid); +printf ("Using machid 0x%x from environment\n" , machid); + } + +show_boot_progress (15 );#ifdef CONFIG_OF_LIBFDT -if (images->ft_len) -return bootm_linux_fdt (machid, images); +if (images->ft_len) +return bootm_linux_fdt (machid, images, flag);#endif - kernel_entry = (void (*)(int ,int ,uint ))images->ep; + kernel_entry = (void (*)(int ,int ,uint ))images->ep; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry);#if defined (CONFIG_SETUP_MEMORY_TAGS ) || \ defined (CONFIG_CMDLINE_TAG ) || \ defined (CONFIG_INITRD_TAG ) || \ defined (CONFIG_SERIAL_TAG ) || \ defined (CONFIG_REVISION_TAG ) -setup_start_tag (bd); +setup_start_tag (bd);#ifdef CONFIG_SERIAL_TAG -setup_serial_tag (¶ms); +setup_serial_tag (¶ms);#endif #ifdef CONFIG_REVISION_TAG -setup_revision_tag (¶ms); +setup_revision_tag (¶ms);#endif #ifdef CONFIG_SETUP_MEMORY_TAGS -setup_memory_tags (bd); +setup_memory_tags (bd);#endif #ifdef CONFIG_CMDLINE_TAG -setup_commandline_tag (bd, commandline); +setup_commandline_tag (bd, commandline);#endif #ifdef CONFIG_INITRD_TAG -if (images->rd_start && images->rd_end) -setup_initrd_tag (bd, images->rd_start, images->rd_end); +if (images->rd_start && images->rd_end) +setup_initrd_tag (bd, images->rd_start, images->rd_end);#endif -setup_end_tag (bd); +setup_end_tag (bd);
arch/arm/lib/bootm.c int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) · line 159
Quoted 10 lines
arch/arm/lib/bootm.c +4
-4#endif +if (flag &BOOTM_STATE_OS_PREP ) +return 0 ; + } -announce_and_cleanup (); - -kernel_entry (0 , machid, bd->bi_boot_params); -/* does not return */ +if (flag ==0 || flag &BOOTM_STATE_OS_GO ) {
flag == 0? Shouldn't that be flag == BOOTM_STATE_OS_GO?
Quoted 9 lines
arch/arm/lib/bootm.c +4
-0+announce_and_cleanup (); +kernel_entry (0 , machid, bd->bi_boot_params); +/* does not return */ + }return 1 ; }
arch/arm/lib/bootm.c static int fixup_memory_node(void *blob) · line 187
Quoted 9 lines
arch/arm/lib/bootm.c +2
-2@@ -174,10 +181,10 @@ static int fixup_memory_node(void *blob)return fdt_fixup_memory_banks (blob, start, size,CONFIG_NR_DRAM_BANKS ); } -static int bootm_linux_fdt (int machid,bootm_headers_t *images) +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag) {ulong rd_len; -void (*kernel_entry)(int zero,int dt_machid,void *dtblob); +void (*kernel_entry)(int zero,int dt_machid,void *dtblob) =NULL ;
same as above.
arch/arm/lib/bootm.c static int bootm_linux_fdt(int machid, bootm_headers_t *images) · line 197
Quoted 13 lines
arch/arm/lib/bootm.c +2
-3ulong of_size = images->ft_len;char **of_flat_tree = &images->ft_addr;ulong *initrd_start = &images->initrd_start;@@ -185,34 +192,39 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images)struct lmb *lmb = &images->lmb;int ret; - kernel_entry = (void (*)(int ,int ,void *))images->ep; - -boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); +if ((flag ==0 ) || flag &BOOTM_STATE_OS_PREP ) { + kernel_entry = (void (*)(int ,int ,void *))images->ep;
same as above, a cleaner aproach is to gather information for fdt in a dedicated function and in another do the hand-over to linux kernel.
Quoted 54 lines
arch/arm/lib/bootm.c +22
-16- rd_len = images->rd_end - images->rd_start; - ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, - initrd_start, initrd_end); -if (ret) -return ret; +boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); - ret =boot_relocate_fdt (lmb, of_flat_tree, &of_size); -if (ret) -return ret; + rd_len = images->rd_end - images->rd_start; + ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, + initrd_start, initrd_end); +if (ret) +return ret; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); + ret =boot_relocate_fdt (lmb, of_flat_tree, &of_size); +if (ret) +return ret; -fdt_chosen (*of_flat_tree,1 ); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry); -fixup_memory_node (*of_flat_tree); +fdt_chosen (*of_flat_tree,1 ); -fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); +fixup_memory_node (*of_flat_tree); -announce_and_cleanup (); +fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); -kernel_entry (0 , machid, *of_flat_tree); -/* does not return */ +if (flag &BOOTM_STATE_OS_PREP ) + return 0; + } +if (flag ==0 || flag &BOOTM_STATE_OS_GO ) { +announce_and_cleanup (); +kernel_entry (0 , machid, *of_flat_tree); +/* does not return */ + }return 1 ; }#endif common/cmd_bootm.c +0
-0
common/cmd_bootm.c static boot_os_fn *boot_os[] = { · line 159
Quoted 5 lines
common/cmd_bootm.c +1
-1@@ -156,7 +156,7 @@ static boot_os_fn *boot_os[] = {#endif }; -static bootm_headers_t images;/* pointers to os/initrd/fdt images */ +bootm_headers_t images;/* pointers to os/initrd/fdt images */
is this necessary?
common/cmd_bootm.c static boot_os_fn *boot_os[] = { · line 162
Quoted 3 lines
common/cmd_bootm.c +0
-0/* Allow for arch specific config before we boot */ void __arch_preboot_os (void )
regards
Andreas Bie?mann
PATCH v3 1/8 arm: Add Prep subcommand support to bootm
Dear Andreas,
Quoted 43 lines · Andreas Bie?mann
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 40 lines
Adds prep subcommand to bootm implementation of ARM. When bootm is called with the subcommand prep the function stops right after ATAGS creation and before
announce_and_cleanup.This is used in savebp command
Signed-off-by Simon Schwarz<[email protected]>----
V2 changes:
nothingV3 changes:
nothing--- arch/arm/lib/bootm.c | 116 +++++++++++++++++++++++++++---------------------- common/cmd_bootm.c | 2 +- 2 files changed, 65 insertions(+), 53 deletions(-)arch/arm/lib/bootm.c +5
-2@@ -1,4 +1,7 @@ -/* +/* Copyright (C) 2011 +* Corscience GmbH& Co. KG - Simon Schwarz<[email protected]> +* - Added prep subcommand support +* * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH<www.elinos.com> * Marius Groeger<[email protected]> @@ -55,7 +58,7 @@ static struct tag *params;static ulong get_sp (void );#if defined(CONFIG_OF_LIBFDT ) -static int bootm_linux_fdt (int machid,bootm_headers_t *images); +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag);#endif
Quoted 10 lines
arch/arm/lib/bootm.c int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) · line 104
Quoted 7 lines
arch/arm/lib/bootm.c +1
-1void arch_lmb_reserve (struct lmb *lmb)@@ -98,63 +101,67 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)bd_t *bd = gd->bd;char *s;int machid = bd->bi_arch_number; -void (*kernel_entry)(int zero,int arch,uint params); +void (*kernel_entry)(int zero,int arch,uint params) =NULL ;This should not be necessary,
kernel_entrywould be on bss which should be initialized to zero bystart.S.
I added this because of compiler warnings that it could be used uninitialized.
Quoted 12 lines
Quoted 12 lines
arch/arm/lib/bootm.c +0
-8#ifdef CONFIG_CMDLINE_TAG char *commandline =getenv ("bootargs" );#endif - -if ((flag !=0 )&& (flag !=BOOTM_STATE_OS_GO )) -return 1 ; - - s =getenv ("machid" ); -if (s) { - machid =simple_strtoul (s,NULL ,16 ); -printf ("Using machid 0x%x from environment\n" , machid);
Quoted 8 lines
arch/arm/lib/bootm.c int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
Quoted 5 lines
arch/arm/lib/bootm.c +2
-3- } - -show_boot_progress (15 ); +if ((flag !=0 )&& (!(flag&BOOTM_STATE_OS_GO || + flag&BOOTM_STATE_OS_PREP )))switch'n'case would be much cleaner here. And seperating the functionality into functions would be nice too.
Hehe. Somehow I did know that this topic will come up. I intended to change the code as little as possible.
So essentially this would mean to rewrite this to reflect the structure of the ppc version. Will do if there are no objections.
If there are no objections I also would like to separate this patch from this series. This has some advantages:
- Support for the prep subcommand is essential for saving the boot parameters. (if prep is in saving can also be done manually)
- I think that there won't be much discussion about the usefulness of implementing this - just some about the how.
Quoted 62 lines
Quoted 62 lines
arch/arm/lib/bootm.c +25
-13+return 1 ;/* subcommand not implemented */ + else if ((flag == 0) || flag& BOOTM_STATE_OS_PREP) { + s =getenv ("machid" ); + if (s) { +strict_strtoul (s,16 , (long unsigned int *)&machid); +printf ("Using machid 0x%x from environment\n" , machid); + } + +show_boot_progress (15 );#ifdef CONFIG_OF_LIBFDT -if (images->ft_len) -return bootm_linux_fdt (machid, images); +if (images->ft_len) +return bootm_linux_fdt (machid, images, flag);#endif - kernel_entry = (void (*)(int ,int ,uint ))images->ep; + kernel_entry = (void (*)(int ,int ,uint ))images->ep; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry);#if defined (CONFIG_SETUP_MEMORY_TAGS ) || \ defined (CONFIG_CMDLINE_TAG ) || \ defined (CONFIG_INITRD_TAG ) || \ defined (CONFIG_SERIAL_TAG ) || \ defined (CONFIG_REVISION_TAG ) -setup_start_tag (bd); +setup_start_tag (bd);#ifdef CONFIG_SERIAL_TAG -setup_serial_tag (¶ms); +setup_serial_tag (¶ms);#endif #ifdef CONFIG_REVISION_TAG -setup_revision_tag (¶ms); +setup_revision_tag (¶ms);#endif #ifdef CONFIG_SETUP_MEMORY_TAGS -setup_memory_tags (bd); +setup_memory_tags (bd);#endif #ifdef CONFIG_CMDLINE_TAG -setup_commandline_tag (bd, commandline); +setup_commandline_tag (bd, commandline);#endif #ifdef CONFIG_INITRD_TAG -if (images->rd_start&& images->rd_end) -setup_initrd_tag (bd, images->rd_start, images->rd_end); +if (images->rd_start&& images->rd_end) +setup_initrd_tag (bd, images->rd_start, images->rd_end);#endif -setup_end_tag (bd); +setup_end_tag (bd);#endif +if (flag&BOOTM_STATE_OS_PREP ) +return 0 ; + }
Quoted 7 lines
arch/arm/lib/bootm.c int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
Quoted 5 lines
arch/arm/lib/bootm.c +1
-4-announce_and_cleanup (); - -kernel_entry (0 , machid, bd->bi_boot_params); -/* does not return */ +if (flag ==0 || flag&BOOTM_STATE_OS_GO ) {flag == 0? Shouldn't that be flag ==
BOOTM_STATE_OS_GO?
flag = 0 means that no subcommand was issued -> execute everything.
Quoted 13 lines
Quoted 13 lines
arch/arm/lib/bootm.c +4
-0+announce_and_cleanup (); +kernel_entry (0 , machid, bd->bi_boot_params); +/* does not return */ + }return 1 ; }@@ -174,10 +181,10 @@ static int fixup_memory_node(void *blob)return fdt_fixup_memory_banks (blob, start, size,CONFIG_NR_DRAM_BANKS ); }
Quoted 8 lines
arch/arm/lib/bootm.c static int fixup_memory_node(void *blob) · line 187
Quoted 6 lines
arch/arm/lib/bootm.c +2
-2-static int bootm_linux_fdt (int machid,bootm_headers_t *images) +static int bootm_linux_fdt (int machid,bootm_headers_t *images,int flag) {ulong rd_len; -void (*kernel_entry)(int zero,int dt_machid,void *dtblob); +void (*kernel_entry)(int zero,int dt_machid,void *dtblob) =NULL ;same as above.
see above
Quoted 8 lines
Quoted 8 lines
arch/arm/lib/bootm.c +0
-0ulong of_size = images->ft_len;char **of_flat_tree =&images->ft_addr;ulong *initrd_start =&images->initrd_start;@@ -185,34 +192,39 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images)struct lmb *lmb =&images->lmb;int ret;
Quoted 10 lines
arch/arm/lib/bootm.c static int bootm_linux_fdt(int machid, bootm_headers_t *images) · line 197
Quoted 6 lines
arch/arm/lib/bootm.c +2
-3- kernel_entry = (void (*)(int ,int ,void *))images->ep; - -boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); +if ((flag ==0 ) || flag&BOOTM_STATE_OS_PREP ) { + kernel_entry = (void (*)(int ,int ,void *))images->ep;same as above, a cleaner aproach is to gather information for fdt in a dedicated function and in another do the hand-over to linux kernel.
If no objections - will be done in the rewrite.
Quoted 57 lines
Quoted 57 lines
arch/arm/lib/bootm.c +22
-16- rd_len = images->rd_end - images->rd_start; - ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, - initrd_start, initrd_end); -if (ret) -return ret; +boot_fdt_add_mem_rsv_regions (lmb, *of_flat_tree); - ret =boot_relocate_fdt (lmb, of_flat_tree,&of_size); -if (ret) -return ret; + rd_len = images->rd_end - images->rd_start; + ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, + initrd_start, initrd_end); +if (ret) +return ret; -debug ("## Transferring control to Linux (at address %08lx) ...\n" , - (ulong ) kernel_entry); + ret =boot_relocate_fdt (lmb, of_flat_tree,&of_size); +if (ret) +return ret; -fdt_chosen (*of_flat_tree,1 ); +debug ("## Transferring control to Linux (at address %08lx)" \ +"...\n" , (ulong ) kernel_entry); -fixup_memory_node (*of_flat_tree); +fdt_chosen (*of_flat_tree,1 ); -fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); +fixup_memory_node (*of_flat_tree); -announce_and_cleanup (); +fdt_initrd (*of_flat_tree, *initrd_start, *initrd_end,1 ); -kernel_entry (0 , machid, *of_flat_tree); -/* does not return */ +if (flag&BOOTM_STATE_OS_PREP ) + return 0; + } +if (flag ==0 || flag&BOOTM_STATE_OS_GO ) { +announce_and_cleanup (); +kernel_entry (0 , machid, *of_flat_tree); +/* does not return */ + }return 1 ; }#endif common/cmd_bootm.c +0
-0@@ -156,7 +156,7 @@ static boot_os_fn *boot_os[] = {#endif };
Quoted 4 lines
common/cmd_bootm.c static boot_os_fn *boot_os[] = { · line 159
Quoted 2 lines
common/cmd_bootm.c +1
-1-static bootm_headers_t images;/* pointers to os/initrd/fdt images */ +bootm_headers_t images;/* pointers to os/initrd/fdt images */ is this necessary?
This is done to be able to get the fdt address in arch-dependent savebp cmd. Suggestions for a cleaner solution are welcome ;)
Quoted 8 lines
common/cmd_bootm.c static boot_os_fn *boot_os[] = { · line 162
Quoted 4 lines
common/cmd_bootm.c +0
-0/* Allow for arch specific config before we boot */ void __arch_preboot_os (void )regards
Andreas Bie?mann
Regards, thx for reviewing
Simon
PATCH v3 1/8 arm: Add Prep subcommand support to bootm
Dear Simon,
Am 26.08.2011 11:57, schrieb Simon Schwarz:
Quoted 4 lines
Dear Andreas,
Quoted 1 line · Andreas Bie?mann
Dear Simon,
<snip>
Quoted 12 lines
Quoted 11 lines
arch/arm/lib/bootm.c int do_bootm_linux(int flag, int argc, char · line 105
Quoted 8 lines
void
arch_lmb_reserve(struct lmb *lmb)arch/arm/lib/bootm.c +1
-1@@ -98,63 +101,67 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)bd_t *bd = gd->bd;char *s;int machid = bd->bi_arch_number; -void (*kernel_entry)(int zero,int arch,uint params); +void (*kernel_entry)(int zero,int arch,uint params) =NULL ;This should not be necessary,
kernel_entrywould be on bss which should be initialized to zero bystart.S.
Quoted 2 lines
I added this because of compiler warnings that it could be used uninitialized.
I see, you changed the flow of this function elementary. Sorry, did not realize that.
Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
arch/arm/lib/bootm.c +0
-8#ifdef CONFIG_CMDLINE_TAG char *commandline =getenv ("bootargs" );#endif - -if ((flag !=0 )&& (flag !=BOOTM_STATE_OS_GO )) -return 1 ; - - s =getenv ("machid" ); -if (s) { - machid =simple_strtoul (s,NULL ,16 ); -printf ("Using machid 0x%x from environment\n" , machid);Quoted 8 lines
arch/arm/lib/bootm.c int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
Quoted 5 lines
arch/arm/lib/bootm.c +2
-3- } - -show_boot_progress (15 ); +if ((flag !=0 )&& (!(flag&BOOTM_STATE_OS_GO || + flag&BOOTM_STATE_OS_PREP )))switch'n'case would be much cleaner here. And seperating the functionality into functions would be nice too.
Quoted 2 lines
Hehe. Somehow I did know that this topic will come up. I intended to change the code as little as possible.
Well, switch'n'case is not correct here, sorry for misleading comment.
Quoted 2 lines
So essentially this would mean to rewrite this to reflect the structure of the ppc version. Will do if there are no objections.
+1 for rewrite, Albert how do you think about?
Quoted 6 lines
If there are no objections I also would like to separate this patch from this series. This has some advantages:
- Support for the prep subcommand is essential for saving the boot parameters. (if prep is in saving can also be done manually)
- I think that there won't be much discussion about the usefulness of implementing this - just some about the how.
I think it would be good idea to add the 'bootm prep' command to arm implementation of bootm in a separate step.
<snip>
Quoted 5 lines
Quoted 3 lines
Review int do_bootm_linux(int flag, int argc, char · line 111
Quoted 1 line
(quoted diff) +1
-0+ if (flag == 0 || flag& BOOTM_STATE_OS_GO) {flag == 0? Shouldn't that be flag ==
BOOTM_STATE_OS_GO?flag = 0 means that no subcommand was issued -> execute everything.
again, sorry for the noise.
<snip>
best regards
Andreas Bie?mann
PATCH v3 2/8 Add savebp command
In reply to Simon SchwarzThis adds a savebp command to the u-boot.
Related config:CONFIG_CMD_SAVEBP
activate/deactivate the commandCONFIG_CMD_SAVEBP_NAND_OFS
Offset in NAND to useCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
--- common/Makefile | 1 + common/cmd_savebp.c | 149 ++++++++++++++++++++++++++++++++++++++++++ include/configs/devkit8000.h | 6 ++ 3 files changed, 156 insertions(+), 0 deletions(-) create mode 100644 common/cmd_savebp.c
common/Makefile +1 -0
@@ -158,6 +158,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SAVEBP) += cmd_savebp.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
common/cmd_savebp.c new file +149 -0
149 lines not on this page · raw message
include/configs/devkit8000.h +6 -0
@@ -353,4 +353,10 @@#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x200000 +/* SPL OS boot options */ +#define CONFIG_CMD_SAVEBP +#define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v3 2/8 Add savebp command
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 9 lines
This adds a savebp command to the u-boot.
Related config:
CONFIG_CMD_SAVEBP
activate/deactivate the commandCONFIG_CMD_SAVEBP_NAND_OFS
Offset in NAND to useCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPL
This is not used in the code ... why defining it then (here)?
Quoted 3 lines
CONFIG_SYS_SPL_ARGS_ADDRAddress where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
Well this is gd->bd->bi_boot_params (at least on ARM), so why don't you use that parameter here?
Quoted 10 lines
Signed-off-by Simon Schwarz <[email protected]>---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
Quoted 6 lines
V3 changes:
FIX added missing brackets--- common/Makefile | 1 + common/cmd_savebp.c | 149 ++++++++++++++++++++++++++++++++++++++++++ include/configs/devkit8000.h | 6 ++
where is the documentation?
Quoted 38 lines
3 files changed, 156 insertions(+), 0 deletions(-) create mode 100644 common/cmd_savebp.ccommon/Makefile +1
-0@@ -158,6 +158,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SAVEBP) += cmd_savebp.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.ocommon/cmd_savebp.c new file +17
-0@@ -0,0 +1,149 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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
common/cmd_savebp.c line 27
Quoted 10 lines
common/cmd_savebp.c new file +10
-0+* 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 <command.h> + +#define TYPE_FDT 0 +#define TYPE_ATAGS 1
should'nt this go into some header? How about enum here?
common/cmd_savebp.c line 35
Quoted 8 lines
common/cmd_savebp.c new file +8
-0+ +static inline int str2off (const char *p,loff_t *num) +{ +char *endptr; + + *num =simple_strtoull (p, &endptr,16 ); +return *p !='\0' && *endptr =='\0' ; +}
could be merged with the one in cmd_nand.c. Maybe move the one from cmd_nand.c to some header?
Quoted 5 lines
common/cmd_savebp.c new file +5
-0+ +int do_savebp (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +loff_t offset; +int img_type =TYPE_ATAGS ;
common/cmd_savebp.c line 50
Quoted 10 lines
common/cmd_savebp.c new file +10
-0+int ret =0 ; +int bootm_argc =5 ; +char *bootm_argsv[] = {"do_bootm" ,"xxxxxxx" ,"0x82000000" ,"-" , +"0x80000100" }; + + offset = (loff_t )CONFIG_CMD_SAVEBP_NAND_OFS ; + bootm_argsv[2 ] =getenv ("loadaddr" ); +/* - Validate args - */ +switch (argc) { +case 6 :/* 4. fdt addr */
^ wrong number?
common/cmd_savebp.c line 52
Quoted 2 lines
common/cmd_savebp.c new file +2
-0+if (strcmp (argv[5 ],"-" )) +strcpy (bootm_argsv[4 ], argv[5 ]);
If one set '-' as fifth argument bootm_argsv will stay with your given "0x80000100" ... shouldn't the default argument be pre-calculated at compile time. I guess the 0x80000100 is CONFIG_SYS_SDRAM_BASE + 0x100 in your case (or tell it CONFIG_SYS_SPL_ARGS_ADDR).
BTW: it is unsafe to use strcpy() here cause you may have some greater string in 'src' than in 'dst' you should use strncpy() with strlen(dst) as 'count' or even strdup() here.
In my opinion it would be best to use something like this here:
---8<---
char *bootm_argsv[5];
bootm_argsv[0] = "bootm";
...
bootm_argsv[4] = strdup(argv[5]);
...
--->8---
Or even
bootm_argsv[4] = argv[5];
But that have to be investigated, I don't know currently if it will work.
common/cmd_savebp.c line 53
Quoted 1 line
common/cmd_savebp.c new file +1
-0+case 5 :/* 5. initrd addr */
^ wrong number?
Quoted 76 lines
common/cmd_savebp.c new file +76
-0+if (strcmp (argv[4 ],"-" )) +strcpy (bootm_argsv[3 ], argv[4 ]); +case 4 :/* 3. arg kernel addr */ +if (strcmp (argv[3 ],"-" )) +strcpy (bootm_argsv[2 ], argv[3 ]); +case 3 :/* 2. arg offset */ +if (strcmp (argv[2 ],"-" )) { +if (!str2off (argv[2 ], &offset)) { +printf ("'%s' is not a number\n" , argv[2 ]); +return cmd_usage (cmdtp); + } + } +case 2 :/* 1. arg atags or fdt */ +if (!strcmp (argv[1 ],"fdt" )) { + img_type =TYPE_FDT ; + bootm_argc =5 ; + }else if (!strcmp (argv[1 ],"atags" )) { + img_type =TYPE_ATAGS ; + bootm_argc =4 ; + }else { +return cmd_usage (cmdtp); + } +/* using standard offset */ +printf ("using standard destination at: 0x%x\n" , + (uint32_t )offset); +break ; +default : +return cmd_usage (cmdtp); + } +debug ("using as bootm arsgs: %s / %s / %s / %s / %s\n" + , bootm_argsv[0 ], bootm_argsv[1 ], bootm_argsv[2 ], + bootm_argsv[3 ], bootm_argsv[4 ]); + +/* - do the work - */ +/* exec bootm_start as subcommand of do_bootm to init the images +* data structure */ +debug ("exec bootm subcommand start\n" ); + bootm_argsv[1 ] ="start" ; + ret =do_bootm (find_cmd ("do_bootm" ),0 , bootm_argc, bootm_argsv); +debug ("Subcommand start bootm retcode: %d\n" , ret); + +debug ("exec bootm subcommand loados\n" ); + bootm_argsv[1 ] ="loados" ; + ret =do_bootm (find_cmd ("do_bootm" ),0 , bootm_argc, bootm_argsv); +debug ("Subcommand loados bootm retcode: %d\n" , ret); + +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH +debug ("exec bootm subcommand ramdisk\n" ); + bootm_argsv[1 ] ="ramdisk" ; + ret =do_bootm (find_cmd ("do_bootm" ),0 , bootm_argc, bootm_argsv); +debug ("Subcommand ramdisk bootm retcode: %d\n" , ret); +#endif + +#ifdef CONFIG_OF_LIBFDT +if (img_type ==TYPE_FDT ) { +debug ("exec bootm subcommand fdt\n" ); + bootm_argsv[1 ] ="fdt" ; + ret =do_bootm (find_cmd ("do_bootm" ),0 , bootm_argc, + bootm_argsv); +debug ("Subcommand fdt bootm retcode: %d\n" , ret); + } +#endif + +debug ("exec bootm subcommand cmdline\n" ); + bootm_argsv[1 ] ="cmdline" ; + ret =do_bootm (find_cmd ("do_bootm" ),0 , bootm_argc, bootm_argsv); +debug ("Subcommand cmdline bootm retcode: %d\n" , ret); + +debug ("exec bootm bdt cmdline\n" ); + bootm_argsv[1 ] ="bdt" ; + ret =do_bootm (find_cmd ("do_bootm" ),0 , bootm_argc, bootm_argsv); +debug ("Subcommand bdt bootm retcode: %d\n" , ret); + +debug ("exec bootm subcommand prep\n" ); + bootm_argsv[1 ] ="prep" ; + ret =do_bootm (find_cmd ("do_bootm" ),0 , bootm_argc, bootm_argsv);
common/cmd_savebp.c line 139
Quoted 10 lines
common/cmd_savebp.c new file +10
-0+debug ("Subcommand prep bootm retcode: %d\n" , ret); +if (ret) { +printf ("ERROR prep subcommand failed!\n" ); +return -1 ; + } +/* call arch specific handlers */ +if (img_type ==TYPE_FDT ) +do_savebp_fdt (offset); +else +do_savebp_atags (offset);
where are these two do_savebp_x() functions?
Quoted 15 lines
common/cmd_savebp.c new file +10
-0+ +return 0 ; +} + +U_BOOT_CMD ( + savebp,6 ,1 , do_savebp,"save boot params to NAND flash" , +"[ftd|atags] [nand_offset] [kernel_addr] [initrd_addr] [fdt_addr] \ +saves the parameter image to NAND. All but the first paramter \ +can be omitted to use standard values. If nothing or a '-' is \ +used standardvalues are used where necessary" );include/configs/devkit8000.h +0
-0
include/configs/devkit8000.h line 362
Quoted 10 lines
include/configs/devkit8000.h +6
-0@@ -353,4 +353,10 @@#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x200000 +/* SPL OS boot options */ +#define CONFIG_CMD_SAVEBP +#define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
regards
Andreas Bie?mann
PATCH v3 2/8 Add savebp command
Dear Andreas,
Quoted 13 lines · Andreas Bie?mann
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 9 lines
This adds a savebp command to the u-boot.
Related config:
CONFIG_CMD_SAVEBP
activate/deactivate the commandCONFIG_CMD_SAVEBP_NAND_OFS
Offset in NAND to useCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPL
Quoted 1 line
This is not used in the code ... why defining it then (here)?
Will move the description to the proper patch.
Quoted 7 lines
Quoted 4 lines
CONFIG_SYS_SPL_ARGS_ADDRAddress where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)Well this is
gd->bd->bi_boot_params(at least on ARM), so why don't you use that parameter here?
Because this is used in SPL where the bd struct is not fully initialized.
Quoted 11 lines
Quoted 11 lines
Signed-off-by Simon Schwarz<[email protected]>---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
Quoted 8 lines
Quoted 6 lines
V3 changes:
FIX added missing brackets--- common/Makefile | 1 + common/cmd_savebp.c | 149 ++++++++++++++++++++++++++++++++++++++++++ include/configs/devkit8000.h | 6 ++where is the documentation?
Last patch - will squash it.
Quoted 43 lines
Quoted 43 lines
3 files changed, 156 insertions(+), 0 deletions(-)create mode 100644
common/cmd_savebp.ccommon/Makefile +1
-0@@ -158,6 +158,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SAVEBP) += cmd_savebp.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.ocommon/cmd_savebp.c new file +21
-0@@ -0,0 +1,149 @@ +/* Copyright (C) 2011 +* Corscience GmbH& Co. KG - Simon Schwarz<[email protected]> +* +* 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 +*/
Quoted 9 lines
common/cmd_savebp.c line 27
Quoted 6 lines
common/cmd_savebp.c new file +6
-0+ +#include <common.h> +#include <command.h> + +#define TYPE_FDT 0 +#define TYPE_ATAGS 1should'nt this go into some header? How about enum here?
Will change.
Quoted 11 lines
common/cmd_savebp.c line 35
Quoted 8 lines
common/cmd_savebp.c new file +8
-0+ +static inline int str2off (const char *p,loff_t *num) +{ +char *endptr; + + *num =simple_strtoull (p,&endptr,16 ); +return *p !='\0' && *endptr =='\0' ; +}could be merged with the one in
cmd_nand.c. Maybe move the one fromcmd_nand.cto some header?
Hm, what would be the best place for that? It's at least useful for mmc and nand. common.h? mtd_common.h?
Quoted 17 lines
Quoted 6 lines
common/cmd_savebp.c new file +5
-0+ +int do_savebp (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +loff_t offset; +int img_type =TYPE_ATAGS ;common/cmd_savebp.c line 50
Quoted 10 lines
common/cmd_savebp.c new file +10
-0+int ret =0 ; +int bootm_argc =5 ; +char *bootm_argsv[] = {"do_bootm" ,"xxxxxxx" ,"0x82000000" ,"-" , +"0x80000100" }; + + offset = (loff_t )CONFIG_CMD_SAVEBP_NAND_OFS ; + bootm_argsv[2 ] =getenv ("loadaddr" ); +/* - Validate args - */ +switch (argc) { +case 6 :/* 4. fdt addr */ ^ wrong number?
Changed.
Quoted 8 lines
common/cmd_savebp.c line 52
Quoted 3 lines
common/cmd_savebp.c new file +2
-0+if (strcmp (argv[5 ],"-" )) +strcpy (bootm_argsv[4 ], argv[5 ]);If one set '-' as fifth argument
bootm_argsvwill stay with your given "0x80000100" ... shouldn't the default argument be pre-calculated at compile time. I guess the0x80000100isCONFIG_SYS_SDRAM_BASE+0x100in your case (or tell itCONFIG_SYS_SPL_ARGS_ADDR).
Will change.
Quoted 4 lines
BTW: it is unsafe to use
strcpy()here cause you may have some greater string in 'src' than in 'dst' you should usestrncpy()with strlen(dst) as 'count' or evenstrdup()here.
will do.
Quoted 12 lines
In my opinion it would be best to use something like this here:
---8<---
char *bootm_argsv[5];bootm_argsv[0] = "bootm";
...
bootm_argsv[4] =strdup(argv[5]);
...
--->8---
Quoted 6 lines
Or even
bootm_argsv[4] = argv[5];
But that have to be investigated, I don't know currently if it will work.
Will think about...
Quoted 2 lines
common/cmd_savebp.c line 53
Quoted 1 line
common/cmd_savebp.c new file +1
-0+case 5 :/* 5. initrd addr */ ^ wrong number?
changed.
Quoted 1 line
<snip>
Quoted 8 lines
common/cmd_savebp.c line 139
Quoted 6 lines
common/cmd_savebp.c new file +6
-0+ } +/* call arch specific handlers */ +if (img_type ==TYPE_FDT ) +do_savebp_fdt (offset); +else +do_savebp_atags (offset);where are these two
do_savebp_x()functions?
later patch will change sequence.
Regards, thanks for the feedback!
Simon
PATCH v3 3/8 arm: Add savebp implementation for arm
In reply to Simon SchwarzThis adds the savebp implementation to the arm platform.
Related CONFIGs:CONFIG_CMD_SAVEBP_WRITE_SIZE defines the size of the image to write
---
V2 changes:
DEL _cosmetic_ old comment
V3 changes:
nothing
--- arch/arm/include/asm/savebp.h | 27 ++++++++++++ arch/arm/lib/Makefile | 1 + arch/arm/lib/savebp.c | 91 +++++++++++++++++++++++++++++++++++++++++ include/command.h | 5 ++ include/configs/devkit8000.h | 1 + 5 files changed, 125 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/savebp.h create mode 100644 arch/arm/lib/savebp.c
arch/arm/include/asm/savebp.h new file +27 -0
@@ -0,0 +1,27 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ +#ifndef _SAVEBP_H_ +#define _SAVEBP_H_ + +extern bootm_headers_t images; + +#endif /* _SAVEBP_H_ */
arch/arm/lib/Makefile +1 -0
@@ -44,6 +44,7 @@ COBJS-y += cache-cp15.o COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o COBJS-y += interrupts.o COBJS-y += reset.o +COBJS-$(CONFIG_CMD_SAVEBP) += savebp.o SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o endif
arch/arm/lib/savebp.c new file +91 -0
91 lines not on this page · raw message
include/command.h +5 -0
@@ -101,6 +101,11 @@ extern int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);extern int do_bootm (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]);extern int do_reset (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]); +#ifdef CONFIG_CMD_SAVEBP +int do_savebp_atags (loff_t offset); +int do_savebp_fdt (loff_t offset); +#endif +#endif /* __ASSEMBLY__ */ /*
include/configs/devkit8000.h +1 -0
@@ -355,6 +355,7 @@/* SPL OS boot options */ #define CONFIG_CMD_SAVEBP +#define CONFIG_CMD_SAVEBP_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000)#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000
Signature · 1 line
1.7.4.1
PATCH v3 3/8 arm: Add savebp implementation for arm
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 1 line
This adds the savebp implementation to the arm platform.
please reorder your series and let this come before 'Add savebp command' cause that patch uses functionality from this one.
Quoted 9 lines
Related CONFIGs:
CONFIG_CMD_SAVEBP_WRITE_SIZEdefines the size of the image to writeSigned-off-by Simon Schwarz <[email protected]>---
V2 changes:
DEL _cosmetic_ old comment
Quoted 8 lines
V3 changes:
nothing--- arch/arm/include/asm/savebp.h | 27 ++++++++++++ arch/arm/lib/Makefile | 1 + arch/arm/lib/savebp.c | 91 +++++++++++++++++++++++++++++++++++++++++ include/command.h | 5 ++ include/configs/devkit8000.h | 1 +
documentation of CONFIG_CMD_SAVEBP_WRITE_SIZE is missing
Quoted 21 lines
arch/arm/include/asm/savebp.h new file +15
-0@@ -0,0 +1,27 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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.
arch/arm/include/asm/savebp.h line 25
Quoted 10 lines
arch/arm/include/asm/savebp.h new file +10
-0+* +* 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 +*/ +#ifndef _SAVEBP_H_ +#define _SAVEBP_H_ + +extern bootm_headers_t images;
You made that available globally in your first patch of this series, please remove that from first patch and move to this one.
<snip>
BTW while reading this patch I got another idea to solve problem 'how get we saved the boot information to <storage>'.
The required information regardless of whether it is ATAGS or FDT is only a blob at some place in ram after the 'bootm x' commands used in 'Add savebp command'. Saving a blob from location X with size Y to location Z is easy and already implemented.
So the only required thing is to get the 'blob' prepared in RAM. In my opinion this could be a subcommand of bootm instead of a new command.
How about:
---8<---
# bootm savebp ...done boot information is @0x80000100 with size 0x100 # nandecc hw # nand erase ... # nand write 80000100 ... --->8---
regards
Andreas Bie?mann
PATCH v3 3/8 arm: Add savebp implementation for arm
Dear Andreas,
Quoted 8 lines · Andreas Bie?mann
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 1 line
This adds the savebp implementation to the arm platform.
please reorder your series and let this come before 'Add savebp command' cause that patch uses functionality from this one.
Will do.
Quoted 18 lines
Quoted 9 lines
Related CONFIGs:
CONFIG_CMD_SAVEBP_WRITE_SIZEdefines the size of the image to writeSigned-off-by Simon Schwarz<[email protected]>---
V2 changes:
DEL _cosmetic_ old commentQuoted 8 lines
V3 changes:
nothing--- arch/arm/include/asm/savebp.h | 27 ++++++++++++ arch/arm/lib/Makefile | 1 + arch/arm/lib/savebp.c | 91 +++++++++++++++++++++++++++++++++++++++++ include/command.h | 5 ++ include/configs/devkit8000.h | 1 +
Quoted 2 lines
documentation of
CONFIG_CMD_SAVEBP_WRITE_SIZEis missing
Will add.
Quoted 26 lines
Quoted 26 lines
arch/arm/include/asm/savebp.h new file +20
-0@@ -0,0 +1,27 @@ +/* Copyright (C) 2011 +* Corscience GmbH& Co. KG - Simon Schwarz<[email protected]> +* +* 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
Quoted 8 lines
arch/arm/include/asm/savebp.h line 25
Quoted 5 lines
arch/arm/include/asm/savebp.h new file +5
-0+*/ +#ifndef _SAVEBP_H_ +#define _SAVEBP_H_ + +extern bootm_headers_t images;You made that available globally in your first patch of this series, please remove that from first patch and move to this one.
ok.
Quoted 15 lines
<snip>
BTW while reading this patch I got another idea to solve problem 'how get we saved the boot information to<storage>'.
The required information regardless of whether it is ATAGS or FDT is only a blob at some place in ram after the 'bootm x' commands used in 'Add savebp command'. Saving a blob from location X with size Y to location Z is easy and already implemented.So the only required thing is to get the 'blob' prepared in RAM. In my opinion this could be a subcommand of bootm instead of a new command.
How about:
Quoted 7 lines
---8<---
# bootm savebp ...done boot information is @0x80000100 with size 0x100 # nandecc hw # nand erase ... # nand write 80000100 ... --->8---
This was actually my first implementation (although not with a switch):
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/102669
It was criticised because saving the parameter images is not the responsibility of bootm - which is true. Although adding a switch would be a cleaner solution than my first implementation - would that be acceptable?
How about implementing it as bootm subcommand?
Quoted 4 lines
regards
Andreas Bie?mann
Regards & thx for reviewing
Simon
PATCH v3 3/8 arm: Add savebp implementation for arm
Dear Simon,
Am 26.08.2011 12:10, schrieb Simon Schwarz:
Quoted 2 lines
Dear Andreas,
<snip>
Quoted 23 lines
Quoted 12 lines
BTW while reading this patch I got another idea to solve problem 'how get we saved the boot information to<storage>'.
The required information regardless of whether it is ATAGS or FDT is only a blob at some place in ram after the 'bootm x' commands used in 'Add savebp command'. Saving a blob from location X with size Y to location Z is easy and already implemented.So the only required thing is to get the 'blob' prepared in RAM. In my opinion this could be a subcommand of bootm instead of a new command.
How about:
Quoted 7 lines
---8<---
# bootm savebp ...done boot information is @0x80000100 with size 0x100 # nandecc hw # nand erase ... # nand write 80000100 ... --->8---This was actually my first implementation (although not with a switch):
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Quoted 6 lines
It was criticised because saving the parameter images is not the responsibility of bootm - which is true. Although adding a switch would be a cleaner solution than my first implementation - would that be acceptable?
How about implementing it as bootm subcommand?
Another question, how often will one change the boot information for SPL booting?
I guess most people will use the normal u-boot to test different configurations and start directly into the OS. When one has some satisfying configuration he will store this for SPL boot into flash regardless whether it is a separate command or a list of commands.
The current solution (having savebp command utilize do_bootm()) couples these two commands in a way which may lead to problems in future (but I don't know what others think about ... Wolfgang?).
I vote for a well documented guide or an example script to gather the boot information and store it for SPL booting (at least for this patch set). I know your bachelor thesis filing date is end of September and I would appreciate to have this functionality in before. The rest of this series seems quite good to me. Except for some minor changes to the arm-bootm prep command ... but read my answer to that patch.
best regards
Andreas Bie?mann
PATCH v3 4/8 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzThis adds Linux booting to the SPL
Related CONFIGs:CONFIG_SPL_OS_BOOT
Activates/Deactivates the OS booting featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_SPL_MACHID
Machine ID of the used boardCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl.c | 48 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 7 +++- 2 files changed, 51 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +46 -2
@@ -35,6 +35,7 @@#include <asm/arch/mmc_host_def.h> #include <i2c.h> #include <image.h> +#include <asm/omap_gpio.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -63,6 +64,25 @@ void board_init_f(ulong dummy)relocate_code (CONFIG_SPL_STACK , &gdata,CONFIG_SPL_TEXT_BASE ); } +#ifdef CONFIG_SPL_OS_BOOT +/* Return the value of the U-boot key +* +* RETURN +* 0 if not pressed +* positiv if pressed +*/ +int spl_uboot_key (void ) +{ +int val =0 ; +if (!omap_request_gpio (CONFIG_SPL_OS_BOOT_KEY )) { +omap_set_gpio_direction (CONFIG_SPL_OS_BOOT_KEY ,1 ); + val =omap_get_gpio_datain (CONFIG_SPL_OS_BOOT_KEY ); +omap_free_gpio (CONFIG_SPL_OS_BOOT_KEY ); + } +return !val; +} +#endif /* CONFIG_SPL_OS_BOOT */ +void spl_parse_image_header (const struct image_header *header) {u32 header_size =sizeof (struct image_header );
@@ -90,7 +110,25 @@ void spl_parse_image_header(const struct image_header *header) } } -static void jump_to_image_no_args (void ) +#ifdef CONFIG_SPL_OS_BOOT +/* This function jumps to an image with argument. Normally an FDT or ATAGS +* image. +* arg: Pointer to paramter image in RAM +*/ +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_SYS_SPL_MACHID , 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 +137,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;
@@ -134,6 +172,12 @@ 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" ); +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 ();
include/configs/devkit8000.h +5 -2
@@ -38,7 +38,7 @@#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_SYS_TEXT_BASE 0x80100000#define CONFIG_SDRC /* The chip has SDRC controller */
@@ -328,7 +328,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 */
@@ -358,6 +358,9 @@#define CONFIG_CMD_SAVEBP_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000) +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 26 +#define CONFIG_SYS_SPL_MACHID MACH_TYPE_DEVKIT8000#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v3 4/8 omap-common/spl: Add linux boot to SPL
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 41 lines
This adds Linux booting to the SPL
Related CONFIGs:
CONFIG_SPL_OS_BOOT
Activates/Deactivates the OS booting featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_SPL_MACHID
Machine ID of the used boardCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDRAddress where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100Signed-off-by Simon Schwarz <[email protected]>---
V2 changes:
nothingV3 changes:
nothing--- arch/arm/cpu/armv7/omap-common/spl.c | 48 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 7 +++- 2 files changed, 51 insertions(+), 4 deletions(-)arch/arm/cpu/armv7/omap-common/spl.c +1
-0@@ -35,6 +35,7 @@#include <asm/arch/mmc_host_def.h> #include <i2c.h> #include <image.h> +#include <asm/omap_gpio.h> DECLARE_GLOBAL_DATA_PTR ;
arch/arm/cpu/armv7/omap-common/spl.c void board_init_f(ulong dummy) · line 67
Quoted 4 lines
arch/arm/cpu/armv7/omap-common/spl.c +1
-0@@ -63,6 +64,25 @@ void board_init_f(ulong dummy)relocate_code (CONFIG_SPL_STACK , &gdata,CONFIG_SPL_TEXT_BASE ); } +#ifdef CONFIG_SPL_OS_BOOT
Is this required? -ffunction-sections and --gc-sections should do he job.
Quoted 22 lines
arch/arm/cpu/armv7/omap-common/spl.c +18
-0+/* Return the value of the U-boot key +* +* RETURN +* 0 if not pressed +* positiv if pressed +*/ +int spl_uboot_key (void ) +{ +int val =0 ; +if (!omap_request_gpio (CONFIG_SPL_OS_BOOT_KEY )) { +omap_set_gpio_direction (CONFIG_SPL_OS_BOOT_KEY ,1 ); + val =omap_get_gpio_datain (CONFIG_SPL_OS_BOOT_KEY ); +omap_free_gpio (CONFIG_SPL_OS_BOOT_KEY ); + } +return !val; +} +#endif /* CONFIG_SPL_OS_BOOT */ +void spl_parse_image_header (const struct image_header *header) {u32 header_size =sizeof (struct image_header );
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 113
Quoted 5 lines
arch/arm/cpu/armv7/omap-common/spl.c +1
-1@@ -90,7 +110,25 @@ void spl_parse_image_header(const struct image_header *header) } } -static void jump_to_image_no_args (void ) +#ifdef CONFIG_SPL_OS_BOOT
here too.
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 126
Quoted 13 lines
arch/arm/cpu/armv7/omap-common/spl.c +13
-0+/* This function jumps to an image with argument. Normally an FDT or ATAGS +* image. +* arg: Pointer to paramter image in RAM +*/ +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_SYS_SPL_MACHID , arg);
the MACHID is saved in gd->bd, couldn't this be used here?
BTW: You missed setting CONFIG_SYS_SPL_MACHID in your board configuration header in this patch. Where is it done?
Quoted 63 lines
arch/arm/cpu/armv7/omap-common/spl.c +12
-1+} +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 +137,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;@@ -134,6 +172,12 @@ 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" ); +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 ();include/configs/devkit8000.h +5
-2@@ -38,7 +38,7 @@#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_SYS_TEXT_BASE 0x80100000#define CONFIG_SDRC /* The chip has SDRC controller */ @@ -328,7 +328,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 */ @@ -358,6 +358,9 @@#define CONFIG_CMD_SAVEBP_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000) +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 26 +#define CONFIG_SYS_SPL_MACHID MACH_TYPE_DEVKIT8000#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
PATCH v3 4/8 omap-common/spl: Add linux boot to SPL
Quoted 43 lines · Andreas Bie?mann
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 40 lines
This adds Linux booting to the SPL
Related CONFIGs:
CONFIG_SPL_OS_BOOT
Activates/Deactivates the OS booting featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_SPL_MACHID
Machine ID of the used boardCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDRAddress where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100Signed-off-by Simon Schwarz<[email protected]>---
V2 changes:
nothingV3 changes:
nothing--- arch/arm/cpu/armv7/omap-common/spl.c | 48 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 7 +++- 2 files changed, 51 insertions(+), 4 deletions(-)arch/arm/cpu/armv7/omap-common/spl.c +1
-0@@ -35,6 +35,7 @@#include <asm/arch/mmc_host_def.h> #include <i2c.h> #include <image.h> +#include <asm/omap_gpio.h> DECLARE_GLOBAL_DATA_PTR ;
Quoted 8 lines
arch/arm/cpu/armv7/omap-common/spl.c void board_init_f(ulong dummy) · line 67
Quoted 5 lines
arch/arm/cpu/armv7/omap-common/spl.c +1
-0@@ -63,6 +64,25 @@ void board_init_f(ulong dummy)relocate_code (CONFIG_SPL_STACK ,&gdata,CONFIG_SPL_TEXT_BASE ); } +#ifdef CONFIG_SPL_OS_BOOT Is this required? -ffunction-sections and --gc-sections should do he job.
true. Will change
Quoted 25 lines
Quoted 25 lines
arch/arm/cpu/armv7/omap-common/spl.c +18
-0+/* Return the value of the U-boot key +* +* RETURN +* 0 if not pressed +* positiv if pressed +*/ +int spl_uboot_key (void ) +{ +int val =0 ; +if (!omap_request_gpio (CONFIG_SPL_OS_BOOT_KEY )) { +omap_set_gpio_direction (CONFIG_SPL_OS_BOOT_KEY ,1 ); + val =omap_get_gpio_datain (CONFIG_SPL_OS_BOOT_KEY ); +omap_free_gpio (CONFIG_SPL_OS_BOOT_KEY ); + } +return !val; +} +#endif /* CONFIG_SPL_OS_BOOT */ +void spl_parse_image_header (const struct image_header *header) {u32 header_size =sizeof (struct image_header );@@ -90,7 +110,25 @@ void spl_parse_image_header(const struct image_header *header) } }
Quoted 5 lines
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 113
Quoted 2 lines
arch/arm/cpu/armv7/omap-common/spl.c +1
-1-static void jump_to_image_no_args (void ) +#ifdef CONFIG_SPL_OS_BOOT here too.
too.
Quoted 9 lines
Quoted 9 lines
arch/arm/cpu/armv7/omap-common/spl.c +9
-0+/* This function jumps to an image with argument. Normally an FDT or ATAGS +* image. +* arg: Pointer to paramter image in RAM +*/ +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));
Quoted 9 lines
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 126
Quoted 4 lines
arch/arm/cpu/armv7/omap-common/spl.c +4
-0+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_SYS_SPL_MACHID , arg);the MACHID is saved in
gd->bd, couldn't this be used here?
BTW: You missed settingCONFIG_SYS_SPL_MACHIDin your board configuration header in this patch. Where is it done?
In SPL gd is not fully initialized.
CONFIG_SYS_SPL_MACHID is set see below in include/configs/devkit8000.h
Quoted 52 lines
Quoted 52 lines
arch/arm/cpu/armv7/omap-common/spl.c +12
-1+} +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 +137,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;@@ -134,6 +172,12 @@ 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" ); +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 ();include/configs/devkit8000.h +2
-2@@ -38,7 +38,7 @@#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_SYS_TEXT_BASE 0x80100000#define CONFIG_SDRC /* The chip has SDRC controller */ @@ -328,7 +328,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
Quoted 12 lines
include/configs/devkit8000.h line 366
Quoted 11 lines
include/configs/devkit8000.h +3
-0/* NAND boot config */ @@ -358,6 +358,9 @@#define CONFIG_CMD_SAVEBP_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SAVEBP_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ 0x400000) +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 26 +#define CONFIG_SYS_SPL_MACHID MACH_TYPE_DEVKIT8000#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Regards, thx for reviewing
Simon
PATCH v3 4/8 omap-common/spl: Add linux boot to SPL
Dear Simon
Am 26.08.2011 12:17, schrieb Simon Schwarz:
Quoted 2 lines · Andreas Bie?mann
Quoted 1 line
Dear Simon,
<snip>
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
+/* This function jumps to an image with argument. Normally an FDT or ATAGS
+ * image.
+ * arg: Pointer to paramter image in RAM
+ */arch/arm/cpu/armv7/omap-common/spl.c +5
-0+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));Quoted 9 lines
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 126
Quoted 4 lines
arch/arm/cpu/armv7/omap-common/spl.c +4
-0+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_SYS_SPL_MACHID , arg);the MACHID is saved in
gd->bd, couldn't this be used here?
BTW: You missed settingCONFIG_SYS_SPL_MACHIDin your board configuration header in this patch. Where is it done?
Quoted 1 line
In SPL gd is not fully initialized.
I see ... but how about using existing CONFIG_MACH_TYPE then?
Quoted 1 line
CONFIG_SYS_SPL_MACHIDis set see below ininclude/configs/devkit8000.h
Sorry for the noise, did not see it.
regards
Andreas Bie?mann
PATCH v3 4/8 omap-common/spl: Add linux boot to SPL
Dear Andreas,
Quoted 28 lines · Andreas Bie?mann
Dear Simon
Am 26.08.2011 12:17, schrieb Simon Schwarz:
Quoted 2 lines · Andreas Bie?mann
Quoted 1 line
Dear Simon,
<snip>
Quoted 20 lines
Quoted 19 lines
Quoted 5 lines
+/* This function jumps to an image with argument. Normally an FDT or ATAGS
+ * image.
+ * arg: Pointer to paramter image in RAM
+ */arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 126
Quoted 9 lines
arch/arm/cpu/armv7/omap-common/spl.c +9
-0+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_SYS_SPL_MACHID , arg);the MACHID is saved in
gd->bd, couldn't this be used here?
BTW: You missed settingCONFIG_SYS_SPL_MACHIDin your board configuration header in this patch. Where is it done?
Quoted 4 lines
Quoted 1 line
In SPL gd is not fully initialized.
I see ... but how about using existing
CONFIG_MACH_TYPEthen?
done.
Quoted 8 lines
Quoted 1 line
CONFIG_SYS_SPL_MACHIDis set see below ininclude/configs/devkit8000.hSorry for the noise, did not see it.
regards
Andreas Bie?mann
regards
Simon
PATCH v3 4/8 omap-common/spl: Add linux boot to SPL
Quoted 31 lines · Simon Schwarz
Dear Andreas,
Quoted 28 lines · Andreas Bie?mann
Dear Simon
Am 26.08.2011 12:17, schrieb Simon Schwarz:
Quoted 2 lines · Andreas Bie?mann
Quoted 1 line
Dear Simon,
<snip>
Quoted 20 lines
Quoted 19 lines
Quoted 5 lines
+/* This function jumps to an image with argument. Normally an FDT or ATAGS
+ * image.
+ * arg: Pointer to paramter image in RAM
+ */arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 126
Quoted 9 lines
arch/arm/cpu/armv7/omap-common/spl.c +9
-0+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_SYS_SPL_MACHID , arg);the MACHID is saved in
gd->bd, couldn't this be used here?
BTW: You missed settingCONFIG_SYS_SPL_MACHIDin your board configuration header in this patch. Where is it done?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
In SPL gd is not fully initialized.
I see ... but how about using existing
CONFIG_MACH_TYPEthen?done.
I correct myself: not done.
If I use CONFIG_MACH_TYPE u-boot doesn't boot any more. This seems to be a bug in handling this define.
Any ideas on this?
Regards
Simon
PATCH v3 5/8 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzLinux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl.c | 1 + arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 33 ++++++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 9 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +1 -0
@@ -175,6 +175,7 @@ void board_init_r(gd_t *id, ulong dummy)#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
arch/arm/include/asm/omap_common.h +2 -0
@@ -77,6 +77,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +24 -9
@@ -62,6 +62,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -80,14 +92,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -119,7 +124,7 @@ void set_muxconf_regs(void)MUX_DEVKIT8000 (); } -#if defined(CONFIG_DRIVER_DM9000 ) & !defined(CONFIG_SPL_BUILD ) +#ifdef CONFIG_DRIVER_DM9000 /* * Routine: board_eth_init * Description: Setting up the Ethernet hardware.
@@ -129,3 +134,13 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* do board specific preperation before SPL +* Linux boot */ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH v3 6/8 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzThis implements booting of Linux from NAND in SPL
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 48 +++++++++++++++++++--------- 1 files changed, 32 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +32 -16
@@ -46,26 +46,42 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* load parameter image */ +nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS , +CONFIG_CMD_SAVEBP_WRITE_SIZE , + (void *)CONFIG_SYS_SPL_ARGS_ADDR ); +/* load linux */ +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , +CONFIG_SYS_NAND_PAGE_SIZE , (void *)header); +spl_parse_image_header (header); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v3 7/8 omap-common: fixes BSS overwriting problem
In reply to Simon Schwarzspl_nand overwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +18 -3
@@ -24,6 +24,7 @@#include <asm/u-boot.h> #include <asm/utils.h> #include <asm/arch/sys_proto.h> +#include <asm/io.h> #include <nand.h> #include <timestamp_autogenerated.h> #include <version_autogenerated.h>
@@ -33,6 +34,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -49,16 +51,29 @@ void spl_nand_load_image(void)#ifdef CONFIG_SPL_OS_BOOT if (!spl_uboot_key ()) {/* load parameter image */ -nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS , +/* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_WRITE_SIZE therefore may overwrite +* following sections like BSS */ +nand_spl_load_image (CONFIG_CMD_SAVEBP_NAND_OFS ,CONFIG_CMD_SAVEBP_WRITE_SIZE , - (void *)CONFIG_SYS_SPL_ARGS_ADDR ); + (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_SAVEBP_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);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header)); } else#endif {
Signature · 1 line
1.7.4.1
PATCH v3 8/8 savebp: added Readme
In reply to Simon SchwarzAdds a Readme for the savebp command
---
V2 changes:
ADDED in V2
V3 changes:
nothing
--- doc/README.commands.savebp | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) create mode 100644 doc/README.commands.savebp
doc/README.commands.savebp new file +28 -0
@@ -0,0 +1,28 @@ +The savebp (=save boot parameters) is used to save a boot parameter image to +non-volatile memory. + +To execute the command everything has to be in place as if bootm should be +used. +(kernel image, initrd-image, fdt-image etc.) + +Call is: +savebp [ftd|atags] [nand_offset] [kernel_addr] [initrd_addr] [fdt_addr] + +Only the first parameter [ftd|atags] is mandatory if the others are left blank +standard values are used. + +e.g: +savebp fdt 0x680000 0x82000000 0x80000100 - +savebo atags + +typical call on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND */ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +savebp fdt 0x680000 0x82000000 0x80000100 - /* Save the image */ + +------------Behind the scene--------------- +Atm the implementation is that we have /common/cmd_savebp.c which implements +the command tself and the subcommand calls to bootm. +Then the arch specific implementation of do_save_atags or do_savebp_fdt +in /arch/arm/lib is called.
Signature · 1 line
1.7.4.1
PATCH v3 8/8 savebp: added Readme
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 1 line
Adds a Readme for the savebp command
This patch should be merged with 'Add savebp command'
Quoted 30 lines
Signed-off-by Simon Schwarz <[email protected]>---
V2 changes:
ADDED in V2V3 changes:
nothing--- doc/README.commands.savebp | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) create mode 100644 doc/README.commands.savebpdoc/README.commands.savebp new file +10
-0@@ -0,0 +1,28 @@ +The savebp (=save boot parameters) is used to save a boot parameter image to +non-volatile memory. + +To execute the command everything has to be in place as if bootm should be +used. +(kernel image, initrd-image, fdt-image etc.) + +Call is: +savebp [ftd|atags] [nand_offset] [kernel_addr] [initrd_addr] [fdt_addr] +
doc/README.commands.savebp line 20
Quoted 10 lines
doc/README.commands.savebp new file +10
-0+Only the first parameter [ftd|atags] is mandatory if the others are left blank +standard values are used. + +e.g: +savebp fdt 0x680000 0x82000000 0x80000100 - +savebo atags + +typical call on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND */
why read the kernel image here?
doc/README.commands.savebp line 26
Quoted 6 lines
doc/README.commands.savebp new file +6
-0+tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +savebp fdt 0x680000 0x82000000 0x80000100 - /* Save the image */ + +------------Behind the scene--------------- +Atm the implementation is that we have /common/cmd_savebp.c which implements +the command tself and the subcommand calls to bootm.
^itself
doc/README.commands.savebp line 28
Quoted 2 lines
doc/README.commands.savebp new file +2
-0+Then the arch specific implementation of do_save_atags or do_savebp_fdt +in /arch/arm/lib is called.
(therefore a errormessage should/could be added to common/cmd_savebp.c, if ARCH != ARM)
regrads
Andreas Bie?mann
PATCH v3 8/8 savebp: added Readme
Quoted 40 lines · Andreas Bie?mann
Dear Simon,
Am 25.08.2011 10:33, schrieb Simon Schwarz:
Quoted 1 line
Adds a Readme for the savebp command
This patch should be merged with 'Add savebp command'
Quoted 34 lines
Signed-off-by Simon Schwarz<[email protected]>---
V2 changes:
ADDED in V2V3 changes:
nothing--- doc/README.commands.savebp | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)create mode 100644 doc/README.commands.savebp
doc/README.commands.savebp new file +14
-0@@ -0,0 +1,28 @@ +The savebp (=save boot parameters) is used to save a boot parameter image to +non-volatile memory. + +To execute the command everything has to be in place as if bootm should be +used. +(kernel image, initrd-image, fdt-image etc.) + +Call is: +savebp [ftd|atags] [nand_offset] [kernel_addr] [initrd_addr] [fdt_addr] + +Only the first parameter [ftd|atags] is mandatory if the others are left blank +standard values are used. + +e.g:
Quoted 9 lines
doc/README.commands.savebp line 20
Quoted 6 lines
doc/README.commands.savebp new file +6
-0+savebp fdt 0x680000 0x82000000 0x80000100 - +savebo atags + +typical call on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND */why read the kernel image here?
Because bootm needs it.
Quoted 8 lines
doc/README.commands.savebp line 26
Quoted 6 lines
doc/README.commands.savebp new file +6
-0+tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +savebp fdt 0x680000 0x82000000 0x80000100 - /* Save the image */ + +------------Behind the scene--------------- +Atm the implementation is that we have /common/cmd_savebp.c which implements +the command tself and the subcommand calls to bootm.^itself
Quoted 5 lines
doc/README.commands.savebp line 28
Quoted 2 lines
doc/README.commands.savebp new file +2
-0+Then the arch specific implementation of do_save_atags or do_savebp_fdt +in /arch/arm/lib is called.(therefore a errormessage should/could be added to
common/cmd_savebp.c, if ARCH != ARM)
will add.
Quoted 4 lines
regrads
Andreas Bie?mann
Regards
Simon
PATCH v3 8/8 savebp: added Readme
In reply to Simon SchwarzHello.
Quoted 3 lines · Simon Schwarz
Adds a Readme for the savebp command
Signed-off-by Simon Schwarz<[email protected]>
[...]
Quoted 21 lines
doc/README.commands.savebp new file +15
-0@@ -0,0 +1,28 @@ +The savebp (=save boot parameters) is used to save a boot parameter image to +non-volatile memory. + +To execute the command everything has to be in place as if bootm should be +used. +(kernel image, initrd-image, fdt-image etc.) + +Call is: +savebp [ftd|atags] [nand_offset] [kernel_addr] [initrd_addr] [fdt_addr] + +Only the first parameter [ftd|atags] is mandatory if the others are left blank +standard values are used. + +e.g: +savebp fdt 0x680000 0x82000000 0x80000100 -
doc/README.commands.savebp line 25
Quoted 10 lines
doc/README.commands.savebp new file +10
-0+savebo atags + +typical call on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND */ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +savebp fdt 0x680000 0x82000000 0x80000100 - /* Save the image */ + +------------Behind the scene--------------- +Atm the implementation is that we have /common/cmd_savebp.c which implements
Only ATM.
doc/README.commands.savebp line 26
Quoted 1 line
doc/README.commands.savebp new file +1
-0+the command tself and the subcommand calls to bootm.
s/tself/itself/
doc/README.commands.savebp line 28
Quoted 2 lines
doc/README.commands.savebp new file +2
-0+Then the arch specific implementation of do_save_atags or do_savebp_fdt +in /arch/arm/lib is called.
WBR, Sergei
v3 cover SPL Linux boot
In reply to Simon SchwarzDear Simon Schwarz,
Quoted 2 lines · In message <[email protected]> you…
Adds direct Linux boot to SPL. It implements a savebp command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Thanks for this work. It is highly appreciated.
Quoted 2 lines
checkpatch whines about not using
strict_strtoull- since this is not available - I can't change this.
That's OK.
A question ex ante: what is the "bp" in "savebp" supposed to mean? I cannot come up with a good interpretation (might might show the effects of me working in a way too hot environment, or might indicate that we should chose a better name).
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de WARNING: This Product Attracts Every Other Piece of Matter in the Universe, Including the Products of Other Manufacturers, with a Force Proportional to the Product of the Masses and Inversely Proportional to the Distance Between Them.
v3 cover SPL Linux boot
Dear Wolfgang Denk,
Quoted 11 lines · Wolfgang Denk
Dear Simon Schwarz,
Quoted 2 lines · In message<[email protected]> you…
Adds direct Linux boot to SPL. It implements a savebp command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Thanks for this work. It is highly appreciated.
Quoted 2 lines
checkpatch whines about not using
strict_strtoull- since this is not available - I can't change this.
Quoted 6 lines
That's OK.
A question ex ante: what is the "bp" in "savebp" supposed to mean? I cannot come up with a good interpretation (might might show the effects of me working in a way too hot environment, or might indicate that we should chose a better name).
Today: Definatly too hot ;)
It means "save boot parameters" - better proposals welcome.
Quoted 5 lines
Best regards,
Wolfgang Denk
Regards
Simon
v3 cover SPL Linux boot
Dear Simon,
Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines
A question ex ante: what is the "bp" in "savebp" supposed to mean? I
...
Quoted 1 line
It means "save boot parameters" - better proposals welcome.
If it's not too much of trouble I would indeed ask you to change that name.
Dismissing ecological considerations (should we save BP?), the ntroduction of such a command name would break a number of boards which use "save" as abbreviation for "saveenv" in their default configurations:
FPS850L M5253DEMO M5329EVB M5475EVB TQM850L TQM860M FPS860L M5271EVB M5373EVB M5485EVB TQM850M TQM862L M5208EVBE M5272C3 M54451EVB NSCU TQM855L TQM862M M52277EVB M5275EVB M54451EVB TQM823L TQM855M TQM866M M52277EVB M5282EVB M54455EVB TQM823M TQM860L virtlab2 M5235EVB M53017EVB M54455EVB
Yes, it has always been a bad idea to use abbreviated command names in environment settings, but it's being done again and again (myself not being immune to that temptation).
So please let's use a different name, one that does not start with "save".
Also, I think we should try and make the approach a bit more generic. Your current implementation supports only NAND as storage. But what if we want to do the same when booting from SDCard?
Maybe we should split the steps of extracting the FDT and ATAGS images and the process of actually writing them to persistent storage in two separate steps - for the second step we can then use existing standard commands, so only the "export" step is needed.
As all this is about preparing for a SPL boot, I suggest we name the new command "spl"; the resulting user interface could be like this:
spl export <img> addr [args ...]
with "img" being either "fdt" or "atags". [This would allow to add other SPL related commands easily in case we should need them.
What do you think?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Have you lived in this village all your life?" "No, not yet."
v3 cover SPL Linux boot
Hi Wolfgang,
Quoted 2 lines · Wolfgang Denk
Dear Simon,
...
Quoted 5 lines
As all this is about preparing for a SPL boot, I suggest we name the new command "spl"; the resulting user interface could be like this:
spl export <img> addr [args ...]
How about skipping the spl part and have command named 'export', if that's not existing already? To me this sounds better than 'spl export':
export <img> addr [args ...]
best regards,
Aneesh
v3 cover SPL Linux boot
Dear Aneesh V,
Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 6 lines
As all this is about preparing for a SPL boot, I suggest we name the new command "spl"; the resulting user interface could be like this:
spl export <img> addr [args ...]
How about skipping the spl part and have command named 'export', if that's not existing already? To me this sounds better than 'spl export':
export <img> addr [args ...]
I think the command name should establish a mental context to what er are doing. We may need additional commands in the context of SPL setup, so "spl export" serves a double purpose: it creates the context that we are doing something for SPL, and it allows for extensions.
"export" alone could be about anything.
See for example the environment handling - here we also provide a sub-command "env export", but I (intentionally) never attempted to add "export" as direct command to export the environment variables.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "No matter where you go, there you are..." - Buckaroo Banzai
v3 cover SPL Linux boot
In reply to Wolfgang DenkDear Wolfgang,
Quoted 23 lines · Wolfgang Denk
Dear Simon,
Quoted 2 lines · In message<[email protected]> you wrote:
Quoted 2 lines
A question ex ante: what is the "bp" in "savebp" supposed to mean? I
...
Quoted 1 line
It means "save boot parameters" - better proposals welcome.
If it's not too much of trouble I would indeed ask you to change that name.
Dismissing ecological considerations (should we save BP?), the ntroduction of such a command name would break a number of boards which use "save" as abbreviation for "saveenv" in their default configurations:
FPS850L M5253DEMO M5329EVB M5475EVB TQM850L TQM860M FPS860L M5271EVB M5373EVB M5485EVB TQM850M TQM862L M5208EVBE M5272C3 M54451EVB NSCU TQM855L TQM862M M52277EVB M5275EVB M54451EVB TQM823L TQM855M TQM866M M52277EVB M5282EVB M54455EVB TQM823M TQM860L virtlab2 M5235EVB M53017EVB M54455EVB
Quoted 6 lines
Yes, it has always been a bad idea to use abbreviated command names in environment settings, but it's being done again and again (myself not being immune to that temptation).
So please let's use a different name, one that does not start with "save".
Ecological reasons accepted :)
Quoted 4 lines
Also, I think we should try and make the approach a bit more generic. Your current implementation supports only NAND as storage. But what if we want to do the same when booting from SDCard?
Agreed.
Quoted 5 lines
Maybe we should split the steps of extracting the FDT and ATAGS images and the process of actually writing them to persistent storage in two separate steps - for the second step we can then use existing standard commands, so only the "export" step is needed.
Essentially it would already be possible to extract FDT/ATAGS if arm bootm implementation would implement prep subcommand.
I plan to split 1/8 from this set - see discussion for this patch. After that extract the images is just reading the start address and reading/calculating the size of them.
Quoted 8 lines
As all this is about preparing for a SPL boot, I suggest we name the new command "spl"; the resulting user interface could be like this:
spl export<img> addr [args ...]
with "img" being either "fdt" or "atags". [This would allow to add other SPL related commands easily in case we should need them.
No objections.
Quoted 6 lines
What do you think?
Best regards,
Wolfgang Denk
Regards
Simon
v3 cover SPL Linux boot
In reply to Wolfgang DenkDear Wolfgang,
Am 26.08.2011 13:36, schrieb Wolfgang Denk:
Quoted 7 lines
Dear Simon,
Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines
A question ex ante: what is the "bp" in "savebp" supposed to mean? I
...
Quoted 1 line
It means "save boot parameters" - better proposals welcome.
<snip>
Quoted 8 lines
Also, I think we should try and make the approach a bit more generic. Your current implementation supports only NAND as storage. But what if we want to do the same when booting from SDCard?
Maybe we should split the steps of extracting the FDT and ATAGS images and the process of actually writing them to persistent storage in two separate steps - for the second step we can then use existing standard commands, so only the "export" step is needed.
Well the 'export' step can already be done by exiting commands. e.g.
bootm start
bootm loados
bootm ramdisk (if CONFIG_SYS_BOOT_RAMDISK_HIGH)
bootm fdt (if CONFIG_OF_LIBFDT)
bootm cmdline
bootm bdt
bootm prep
Now the required date is ready to use at gd->bd->bi_boot_params, this information should the board maintainer/user know as (for arm boards) it is always set in board_init().
The data can now be written with already available commands regardless whether they are nand or nor or fat/ext/ubi... write commands.
All this could be done in a new command or one can utilize a self written script ...
The main parts of Simon's series are 'gather boot information' (make it possible for arm), 'safe boot information' (the question discussed in this mail' and 'use spl to start linux'. In my opinion (with knowledge of his bachelor thesis filing date) the parts 'gather boot information' and 'use spl to start linux' are most important cause the part 'safe boot information' can currently be done with existing commands.
Quoted 8 lines
As all this is about preparing for a SPL boot, I suggest we name the new command "spl"; the resulting user interface could be like this:
spl export <img> addr [args ...]
with "img" being either "fdt" or "atags". [This would allow to add other SPL related commands easily in case we should need them.
Nevertheless +1 for spl in the new command name (only export as suggested by Aneesh) is a bit weak.
best regards
Andreas Bie?mann
v4 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
based on:
- The new SPL layout
- OMAP3 new SPL layout
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105260)
- CONFIG_MACH_TYPE fix
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105809)
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)
Related to:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Simon Schwarz (6):
removed static from images in cmd_bootm.c
Add cmd_spl command
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common/spl: Add linux boot to SPL
omap-common: Add NAND SPL linux booting
omap-common: fixes BSS overwriting problem
arch/arm/cpu/armv7/omap-common/spl.c | 45 ++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 63 +++++++-- arch/arm/include/asm/omap_common.h | 2 + board/timll/devkit8000/devkit8000.c | 33 ++++-- common/Makefile | 1 + common/cmd_bootm.c | 2 +- common/cmd_spl.c | 214 +++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++ include/cmd_spl.h | 30 ++++ include/configs/devkit8000.h | 16 ++- 10 files changed, 407 insertions(+), 30 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
Signature · 1 line
1.7.4.1
PATCH v4 1/6 removed static from images in cmd_bootm.c
This removes static modifier from cmd_bootm.c to make it public and usable by savebp
--- common/cmd_bootm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bootm.c +1 -1
@@ -156,7 +156,7 @@ static boot_os_fn *boot_os[] = {#endif }; -static bootm_headers_t images;/* pointers to os/initrd/fdt images */ +bootm_headers_t images;/* pointers to os/initrd/fdt images */ /* Allow for arch specific config before we boot */ void __arch_preboot_os (void )
Signature · 1 line
1.7.4.1
PATCH v4 2/6 Add cmd_spl command
In reply to Simon SchwarzThis adds a spl command to the u-boot.
Related config:CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
--- common/Makefile | 1 + common/cmd_spl.c | 214 ++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++++ include/cmd_spl.h | 30 ++++++ include/configs/devkit8000.h | 7 ++ 5 files changed, 283 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
common/Makefile +1 -0
@@ -158,6 +158,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
common/cmd_spl.c new file +214 -0
214 lines not on this page · raw message
doc/README.commands.spl new file +31 -0
@@ -0,0 +1,31 @@ +The spl command is used to export a boot parameter image to RAM. Later +it may implement more functions connected to the SPL. + +SUBCOMMAND EXPORT +To execute the command everything has to be in place as if bootm should be +used. (kernel image, initrd-image, fdt-image etc.) + +export has to subcommands: + atags: exports the ATAGS + fdt: exports the FDT + +Call is: +spl export <ftd|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt] + + +TYPICAL CALL + +on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +spl export atags /* export ATAGS */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write 0x80000100 0x680000 0x20000 /* write the image - one page */ + +call with FDT: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +spl export fdt 0x82000000 - 0x80000100 /* export FDT */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write <adress shown by spl export> 0x680000 0x20000
include/cmd_spl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ + +extern bootm_headers_t images; + +enum image_type {FDT ,ATAGS }; + +#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002)
include/configs/devkit8000.h +7 -0
@@ -353,4 +353,11 @@#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x200000 +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v4 3/6 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzLinux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 33 ++++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-)
arch/arm/include/asm/omap_common.h +2 -0
@@ -77,6 +77,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +24 -9
@@ -62,6 +62,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -80,14 +92,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -119,7 +124,7 @@ void set_muxconf_regs(void)MUX_DEVKIT8000 (); } -#if defined(CONFIG_DRIVER_DM9000 ) & !defined(CONFIG_SPL_BUILD ) +#ifdef CONFIG_DRIVER_DM9000 /* * Routine: board_eth_init * Description: Setting up the Ethernet hardware.
@@ -129,3 +134,13 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* do board specific preperation before SPL +* Linux boot */ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH v4 4/6 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzThis 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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
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
--- arch/arm/cpu/armv7/omap-common/spl.c | 45 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 9 +++++- 2 files changed, 50 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +43 -2
@@ -35,6 +35,7 @@#include <asm/arch/mmc_host_def.h> #include <i2c.h> #include <image.h> +#include <asm/omap_gpio.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -63,6 +64,23 @@ 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 +*/ +int spl_uboot_key (void ) +{ +int val =0 ; +if (!omap_request_gpio (CONFIG_SPL_OS_BOOT_KEY )) { +omap_set_gpio_direction (CONFIG_SPL_OS_BOOT_KEY ,1 ); + val =omap_get_gpio_datain (CONFIG_SPL_OS_BOOT_KEY ); +omap_free_gpio (CONFIG_SPL_OS_BOOT_KEY ); + } +return !val; +} +void spl_parse_image_header (const struct image_header *header) {u32 header_size =sizeof (struct image_header );
@@ -90,7 +108,23 @@ 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 +*/ +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)); + +void jump_to_image_no_args (void ) {typedef void (*image_entry_noargs_t )(void )__attribute__ ((noreturn)); image_entry_noargs_t image_entry =
@@ -99,8 +133,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;
@@ -134,6 +168,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 ();
include/configs/devkit8000.h +7 -2
@@ -38,7 +38,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 */
@@ -328,7 +330,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 */
@@ -358,6 +360,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 */
Signature · 1 line
1.7.4.1
PATCH v4 5/6 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzThis implements booting of Linux from NAND in SPL
Related config parameters:CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 62 +++++++++++++++++++++------- 1 files changed, 46 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +46 -16
@@ -24,6 +24,7 @@#include <asm/u-boot.h> #include <asm/utils.h> #include <asm/arch/sys_proto.h> +#include <asm/io.h> #include <nand.h> #include <timestamp_autogenerated.h> #include <version_autogenerated.h>
@@ -33,6 +34,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -46,26 +48,54 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* load parameter image */ +/* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v4 6/6 omap-common: fixes BSS overwriting problem
In reply to Simon Schwarzspl_nand overwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +2 -1
@@ -72,7 +72,8 @@ void spl_nand_load_image(void) CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);spl_parse_image_header (header);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header)); } else#endif {
Signature · 1 line
1.7.4.1
v5 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V5:
- Rebased on u-boot-ti
- fixed MAKEALL warnings and errors
- adapted to general gpio interface
based on:
- The new SPL layout
- OMAP3 new SPL layout
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105260)
- CONFIG_MACH_TYPE fix
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105809)
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)
Related to:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Simon Schwarz (6):
removed static from images in cmd_bootm.c
Add cmd_spl command
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common/spl: Add linux boot to SPL
omap-common: Add NAND SPL linux booting
omap-common: fixes BSS overwriting problem
arch/arm/cpu/armv7/omap-common/spl.c | 49 +++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 63 +++++++-- arch/arm/include/asm/omap_common.h | 2 + board/timll/devkit8000/devkit8000.c | 31 +++- common/Makefile | 1 + common/cmd_bootm.c | 2 +- common/cmd_spl.c | 214 +++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++ include/cmd_spl.h | 30 ++++ include/configs/devkit8000.h | 16 ++- 10 files changed, 410 insertions(+), 29 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
Signature · 1 line
1.7.4.1
PATCH v5 1/6 removed static from images in cmd_bootm.c
This removes static modifier from cmd_bootm.c to make it public and usable by savebp
--- common/cmd_bootm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bootm.c +1 -1
@@ -156,7 +156,7 @@ static boot_os_fn *boot_os[] = {#endif }; -static bootm_headers_t images;/* pointers to os/initrd/fdt images */ +bootm_headers_t images;/* pointers to os/initrd/fdt images */ /* Allow for arch specific config before we boot */ void __arch_preboot_os (void )
Signature · 1 line
1.7.4.1
PATCH v5 2/6 Add cmd_spl command
In reply to Simon SchwarzThis adds a spl command to the u-boot.
Related config:CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
--- common/Makefile | 1 + common/cmd_spl.c | 214 ++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++++ include/cmd_spl.h | 30 ++++++ include/configs/devkit8000.h | 7 ++ 5 files changed, 283 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
common/Makefile +1 -0
@@ -160,6 +160,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
common/cmd_spl.c new file +214 -0
214 lines not on this page · raw message
doc/README.commands.spl new file +31 -0
@@ -0,0 +1,31 @@ +The spl command is used to export a boot parameter image to RAM. Later +it may implement more functions connected to the SPL. + +SUBCOMMAND EXPORT +To execute the command everything has to be in place as if bootm should be +used. (kernel image, initrd-image, fdt-image etc.) + +export has to subcommands: + atags: exports the ATAGS + fdt: exports the FDT + +Call is: +spl export <ftd|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt] + + +TYPICAL CALL + +on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +spl export atags /* export ATAGS */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write 0x80000100 0x680000 0x20000 /* write the image - one page */ + +call with FDT: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +spl export fdt 0x82000000 - 0x80000100 /* export FDT */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write <adress shown by spl export> 0x680000 0x20000
include/cmd_spl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ + +extern bootm_headers_t images; + +enum image_type {FDT ,ATAGS }; + +#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002)
include/configs/devkit8000.h +7 -0
@@ -354,4 +354,11 @@#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x200000 +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v5 3/6 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzLinux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 31 +++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-)
arch/arm/include/asm/omap_common.h +2 -0
@@ -77,6 +77,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +23 -8
@@ -63,6 +63,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -81,14 +93,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -138,3 +143,13 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* do board specific preperation before SPL +* Linux boot */ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH v5 4/6 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzThis 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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
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
--- arch/arm/cpu/armv7/omap-common/spl.c | 49 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 9 +++++- 2 files changed, 54 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +47 -2
@@ -35,6 +35,7 @@#include <asm/arch/mmc_host_def.h> #include <i2c.h> #include <image.h> +#include <asm/gpio.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -63,6 +64,25 @@ 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 +110,25 @@ 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 +137,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;
@@ -134,6 +172,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 ();
include/configs/devkit8000.h +7 -2
@@ -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 */
@@ -329,7 +331,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 */
@@ -359,6 +361,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 */
Signature · 1 line
1.7.4.1
PATCH v5 5/6 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzThis implements booting of Linux from NAND in SPL
Related config parameters:CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 62 +++++++++++++++++++++------- 1 files changed, 46 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +46 -16
@@ -24,6 +24,7 @@#include <asm/u-boot.h> #include <asm/utils.h> #include <asm/arch/sys_proto.h> +#include <asm/io.h> #include <nand.h> #include <timestamp_autogenerated.h> #include <version_autogenerated.h>
@@ -33,6 +34,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -46,26 +48,54 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* load parameter image */ +/* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v5 6/6 omap-common: fixes BSS overwriting problem
In reply to Simon Schwarzspl_nand overwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +2 -1
@@ -72,7 +72,8 @@ void spl_nand_load_image(void) CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);spl_parse_image_header (header);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header)); } else#endif {
Signature · 1 line
1.7.4.1
v6 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V5:
- Rebased on u-boot-ti
- fixed MAKEALL warnings and errors
- adapted to general gpio interface
Changes in V6:
- Change old commit message
based on:
- The new SPL layout
- OMAP3 new SPL layout
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105260)
- CONFIG_MACH_TYPE fix
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105809)
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)
Related to:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Simon Schwarz (6):
removed static from images in cmd_bootm.c
Add cmd_spl command
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common/spl: Add linux boot to SPL
omap-common: Add NAND SPL linux booting
omap-common: fixes BSS overwriting problem
arch/arm/cpu/armv7/omap-common/spl.c | 49 +++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 63 +++++++-- arch/arm/include/asm/omap_common.h | 2 + board/timll/devkit8000/devkit8000.c | 31 +++- common/Makefile | 1 + common/cmd_bootm.c | 2 +- common/cmd_spl.c | 214 +++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++ include/cmd_spl.h | 30 ++++ include/configs/devkit8000.h | 16 ++- 10 files changed, 410 insertions(+), 29 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
Signature · 1 line
1.7.4.1
PATCH v6 1/6 removed static from images in cmd_bootm.c
This removes static modifier from images variable in cmd_bootm.c.
---
V6 changes:
- removed the mention of savebp from commit message
--- common/cmd_bootm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bootm.c +1 -1
@@ -156,7 +156,7 @@ static boot_os_fn *boot_os[] = {#endif }; -static bootm_headers_t images;/* pointers to os/initrd/fdt images */ +bootm_headers_t images;/* pointers to os/initrd/fdt images */ /* Allow for arch specific config before we boot */ void __arch_preboot_os (void )
Signature · 1 line
1.7.4.1
Wolfgang Denk
AppliedPATCH v6 1/6 removed static from images in cmd_bootm.c
Dear Simon Schwarz,
Quoted 10 lines · In message <[email protected]> you…
This removes static modifier from images variable in
cmd_bootm.c.Signed-off-by Simon Schwarz <[email protected]>---
V6 changes:
- removed the mention of savebp from commit message--- common/cmd_bootm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "If you can, help others. If you can't, at least don't hurt others." - the Dalai Lama
PATCH v6 2/6 Add cmd_spl command
In reply to Simon SchwarzThis adds a spl command to the u-boot.
Related config:CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
--- common/Makefile | 1 + common/cmd_spl.c | 214 ++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++++ include/cmd_spl.h | 30 ++++++ include/configs/devkit8000.h | 7 ++ 5 files changed, 283 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
common/Makefile +1 -0
@@ -160,6 +160,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
common/cmd_spl.c new file +214 -0
214 lines not on this page · raw message
doc/README.commands.spl new file +31 -0
@@ -0,0 +1,31 @@ +The spl command is used to export a boot parameter image to RAM. Later +it may implement more functions connected to the SPL. + +SUBCOMMAND EXPORT +To execute the command everything has to be in place as if bootm should be +used. (kernel image, initrd-image, fdt-image etc.) + +export has to subcommands: + atags: exports the ATAGS + fdt: exports the FDT + +Call is: +spl export <ftd|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt] + + +TYPICAL CALL + +on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +spl export atags /* export ATAGS */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write 0x80000100 0x680000 0x20000 /* write the image - one page */ + +call with FDT: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +spl export fdt 0x82000000 - 0x80000100 /* export FDT */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write <adress shown by spl export> 0x680000 0x20000
include/cmd_spl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ + +extern bootm_headers_t images; + +enum image_type {FDT ,ATAGS }; + +#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002)
include/configs/devkit8000.h +7 -0
@@ -354,4 +354,11 @@#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x200000 +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
Wolfgang Denk
AppliedPATCH v6 2/6 Add cmd_spl command
Dear Simon Schwarz,
Quoted 31 lines · In message <[email protected]> you…
This adds a spl command to the u-boot.
Related config:
CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to useSigned-off-by Simon Schwarz <[email protected]>---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help messageV3 changes:
FIX added missing bracketsV4 changes:
CHG Corrected argument number in comments
CHG added check forCONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
Quoted 10 lines
--- common/Makefile | 1 + common/cmd_spl.c | 214 ++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++++ include/cmd_spl.h | 30 ++++++ include/configs/devkit8000.h | 7 ++ 5 files changed, 283 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Build a system that even a fool can use and only a fool will want to use it.
PATCH v6 2/6 Add cmd_spl command
In reply to Simon SchwarzDear Simon Schwarz,
Quoted 9 lines · In message <[email protected]> you…
This adds a spl command to the u-boot.
Related config:
CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to useSigned-off-by Simon Schwarz <[email protected]>
...
Review line 2
Quoted 4 lines
+++
b/common/cmd_spl.c(quoted diff) +2
-0@@ -0,0 +1,214 @@ +/* Copyright (C) 2011 + * Corscience GmbH & Co. KG - Simon Schwarz <[email protected]>
Incorrect multiline comment style.
common/cmd_spl.c line 81
Quoted 9 lines
common/cmd_spl.c new file +9
-0+int spl_export_fdt (int argc,char *const argv[]) +{ +#ifdef CONFIG_OF_LIBFDT +/* Create subcommand string */ +char *subcommand[] = {"start" ,"loados" , +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH +"ramdisk" , +#endif +"fdt" ,"cmdline" ,"bdt" ,"prep" ,'\0' };
Please format struct entries one per line.
common/cmd_spl.c line 111
Quoted 5 lines
common/cmd_spl.c new file +5
-0+char *subcommand[] = {"start" ,"loados" , +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH +"ramdisk" , +#endif +"cmdline" ,"bdt" ,"prep" ,'\0' };
Ditto.
common/cmd_spl.c line 207
Quoted 7 lines
common/cmd_spl.c new file +7
-0+/* Arguments: +* 1: subcommand +* 2: image_type +* 3: nand_offset +* 4: kernel_addr +* 5: initrd_addr +* 6: fdt_adr */
Incorrect multiline comment style.
Review line 25
Quoted 2 lines
(quoted diff) +2
-0+/* Copyright (C) 2011 + * Corscience GmbH & Co. KG - Simon Schwarz <[email protected]>
Incorrect multiline comment style.
Please fix globally.
include/cmd_spl.h line 30
Quoted 4 lines
include/cmd_spl.h new file +4
-0+#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002)
Please remove unnecessary parens.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "You ain't experienced..." "Well, nor are you." "That's true. But the point is ... the point is ... the point is we've been not experienced for a lot longer than you. We've got a lot of experience of not having any experience." - Terry Pratchett, _Witches Abroad_
PATCH v6 3/6 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzLinux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 31 +++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-)
arch/arm/include/asm/omap_common.h +2 -0
@@ -77,6 +77,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +23 -8
@@ -63,6 +63,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -81,14 +93,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -138,3 +143,13 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* do board specific preperation before SPL +* Linux boot */ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH v6 3/6 devkit8000/spl: init GPMC for dm9000 in SPL
Dear Simon Schwarz,
Quoted 3 lines · In message <[email protected]> you…
Linux crashes if the GPMC isn't configured for the dm9000.
Signed-off-by Simon Schwarz <[email protected]>
...
board/timll/devkit8000/devkit8000.c int board_eth_init(bd_t *bis) · line 149
Quoted 3 lines
board/timll/devkit8000/devkit8000.c +3
-0+#ifdef CONFIG_SPL_OS_BOOT +/* do board specific preperation before SPL +* Linux boot */
Incorrect multiline comment style.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The software required `Windows 95 or better', so I installed Linux.
PATCH v6 4/6 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzThis 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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
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
--- arch/arm/cpu/armv7/omap-common/spl.c | 49 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 9 +++++- 2 files changed, 54 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +47 -2
@@ -35,6 +35,7 @@#include <asm/arch/mmc_host_def.h> #include <i2c.h> #include <image.h> +#include <asm/gpio.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -63,6 +64,25 @@ 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 +110,25 @@ 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 +137,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;
@@ -134,6 +172,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 ();
include/configs/devkit8000.h +7 -2
@@ -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 */
@@ -329,7 +331,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 */
@@ -359,6 +361,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 */
Signature · 1 line
1.7.4.1
PATCH v6 4/6 omap-common/spl: Add linux boot to SPL
Dear Simon Schwarz,
Quoted 7 lines · In message <[email protected]> you…
+/* Return the value of the U-boot key
+ *
+ * RETURN
+ * 0 if not pressed
+ * positiv if pressed
+ */
Incorrect multiline comment style.
Please fix globally in _all_ your patches.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I find this a nice feature but it is not according to the documen-
tation. Or is it a BUG?" "Let's call it an accidental feature. :-)"
- Larry Wall in <[email protected]>PATCH v6 5/6 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzThis implements booting of Linux from NAND in SPL
Related config parameters:CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 62 +++++++++++++++++++++------- 1 files changed, 46 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +46 -16
@@ -24,6 +24,7 @@#include <asm/u-boot.h> #include <asm/utils.h> #include <asm/arch/sys_proto.h> +#include <asm/io.h> #include <nand.h> #include <timestamp_autogenerated.h> #include <version_autogenerated.h>
@@ -33,6 +34,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -46,26 +48,54 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* load parameter image */ +/* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v6 6/6 omap-common: fixes BSS overwriting problem
In reply to Simon Schwarzspl_nand overwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!
---
V2 changes:
nothing
V3 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +2 -1
@@ -72,7 +72,8 @@ void spl_nand_load_image(void) CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);spl_parse_image_header (header);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header)); } else#endif {
Signature · 1 line
1.7.4.1
v7 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V5:
- Rebased on u-boot-ti
- fixed MAKEALL warnings and errors
- adapted to general gpio interface
Changes in V6:
- Change old commit message
Changes in V7:
- Correct style and format errors
based on:
- The new SPL layout
- OMAP3 new SPL layout
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105260)
- CONFIG_MACH_TYPE fix
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105809)
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)
Related to:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Simon Schwarz (5):
Add cmd_spl command
omap-common: Add NAND SPL linux booting
omap-common/spl: Add linux boot to SPL
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common: fixes BSS overwriting problem
arch/arm/cpu/armv7/omap-common/spl.c | 51 +++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 63 ++++++-- arch/arm/include/asm/omap_common.h | 2 + board/timll/devkit8000/devkit8000.c | 33 ++++- common/Makefile | 1 + common/cmd_spl.c | 224 +++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++ include/cmd_spl.h | 30 ++++ include/configs/devkit8000.h | 16 ++- 9 files changed, 423 insertions(+), 28 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
Signature · 1 line
1.7.4.1
PATCH v7 1/5 Add cmd_spl command
From: Simon Schwarz <[email protected]>
This adds a spl command to the u-boot.
Related config:CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style, cosmetic changes
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113499) --- common/Makefile | 1 + common/cmd_spl.c | 224 ++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++++ include/cmd_spl.h | 30 ++++++ include/configs/devkit8000.h | 7 ++ 5 files changed, 293 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
common/Makefile +1 -0
@@ -164,6 +164,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o # others ifdef CONFIG_DDR_SPD
common/cmd_spl.c new file +224 -0
224 lines not on this page · raw message
doc/README.commands.spl new file +31 -0
@@ -0,0 +1,31 @@ +The spl command is used to export a boot parameter image to RAM. Later +it may implement more functions connected to the SPL. + +SUBCOMMAND EXPORT +To execute the command everything has to be in place as if bootm should be +used. (kernel image, initrd-image, fdt-image etc.) + +export has to subcommands: + atags: exports the ATAGS + fdt: exports the FDT + +Call is: +spl export <ftd|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt] + + +TYPICAL CALL + +on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +spl export atags /* export ATAGS */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write 0x80000100 0x680000 0x20000 /* write the image - one page */ + +call with FDT: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +spl export fdt 0x82000000 - 0x80000100 /* export FDT */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write <adress shown by spl export> 0x680000 0x20000
include/cmd_spl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ + +extern bootm_headers_t images; + +enum image_type {FDT ,ATAGS }; + +#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002)
include/configs/devkit8000.h +7 -0
@@ -361,4 +361,11 @@#define CONFIG_SYS_SPL_MALLOC_START 0x80108000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v7 2/5 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
This implements booting of Linux from NAND in SPL
Related config parameters:CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 62 +++++++++++++++++++++------- 1 files changed, 46 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +46 -16
@@ -24,6 +24,7 @@#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>
@@ -32,6 +33,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -45,26 +47,54 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* load parameter image */ +/* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v7 2/5 omap-common: Add NAND SPL linux booting
Quoted 3 lines · Simon Schwarz
From: Simon Schwarz <[email protected]>
This implements booting of Linux from NAND in SPL
[snip]
Quoted 5 lines
+ ? ? ? ? ? ? ? /* load parameter image */
+ ? ? ? ? ? ? ? /* load to temp position sincenand_spl_load_imagereads
+ ? ? ? ? ? ? ? ?* a whole block which is typically larger than
+ ? ? ? ? ? ? ? ?*CONFIG_CMD_SAVEBP_WRITE_SIZEtherefore may overwrite
+ ? ? ? ? ? ? ? ?* following sections like BSS */
In v6 Wolfgang asked you to fix incorrect multiline comments in the whole series, but this is still here :( This is the only problem I see so if you can't respin this patch shortly I'll update the comment and SIgned-off-by the change since it's just reformatting a comment, which I assume is fine with you.
Signature · 1 line
Tom
PATCH v7 3/5 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
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(-)
arch/arm/cpu/armv7/omap-common/spl.c +49 -2
@@ -35,6 +35,7 @@#include <i2c.h> #include <image.h> #include <malloc.h> +#include <asm/gpio.h> 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 ();
include/configs/devkit8000.h +7 -2
@@ -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 */
Signature · 1 line
1.7.4.1
PATCH v7 4/5 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
Linux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
noting
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113500) --- arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 33 +++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-)
arch/arm/include/asm/omap_common.h +2 -0
@@ -78,6 +78,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header);void omap_rev_string (char *omap_rev_string); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +25 -8
@@ -63,6 +63,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -81,14 +93,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -138,3 +143,15 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* +* Do board specific preperation before SPL +* Linux boot +*/ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH v7 4/5 devkit8000/spl: init GPMC for dm9000 in SPL
Quoted 3 lines · Simon Schwarz
From: Simon Schwarz <[email protected]>
Linux crashes if the GPMC isn't configured for the dm9000.
Not a NAK since the code does this before the patch as well, but a clean up to devkit8000 I'd like to see is switching this over to enable_gpmc_cs_config()
Signature · 1 line
Tom
PATCH v7 5/5 omap-common: fixes BSS overwriting problem
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
spl_nand overwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
nothing
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
nothing
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +2 -1
@@ -71,7 +71,8 @@ void spl_nand_load_image(void) CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);spl_parse_image_header (header);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header)); } else#endif {
Signature · 1 line
1.7.4.1
PATCH v7 5/5 omap-common: fixes BSS overwriting problem
Quoted 10 lines · Simon Schwarz
From: Simon Schwarz <[email protected]>
spl_nandoverwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!Signed-off-by Simon Schwarz <[email protected]>---
arch/arm/cpu/armv7/omap-common/spl_nand.c void spl_nand_load_image(void) · line 75
Quoted 6 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +2
-1@@ -71,7 +71,8 @@ void spl_nand_load_image(void) CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);spl_parse_image_header (header);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header));
^---
Do you mean maybe sizeof(*header) ?
However, spl_image.load_addr was already decremented in spl_parse_image_header() and correctly set to 64 byte before the load address. Do we really need it ?
I found the readon of the kernel corrupt image. We are setting a very hard address in /nand_spl_simple.c:
ecc_calc = (u_char *)(CONFIG_SYS_SDRAM_BASE + 0x10000);
Because the image for a TI SOC is loaded at 0x80008000, we have a conflict and the image is corrupted where the ECC is computed.
It is not a really good idea to fix in this way where to compute the ECC. Should be not better to put it in the CONFIG_SYS_INIT_RAM_ADDR area ?
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v7 5/5 omap-common: fixes BSS overwriting problem
Quoted 31 lines · Stefano Babic
Quoted 10 lines · Simon Schwarz
From: Simon Schwarz<[email protected]>
spl_nandoverwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!Signed-off-by Simon Schwarz<[email protected]>---
arch/arm/cpu/armv7/omap-common/spl_nand.c void spl_nand_load_image(void) · line 75
Quoted 6 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +2
-1@@ -71,7 +71,8 @@ void spl_nand_load_image(void) CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);spl_parse_image_header (header);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header));^---Do you mean maybe
sizeof(*header)?However, spl_image.load_addr was already decremented in
spl_parse_image_header()and correctly set to 64 byte before the load address. Do we really need it ?I found the readon of the kernel corrupt image. We are setting a very hard address in /nand_spl_simple.c:
ecc_calc= (u_char*)(CONFIG_SYS_SDRAM_BASE +0x10000);
Quoted 9 lines
Because the image for a TI SOC is loaded at
0x80008000, we have a conflict and the image is corrupted where the ECC is computed.It is not a really good idea to fix in this way where to compute the ECC. Should be not better to put it in the
CONFIG_SYS_INIT_RAM_ADDRarea ?Best regards,
Stefano Babic
Hmm. This is from the former nand_spl.
Why not use malloc for this? Thanks to changes in the FAT driver we now have it in the SPL.
I don't see a reason to have this in SRAM when SDRAM is available.
Regards
Simon
PATCH v7 5/5 omap-common: fixes BSS overwriting problem
Quoted 1 line · Simon Schwarz
Hmm. This is from the former
nand_spl.
Yes, I know. Until the load address does not conflict with the fix offset, we have never seen this problem.
Quoted 1 line
Why not use malloc for this?
Of course, malloc - I want only to get rid of such hardcoded values ;-)
Quoted 4 lines
Thanks to changes in the FAT driver we now
have it in the SPL.I don't see a reason to have this in SRAM when SDRAM is available.
No reason at all, of course.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v7 5/5 omap-common: fixes BSS overwriting problem
In reply to Simon SchwarzDear Simon Schwarz,
Quoted 3 lines · In message <[email protected]> you wrote:
Why not use malloc for this? Thanks to changes in the FAT driver we now have it in the SPL.
No, please do NOT do that!!!
I knew I should have never accepted to allow this in the SPL fromt he beginning, and indeed it was a mistake not to block this.
Please now don't use it without thinking if it's really, really needed!
I recommend NOT to use malloc() at all in SPL code.
[Guess I should have a more carefull eye on all SPL related submissions and install a "grep-malloc-and-NAK" script. :-( ]
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The only perfect science is hind-sight.
PATCH v7 5/5 omap-common: fixes BSS overwriting problem
In reply to Simon SchwarzQuoted 4 lines · Simon Schwarz
Quoted 3 lines · Stefano Babic
I found the readon of the kernel corrupt image. We are setting a very hard address in /nand_spl_simple.c:
Quoted 8 lines
Quoted 8 lines
ecc_calc= (u_char*)(CONFIG_SYS_SDRAM_BASE +0x10000);Because the image for a TI SOC is loaded at
0x80008000, we have a conflict and the image is corrupted where the ECC is computed.It is not a really good idea to fix in this way where to compute the ECC. Should be not better to put it in the
CONFIG_SYS_INIT_RAM_ADDRarea ?
There's a patch to fix this (with some minor changes requested):
http://patchwork.ozlabs.org/patch/128018/
Quoted 10 lines
Quoted 3 lines
Best regards,
Stefano BabicHmm. This is from the former
nand_spl.Why not use malloc for this? Thanks to changes in the FAT driver we now have it in the SPL.
I don't see a reason to have this in SRAM when SDRAM is available.
nand_spl_simple.c is used by some very small SPL targets -- 4K or so. malloc doesn't fit.
-Scott
PATCH v7 5/5 omap-common: fixes BSS overwriting problem
In reply to Stefano BabicQuoted 26 lines · Stefano Babic
Quoted 10 lines · Simon Schwarz
From: Simon Schwarz<[email protected]>
spl_nandoverwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!Signed-off-by Simon Schwarz<[email protected]>---
arch/arm/cpu/armv7/omap-common/spl_nand.c void spl_nand_load_image(void) · line 75
Quoted 6 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +2
-1@@ -71,7 +71,8 @@ void spl_nand_load_image(void) CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);spl_parse_image_header (header);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header));^---Do you mean maybe
sizeof(*header)?However, spl_image.load_addr was already decremented in
spl_parse_image_header()and correctly set to 64 byte before the load address. Do we really need it ?
[SNIP]
Quoted 3 lines
Best regards,
Stefano Babic
You are right -> V9. Lets see if we get it to two digits ;)
Regards
Simon
v7 cover SPL Linux boot
In reply to Simon SchwarzQuoted 22 lines · Simon Schwarz
Adds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V5:
- Rebased on u-boot-ti
- fixed MAKEALL warnings and errors
- adapted to general gpio interface
Changes in V6:
- Change old commit messageChanges in V7:
- Correct style and format errorsbased on:
- The new SPL layout
- OMAP3 new SPL layout
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105260)
-CONFIG_MACH_TYPEfix
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105809)
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)
Quoted 2 lines
Related to:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102669
Hi Simon,
I am trying your patches on the Beagleboard - really I want to get a feeling how it is possible to introduce this mechanism for other architectures, too.
I have the major issue when the SPL gives the control to the kernel ( Linux-3.2.0-rc4-00154-g8e8da02). The code is started, however I get the error "uncompression error" in the gunzip() function of the kernel - really at the beginning of the code.
I have already checked the boot parameters area at address 0x80000100 created by spl export, and it is the same as the parameters generated by bootm under u-boot (where, of course, everything is working fine).
In jump_to_image_linux() all parameters are correct and image_entry points to the load address read from the uImage header (0x80008000 for TI kernel).
The most obvious thing could be that the Kernel image is not copied correctly from NAND to RAM, but checking some parts of memory I have not found any discrepancy. Of course, I must check better this point, but it seems to me not so probable that there is an issue with the NAND.
I have also added the cache functions to invalidate I-Cache to the SPL, calling the cleanup_before_linux() function - but no success. Do you have any hints ?
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
v8 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V5:
- Rebased on u-boot-ti
- fixed MAKEALL warnings and errors
- adapted to general gpio interface
Changes in V6:
- Change old commit message
Changes in V7:
- Correct style and format errors
Changes in V8:
- rebased on u-boot
based on:
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)
Simon Schwarz (5):
Add cmd_spl command
omap-common: Add NAND SPL linux booting
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common: fixes BSS overwriting problem
omap-common/spl: Add linux boot to SPL
arch/arm/cpu/armv7/omap-common/spl.c | 51 +++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 65 +++++++-- arch/arm/include/asm/omap_common.h | 2 + board/timll/devkit8000/devkit8000.c | 33 ++++- common/Makefile | 1 + common/cmd_spl.c | 224 +++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++ include/cmd_spl.h | 30 ++++ include/configs/devkit8000.h | 13 ++- 9 files changed, 423 insertions(+), 27 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
Signature · 1 line
1.7.4.1
PATCH v8 1/5 Add cmd_spl command
From: Simon Schwarz <[email protected]>
This adds a spl command to the u-boot.
Related config:CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style, cosmetic changes
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113499) REBASE on u-boot --- common/Makefile | 1 + common/cmd_spl.c | 224 ++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++++ include/cmd_spl.h | 30 ++++++ include/configs/devkit8000.h | 7 ++ 5 files changed, 293 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
common/Makefile +1 -0
@@ -164,6 +164,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o # others ifdef CONFIG_DDR_SPD
common/cmd_spl.c new file +224 -0
224 lines not on this page · raw message
doc/README.commands.spl new file +31 -0
@@ -0,0 +1,31 @@ +The spl command is used to export a boot parameter image to RAM. Later +it may implement more functions connected to the SPL. + +SUBCOMMAND EXPORT +To execute the command everything has to be in place as if bootm should be +used. (kernel image, initrd-image, fdt-image etc.) + +export has to subcommands: + atags: exports the ATAGS + fdt: exports the FDT + +Call is: +spl export <ftd|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt] + + +TYPICAL CALL + +on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +spl export atags /* export ATAGS */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write 0x80000100 0x680000 0x20000 /* write the image - one page */ + +call with FDT: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +spl export fdt 0x82000000 - 0x80000100 /* export FDT */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write <adress shown by spl export> 0x680000 0x20000
include/cmd_spl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ + +extern bootm_headers_t images; + +enum image_type {FDT ,ATAGS }; + +#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002)
include/configs/devkit8000.h +7 -0
@@ -368,4 +368,11 @@#define CONFIG_SYS_SPL_MALLOC_START 0x80208000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v8 2/5 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
This implements booting of Linux from NAND in SPL
Related config parameters:CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
nothing
V8 changes:
FIX multiline comment style
REBASE on u-boot
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 64 +++++++++++++++++++++------- 1 files changed, 48 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +48 -16
@@ -24,6 +24,7 @@#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>
@@ -32,6 +33,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -45,26 +47,56 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* +* load parameter image +* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v8 3/5 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
Linux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
noting
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113500)
V8 changes:
REBASE on u-boot
--- arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 33 +++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-)
arch/arm/include/asm/omap_common.h +2 -0
@@ -87,6 +87,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header);void omap_rev_string (char *omap_rev_string); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +25 -8
@@ -63,6 +63,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -81,14 +93,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -138,3 +143,15 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* +* Do board specific preperation before SPL +* Linux boot +*/ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH v8 4/5 omap-common: fixes BSS overwriting problem
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
spl_nand overwrote BSS section because it reads a whole block everytime. Now loads the block to spare area and just copy the needed junk to destination. Whole block read is necessary for ecc check!
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
nothing
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
nothing
V8 changes:
REBASE on u-boot
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +2 -1
@@ -73,7 +73,8 @@ void spl_nand_load_image(void) CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);spl_parse_image_header (header);nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); + spl_image.size, + (void *)spl_image.load_addr -sizeof (header)); } else#endif {
Signature · 1 line
1.7.4.1
PATCH v8 5/5 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
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)
V8 changes:
REBASE on u-boot
--- arch/arm/cpu/armv7/omap-common/spl.c | 51 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 6 +++- 2 files changed, 54 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +49 -2
@@ -35,6 +35,7 @@#include <i2c.h> #include <image.h> #include <malloc.h> +#include <asm/gpio.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -64,6 +65,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 );
@@ -91,7 +112,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 )(u32 *)__attribute__ ((noreturn)); image_entry_noargs_t image_entry =
@@ -104,8 +144,8 @@ static void jump_to_image_no_args(void)#endif image_entry ((u32 *)&boot_params_ptr); } -void jump_to_image_no_args (void ) __attribute__ ((noreturn)); +void board_init_r (gd_t *id,ulong dummy) {u32 boot_device;
@@ -142,6 +182,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 ();
include/configs/devkit8000.h +5 -1
@@ -36,6 +36,7 @@#define CONFIG_OMAP34XX 1/* which is a 34XX */ #define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_DEVKIT8000 1/* working with DevKit8000 */ +#define CONFIG_MACH_TYPE MACH_TYPE_DEVKIT8000/* * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
@@ -339,7 +340,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 */
@@ -373,6 +374,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 */
Signature · 1 line
1.7.4.1
v9 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V5:
- Rebased on u-boot-ti
- fixed MAKEALL warnings and errors
- adapted to general gpio interface
Changes in V6:
- Change old commit message
Changes in V7:
- Correct style and format errors
Changes in V8:
- rebased on u-boot
Changes in V9:
- Deleted a left-over patch from the series this also fixed the first problem mentioned here:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/119452
based on:
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)
Simon Schwarz (4):
Add cmd_spl command
omap-common: Add NAND SPL linux booting
devkit8000/spl: init GPMC for dm9000 in SPL
omap-common/spl: Add linux boot to SPL
arch/arm/cpu/armv7/omap-common/spl.c | 51 +++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 64 ++++++-- arch/arm/include/asm/omap_common.h | 2 + board/timll/devkit8000/devkit8000.c | 33 ++++- common/Makefile | 1 + common/cmd_spl.c | 224 +++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++ include/cmd_spl.h | 30 ++++ include/configs/devkit8000.h | 13 ++- 9 files changed, 422 insertions(+), 27 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
Signature · 1 line
1.7.4.1
PATCH v9 1/4 Add cmd_spl command
From: Simon Schwarz <[email protected]>
This adds a spl command to the u-boot.
Related config:CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style, cosmetic changes
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113499) REBASE on u-boot --- common/Makefile | 1 + common/cmd_spl.c | 224 ++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++++ include/cmd_spl.h | 30 ++++++ include/configs/devkit8000.h | 7 ++ 5 files changed, 293 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
common/Makefile +1 -0
@@ -164,6 +164,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o # others ifdef CONFIG_DDR_SPD
common/cmd_spl.c new file +224 -0
224 lines not on this page · raw message
doc/README.commands.spl new file +31 -0
@@ -0,0 +1,31 @@ +The spl command is used to export a boot parameter image to RAM. Later +it may implement more functions connected to the SPL. + +SUBCOMMAND EXPORT +To execute the command everything has to be in place as if bootm should be +used. (kernel image, initrd-image, fdt-image etc.) + +export has to subcommands: + atags: exports the ATAGS + fdt: exports the FDT + +Call is: +spl export <ftd|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt] + + +TYPICAL CALL + +on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +spl export atags /* export ATAGS */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write 0x80000100 0x680000 0x20000 /* write the image - one page */ + +call with FDT: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +spl export fdt 0x82000000 - 0x80000100 /* export FDT */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write <adress shown by spl export> 0x680000 0x20000
include/cmd_spl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ + +extern bootm_headers_t images; + +enum image_type {FDT ,ATAGS }; + +#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002)
include/configs/devkit8000.h +7 -0
@@ -368,4 +368,11 @@#define CONFIG_SYS_SPL_MALLOC_START 0x80208000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100)#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v9 1/4 Add cmd_spl command
common/cmd_spl.c
Quoted 4 lines · On Tuesday 06 December 2011 13:34:35 Simon Schwarz wrote:
common/cmd_spl.c new file +1
-0+int call_bootm (int argc,char *const argv[],char *subcommand[])
static
Quoted 1 line
+int
spl_export_fdt(int argc, char * const argv[])
static
common/cmd_spl.c line 80
Quoted 3 lines
common/cmd_spl.c new file +3
-0+#ifdef CONFIG_OF_LIBFDT +/* Create subcommand string */ + char *subcommand[] = {"start",
that start needs to be on a new line
common/cmd_spl.c line 89
Quoted 1 line
common/cmd_spl.c new file +1
-0+ '\0'};
if this were NULL (and the call_bootm() checked for that) would be more natural to argv[] processing
Quoted 1 line
+int
spl_export_atags(int argc, char * const argv[])
static
common/cmd_spl.c line 119
Quoted 5 lines
common/cmd_spl.c new file +5
-0+char *subcommand[] = {"start" ,"loados" , +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH +"ramdisk" , +#endif +"cmdline" ,"bdt" ,"prep" ,'\0' };
char *subcommand[] = {
... some strings ...
... some more strings ...
};Quoted 1 line
+int
spl_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static
common/cmd_spl.c
Quoted 2 lines
common/cmd_spl.c new file +2
-0+{ +
delete that newline
common/cmd_spl.c
Quoted 1 line
common/cmd_spl.c new file +1
-0+cmd_tbl_t *c;
i think you can const this ...
Quoted 1 line
+int
do_spl(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static
common/cmd_spl.c
Quoted 1 line
common/cmd_spl.c new file +1
-0+cmd_tbl_t *c;
i think you can const this ...
common/cmd_spl.c
Quoted 1 line
common/cmd_spl.c new file +1
-0+ cmd = (int )c->cmd;
you're casting a pointer to an integer ? wtf is going on ?
include/cmd_spl.h
Quoted 2 lines
include/cmd_spl.h new file +0
-0
needs #ifdef protection against multiple inclusion
Quoted 1 line
+extern
bootm_headers_timages;
i get the feeling this isn't the right place for this and it should be in include/image.h instead ...
Quoted 1 line
+enum
image_type{FDT, ATAGS};
these names are too short, and the "image" namespace is taken by image.h already ... but leading on to the following defines ...
include/cmd_spl.h line 30
Quoted 4 lines
include/cmd_spl.h new file +4
-0+#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002)
why do these need to be defines ?
enum spl_export_type {
SPL_EXPORT_FDT = 1,
SPL_EXPORT_ATAGS = 2,
};also, drop the paren here
include/configs/devkit8000.h
Quoted 2 lines
include/configs/devkit8000.h +0
-0
generally board updates should be a sep commit
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111207/b375c51a/attachment.pgp>
PATCH v9 1/4 Add cmd_spl command
Hi Mike,
2011/12/8 Mike Frysinger <[email protected]>:
Quoted 7 lines · On Tuesday 06 December 2011 13:34:35 Simon Schwarz wrote:
common/cmd_spl.c
Quoted 4 lines
common/cmd_spl.c new file +1
-0+int call_bootm (int argc,char *const argv[],char *subcommand[])static
done.
Quoted 5 lines
Quoted 2 lines
+int
spl_export_fdt(int argc, char * const argv[])static
done.
Quoted 8 lines
Quoted 4 lines
+#ifdef
CONFIG_OF_LIBFDT
+ ? ? /* Create subcommand string */
+ ? ? char *subcommand[] = {"start",that start needs to be on a new line
Quoted 1 line
+ ? ? '\0'};
ok. Will change this to NULL.
Quoted 7 lines
if this were NULL (and the
call_bootm()checked for that) would be more natural to argv[] processingQuoted 1 line
+int
spl_export_atags(int argc, char * const argv[])static
done
Quoted 11 lines
common/cmd_spl.c
Quoted 6 lines
+ ? ? char *subcommand[] = {"start", "loados",
common/cmd_spl.c new file +4
-0+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH + ? ? "ramdisk", +#endif + ? ? "cmdline", "bdt", "prep", '\0'};char *subcommand[] = {
? ? ? ?... some strings ...
? ? ? ?... some more strings ...
};
done
Quoted 5 lines
Quoted 2 lines
+int
spl_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])static
done
Quoted 5 lines
common/cmd_spl.c
Quoted 2 lines
common/cmd_spl.c new file +2
-0+{ +delete that newline
done
Quoted 4 lines
Quoted 1 line
+ ? ?
cmd_tbl_t*c;i think you can const this ...
right should work -> done.
Quoted 4 lines
Quoted 1 line
+int
do_spl(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])static
done.
Quoted 4 lines
Quoted 1 line
+ ? ?
cmd_tbl_t*c;i think you can const this ...
done.
Quoted 4 lines
Quoted 1 line
+ ? ? ? ? ? ? cmd = (int)c->cmd;
you're casting a pointer to an integer ? ?wtf is going on ?
This is the same as in bootm.c. cmd is overloaded with the state of the statemachine. It is used as an integer.
Quoted 5 lines
include/cmd_spl.h
Quoted 2 lines
include/cmd_spl.h new file +0
-0needs #ifdef protection against multiple inclusion
right. done.
Quoted 5 lines
Quoted 1 line
+extern
bootm_headers_timages;i get the feeling this isn't the right place for this and it should be in
include/image.hinstead ...
I trust you with this ;)
Quoted 4 lines
Quoted 1 line
+enum
image_type{FDT, ATAGS};these names are too short, and the "image" namespace is taken by
image.halready ... but leading on to the following defines ...
Hm - it seems that they are not used anyway. deleted.
Quoted 12 lines
include/cmd_spl.h
Quoted 5 lines
include/cmd_spl.h new file +4
-0+#define SPL_EXPORT ? (0x00000001) + +#define SPL_EXPORT_FDT ? ? ? ? ? ? ? (0x00000001) +#define SPL_EXPORT_ATAGS ? ? (0x00000002)why do these need to be defines ?
enumspl_export_type{
? ? ? ?SPL_EXPORT_FDT = 1,
? ? ? ?SPL_EXPORT_ATAGS = 2,
};
Quoted 2 lines
also, drop the paren here
I used bootm.c as reference - it's the same there.
Quoted 4 lines
include/configs/devkit8000.h
Quoted 2 lines
include/configs/devkit8000.h +0
-0generally board updates should be a sep commit
will do.
Quoted 1 line
-mike
Thanks!
Simon
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
This implements booting of Linux from NAND in SPL
Related config parameters:CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
nothing
V8 changes:
FIX multiline comment style
REBASE on u-boot
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 64 +++++++++++++++++++++------- 1 files changed, 48 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +48 -16
@@ -24,6 +24,7 @@#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>
@@ -32,6 +33,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
@@ -45,26 +47,56 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* +* load parameter image +* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
Quoted 8 lines · Simon Schwarz
From: Simon Schwarz <[email protected]>
This implements booting of Linux from NAND in SPL
Related config parameters:
CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Quoted 6 lines
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)Signed-off-by Simon Schwarz <[email protected]>---
Hi Simon,
Quoted 22 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +2
-0@@ -24,6 +24,7 @@#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> @@ -32,6 +33,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );
arch/arm/cpu/armv7/omap-common/spl_nand.c void spl_nand_load_image(void) · line 51
Quoted 5 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +2
-0@@ -45,26 +47,56 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) {
Using a gpio or whatever mechanis is baord specific. What about to set a weak function and let that the board decides itself what to do ?
Not always a GPIO can be used for this purpose.
I have noted another issue. If the kernel image is not found, the fallback is to load u-boot. However, u-boot is searched at the address in NAND of the kernel, not at CONFIG_SYS_NAND_U_BOOT_OFFS.
This means that if the kernel is not loaded at all, the SPL starts to start a u-boot.bin instead of u-boot.img loaded at CONFIG_CMD_SPL_NAND_OFS, and this fails.
Quoted 13 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +13
-0+/* +* load parameter image +* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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;
arch/arm/cpu/armv7/omap-common/spl_nand.c void spl_nand_load_image(void) · line 74
Quoted 10 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +9
-0+ 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);
So if the parse function fails, we should have the fallback to u-boot, exactly as we have now the fallback from u-boot.img to u-boot.bin.
The function you write are in omap-common/spl_nand.c, but they are not specific for OMAP, and any architecture can profit from your work. What about to move common functions away from TI related directory ? I do not know which is the best place, maybe a new directory under the root as spllib ?
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
Quoted 42 lines · Stefano Babic
Quoted 8 lines · Simon Schwarz
From: Simon Schwarz<[email protected]>
This implements booting of Linux from NAND in SPL
Related config parameters:
CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDRQuoted 6 lines
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)Signed-off-by Simon Schwarz<[email protected]>---
Hi Simon,
Quoted 23 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +2
-0@@ -24,6 +24,7 @@#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> @@ -32,6 +33,7 @@void spl_nand_load_image (void ) {struct image_header *header; +int *src, *dst;switch (omap_boot_mode ()) {case NAND_MODE_HW_ECC :debug ("spl: nand - using hw ecc\n" );@@ -45,26 +47,56 @@ void spl_nand_load_image(void)
Quoted 7 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c void spl_nand_load_image(void) · line 51
Quoted 4 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +2
-0/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) {Using a gpio or whatever mechanis is baord specific. What about to set a weak function and let that the board decides itself what to do ?
Sounds reasonable to me. So I'am ok with this.
Quoted 30 lines
Not always a GPIO can be used for this purpose.
I have noted another issue. If the kernel image is not found, the fallback is to load u-boot. However, u-boot is searched at the address in NAND of the kernel, not at
CONFIG_SYS_NAND_U_BOOT_OFFS.This means that if the kernel is not loaded at all, the SPL starts to start a u-boot.bin instead of u-boot.img loaded at
CONFIG_CMD_SPL_NAND_OFS, and this fails.Quoted 19 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +18
-0+/* +* load parameter image +* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); + }
Quoted 8 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c void spl_nand_load_image(void) · line 74
Quoted 4 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +4
-0+/* load linux */ +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , +CONFIG_SYS_NAND_PAGE_SIZE , (void *)header); +spl_parse_image_header (header);So if the parse function fails, we should have the fallback to u-boot, exactly as we have now the fallback from u-boot.img to u-boot.bin.
Hm, I don't think that we want any fallback here. I would prefere an error message and hang. The direct boot is designed to be used in the field - so IMHO we don't want to start the bootloader automatically if a normal startup fails.
Quoted 6 lines
The function you write are in
omap-common/spl_nand.c, but they are not specific for OMAP, and any architecture can profit from your work. What about to move common functions away from TI related directory ? I do not know which is the best place, maybe a new directory under the root as spllib ?
Hm thats generally right. I would prefer lib_spl. Somehow it feels like going back to nand_spl times. Duno if there are better places?
The first two points I will fix/rework hopfully on monday (I'am not in the next two days)
Regards
Simon
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
Quoted 8 lines · Simon Schwarz
Quoted 4 lines
So if the parse function fails, we should have the fallback to u-boot, exactly as we have now the fallback from u-boot.img to u-boot.bin.
Hm, I don't think that we want any fallback here. I would prefere an error message and hang. The direct boot is designed to be used in the field - so IMHO we don't want to start the bootloader automatically if a normal startup fails.
this is also reasonable - we should drop the current behavior: if Linux is not found, SPL tries to start the loaded code as u-boot.bin.
Better to hang with a message.
Quoted 7 lines
Quoted 5 lines
The function you write are in
omap-common/spl_nand.c, but they are not specific for OMAP, and any architecture can profit from your work. What about to move common functions away from TI related directory ? I do not know which is the best place, maybe a new directory under the root as spllib ?Hm thats generally right. I would prefer
lib_spl. Somehow it feels like going back tonand_spltimes. Duno if there are better places?
Tom probably can suggest us something..
BR,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
Quoted 1 line · Stefano Babic
On 07/12/2011 18:57, Simon Schwarz wrote:
[snip]
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
The function you write are in
omap-common/spl_nand.c, but they are not specific for OMAP, and any architecture can profit from your work. What about to move common functions away from TI related directory ? I do not know which is the best place, maybe a new directory under the root as spllib ?Hm thats generally right. I would prefer
lib_spl. Somehow it feels like going back tonand_spltimes. Duno if there are better places?Tom probably can suggest us something..
common/spl_<a few files>.c ?
Signature · 1 line
Tom
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzDear Simon Schwarz,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 4 lines
So if the parse function fails, we should have the fallback to u-boot, exactly as we have now the fallback from u-boot.img to u-boot.bin.
Hm, I don't think that we want any fallback here. I would prefere an error message and hang. The direct boot is designed to be used in the field - so IMHO we don't want to start the bootloader automatically if a normal startup fails.
I feel it is better to start U-Boot and enable the user to analyze the situation instead of just hanging hard.
Just my 0.02#
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Very ugly or very beautiful women should be flattered on their
understanding, and mediocre ones on their beauty.
-- Philip Earl of ChesterfieldPATCH v9 2/4 omap-common: Add NAND SPL linux booting
Quoted 12 lines · Wolfgang Denk
Dear Simon Schwarz,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 4 lines
So if the parse function fails, we should have the fallback to u-boot, exactly as we have now the fallback from u-boot.img to u-boot.bin.
Hm, I don't think that we want any fallback here. I would prefere an error message and hang. The direct boot is designed to be used in the field - so IMHO we don't want to start the bootloader automatically if a normal startup fails.
Quoted 4 lines
I feel it is better to start U-Boot and enable the user to analyze the situation instead of just hanging hard.
Just my 0.02#
Personally I think also that having a fallback is a good idea. I have in mind a lot of boards that have not buttons or an available interface to a simple GPIO, making any interaction impossible. If we have not a fallback, we increase the risk for the end users to damage the boards if for example the kernel is updated.
Apart a mechanism with a GPIO, can we think to use in a simple way the console for this ? SPL supports it, and we could share the same mechanism for all boards, in such way as we stop the autoboot in U-Boot.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
Quoted 21 lines · On Thursday 08 December 2011 05:14:36 Stefano Babic wrote:
Quoted 9 lines · Wolfgang Denk
Quoted 7 lines · Simon Schwarz
Quoted 2 lines
So if the parse function fails, we should have the fallback to u-boot, exactly as we have now the fallback from u-boot.img to u-boot.bin.
Hm, I don't think that we want any fallback here. I would prefere an error message and hang. The direct boot is designed to be used in the field - so IMHO we don't want to start the bootloader automatically if a normal startup fails.
Quoted 4 lines
I feel it is better to start U-Boot and enable the user to analyze the situation instead of just hanging hard.
Just my 0.02#
Personally I think also that having a fallback is a good idea. I have in mind a lot of boards that have not buttons or an available interface to a simple GPIO, making any interaction impossible. If we have not a fallback, we increase the risk for the end users to damage the boards if for example the kernel is updated.
Quoted 3 lines
Apart a mechanism with a GPIO, can we think to use in a simple way the console for this ? SPL supports it, and we could share the same mechanism for all boards, in such way as we stop the autoboot in U-Boot.
isn't this the purpose of the boot progress / led code ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111208/22b61b99/attachment.pgp>
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
Quoted 6 lines · Mike Frysinger
Quoted 4 lines
Apart a mechanism with a GPIO, can we think to use in a simple way the console for this ? SPL supports it, and we could share the same mechanism for all boards, in such way as we stop the autoboot in U-Boot.
isn't this the purpose of the boot progress / led code ? -mike
Well, I would like to import less code in SPL to take it as small as possible. Under U-Boot we have a lot of possibilities, but we need only a simple way with SPL.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v9 2/4 omap-common: Add NAND SPL linux booting
Quoted 11 lines · On Thursday 08 December 2011 11:40:48 Stefano Babic wrote:
Quoted 6 lines · Mike Frysinger
Quoted 4 lines
Apart a mechanism with a GPIO, can we think to use in a simple way the console for this ? SPL supports it, and we could share the same mechanism for all boards, in such way as we stop the autoboot in U-Boot.
isn't this the purpose of the boot progress / led code ?
Well, I would like to import less code in SPL to take it as small as possible. Under U-Boot we have a lot of possibilities, but we need only a simple way with SPL.
the status led should be fairly light weight (once you've got the GPIO core). check out the two files:
drivers/misc/status_led.c
drivers/misc/gpio_led.c
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111208/770c175c/attachment.pgp>
PATCH v9 3/4 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
Linux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
noting
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113500)
V8 changes:
REBASE on u-boot
--- arch/arm/include/asm/omap_common.h | 2 ++ board/timll/devkit8000/devkit8000.c | 33 +++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-)
arch/arm/include/asm/omap_common.h +2 -0
@@ -87,6 +87,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header);void omap_rev_string (char *omap_rev_string); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +25 -8
@@ -63,6 +63,18 @@ int board_init(void)return 0 ; } +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); +writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); +writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); +writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); +writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); +writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); +writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -81,14 +93,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -138,3 +143,15 @@ int board_eth_init(bd_t *bis) return dm9000_initialize(bis); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* +* Do board specific preperation before SPL +* Linux boot +*/ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif
Signature · 1 line
1.7.4.1
PATCH v9 3/4 devkit8000/spl: init GPMC for dm9000 in SPL
Quoted 5 lines · Simon Schwarz
From: Simon Schwarz <[email protected]>
Linux crashes if the GPMC isn't configured for the dm9000.
Signed-off-by Simon Schwarz <[email protected]>
Since we have a little time before this goes into a 'next' branch, can you please rework this to an enable_gpmc_cs_config() call? Thanks.
Signature · 1 line
Tom
PATCH v9 4/4 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
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)
V8 changes:
REBASE on u-boot
--- arch/arm/cpu/armv7/omap-common/spl.c | 51 ++++++++++++++++++++++++++++++++- include/configs/devkit8000.h | 6 +++- 2 files changed, 54 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +49 -2
@@ -35,6 +35,7 @@#include <i2c.h> #include <image.h> #include <malloc.h> +#include <asm/gpio.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -64,6 +65,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 );
@@ -91,7 +112,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 )(u32 *)__attribute__ ((noreturn)); image_entry_noargs_t image_entry =
@@ -104,8 +144,8 @@ static void jump_to_image_no_args(void)#endif image_entry ((u32 *)&boot_params_ptr); } -void jump_to_image_no_args (void ) __attribute__ ((noreturn)); +void board_init_r (gd_t *id,ulong dummy) {u32 boot_device;
@@ -142,6 +182,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 ();
include/configs/devkit8000.h +5 -1
@@ -36,6 +36,7 @@#define CONFIG_OMAP34XX 1/* which is a 34XX */ #define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_DEVKIT8000 1/* working with DevKit8000 */ +#define CONFIG_MACH_TYPE MACH_TYPE_DEVKIT8000/* * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
@@ -339,7 +340,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 */
@@ -373,6 +374,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 */
Signature · 1 line
1.7.4.1
PATCH v9 4/4 omap-common/spl: Add linux boot to SPL
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 131
Quoted 8 lines · On Tuesday 06 December 2011 13:34:38 Simon Schwarz wrote:
arch/arm/cpu/armv7/omap-common/spl.c +4
-0+void jump_to_image_linux (void *arg) +{ +} +void jump_to_image_linux (void *) __attribute__ ((noreturn));
no need for this. do it in one line:__noreturn void jump_to_image_linux(void *arg)
{
...
}(include linux/compiler.h if need be)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111207/5c53fed8/attachment.pgp>
PATCH v9 4/4 omap-common/spl: Add linux boot to SPL
Quoted 16 lines · Mike Frysinger
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 131
Quoted 8 lines · On Tuesday 06 December 2011 13:34:38 Simon Schwarz wrote:
arch/arm/cpu/armv7/omap-common/spl.c +4
-0+void jump_to_image_linux (void *arg) +{ +} +void jump_to_image_linux (void *) __attribute__ ((noreturn));no need for this. ?do it in one line:
__noreturnvoidjump_to_image_linux(void *arg)
{
? ? ? ?...
}
Quoted 1 line
(include
linux/compiler.hif need be)
Style? I prefer the single line version myself but I've seen lots of the long form when poking around before.
Signature · 1 line
Tom
PATCH v9 4/4 omap-common/spl: Add linux boot to SPL
Quoted 17 lines · On Wednesday 07 December 2011 20:09:13 Tom Rini wrote:
Quoted 16 lines · Mike Frysinger
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 131
Quoted 8 lines · On Tuesday 06 December 2011 13:34:38 Simon Schwarz wrote:
arch/arm/cpu/armv7/omap-common/spl.c +4
-0+void jump_to_image_linux (void *arg) +{ +} +void jump_to_image_linux (void *) __attribute__ ((noreturn));no need for this. do it in one line:
__noreturnvoidjump_to_image_linux(void *arg){ ... }
Quoted 4 lines
Quoted 1 line
(include
linux/compiler.hif need be)Style? I prefer the single line version myself but I've seen lots of the long form when poking around before.
i think it's a matter of people not knowing the subtle behavior of gcc attributes and func prototypes vs func definitions.
i.e. they're used to seeing:
void foo(void) __attribute__((...));
so they try doing:
void foo(void) __attribute__((...))
{
}
which fails to build, so they get confused and just copy & paste the line twice since that works. that's my biggest problem with this -- the manual duplication of the func signature.
what they don't realize is you can do w/out duplication:
void __attribute__((...)) foo(void)
{
}
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111208/590bacb5/attachment.pgp>
PATCH v7 3/5 omap-common/spl: Add linux boot to SPL
Quoted 34 lines · Mike Frysinger
Quoted 17 lines · On Wednesday 07 December 2011 20:09:13 Tom Rini wrote:
Quoted 16 lines · Mike Frysinger
arch/arm/cpu/armv7/omap-common/spl.c void spl_parse_image_header(const struct image_header *header) · line 131
Quoted 8 lines · On Tuesday 06 December 2011 13:34:38 Simon Schwarz wrote:
arch/arm/cpu/armv7/omap-common/spl.c +4
-0+void jump_to_image_linux (void *arg) +{ +} +void jump_to_image_linux (void *) __attribute__ ((noreturn));no need for this. do it in one line:
__noreturnvoidjump_to_image_linux(void *arg){ ... }Quoted 4 lines
Quoted 1 line
(include
linux/compiler.hif need be)Style? I prefer the single line version myself but I've seen lots of the long form when poking around before.
i think it's a matter of people not knowing the subtle behavior of gcc attributes and func prototypes vs func definitions.
i.e. they're used to seeing:
void foo(void) __attribute__((...));so they try doing:
void foo(void) __attribute__((...))
{
}
Quoted 8 lines
which fails to build, so they get confused and just copy & paste the line twice since that works. that's my biggest problem with this -- the manual duplication of the func signature.
what they don't realize is you can do w/out duplication:
void __attribute__((...)) foo(void)
{
}
Quite possible. Wolfgang, is there a style thing here or would you like to see all of the long form versions converted to the short form and use <linux/compiler.h>? If so I'll make a note on my todo list... Thanks!
Signature · 4 lines
Tom -- Tom
PATCH v7 3/5 omap-common/spl: Add linux boot to SPL
Dear Tom Rini,
Quoted 9 lines · In message <CA+M6bXn-YQyYWcp++xN8Nyu283wfW2kOgiEQ8P08pbHsg7sM7w@mail.gmail.com>…
Quoted 5 lines
what they don't realize is you can do w/out duplication:
void __attribute__((...)) foo(void)
{
}Quite possible. Wolfgang, is there a style thing here or would you like to see all of the long form versions converted to the short form and use <
linux/compiler.h>? If so I'll make a note on my todo list... Thanks!
It would be nice to see this converted to using the short form.
Thanks in advance.
Quoted 8 lines
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printableOn Wednesday, December 7, 2011, Mike Frysinger <<a href=3D"mailto:vapier= @gentoo.org">vapier at gentoo.org</a>> wrote:<br>> On Wednesday 07 Decem= ber 2011 20:09:13 Tom Rini wrote:<br>>> On Wed, Dec 7, 2011 at 5:50 P= M, Mike Frysinger <<a href=3D"mailto:[email protected]">vapier at gentoo.or= g</a>> wrote:<br>
...
Um... please don't.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There are no data that cannot be plotted on a straight line if the axis are chosen correctly.
v9 cover SPL Linux boot
In reply to Simon SchwarzQuoted 2 lines · Simon Schwarz
Adds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
After talking with Albert on IRC about this, there's concern about the general impact (esp since the pre-req is a generic change) so it'd be best if people can try and Tested-by this series now and get this in early in the merge window to check for unexpected fallout.
Signature · 1 line
Tom
v9 cover SPL Linux boot
Quoted 10 lines · Tom Rini
Quoted 2 lines · Simon Schwarz
Adds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
After talking with Albert on IRC about this, there's concern about the general impact (esp since the pre-req is a generic change) so it'd be best if people can try and Tested-by this series now and get this in early in the merge window to check for unexpected fallout.
Agree with you - I am testing the patches and I am finding some issues - better to be ready when the merge window will open again.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
v9 cover SPL Linux boot
In reply to Simon SchwarzQuoted 16 lines · Simon Schwarz
Adds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V5:
- Rebased on u-boot-ti
- fixed MAKEALL warnings and errors
- adapted to general gpio interface
Changes in V6:
- Change old commit messageChanges in V7:
- Correct style and format errorsChanges in V8:
- rebased on u-boot
Quoted 8 lines
Changes in V9:
- Deleted a left-over patch from the series this also fixed the first problem mentioned here:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/119452based on:
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)
Hi Simon,
I am testing your patches (V9) - the kernel image is not corrupted anynmore due to the ECC, but I am not able to boot successfully the kernel. I am testing now with a second hardware (twister, I have recently posted the patches for this board, also OMAP3) to have a comparison with the beagleboard.
The kernel starts but it stops very soon, I think after the machine-id check and it seems it cannot poarse correctly the tags. However, the parameters exported by "spl export" are correct and I have not found any difference with the "bootm" command under U-boot.
I am starting to debug the kernel to get some more infos, but do you have some hints ? How do you test it ?
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
v9 cover SPL Linux boot
Quoted 39 lines · Stefano Babic
Quoted 16 lines · Simon Schwarz
Adds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V5:
- Rebased on u-boot-ti
- fixed MAKEALL warnings and errors
- adapted to general gpio interface
Changes in V6:
- Change old commit messageChanges in V7:
- Correct style and format errorsChanges in V8:
- rebased on u-bootQuoted 8 lines
Changes in V9:
- Deleted a left-over patch from the series this also fixed the first problem mentioned here:
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/119452based on:
- Prep subcommand patch for arm
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106725)Hi Simon,
I am testing your patches (V9) - the kernel image is not corrupted anynmore due to the ECC, but I am not able to boot successfully the kernel. I am testing now with a second hardware (twister, I have recently posted the patches for this board, also OMAP3) to have a comparison with the beagleboard.
The kernel starts but it stops very soon, I think after the machine-id check and it seems it cannot poarse correctly the tags. However, the parameters exported by "spl export" are correct and I have not found any difference with the "bootm" command under U-boot.
Quoted 6 lines
I am starting to debug the kernel to get some more infos, but do you have some hints ? How do you test it ?
Best regards,
Stefano Babic
Hi Stefano,
great that someone has a closer look on this!
The only problem i had was a wrong machine id (The one to use is defined in the board config file).
So I didn't do any debugging in the kernel besides from activating early printk.
Regards
Simon
v9 cover SPL Linux boot
In reply to Simon SchwarzQuoted 2 lines · On Tuesday 06 December 2011 13:34:34 Simon Schwarz wrote:
Adds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
sounds like you just obsoleted Qi. nice!
http://wiki.openmoko.org/wiki/Qi
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111207/a7e13e30/attachment.pgp>
v10 cover SPL Linux boot
In reply to Simon SchwarzAdds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V10:
- spl_start_uboot replaces spl_uboot_key and is defined weak
- if the linux image is not found a normal u-boot is started
- some minor changes
based on:
- Prep subcommand patch for arm
Please test this patch - there have been major changes!
Simon Schwarz (7):
Add cmd_spl command
devki8000: add config for spl command
omap-common: Add NAND SPL linux booting devkit8000/spl: init GPMC for dm9000 in SPL omap-common/spl: Add linux boot to SPL omap/spl: change output of spl_parse_image_header
devkit8000: Implement and activate direct OS boot
arch/arm/cpu/armv7/omap-common/spl.c | 51 ++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 75 ++++++++-- arch/arm/include/asm/omap_common.h | 3 + board/timll/devkit8000/devkit8000.c | 57 ++++++- common/Makefile | 1 + common/cmd_spl.c | 229 +++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++ include/cmd_spl.h | 30 ++++ include/configs/devkit8000.h | 15 ++- include/image.h | 2 + 10 files changed, 464 insertions(+), 30 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
Signature · 1 line
1.7.4.1
PATCH v10 1/7 Add cmd_spl command
From: Simon Schwarz <[email protected]>
This adds a spl command to the u-boot.
Related config:CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style, cosmetic changes
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113499)
REBASE on u-boot
V8 changes:
nothing
V9 changes:
nothing
V10 changes:
CHG list is now terminated by NULL not \0 ADD static modifiers to most of cmd_spl.c functions DEL board changes
ADD include protection to cmd_spl.h
DEL not used enum image_tyep
CHG some cosmetic
CHG images extern moved from cmd_spl.h to image.h
--- common/Makefile | 1 + common/cmd_spl.c | 229 +++++++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 +++++++ include/cmd_spl.h | 30 ++++++ include/image.h | 2 + 5 files changed, 293 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
common/Makefile +1 -0
@@ -162,6 +162,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o # others ifdef CONFIG_DDR_SPD
common/cmd_spl.c new file +229 -0
229 lines not on this page · raw message
doc/README.commands.spl new file +31 -0
@@ -0,0 +1,31 @@ +The spl command is used to export a boot parameter image to RAM. Later +it may implement more functions connected to the SPL. + +SUBCOMMAND EXPORT +To execute the command everything has to be in place as if bootm should be +used. (kernel image, initrd-image, fdt-image etc.) + +export has to subcommands: + atags: exports the ATAGS + fdt: exports the FDT + +Call is: +spl export <ftd|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt] + + +TYPICAL CALL + +on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +spl export atags /* export ATAGS */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write 0x80000100 0x680000 0x20000 /* write the image - one page */ + +call with FDT: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +spl export fdt 0x82000000 - 0x80000100 /* export FDT */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write <adress shown by spl export> 0x680000 0x20000
include/cmd_spl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ +#ifndef _NAND_SPL_H_ +#define _NAND_SPL_H_ + +#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002) + +#endif /* _NAND_SPL_H_ */
include/image.h +2 -0
@@ -267,6 +267,8 @@ typedef struct bootm_headers {#endif } bootm_headers_t; +extern bootm_headers_t images; +/* * Some systems (for example LWMON) have very short watchdog periods; * we must make sure to split long operations like memmove() or
Signature · 1 line
1.7.4.1
PATCH v10 2/7 devki8000: add config for spl command
In reply to Simon SchwarzThis adds some configs for devkit8000 to use the new spl command
---
V10 changes:
This is new in V10 was split from other patch
--- include/configs/devkit8000.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
include/configs/devkit8000.h +8 -0
@@ -356,4 +356,12 @@#define CONFIG_SYS_SPL_MALLOC_START 0x80208000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100) +#endif /* __CONFIG_H */
Signature · 1 line
1.7.4.1
PATCH v10 3/7 omap-common: Add NAND SPL linux booting
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
This implements booting of Linux from NAND in SPL
Related config parameters:CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
nothing
V8 changes:
FIX multiline comment style
REBASE on u-boot
V9 changes:
nothing
V10 changes:
ADD unused __attribute__ to src and dst because they provoked a warning
if SPL os boot was not active
--- arch/arm/cpu/armv7/omap-common/spl_nand.c | 66 ++++++++++++++++++++++------- 1 files changed, 50 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +50 -16
@@ -24,6 +24,7 @@#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>
@@ -32,6 +33,9 @@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" );
@@ -45,26 +49,56 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* +* load parameter image +* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.4.1
PATCH v10 4/7 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
Linux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
noting
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113500)
V8 changes:
REBASE on u-boot
V9 changes:
nothing
V10 changes:
use enable_gpmc_cs_config to config the GPMC for dm9000
--- arch/arm/include/asm/omap_common.h | 2 + board/timll/devkit8000/devkit8000.c | 39 +++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 8 deletions(-)
arch/arm/include/asm/omap_common.h +2 -0
@@ -87,6 +87,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header);void omap_rev_string (char *omap_rev_string); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +31 -8
@@ -63,6 +63,24 @@ int board_init(void)return 0 ; } +static u32 gpmc_net_config[GPMC_MAX_REG ] = { +NET_GPMC_CONFIG1 , +NET_GPMC_CONFIG2 , +NET_GPMC_CONFIG3 , +NET_GPMC_CONFIG4 , +NET_GPMC_CONFIG5 , +NET_GPMC_CONFIG6 , +NET_GPMC_CONFIG7 , +}; + + +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +enable_gpmc_cs_config (gpmc_net_config, &gpmc_cfg->cs[6 ], +CONFIG_DM9000_BASE ,GPMC_SIZE_16M ); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -81,14 +99,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -139,6 +150,18 @@ int board_eth_init(bd_t *bis) }#endif +#ifdef CONFIG_SPL_OS_BOOT +/* +* Do board specific preperation before SPL +* Linux boot +*/ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif +/* * Routine: get_board_mem_timings * Description: If we use SPL then there is no x-loader nor config header
Signature · 1 line
1.7.4.1
PATCH v10 5/7 omap-common/spl: Add linux boot to SPL
In reply to Simon SchwarzFrom: Simon Schwarz <[email protected]>
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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
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)
V8 changes:
REBASE on u-boot
V9 changes:
nothing
V10 changes:
CHG used short form to mark not returning function
DEL devkit8000 config changes from this patch
CHG spl_uboot_key renamed to spl_start_uboot and defined weak to be
implemented board specific
CHG If the Linux image for the direct OS boot is not found the SPL tries
to load a u-boot image
CHG %X in %p in debug message
--- arch/arm/cpu/armv7/omap-common/spl.c | 49 +++++++++++++++++++++++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 17 +++++++--- arch/arm/include/asm/omap_common.h | 1 + 3 files changed, 60 insertions(+), 7 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +47 -2
@@ -35,6 +35,7 @@#include <i2c.h> #include <image.h> #include <malloc.h> +#include <linux/compiler.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -64,6 +65,25 @@ void board_init_f(ulong dummy)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 );
@@ -91,7 +111,25 @@ 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 +__noreturn void 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(); */ /*write SPL function for that*/ +image_entry (0 ,CONFIG_MACH_TYPE , arg); +} +#endif + +void jump_to_image_no_args (void ) {typedef void (*image_entry_noargs_t )(u32 *)__attribute__ ((noreturn)); image_entry_noargs_t image_entry =
@@ -105,8 +143,8 @@ static void jump_to_image_no_args(void)u32 boot_params_ptr_addr = (u32)&boot_params_ptr;image_entry ((u32 *)boot_params_ptr_addr); } -void jump_to_image_no_args (void ) __attribute__ ((noreturn)); +void board_init_r (gd_t *id,ulong dummy) {u32 boot_device;
@@ -146,6 +184,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 ();
arch/arm/cpu/armv7/omap-common/spl_nand.c +12 -5
@@ -29,7 +29,6 @@#include <version.h> #include <asm/omap_common.h> -void spl_nand_load_image (void ) {struct image_header *header;
@@ -50,7 +49,7 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE );#ifdef CONFIG_SPL_OS_BOOT -if (!spl_uboot_key ()) { +if (!spl_start_uboot ()) {/* * load parameter image * load to temp position since nand_spl_load_image reads
@@ -74,9 +73,17 @@ void spl_nand_load_image(void)nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS ,CONFIG_SYS_NAND_PAGE_SIZE , (void *)header);spl_parse_image_header (header); -nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); - } else +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); + }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
arch/arm/include/asm/omap_common.h +1 -0
@@ -89,6 +89,7 @@ void spl_parse_image_header(const struct image_header *header);void omap_rev_string (char *omap_rev_string);int spl_uboot_key (void );void spl_board_prepare_for_linux (void ); +int spl_start_uboot (void );/* NAND SPL functions */ void spl_nand_load_image (void );
Signature · 1 line
1.7.4.1
PATCH v10 5/7 omap-common/spl: Add linux boot to SPL
Quoted 16 lines · Simon Schwarz
From: Simon Schwarz <[email protected]>
This adds Linux booting to the SPL
This depends on
CONFIG_MACH_TYPEpatch 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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Quoted 5 lines
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100Signed-off-by Simon Schwarz <[email protected]>---
Hi Simon and Myself (as I will continue Simon's work),
Quoted 24 lines
arch/arm/cpu/armv7/omap-common/spl_nand.c +5
-5-void spl_nand_load_image (void ) {struct image_header *header;@@ -50,7 +49,7 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE );#ifdef CONFIG_SPL_OS_BOOT -if (!spl_uboot_key ()) { +if (!spl_start_uboot ()) {/* * load parameter image * load to temp position since nand_spl_load_image reads @@ -74,9 +73,17 @@ void spl_nand_load_image(void)nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS ,CONFIG_SYS_NAND_PAGE_SIZE , (void *)header);spl_parse_image_header (header); -nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , - spl_image.size, (void *)spl_image.load_addr); - }else +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);
PATCH v10 6/7 omap/spl: change output of spl_parse_image_header
In reply to Simon SchwarzThis only outputs "Assuming u-boot.bin..." if debug is active.
---
v10 changes:
NEW in v10
--- arch/arm/cpu/armv7/omap-common/spl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +1 -1
@@ -101,7 +101,7 @@ void spl_parse_image_header(const struct image_header *header)/* Signature not found - assume u-boot.bin */ printf ("mkimage signature not found - ih_magic = %x\n" , header->ih_magic); -puts ("Assuming u-boot.bin ..\n" ); +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 ;
Signature · 1 line
1.7.4.1
PATCH v10 7/7 devkit8000: Implement and activate direct OS boot
In reply to Simon Schwarz- Implements spl_start_uboot() for devkit8000
- Add configs to activate direct OS boot from SPL
---
V10 changes:
sliced from the implementation
added an implementation of spl_start_uboot for devkit8000
--- board/timll/devkit8000/devkit8000.c | 18 ++++++++++++++++++ include/configs/devkit8000.h | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-)
board/timll/devkit8000/devkit8000.c +18 -0
@@ -41,6 +41,7 @@#include <asm/arch/mem.h> #include <asm/mach-types.h> #include "devkit8000.h" +#include <asm/gpio.h> #ifdef CONFIG_DRIVER_DM9000 #include <net.h> #include <netdev.h>
@@ -160,6 +161,23 @@ void spl_board_prepare_for_linux(void) gpmc_dm9000_config(); } +/* +* devkit8000 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 (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 /*
include/configs/devkit8000.h +5 -2
@@ -35,7 +35,7 @@#define CONFIG_OMAP 1/* in a TI OMAP core */ #define CONFIG_OMAP34XX 1/* which is a 34XX */ #define CONFIG_OMAP3_DEVKIT8000 1/* working with DevKit8000 */ - +#define CONFIG_MACH_TYPE MACH_TYPE_DEVKIT8000/* * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM * 64 bytes before this address should be set aside for u-boot.img's
@@ -327,7 +327,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 */
@@ -357,6 +357,9 @@#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ /* SPL OS boot options */ +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 26 +#define CONFIG_CMD_SPL #define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\
Signature · 1 line
1.7.4.1
v10 cover SPL Linux boot
In reply to Simon SchwarzHi,
I have not yet factored out the general elements of SPL direct boot. ATM i don't have the time - so if someone wants to take it :)
If not this will have to wait, maybe until next year.
Regards
Simon
Quoted 37 lines · Simon Schwarz
Adds direct Linux boot to SPL. It implements a spl export command to save ATAGS or FDT to NAND flash. The kernel image has to be in place for this!
Changes in V10:
-spl_start_ubootreplacesspl_uboot_keyand is defined weak
- if the linux image is not found a normal u-boot is started
- some minor changesbased on:
- Prep subcommand patch for armPlease test this patch - there have been major changes!
Simon Schwarz (7):
Addcmd_splcommand
devki8000: add config for spl command
omap-common: Add NAND SPL linux booting devkit8000/spl: init GPMC for dm9000 in SPL omap-common/spl: Add linux boot to SPL omap/spl: change output ofspl_parse_image_header
devkit8000: Implement and activate direct OS bootarch/arm/cpu/armv7/omap-common/spl.c | 51 ++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 75 ++++++++-- arch/arm/include/asm/omap_common.h | 3 + board/timll/devkit8000/devkit8000.c | 57 ++++++- common/Makefile | 1 + common/cmd_spl.c | 229 +++++++++++++++++++++++++++++ doc/README.commands.spl | 31 ++++ include/cmd_spl.h | 30 ++++ include/configs/devkit8000.h | 15 ++- include/image.h | 2 + 10 files changed, 464 insertions(+), 30 deletions(-)create mode 100644
common/cmd_spl.c
create mode 100644 doc/README.commands.spl
create mode 100644include/cmd_spl.h
v10 cover SPL Linux boot
Quoted 2 lines · Simon Schwarz
Hi,
Hi Simon,
Quoted 2 lines
I have not yet factored out the general elements of SPL direct boot. ATM i don't have the time - so if someone wants to take it :)
I take your proposal and I will go on working on this patchset - I can test the patches on a AM3517 board (I get Linux booting). However, I hope you can have a little piece of time to review my changes ;-)
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
v10 cover SPL Linux boot
Quoted 6 lines · Stefano Babic
Quoted 2 lines · Simon Schwarz
Hi,
Hi Simon,
Quoted 9 lines
Quoted 2 lines
I have not yet factored out the general elements of SPL direct boot. ATM i don't have the time - so if someone wants to take it :)
I take your proposal and I will go on working on this patchset - I can test the patches on a AM3517 board (I get Linux booting). However, I hope you can have a little piece of time to review my changes ;-)
Stefano
Hi Stefano,
great! I will do my best ;)
Regards
Simon
[U-Boot] SPL Linux Boot
In reply to Simon SchwarzHi,
this is a new submission of the Simon's work to add a way to boot Linux directly from the SPL. From the last patchset series, the main changes introduced by me are the following:
- compile the cache functions in SPL to make cleanup_before_linux() available.
- do not call I"C function on boards where I2C is not available
- fix a bug from last version (fallback to U-Boot)
- move all related SPL stuff to common/ and fix omap related functions.
Tested on the twister board (patches for this board in u-boot-ti, next)
Note: to test it is also required Simon's patch:
arm: Add Prep subcommand support to bootm
http://patchwork.ozlabs.org/patch/129753/
[PATCH V11 01/13] Add cmd_spl command [PATCH V11 02/13] devki8000: add config for spl command [PATCH V11 03/13] omap-common: Add NAND SPL linux booting [PATCH V11 04/13] devkit8000/spl: init GPMC for dm9000 in SPL [PATCH V11 05/13] omap-common/spl: Add linux boot to SPL [PATCH V11 06/13] omap/spl: change output of spl_parse_image_header [PATCH V11 07/13] devkit8000: Implement and activate direct OS boot [PATCH V11 08/13] Add cache functions to SPL for armv7 [PATCH V11 09/13] OMAP3: SPL: do not call I2C init if no I2C is [PATCH V11 10/13] OMAP3: move SPL files to be used by other [PATCH V11 11/13] TI: SPL: make SPL available for other SOCs as TI [PATCH V11 12/13] SPL: call cleanup_before_linux() before booting [PATCH V11 13/13] OMAP3: twister: add support to boot Linux from
PATCH v11 1/13 Add cmd_spl command
From: Simon Schwarz <[email protected]>
This adds a spl command to the u-boot.
Related config:CONFIG_CMD_CPL
activate/deactivate the commandCONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message
V3 changes:
FIX added missing brackets
V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch CHG renamed to spl now with subcommand export, very different now ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style, cosmetic changes
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113499)
REBASE on u-boot
V8 changes:
nothing
V9 changes:
nothing
V10 changes:
CHG list is now terminated by NULL not \0 ADD static modifiers to most of cmd_spl.c functions DEL board changes
ADD include protection to cmd_spl.h
DEL not used enum image_tyep
CHG some cosmetic
CHG images extern moved from cmd_spl.h to image.h
V11 changes:
nothing
common/Makefile | 1 + common/cmd_spl.c | 229 +++++++++++++++++++++++++++++++++++++++++++++++ doc/README.commands.spl | 31 +++++++ include/cmd_spl.h | 30 ++++++ include/image.h | 2 + 5 files changed, 293 insertions(+), 0 deletions(-) create mode 100644 common/cmd_spl.c create mode 100644 doc/README.commands.spl create mode 100644 include/cmd_spl.h
common/Makefile +1 -0
@@ -165,6 +165,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o +COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o # others ifdef CONFIG_DDR_SPD
common/cmd_spl.c new file +229 -0
229 lines not on this page · raw message
doc/README.commands.spl new file +31 -0
@@ -0,0 +1,31 @@ +The spl command is used to export a boot parameter image to RAM. Later +it may implement more functions connected to the SPL. + +SUBCOMMAND EXPORT +To execute the command everything has to be in place as if bootm should be +used. (kernel image, initrd-image, fdt-image etc.) + +export has to subcommands: + atags: exports the ATAGS + fdt: exports the FDT + +Call is: +spl export <ftd|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt] + + +TYPICAL CALL + +on OMAP3: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +spl export atags /* export ATAGS */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write 0x80000100 0x680000 0x20000 /* write the image - one page */ + +call with FDT: +nandecc hw +nand read 0x82000000 0x280000 0x400000 /* Read kernel image from NAND*/ +tftpboot 0x80000100 devkit8000.dtb /* Read fdt */ +spl export fdt 0x82000000 - 0x80000100 /* export FDT */ +nand erase 0x680000 0x20000 /* erase - one page */ +nand write <adress shown by spl export> 0x680000 0x20000
include/cmd_spl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Copyright (C) 2011 +* Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> +* +* 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 +*/ +#ifndef _NAND_SPL_H_ +#define _NAND_SPL_H_ + +#define SPL_EXPORT (0x00000001) + +#define SPL_EXPORT_FDT (0x00000001) +#define SPL_EXPORT_ATAGS (0x00000002) + +#endif /* _NAND_SPL_H_ */
include/image.h +2 -0
@@ -267,6 +267,8 @@ typedef struct bootm_headers {#endif } bootm_headers_t; +extern bootm_headers_t images; +/* * Some systems (for example LWMON) have very short watchdog periods; * we must make sure to split long operations like memmove() or
Signature · 1 line
1.7.5.4
PATCH v11 2/13 devki8000: add config for spl command
In reply to Stefano BabicFrom: Simon Schwarz <[email protected]>
This adds some configs for devkit8000 to use the new spl command
---
V10 changes:
This is new in V10 was split from other patch
include/configs/devkit8000.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
include/configs/devkit8000.h +8 -0
@@ -351,4 +351,12 @@#define CONFIG_SYS_SPL_MALLOC_START 0x80208000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x400000) +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100) +#endif /* __CONFIG_H */
Signature · 1 line
1.7.5.4
PATCH v11 3/13 omap-common: Add NAND SPL linux booting
In reply to Stefano BabicFrom: Simon Schwarz <[email protected]>
This implements booting of Linux from NAND in SPL
Related config parameters:CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normally RAM-start + 0x100 (on ARM)
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
nothing
V8 changes:
FIX multiline comment style
REBASE on u-boot
V9 changes:
nothing
V10 changes:
ADD unused __attribute__ to src and dst because they provoked a warning
if SPL os boot was not active
V11 changes:
nothing
arch/arm/cpu/armv7/omap-common/spl_nand.c | 66 ++++++++++++++++++++++------- 1 files changed, 50 insertions(+), 16 deletions(-)
arch/arm/cpu/armv7/omap-common/spl_nand.c +50 -16
@@ -24,6 +24,7 @@#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>
@@ -32,6 +33,9 @@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" );
@@ -45,26 +49,56 @@ void spl_nand_load_image(void)/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +#ifdef CONFIG_SPL_OS_BOOT +if (!spl_uboot_key ()) { +/* +* load parameter image +* load to temp position since nand_spl_load_image reads +* a whole block which is typically larger than +* CONFIG_CMD_SAVEBP_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); +nand_spl_load_image (CONFIG_SYS_NAND_SPL_KERNEL_OFFS , + spl_image.size, (void *)spl_image.load_addr); + } else +#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 *)image_load_addr); +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 *)image_load_addr); +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); +/* 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 (); }
Signature · 1 line
1.7.5.4
PATCH v11 4/13 devkit8000/spl: init GPMC for dm9000 in SPL
In reply to Stefano BabicFrom: Simon Schwarz <[email protected]>
Linux crashes if the GPMC isn't configured for the dm9000.
---
V2 changes:
nothing
V3 changes:
nothing
V4 changes:
noting
V5 changes:
nothing
V6 changes:
nothing
V7 changes:
FIX multiline comment style
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113500)
V8 changes:
REBASE on u-boot
V9 changes:
nothing
V10 changes:
use enable_gpmc_cs_config to config the GPMC for dm9000
arch/arm/include/asm/omap_common.h | 2 + board/timll/devkit8000/devkit8000.c | 39 +++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 8 deletions(-)
arch/arm/include/asm/omap_common.h +2 -0
@@ -87,6 +87,8 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header);void omap_rev_string (char *omap_rev_string); +int spl_uboot_key (void ); +void spl_board_prepare_for_linux (void );/* NAND SPL functions */ void spl_nand_load_image (void );
board/timll/devkit8000/devkit8000.c +31 -8
@@ -63,6 +63,24 @@ int board_init(void)return 0 ; } +static u32 gpmc_net_config[GPMC_MAX_REG ] = { +NET_GPMC_CONFIG1 , +NET_GPMC_CONFIG2 , +NET_GPMC_CONFIG3 , +NET_GPMC_CONFIG4 , +NET_GPMC_CONFIG5 , +NET_GPMC_CONFIG6 , +NET_GPMC_CONFIG7 , +}; + + +/* Configure GPMC registers for DM9000 */ +static void gpmc_dm9000_config (void ) +{ +enable_gpmc_cs_config (gpmc_net_config, &gpmc_cfg->cs[6 ], +CONFIG_DM9000_BASE ,GPMC_SIZE_16M ); +} +/* * Routine: misc_init_r * Description: Configure board specific parts
@@ -81,14 +99,7 @@ int misc_init_r(void)#endif #ifdef CONFIG_DRIVER_DM9000 -/* Configure GPMC registers for DM9000 */ -writel (NET_GPMC_CONFIG1 , &gpmc_cfg->cs[6 ].config1); -writel (NET_GPMC_CONFIG2 , &gpmc_cfg->cs[6 ].config2); -writel (NET_GPMC_CONFIG3 , &gpmc_cfg->cs[6 ].config3); -writel (NET_GPMC_CONFIG4 , &gpmc_cfg->cs[6 ].config4); -writel (NET_GPMC_CONFIG5 , &gpmc_cfg->cs[6 ].config5); -writel (NET_GPMC_CONFIG6 , &gpmc_cfg->cs[6 ].config6); -writel (NET_GPMC_CONFIG7 , &gpmc_cfg->cs[6 ].config7); +gpmc_dm9000_config ();/* Use OMAP DIE_ID as MAC address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -139,6 +150,18 @@ int board_eth_init(bd_t *bis) }#endif +#ifdef CONFIG_SPL_OS_BOOT +/* +* Do board specific preperation before SPL +* Linux boot +*/ +void spl_board_prepare_for_linux (void ) +{ +gpmc_dm9000_config (); +} + +#endif +/* * Routine: get_board_mem_timings * Description: If we use SPL then there is no x-loader nor config header
Signature · 1 line
1.7.5.4
PATCH v11 5/13 omap-common/spl: Add linux boot to SPL
In reply to Stefano BabicFrom: Simon Schwarz <[email protected]>
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 featureCONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is bootedCONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPLCONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is normaly RAM-begin + 0x100
---
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)
V8 changes:
REBASE on u-boot
V9 changes:
nothing
V10 changes:
CHG used short form to mark not returning function
DEL devkit8000 config changes from this patch
CHG spl_uboot_key renamed to spl_start_uboot and defined weak to be
implemented board specific
CHG If the Linux image for the direct OS boot is not found the SPL tries
to load a u-boot image
CHG %X in %p in debug message
V11 changes:
U-Boot was always started instead of Linux
arch/arm/cpu/armv7/omap-common/spl.c | 49 +++++++++++++++++++++++++- arch/arm/cpu/armv7/omap-common/spl_nand.c | 53 ++++++++++++++++------------ arch/arm/include/asm/omap_common.h | 1 + 3 files changed, 78 insertions(+), 25 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +47 -2
@@ -35,6 +35,7 @@#include <i2c.h> #include <image.h> #include <malloc.h> +#include <linux/compiler.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -64,6 +65,25 @@ void board_init_f(ulong dummy)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 );
@@ -91,7 +111,25 @@ 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 +__noreturn void 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(); */ /*write SPL function for that*/ +image_entry (0 ,CONFIG_MACH_TYPE , arg); +} +#endif + +void jump_to_image_no_args (void ) {typedef void (*image_entry_noargs_t )(u32 *)__attribute__ ((noreturn)); image_entry_noargs_t image_entry =
@@ -105,8 +143,8 @@ static void jump_to_image_no_args(void)u32 boot_params_ptr_addr = (u32)&boot_params_ptr;image_entry ((u32 *)boot_params_ptr_addr); } -void jump_to_image_no_args (void ) __attribute__ ((noreturn)); +void board_init_r (gd_t *id,ulong dummy) {u32 boot_device;
@@ -146,6 +184,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 ();
arch/arm/cpu/armv7/omap-common/spl_nand.c +30 -23
75 lines not on this page · raw message
arch/arm/include/asm/omap_common.h +1 -0
@@ -89,6 +89,7 @@ void spl_parse_image_header(const struct image_header *header);void omap_rev_string (char *omap_rev_string);int spl_uboot_key (void );void spl_board_prepare_for_linux (void ); +int spl_start_uboot (void );/* NAND SPL functions */ void spl_nand_load_image (void );
Signature · 1 line
1.7.5.4
PATCH v11 6/13 omap/spl: change output of spl_parse_image_header
In reply to Stefano BabicFrom: Simon Schwarz <[email protected]>
This only outputs "Assuming u-boot.bin..." if debug is active.
---
V11: no changes
arch/arm/cpu/armv7/omap-common/spl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +1 -1
@@ -101,7 +101,7 @@ void spl_parse_image_header(const struct image_header *header)/* Signature not found - assume u-boot.bin */ printf ("mkimage signature not found - ih_magic = %x\n" , header->ih_magic); -puts ("Assuming u-boot.bin ..\n" ); +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 ;
Signature · 1 line
1.7.5.4
PATCH v11 7/13 devkit8000: Implement and activate direct OS boot
In reply to Stefano BabicFrom: Simon Schwarz <[email protected]>
- Implements spl_start_uboot() for devkit8000
- Add configs to activate direct OS boot from SPL
---
V10 changes:
sliced from the implementation
added an implementation of spl_start_uboot for devkit8000
board/timll/devkit8000/devkit8000.c | 18 ++++++++++++++++++ include/configs/devkit8000.h | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-)
board/timll/devkit8000/devkit8000.c +18 -0
@@ -41,6 +41,7 @@#include <asm/arch/mem.h> #include <asm/mach-types.h> #include "devkit8000.h" +#include <asm/gpio.h> #ifdef CONFIG_DRIVER_DM9000 #include <net.h> #include <netdev.h>
@@ -160,6 +161,23 @@ void spl_board_prepare_for_linux(void) gpmc_dm9000_config(); } +/* +* devkit8000 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 (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 /*
include/configs/devkit8000.h +5 -2
@@ -35,7 +35,7 @@#define CONFIG_OMAP 1/* in a TI OMAP core */ #define CONFIG_OMAP34XX 1/* which is a 34XX */ #define CONFIG_OMAP3_DEVKIT8000 1/* working with DevKit8000 */ - +#define CONFIG_MACH_TYPE MACH_TYPE_DEVKIT8000/* * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM * 64 bytes before this address should be set aside for u-boot.img's
@@ -327,7 +327,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 */
@@ -352,6 +352,9 @@#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ /* SPL OS boot options */ +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 26 +#define CONFIG_CMD_SPL #define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ #define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\
Signature · 1 line
1.7.5.4
PATCH v11 8/13 Add cache functions to SPL for armv7
In reply to Stefano Babic--- arch/arm/cpu/armv7/Makefile | 4 ++-- arch/arm/cpu/armv7/cpu.c | 2 ++ arch/arm/lib/Makefile | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/Makefile +2 -2
@@ -27,9 +27,9 @@ LIB = $(obj)lib$(CPU).o START := start.o -ifndef CONFIG_SPL_BUILD +#ifndef CONFIG_SPL_BUILD COBJS += cache_v7.o -endif +#endif COBJS += cpu.o COBJS += syslib.o
arch/arm/cpu/armv7/cpu.c +2 -0
@@ -52,7 +52,9 @@ int cleanup_before_linux(void)* * we turn off caches etc ... */ +#ifndef CONFIG_SPL_BUILD disable_interrupts (); +#endif /* * Turn off I-cache and invalidate it
arch/arm/lib/Makefile +3 -2
@@ -39,8 +39,6 @@ GLCOBJS += div0.o COBJS-y += board.o COBJS-y += bootm.o -COBJS-y += cache.o -COBJS-y += cache-cp15.o COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o COBJS-y += interrupts.o COBJS-y += reset.o
@@ -48,6 +46,9 @@ SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o endif +COBJS-y += cache.o +COBJS-y += cache-cp15.o + SRCS := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \ $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
Signature · 1 line
1.7.5.4
PATCH v11 8/13 Add cache functions to SPL for armv7
Quoted 4 lines · Stefano Babic
Signed-off-by Stefano Babic <[email protected]>CC Tom Rini <[email protected]>CC Wolfgang Denk <[email protected]>CC Simon Schwarz <[email protected]>
As I said in my reply to the intro email..
arch/arm/cpu/armv7/Makefile LIB = $(obj)lib$(CPU).o · line 30
Quoted 2 lines
arch/arm/cpu/armv7/Makefile +1
-1-ifndef CONFIG_SPL_BUILD +#ifndef CONFIG_SPL_BUILD
Is why I assume this is an RFC :)
This patch is fine, assuming omap4/5 are still within size limits.
Signature · 1 line
Tom
PATCH v11 9/13 OMAP3: SPL: do not call I2C init if no I2C is set.
In reply to Stefano BabicCall i2c initialization in spl_board_init only if I2C is configured for the board.
--- arch/arm/cpu/armv7/omap3/board.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/omap3/board.c +2 -0
@@ -92,7 +92,9 @@ u32 omap_boot_device(void)void spl_board_init (void ) { +#ifdef CONFIG_HARD_I2C i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); +#endif }#endif /* CONFIG_SPL_BUILD */
Signature · 1 line
1.7.5.4
PATCH v11 9/13 OMAP3: SPL: do not call I2C init if no I2C is set.
Quoted 16 lines · Stefano Babic
Call i2c initialization in
spl_board_initonly if I2C is configured for the board.Signed-off-by Stefano Babic <[email protected]>CC Tom Rini <[email protected]>CC Wolfgang Denk <[email protected]>CC Simon Schwarz <[email protected]>---
?arch/arm/cpu/armv7/omap3/board.c | ? ?2 ++
?1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/cpu/armv7/omap3/board.c +0
-0
arch/arm/cpu/armv7/omap3/board.c u32 omap_boot_device(void) · line 95
Quoted 4 lines
arch/arm/cpu/armv7/omap3/board.c +1
-0@@ -92,7 +92,9 @@ u32 omap_boot_device(void) ?void spl_board_init(void) ?{ +#ifdef CONFIG_HARD_I2C
This should be CONFIG_HARD_I2C || CONFIG_SOFT_I2C. Or perhaps since we're in SPL, CONFIG_SPL_I2C_SUPPORT ?
Signature · 1 line
Tom
PATCH v11 10/13 OMAP3: move SPL files to be used by other architectures.
In reply to Stefano BabicThe SPL used on OMAPx can be reused by other SOCs from different architectures. Move common files into common/ directory.
---
arch/arm/cpu/armv7/omap-common/Makefile | 10 ----------
common/Makefile | 4 ++++
{arch/arm/cpu/armv7/omap-common => common}/spl.c | 0
.../arm/cpu/armv7/omap-common => common}/spl_mmc.c | 0
.../cpu/armv7/omap-common => common}/spl_nand.c | 0
5 files changed, 4 insertions(+), 10 deletions(-)
rename {arch/arm/cpu/armv7/omap-common => common}/spl.c (100%)
rename {arch/arm/cpu/armv7/omap-common => common}/spl_mmc.c (100%)
rename {arch/arm/cpu/armv7/omap-common => common}/spl_nand.c (100%)arch/arm/cpu/armv7/omap-common/Makefile +0 -10
@@ -40,16 +40,6 @@ COBJS += emif-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 -endif - ifndef CONFIG_SPL_BUILD ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),) COBJS += mem-common.o
common/Makefile +4 -0
@@ -186,6 +186,10 @@ COBJS-$(CONFIG_MENU) += menu.o COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o COBJS-$(CONFIG_UPDATE_TFTP) += update.o COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o +else +COBJS-y += spl.o +COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o +COBJS-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o endif COBJS-y += console.o
common/spl.c renamed from arch/arm/cpu/armv7/omap-common/spl.c +0 -0
common/spl_mmc.c renamed from arch/arm/cpu/armv7/omap-common/spl_mmc.c +0 -0
common/spl_nand.c renamed from arch/arm/cpu/armv7/omap-common/spl_nand.c +0 -0
Signature · 1 line
1.7.5.4
PATCH v11 10/13 OMAP3: move SPL files to be used by other architectures.
Quoted 2 lines · Stefano Babic
The SPL used on OMAPx can be reused by other SOCs from different architectures. Move common files into common/ directory.
Thanks for tackling this. My immediate concern however is that this breaks building nand_spl/ boards, but is that really a good concern still?
Signature · 1 line
Tom
PATCH v11 10/13 OMAP3: move SPL files to be used by other architectures.
Quoted 7 lines · Tom Rini
Quoted 2 lines · Stefano Babic
The SPL used on OMAPx can be reused by other SOCs from different architectures. Move common files into common/ directory.
Thanks for tackling this. My immediate concern however is that this breaks building nand_spl/ boards, but is that really a good concern still?
I think the way we have to do is to accept boards implementing the new SPL framework, and put nand_spl in obsolescence. If a board is broken, it must be fixed porting it to the new SPL.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v11 11/13 TI: SPL: make SPL available for other SOCs as TI
In reply to Stefano BabicThe SPL is developped first for TI-OMAPx. The patch move OMAP specific function into OMAP directory.
--- arch/arm/cpu/armv7/omap-common/Makefile | 2 + arch/arm/cpu/armv7/omap-common/spl_omap.c | 71 +++++++++++++++++++++++++++++ arch/arm/cpu/armv7/omap3/board.c | 4 ++ arch/arm/include/asm/omap_common.h | 34 -------------- common/spl.c | 1 + common/spl_mmc.c | 21 ++------- common/spl_nand.c | 14 +----- include/spl.h | 68 +++++++++++++++++++++++++++ 8 files changed, 153 insertions(+), 62 deletions(-) create mode 100644 arch/arm/cpu/armv7/omap-common/spl_omap.c create mode 100644 include/spl.h
arch/arm/cpu/armv7/omap-common/Makefile +2 -0
@@ -44,6 +44,8 @@ ifndef CONFIG_SPL_BUILD ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),) COBJS += mem-common.o endif +else +COBJS += spl_omap.o endif SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
arch/arm/cpu/armv7/omap-common/spl_omap.c new file +71 -0
71 lines not on this page · raw message
arch/arm/cpu/armv7/omap3/board.c +4 -0
@@ -42,6 +42,10 @@#include <asm/omap_common.h> #include <i2c.h> +#ifdef CONFIG_SPL_BUILD +#include <spl.h> +#endif +/* Declarations */ extern omap3_sysinfo sysinfo;static void omap3_setup_aux_cr (void );
arch/arm/include/asm/omap_common.h +0 -34
@@ -64,43 +64,9 @@ void preloader_console_init(void);#define BOOT_DEVICE_XIPWAIT 7#endif -/* Boot type */ -#define MMCSD_MODE_UNDEFINED 0 -#define MMCSD_MODE_RAW 1 -#define MMCSD_MODE_FAT 2 -#define NAND_MODE_HW_ECC 3 - -struct spl_image_info { -const char *name; -u8 os; -u32 load_addr; -u32 entry_point; -u32 size; -}; - -extern struct spl_image_info spl_image; - -extern u32 * boot_params_ptr;u32 omap_boot_device (void );u32 omap_boot_mode (void ); -/* SPL common function s*/ -void spl_parse_image_header (const struct image_header *header); -void omap_rev_string (char *omap_rev_string); -int spl_uboot_key (void ); -void spl_board_prepare_for_linux (void ); -int spl_start_uboot (void ); - -/* NAND SPL functions */ -void spl_nand_load_image (void ); - -/* MMC SPL functions */ -void spl_mmc_load_image (void ); - -#ifdef CONFIG_SPL_BOARD_INIT -void spl_board_init (void ); -#endif -/* * silicon revisions. * Moving this to common, so that most of code can be moved to common,
common/spl.c +1 -0
@@ -30,6 +30,7 @@#include <mmc.h> #include <fat.h> #include <version.h> +#include <spl.h> #include <asm/omap_common.h> #include <asm/arch/mmc_host_def.h> #include <i2c.h>
common/spl_mmc.c +4 -17
@@ -29,25 +29,12 @@#include <mmc.h> #include <fat.h> #include <version.h> -#include <asm/omap_common.h> -#include <asm/arch/mmc_host_def.h> +#include <spl.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 ); -break ; -case BOOT_DEVICE_MMC2 : -omap_mmc_init (1 ); -break ; - } -return 0 ; -} -#endif +/* Define the sector size, this is usually 512 bytes */ +#define MMCSD_SECTOR_SIZE 512static void mmc_load_image_raw (struct mmc *mmc) {
@@ -135,7 +122,7 @@ void spl_mmc_load_image(void)printf ("spl: mmc init failed: err - %d\n" , err);hang (); } - boot_mode =omap_boot_mode (); + boot_mode =spl_boot_mode ();if (boot_mode ==MMCSD_MODE_RAW ) {debug ("boot mode - RAW\n" );mmc_load_image_raw (mmc);
common/spl_nand.c +3 -11
@@ -27,7 +27,7 @@#include <asm/io.h> #include <nand.h> #include <version.h> -#include <asm/omap_common.h> +#include <spl.h> void spl_nand_load_image (void ) {
@@ -35,16 +35,8 @@ void spl_nand_load_image(void) 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 (); - } +/* Call the architecture NAND init function */ +spl_arch_nand_init ();/*use CONFIG_SYS_TEXT_BASE as temporary storage area */ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE );
include/spl.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v11 11/13 TI: SPL: make SPL available for other SOCs as TI
Quoted 2 lines · Stefano Babic
The SPL is developped first for TI-OMAPx. The patch move OMAP specific function into OMAP directory.
I wonder if we should fold this into the mv'ing patch as well.
[snip]
include/spl.h
Quoted 3 lines
include/spl.h +2
-0+/* Boot type */ +#define ? ? ? ?MMCSD_MODE_UNDEFINED ? ?0
Not your bad spacing of course, but please fix.
include/spl.h line 61
Quoted 6 lines
include/spl.h +6
-0+/* NAND SPL functions */ +void spl_nand_load_image (void ); +void spl_arch_nand_init (void ); + +/* MMC SPL functions */ +void spl_mmc_load_image (void );
These should be covered by #ifdef CONFIG_SPL_(NAND||MMC)_SUPPORT
Signature · 1 line
Tom
PATCH v11 11/13 TI: SPL: make SPL available for other SOCs as TI
Quoted 5 lines · Tom Rini
Quoted 2 lines · Stefano Babic
The SPL is developped first for TI-OMAPx. The patch move OMAP specific function into OMAP directory.
I wonder if we should fold this into the mv'ing patch as well.
I can squash the two patches, but I thought the review is easier as I did. The previous patch shows clearly that the patch was only moved, and the changes in Makefile makes possible to build the boards making the patch bisectable. This patch then
Quoted 7 lines
[snip]
include/spl.h line 31
Quoted 3 lines
include/spl.h +2
-0+/* Boot type */ +#define MMCSD_MODE_UNDEFINED 0Not your bad spacing of course, but please fix.
Thanks to have found, I will fix it.
Quoted 9 lines
include/spl.h line 61
Quoted 7 lines
include/spl.h +6
-0+/* NAND SPL functions */ +void spl_nand_load_image (void ); +void spl_arch_nand_init (void ); + +/* MMC SPL functions */ +void spl_mmc_load_image (void );These should be covered by #ifdef CONFIG_SPL_(NAND||MMC)_SUPPORT
Do we need in the header file for the prototypes ? We have never done, and it should be not necessary.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v11 11/13 TI: SPL: make SPL available for other SOCs as TI
Quoted 11 lines · Stefano Babic
Quoted 5 lines · Tom Rini
Quoted 2 lines · Stefano Babic
The SPL is developped first for TI-OMAPx. The patch move OMAP specific function into OMAP directory.
I wonder if we should fold this into the mv'ing patch as well.
I can squash the two patches, but I thought the review is easier as I did. The previous patch shows clearly that the patch was only moved, and the changes in
Makefilemakes possible to build the boards making the patch bisectable. This patch then
Yeah, I guess that works too then, nevermind.
Quoted 19 lines
Quoted 6 lines
[snip]
include/spl.h
Quoted 3 lines
include/spl.h +2
-0+/* Boot type */ +#define ? ? ? ?MMCSD_MODE_UNDEFINED ? ?0Not your bad spacing of course, but please fix.
Thanks to have found, I will fix it.
Quoted 9 lines
include/spl.h line 61
Quoted 7 lines
include/spl.h +6
-0+/* NAND SPL functions */ +void spl_nand_load_image (void ); +void spl_arch_nand_init (void ); + +/* MMC SPL functions */ +void spl_mmc_load_image (void );These should be covered by #ifdef CONFIG_SPL_(NAND||MMC)_SUPPORT
Quoted 2 lines
Do we need in the header file for the prototypes ? We have never done, and it should be not necessary.
I would swear there's other examples like this (and someone brought this to my attention when i first posted spl_board_init internally).
Signature · 1 line
Tom
PATCH v11 12/13 SPL: call cleanup_before_linux() before booting Linux
In reply to Stefano Babic--- common/spl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/spl.c +1 -1
@@ -125,7 +125,7 @@ __noreturn void jump_to_image_linux(void *arg) __attribute__ ((noreturn));image_entry_arg_t image_entry = (image_entry_arg_t ) spl_image.entry_point; -/* cleanup_before_linux(); */ /*write SPL function for that*/ +cleanup_before_linux (); image_entry(0, CONFIG_MACH_TYPE, arg); }#endif
Signature · 1 line
1.7.5.4
PATCH v11 13/13 OMAP3: twister: add support to boot Linux from SPL
In reply to Stefano Babic--- board/technexion/twister/twister.c | 23 +++++++++++++++++++++++ include/configs/twister.h | 16 ++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-)
board/technexion/twister/twister.c +23 -0
@@ -114,3 +114,26 @@ int board_mmc_init(bd_t *bis) return omap_mmc_init(0); }#endif + +#ifdef CONFIG_SPL_OS_BOOT +/* +* Do board specific preperation before SPL +* Linux boot +*/ +void spl_board_prepare_for_linux (void ) +{ +/* init cs for extern lan */ +enable_gpmc_cs_config (gpmc_smc911, &gpmc_cfg->cs[5 ], +CONFIG_SMC911X_BASE ,GPMC_SIZE_16M ); +} +int spl_start_uboot (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
include/configs/twister.h +16 -0
@@ -51,4 +51,20 @@#define CONFIG_EXTRA_ENV_SETTINGS CONFIG_TAM3517_SETTINGS \ "bootcmd=run nandboot\0" +/* SPL OS boot options */ +#define CONFIG_CMD_SPL +#define CONFIG_CMD_SPL_WRITE_SIZE 0x400/* 1024 byte */ +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 +#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\ + 0x600000) +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_OS_BOOT_KEY 7 + +#define CONFIG_SYS_SPL_ARGS_ADDR (PHYS_SDRAM_1 + 0x100) +#define CONFIG_SPL_BOARD_INIT + +#ifdef CONFIG_SPL_BUILD +#undef CONFIG_HARD_I2C +#endif +#endif /* __CONFIG_H */
Signature · 1 line
1.7.5.4
PATCH v11 13/13 OMAP3: twister: add support to boot Linux from SPL
Quoted 4 lines · Stefano Babic
Signed-off-by Stefano Babic <[email protected]>CC Tom Rini <[email protected]>CC Wolfgang Denk <[email protected]>CC Simon Schwarz <[email protected]>
[snip]
include/configs/twister.h line 68
Quoted 3 lines
include/configs/twister.h +3
-0+#ifdef CONFIG_SPL_BUILD +#undef CONFIG_HARD_I2C +#endif
If we switch the I2C test to CONFIG_SPL_I2C_SUPPORT this part here can go away, yes?
Signature · 1 line
Tom
PATCH v11 13/13 OMAP3: twister: add support to boot Linux from SPL
Quoted 5 lines · Tom Rini
Quoted 4 lines · Stefano Babic
Signed-off-by Stefano Babic <[email protected]>CC Tom Rini <[email protected]>CC Wolfgang Denk <[email protected]>CC Simon Schwarz <[email protected]>
Quoted 7 lines
[snip]
include/configs/twister.h line 68
Quoted 3 lines
include/configs/twister.h +3
-0+#ifdef CONFIG_SPL_BUILD +#undef CONFIG_HARD_I2C +#endif If we switch the I2C test to
CONFIG_SPL_I2C_SUPPORTthis part here can go away, yes?
Right, I will fix in this way.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
[U-Boot] SPL Linux Boot
In reply to Stefano BabicQuoted 13 lines · Stefano Babic
Hi,
this is a new submission of the Simon's work to add a way to boot Linux directly from the SPL. From the last patchset series, the main changes introduced by me are the following:
- compile the cache functions in SPL to make
cleanup_before_linux()?available.
- do not call I"C function on boards where I2C is not available
- fix a bug from last version (fallback to U-Boot)
- move all related SPL stuff to common/ and fix omap related ?functions.
Quoted 7 lines
Tested on the twister board (patches for this board in u-boot-ti, next)
Note: to test it is also required Simon's patch:
? ? ? ?arm: Add Prep subcommand support to bootm
I'm going to mark this series as RFC in patchwork as I see you did +#ifneq... in some Makefiles and I know you know better :) That said, can you confirm MAKEALL -s omap3 -s omap4 -s omap5 works? omap4/5 has smaller size requirements than omap3(ish) stuff and I don't have 100% faith in linker magic to make sure the cache stuff added to SPL in arch/arm/lib/ isn't going to bloat up the omap4/5 stuff slightly.
Signature · 1 line
Tom
[U-Boot] SPL Linux Boot
Quoted 18 lines · Tom Rini
Quoted 17 lines · Stefano Babic
Hi,
this is a new submission of the Simon's work to add a way to boot Linux directly from the SPL. From the last patchset series, the main changes introduced by me are the following:
- compile the cache functions in SPL to make
cleanup_before_linux()available.
- do not call I"C function on boards where I2C is not available
- fix a bug from last version (fallback to U-Boot)
- move all related SPL stuff to common/ and fix omap related functions.Tested on the twister board (patches for this board in u-boot-ti, next)
Note: to test it is also required Simon's patch:
Quoted 7 lines
Quoted 3 lines
arm: Add Prep subcommand support to bootm
I'm going to mark this series as RFC in patchwork as I see you did +#ifneq... in some Makefiles and I know you know better :) That said, can you confirm MAKEALL -s omap3 -s omap4 -s omap5 works?
I'll do, I have not yet tested and I built OMAP3. I have seen a couple of other things due to the moved stuff that I should fix.
Quoted 4 lines
omap4/5 has
smaller size requirements than omap3(ish) stuff and I don't have 100% faith in linker magic to make sure the cache stuff added to SPL inarch/arm/lib/isn't going to bloat up the omap4/5 stuff slightly.
Ok, understood, I'll check it - if the added code is too much, I will introduce a new CONFIG_SPL_SUPPORT_CACHE to make build optional.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
[U-Boot] SPL Linux Boot
In reply to Tom RiniQuoted 3 lines · Tom Rini
Quoted 2 lines · Stefano Babic
Hi,
Hi Tom,
Quoted 3 lines
I'm going to mark this series as RFC in patchwork as I see you did +#ifneq... in some Makefiles and I know you know better :) That said, can you confirm MAKEALL -s omap3 -s omap4 -s omap5 works?
there is a missing include in this patchset (fixed in next version), but I can compile all.
Quoted 4 lines
omap4/5 has
smaller size requirements than omap3(ish) stuff and I don't have 100% faith in linker magic to make sure the cache stuff added to SPL inarch/arm/lib/isn't going to bloat up the omap4/5 stuff slightly.
Checking MLO without and with this patchset for an OMAP4 board (panda), I get:
without patchset (u-boot-ti): 33012 bytes
with the patchset (SPL_OS not enabled): 33424
I cannot test it, but is seems still in order, right ?
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
[U-Boot] SPL Linux Boot
Quoted 20 lines · Stefano Babic
Quoted 3 lines · Tom Rini
Quoted 2 lines · Stefano Babic
Hi,
Hi Tom,
Quoted 3 lines
I'm going to mark this series as RFC in patchwork as I see you did +#ifneq... in some Makefiles and I know you know better :) ?That said, can you confirm MAKEALL -s omap3 -s omap4 -s omap5 works?
there is a missing include in this patchset (fixed in next version), but I can compile all.
Quoted 4 lines
?omap4/5 has
smaller size requirements than omap3(ish) stuff and I don't have 100% faith in linker magic to make sure the cache stuff added to SPL inarch/arm/lib/isn't going to bloat up the omap4/5 stuff slightly.
Quoted 7 lines
Checking MLO without and with this patchset for an OMAP4 board (panda), I get:
without patchset (u-boot-ti): 33012 bytes
with the patchset (SPL_OSnot enabled): 33424I cannot test it, but is seems still in order, right ?
Yes, when it's too large it fails to link. Thanks!
Signature · 1 line
Tom
[U-Boot] SPL Linux Boot
Hi Tom,
last version of patchset has not received comments since a long time - Simon sends to me a confirm that tests on the devkit8000 are successful.
Any chance to get the patchset merged soon or do you have any open points ?
Thanks,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
[U-Boot] SPL Linux Boot
Quoted 6 lines · Stefano Babic
Hi Tom,
last version of patchset has not received comments since a long time - Simon sends to me a confirm that tests on the devkit8000 are successful.
Any chance to get the patchset merged soon or do you have any open points ?
I've sent Albert a pull request now for the few things I've got queued up other than this. Once he takes that I'll take the Linux SPL series in, give it a few whacks and move it along to Albert.
Signature · 1 line
Tom
A message that is not in the archive (sent off-list or not yet received): CA+M6bXkv=fav4ApxW7h=86i31bXpdpML1TWyYeWpaGqH7z8TyA@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CA+M6bX=qKs2e4qoseFT=3WSZ_FWSNLivR8OaEP4-K7eL2u_89w@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CA+M6bXnR-k7gK_iTENJvBNJRBbfEBfWDot4zHMUhMyUUOo2qsQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): CA+M6bXkS6DPmW32+n=rB98MXownMpnB7B8kHPz1wtdHTKqS_Sw@mail.gmail.com
[U-Boot] SPL Linux Boot
On 30/01/2012 19:05, Tom Rini wrote:
Hi Tom,
Quoted 5 lines
Quoted 2 lines
OK, doing a MAKEALL for omap3/4/5/am33xx/davinci shows we've got a few missing include problems, I'll go fix that up.
OK, was it when you took over the series that you moved stuff to
common/spl.c? That idea is breaking, badly, non-omap platforms.
I am trying to summarize the different problems we have. Comparing to u-boot-ti, the patchset breaks the following boards:
davinci:
da850_am18xxevm da850evm hawkboard_nand
omap4/5:
fixed including spl.h into arch/arm/cpu/armv7/omap-common/boot-common.c
mx28:
m28evk mx28evk
I have not seen other broken boards - let me know if you find something else.
On omap4/5 is only a thing of include files, as you reported.
A main issue is with davinci, because we have currently two different spl.c (arch/arm/cpu/arm926ejs/davinci/spl.c on davinci). The code can be factorized, if davinci will use preloader_console_init() as omap.
The same problem rises with mx28: there is a specific file arch/arm/cpu/arm926ejs/mx28/spl_boot.c, that redefines board_init_f() and board_init_r() - as we try to have a common spl code, this muist be fixed, too.
A way can be to add an arch weak function to add arch specific initialization inside board_init_*() functions, if any. Have you seen other issues other what I report now ?
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
[U-Boot] SPL Linux Boot
Quoted 31 lines · Stefano Babic
On 30/01/2012 19:05, Tom Rini wrote:
Hi Tom,
Quoted 5 lines
Quoted 2 lines
OK, doing a MAKEALL for omap3/4/5/am33xx/davinci shows we've got a few missing include problems, I'll go fix that up.
OK, was it when you took over the series that you moved stuff to
common/spl.c? ?That idea is breaking, badly, non-omap platforms.I am trying to summarize the different problems we have. Comparing to u-boot-ti, the patchset breaks the following boards:
davinci:
? ? ? ?da850_am18xxevm da850evmhawkboard_nandomap4/5:
? ? ? ?fixed includingspl.hintoarch/arm/cpu/armv7/omap-common/boot-common.cmx28:
? ? ? ?m28evk mx28evkI have not seen other broken boards - let me know if you find something else.
On omap4/5 is only a thing of include files, as you reported.
A main issue is with davinci, because we have currently two different
spl.c(arch/arm/cpu/arm926ejs/davinci/spl.con davinci). The code can be factorized, if davinci will usepreloader_console_init()as omap.
Quoted 8 lines
The same problem rises with mx28: there is a specific file
arch/arm/cpu/arm926ejs/mx28/spl_boot.c, that redefinesboard_init_f()andboard_init_r()- as we try to have a common spl code, this muist be fixed, too.A way can be to add an arch weak function to add arch specific initialization inside ?board_init_*() functions, if any. Have you seen other issues other what I report now ?
That sounds about right. In short, ./MAKEALL -s arm still needs to build before we can take this series in, so perhaps we want to separate back out the "make SPL stuff more generic" from the "let SPL for omap* boot Linux" series.
Signature · 1 line
Tom
[U-Boot] SPL Linux Boot
Quoted 8 lines · Tom Rini
Quoted 3 lines
A way can be to add an arch weak function to add arch specific initialization inside board_init_*() functions, if any. Have you seen other issues other what I report now ?
That sounds about right. In short, ./MAKEALL -s arm still needs to build before we can take this series in, so perhaps we want to separate back out the "make SPL stuff more generic" from the "let SPL for omap* boot Linux" series.
I agree - your proposal makes things easier. I split the patches and I will resend the patchset to add only booting Linux from SPL - and I will rework the patches to make SPL generic to other SOCs later, when the first patchset will be merged.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
[U-Boot] SPL Linux Boot - updated
In reply to Stefano BabicHi,
here an updated version of the patchset to boot Linux directly from SPL. It fixes the (minor) comments received in version 11.
List of changes:
- drop commented lines into arch/arm/cpu/armv7/Makefile after checking build for OMAP4/5
- use CONFIG_SPL_I2C_SUPPORT to protect I2C code
- fix TAB / spaces issues (codestyle)
- add missing include to fix OMAP4/5 build
- use a different GPIO on the twister board to select image to boot
[PATCH V12 01/14] Add cmd_spl command
[PATCH V12 02/14] devki8000: add config for spl command [PATCH V12 03/14] omap-common: Add NAND SPL linux booting [PATCH V12 04/14] devkit8000/spl: init GPMC for dm9000 in SPL [PATCH V12 05/14] omap-common/spl: Add linux boot to SPL [PATCH V12 06/14] omap/spl: change output of spl_parse_image_header [PATCH V12 07/14] devkit8000: Implement and activate direct OS boot [PATCH V12 08/14] Add cache functions to SPL for armv7 [PATCH V12 09/14] OMAP3: SPL: do not call I2C init if no I2C is set. [PATCH V12 10/14] OMAP3: move SPL files to be used by other [PATCH V12 11/14] TI: SPL: make SPL available for other SOCs as TI [PATCH V12 12/14] SPL: call cleanup_before_linux() before booting [PATCH V12 13/14] Fix build OMAP4/5
[PATCH V12 14/14] OMAP3: twister: add support to boot Linux from SPL