From cf2c87d3223901e329241f241c3402c6186e0d98 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 28 Sep 2010 12:14:57 +0900 Subject: sh: Add support load and boot of Initrd. Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- arch/sh/lib/bootm.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c index 9c58ed7..019e8ec 100644 --- a/arch/sh/lib/bootm.c +++ b/arch/sh/lib/bootm.c @@ -43,6 +43,41 @@ static void hexdump(unsigned char *buf, int len) } #endif +#define MOUNT_ROOT_RDONLY 0x000 +#define RAMDISK_FLAGS 0x004 +#define ORIG_ROOT_DEV 0x008 +#define LOADER_TYPE 0x00c +#define INITRD_START 0x010 +#define INITRD_SIZE 0x014 +#define COMMAND_LINE 0x100 + +#define RD_PROMPT (1<<15) +#define RD_DOLOAD (1<<14) +#define CMD_ARG_RD_PROMPT "prompt_ramdisk=" +#define CMD_ARG_RD_DOLOAD "load_ramdisk=" + +#ifdef CONFIG_SH_SDRAM_OFFSET +#define GET_INITRD_START(initrd, linux) (initrd - linux + CONFIG_SH_SDRAM_OFFSET) +#else +#define GET_INITRD_START(initrd, linux) (initrd - linux) +#endif + +static void set_sh_linux_param(unsigned long param_addr, unsigned long data) +{ + *(unsigned long *)(param_addr) = data; +} + +static unsigned long sh_check_cmd_arg(char *cmdline, char *key, int base) +{ + unsigned long val = 0; + char *p = strstr(cmdline, key); + if (p) { + p += strlen(key); + val = simple_strtol(p, NULL, base); + } + return val; +} + int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) { /* Linux kernel load address */ @@ -51,7 +86,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima unsigned char *param = (unsigned char *)image_get_load(images->legacy_hdr_os); /* Linux kernel command line */ - char *cmdline = (char *)param + 0x100; + char *cmdline = (char *)param + COMMAND_LINE; /* PAGE_SIZE */ unsigned long size = images->ep - (unsigned long)param; char *bootargs = getenv("bootargs"); @@ -61,8 +96,37 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima /* Setup parameters */ memset(param, 0, size); /* Clear zero page */ + + /* Set commandline */ strcpy(cmdline, bootargs); + sh_check_cmd_arg(bootargs, CMD_ARG_RD_DOLOAD, 10); + /* Initrd */ + if (images->rd_start || images->rd_end) { + unsigned long ramdisk_flags; + int val = sh_check_cmd_arg(bootargs, CMD_ARG_RD_PROMPT, 10); + if (val == 1) + ramdisk_flags |= RD_PROMPT; + else + ramdisk_flags &= ~RD_PROMPT; + + val = sh_check_cmd_arg(bootargs, CMD_ARG_RD_DOLOAD, 10); + if (val == 1) + ramdisk_flags |= RD_DOLOAD; + else + ramdisk_flags &= ~RD_DOLOAD; + + set_sh_linux_param((unsigned long)param + MOUNT_ROOT_RDONLY, 0x0001); + set_sh_linux_param((unsigned long)param + RAMDISK_FLAGS, ramdisk_flags); + set_sh_linux_param((unsigned long)param + ORIG_ROOT_DEV, 0x0200); + set_sh_linux_param((unsigned long)param + LOADER_TYPE, 0x0001); + set_sh_linux_param((unsigned long)param + INITRD_START, + GET_INITRD_START(images->rd_start, CONFIG_SYS_SDRAM_BASE)); + set_sh_linux_param((unsigned long)param + INITRD_SIZE, + images->rd_end - images->rd_start); + } + + /* Boot kernel */ kernel(); /* does not return */ -- cgit v1.1 From 915d6b7d2b7af0bb28ed4c5aceb92ba64fe86fa8 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 5 Oct 2010 16:58:05 +0900 Subject: sh: sh7785lcr: Add CONFIG_SH_SDRAM_OFFSET Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- include/configs/sh7785lcr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/configs/sh7785lcr.h b/include/configs/sh7785lcr.h index 2c18e2f..6627f99 100644 --- a/include/configs/sh7785lcr.h +++ b/include/configs/sh7785lcr.h @@ -62,8 +62,10 @@ /* MEMORY */ #if defined(CONFIG_SH_32BIT) -#define SH7785LCR_SDRAM_PHYS_BASE (0x48000000) -#define SH7785LCR_SDRAM_BASE (0x88000000) +/* 0x40000000 - 0x47FFFFFF does not use */ +#define CONFIG_SH_SDRAM_OFFSET (0x8000000) +#define SH7785LCR_SDRAM_PHYS_BASE (0x40000000 + CONFIG_SH_SDRAM_OFFSET) +#define SH7785LCR_SDRAM_BASE (0x80000000 + CONFIG_SH_SDRAM_OFFSET) #define SH7785LCR_SDRAM_SIZE (384 * 1024 * 1024) #define SH7785LCR_FLASH_BASE_1 (0xa0000000) #define SH7785LCR_FLASH_BANK_SIZE (64 * 1024 * 1024) -- cgit v1.1 From 006442b35211472d325ee3955566cfb0d079e5b0 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 19 Oct 2010 17:07:07 +0900 Subject: sh: Rename TEXT_BASE to CONFIG_SYS_TEXT_BASE Signed-off-by: Nobuhiro Iwamatsu --- arch/sh/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sh/config.mk b/arch/sh/config.mk index 07ba68f..415c949 100644 --- a/arch/sh/config.mk +++ b/arch/sh/config.mk @@ -29,6 +29,6 @@ STANDALONE_LOAD_ADDR += -EB endif PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__ -PLATFORM_LDFLAGS += -e $(CONFIG_SYS_TEXT_BASE) --defsym reloc_dst=$(TEXT_BASE) +PLATFORM_LDFLAGS += -e $(CONFIG_SYS_TEXT_BASE) --defsym reloc_dst=$(CONFIG_SYS_TEXT_BASE) LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds -- cgit v1.1 From de03f8bc4a3f7bbb09bccbf2e3a5f14b45d5ad64 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 19 Oct 2010 17:14:15 +0900 Subject: sh: Fix warning about uninitialized value of ramdisk_flags Signed-off-by: Nobuhiro Iwamatsu --- arch/sh/lib/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c index 019e8ec..f38d0b0 100644 --- a/arch/sh/lib/bootm.c +++ b/arch/sh/lib/bootm.c @@ -103,7 +103,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima sh_check_cmd_arg(bootargs, CMD_ARG_RD_DOLOAD, 10); /* Initrd */ if (images->rd_start || images->rd_end) { - unsigned long ramdisk_flags; + unsigned long ramdisk_flags = 0; int val = sh_check_cmd_arg(bootargs, CMD_ARG_RD_PROMPT, 10); if (val == 1) ramdisk_flags |= RD_PROMPT; -- cgit v1.1 From 41f2747b9a3c2324e5e6b6fc52a29671426f89d9 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Wed, 20 Oct 2010 01:17:08 +0900 Subject: sh: sh7785lcr: Add CONFIG_SYS_TEXT_BASE for 32bit mode Signed-off-by: Nobuhiro Iwamatsu --- board/renesas/sh7785lcr/config.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/board/renesas/sh7785lcr/config.mk b/board/renesas/sh7785lcr/config.mk index 1a9038c..6853d2b 100644 --- a/board/renesas/sh7785lcr/config.mk +++ b/board/renesas/sh7785lcr/config.mk @@ -24,6 +24,8 @@ # sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp -ifndef CONFIG_SYS_TEXT_BASE +ifdef CONFIG_SH_32BIT +CONFIG_SYS_TEXT_BASE = 0x8FF80000 +else CONFIG_SYS_TEXT_BASE = 0x0ff80000 endif -- cgit v1.1 From e0f0e527f8290bdf72d0fb5e5937c6b943879bf8 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Wed, 20 Oct 2010 01:22:25 +0900 Subject: sh: rsk7203: Move to boards.cfg Move the rsk7203 target out of the Makefile and into boards.cfg. And fix sh2 of MAKEALL. Signed-off-by: Nobuhiro Iwamatsu --- MAKEALL | 5 ++--- Makefile | 8 -------- boards.cfg | 1 + 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/MAKEALL b/MAKEALL index 51312dd..a97061c 100755 --- a/MAKEALL +++ b/MAKEALL @@ -609,9 +609,8 @@ LIST_blackfin="$(boards_by_arch blackfin) ## SH Systems ######################################################################### -LIST_sh2=" \ - rsk7203 \ -" +LIST_sh2="$(boards_by_cpu sh2)" + LIST_sh3=" \ mpr2 \ ms7720se \ diff --git a/Makefile b/Makefile index 06c71a2..205e710 100644 --- a/Makefile +++ b/Makefile @@ -1189,14 +1189,6 @@ bf527-ezkit-v2_config : unconfig #======================================================================== ######################################################################### -## sh2 (Renesas SuperH) -######################################################################### -rsk7203_config: unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_RSK7203 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh2 rsk7203 renesas - -######################################################################### ## sh3 (Renesas SuperH) ######################################################################### diff --git a/boards.cfg b/boards.cfg index 0f3292f..2599c2a 100644 --- a/boards.cfg +++ b/boards.cfg @@ -732,5 +732,6 @@ davinci_dm6467evm arm arm926ejs dm6467evm davinci davinci davinci_schmoogie arm arm926ejs schmoogie davinci davinci davinci_dm355leopard arm arm926ejs dm355leopard davinci davinci bf527-ad7160-eval blackfin blackfin +rsk7203 sh sh2 rsk7203 renesas - # Target ARCH CPU Board name Vendor SoC Options ############################################################################################### -- cgit v1.1 From 3771c69d78cd1acbfd8c530fbd3b153487cdf70c Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Wed, 20 Oct 2010 01:28:29 +0900 Subject: sh: sh3: Move to boards.cfg Move the sh3 target boards out of the Makefile and into boards.cfg. And fix sh3 of MAKEALL. Signed-off-by: Nobuhiro Iwamatsu --- MAKEALL | 6 +----- Makefile | 14 -------------- boards.cfg | 2 ++ 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/MAKEALL b/MAKEALL index a97061c..71dcba2 100755 --- a/MAKEALL +++ b/MAKEALL @@ -610,11 +610,7 @@ LIST_blackfin="$(boards_by_arch blackfin) ######################################################################### LIST_sh2="$(boards_by_cpu sh2)" - -LIST_sh3=" \ - mpr2 \ - ms7720se \ -" +LIST_sh3="$(boards_by_cpu sh3)" LIST_sh4=" \ ms7750se \ diff --git a/Makefile b/Makefile index 205e710..3083c22 100644 --- a/Makefile +++ b/Makefile @@ -1189,20 +1189,6 @@ bf527-ezkit-v2_config : unconfig #======================================================================== ######################################################################### -## sh3 (Renesas SuperH) -######################################################################### - -mpr2_config: unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_MPR2 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh3 mpr2 - -ms7720se_config: unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_MS7720SE 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh3 ms7720se - -######################################################################### ## sh4 (Renesas SuperH) ######################################################################### diff --git a/boards.cfg b/boards.cfg index 2599c2a..1dc557e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -733,5 +733,7 @@ davinci_schmoogie arm arm926ejs schmoogie davinci davinci davinci_dm355leopard arm arm926ejs dm355leopard davinci davinci bf527-ad7160-eval blackfin blackfin rsk7203 sh sh2 rsk7203 renesas - +mpr2 sh sh3 mpr2 - - +ms7720se sh sh3 ms7720se - - # Target ARCH CPU Board name Vendor SoC Options ############################################################################################### -- cgit v1.1 From 03626be3f4533c9875e919bd58c1dfdb73d7f6f0 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Wed, 20 Oct 2010 01:35:28 +0900 Subject: sh: sh4: Move to boards.cfg Move the sh4 target boards out of the Makefile and into boards.cfg. And fix sh4 of MAKEALL. Signed-off-by: Nobuhiro Iwamatsu --- MAKEALL | 19 ++----------------- Makefile | 60 ------------------------------------------------------------ boards.cfg | 10 ++++++++++ 3 files changed, 12 insertions(+), 77 deletions(-) diff --git a/MAKEALL b/MAKEALL index 71dcba2..4ae741a 100755 --- a/MAKEALL +++ b/MAKEALL @@ -611,24 +611,9 @@ LIST_blackfin="$(boards_by_arch blackfin) LIST_sh2="$(boards_by_cpu sh2)" LIST_sh3="$(boards_by_cpu sh3)" +LIST_sh4="$(boards_by_cpu sh4)" -LIST_sh4=" \ - ms7750se \ - ms7722se \ - MigoR \ - r7780mp \ - r2dplus \ - sh7763rdp \ - sh7785lcr \ - ap325rxa \ - espt \ -" - -LIST_sh=" \ - ${LIST_sh2} \ - ${LIST_sh3} \ - ${LIST_sh4} \ -" +LIST_sh="$(boards_by_arch sh)" ######################################################################### ## SPARC Systems diff --git a/Makefile b/Makefile index 3083c22..f8e13d7 100644 --- a/Makefile +++ b/Makefile @@ -1184,66 +1184,6 @@ bf527-ezkit-v2_config : unconfig @$(MKCONFIG) -t BF527_EZKIT_REV_2_1 \ bf527-ezkit blackfin blackfin bf527-ezkit -#======================================================================== -# SH3 (SuperH) -#======================================================================== - -######################################################################### -## sh4 (Renesas SuperH) -######################################################################### - -MigoR_config : unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_MIGO_R 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh4 MigoR renesas - -ms7750se_config: unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_MS7750SE 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh4 ms7750se - -ms7722se_config : unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_MS7722SE 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh4 ms7722se - -r2dplus_config : unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_R2DPLUS 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh4 r2dplus renesas - -r7780mp_config: unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_R7780MP 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh4 r7780mp renesas - -sh7763rdp_config : unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_SH7763RDP 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh4 sh7763rdp renesas - -sh7785lcr_32bit_config \ -sh7785lcr_config : unconfig - @mkdir -p $(obj)include - @mkdir -p $(obj)board/renesas/sh7785lcr - @echo "#define CONFIG_SH7785LCR 1" > $(obj)include/config.h - @if [ "$(findstring 32bit, $@)" ] ; then \ - echo "#define CONFIG_SH_32BIT 1" >> $(obj)include/config.h ; \ - echo "CONFIG_SYS_TEXT_BASE = 0x8ff80000" > \ - $(obj)board/renesas/sh7785lcr/config.tmp ; \ - fi - @$(MKCONFIG) -n $@ -a sh7785lcr sh sh4 sh7785lcr renesas - -ap325rxa_config : unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_AP325RXA 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh4 ap325rxa renesas - -espt_config : unconfig - @mkdir -p $(obj)include - @echo "#define CONFIG_ESPT 1" > $(obj)include/config.h - @$(MKCONFIG) -a $@ sh sh4 espt - ######################################################################### ######################################################################### diff --git a/boards.cfg b/boards.cfg index 1dc557e..b701737 100644 --- a/boards.cfg +++ b/boards.cfg @@ -735,5 +735,15 @@ bf527-ad7160-eval blackfin blackfin rsk7203 sh sh2 rsk7203 renesas - mpr2 sh sh3 mpr2 - - ms7720se sh sh3 ms7720se - - +MigoRsh sh4 MigoR renesas - +ms7750se sh sh4 ms7750se - - +ms7722se sh sh4 ms7722se - - +r2dplus sh sh4 r2dplus renesas - +r7780mp sh sh4 r7780mp renesas - +sh7763rdp sh sh4 sh7763rdp renesas - +sh7785lcr sh sh4 sh7785lcr renesas - +sh7785lcr_32bit sh sh4 sh7785lcr renesas - sh7785lcr:SH_32BIT=1 +ap325rxa sh sh4 ap325rxa renesas - +espt sh sh4 espt - - # Target ARCH CPU Board name Vendor SoC Options ############################################################################################### -- cgit v1.1