summaryrefslogtreecommitdiff
path: root/arch/sh
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-11-12 22:24:06 +0100
committerWolfgang Denk <wd@denx.de>2010-11-12 22:24:06 +0100
commitd963e84c92a63b4e6c4f2f80482a5ecbe9b24fe0 (patch)
tree07dd5889d73f4b66ad608815adcf6f2f953d9501 /arch/sh
parent66fca016057b1c6b697552cc7220ebada9d4f82d (diff)
parent0c0892be0d93a5a892b93739c5eb3bf692fed4ff (diff)
downloadu-boot-imx-d963e84c92a63b4e6c4f2f80482a5ecbe9b24fe0.zip
u-boot-imx-d963e84c92a63b4e6c4f2f80482a5ecbe9b24fe0.tar.gz
u-boot-imx-d963e84c92a63b4e6c4f2f80482a5ecbe9b24fe0.tar.bz2
Merge branch 'master' of /home/wd/git/u-boot/master
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/config.mk2
-rw-r--r--arch/sh/cpu/sh2/start.S5
-rw-r--r--arch/sh/cpu/sh3/start.S5
-rw-r--r--arch/sh/cpu/sh4/start.S5
-rw-r--r--arch/sh/include/asm/config.h3
-rw-r--r--arch/sh/lib/board.c4
-rw-r--r--arch/sh/lib/bootm.c66
7 files changed, 77 insertions, 13 deletions
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
diff --git a/arch/sh/cpu/sh2/start.S b/arch/sh/cpu/sh2/start.S
index 0ab867d..77043f6 100644
--- a/arch/sh/cpu/sh2/start.S
+++ b/arch/sh/cpu/sh2/start.S
@@ -18,6 +18,7 @@
* MA 02111-1307 USA
*/
+#include <asm-offsets.h>
#include <config.h>
#include <version.h>
@@ -73,6 +74,6 @@ loop:
._reloc_dst_end: .long reloc_dst_end
._bss_start: .long bss_start
._bss_end: .long bss_end
-._gd_init: .long (_start - CONFIG_SYS_GBL_DATA_SIZE)
-._stack_init: .long (_start - CONFIG_SYS_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
+._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE)
+._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
._sh_generic_init: .long sh_generic_init
diff --git a/arch/sh/cpu/sh3/start.S b/arch/sh/cpu/sh3/start.S
index c0f8326..9dd2303 100644
--- a/arch/sh/cpu/sh3/start.S
+++ b/arch/sh/cpu/sh3/start.S
@@ -21,6 +21,7 @@
* MA 02111-1307 USA
*/
+#include <asm-offsets.h>
#include <config.h>
#include <version.h>
@@ -72,6 +73,6 @@ loop:
._reloc_dst_end: .long reloc_dst_end
._bss_start: .long bss_start
._bss_end: .long bss_end
-._gd_init: .long (_start - CONFIG_SYS_GBL_DATA_SIZE)
-._stack_init: .long (_start - CONFIG_SYS_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
+._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE)
+._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
._sh_generic_init: .long sh_generic_init
diff --git a/arch/sh/cpu/sh4/start.S b/arch/sh/cpu/sh4/start.S
index 711ae66..4b5f606 100644
--- a/arch/sh/cpu/sh4/start.S
+++ b/arch/sh/cpu/sh4/start.S
@@ -18,6 +18,7 @@
* MA 02111-1307 USA
*/
+#include <asm-offsets.h>
#include <config.h>
#include <version.h>
@@ -69,6 +70,6 @@ loop:
._reloc_dst_end: .long reloc_dst_end
._bss_start: .long bss_start
._bss_end: .long bss_end
-._gd_init: .long (_start - CONFIG_SYS_GBL_DATA_SIZE)
-._stack_init: .long (_start - CONFIG_SYS_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
+._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE)
+._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
._sh_generic_init: .long sh_generic_init
diff --git a/arch/sh/include/asm/config.h b/arch/sh/include/asm/config.h
index 978cc92..049c44e 100644
--- a/arch/sh/include/asm/config.h
+++ b/arch/sh/include/asm/config.h
@@ -21,7 +21,4 @@
#ifndef _ASM_CONFIG_H_
#define _ASM_CONFIG_H_
-/* Relocation to SDRAM works on all sh boards */
-#define CONFIG_RELOC_FIXUP_WORKS
-
#endif
diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
index a302fc2..fe53ab4 100644
--- a/arch/sh/lib/board.c
+++ b/arch/sh/lib/board.c
@@ -89,7 +89,7 @@ static int sh_pci_init(void)
static int sh_mem_env_init(void)
{
- mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_GBL_DATA_SIZE -
+ mem_malloc_init(CONFIG_SYS_TEXT_BASE - GENERATED_GBL_DATA_SIZE -
CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN - 16);
env_relocate();
jumptable_init();
@@ -144,7 +144,7 @@ void sh_generic_init(void)
bd_t *bd;
init_fnc_t **init_fnc_ptr;
- memset(gd, 0, CONFIG_SYS_GBL_DATA_SIZE);
+ memset(gd, 0, GENERATED_GBL_DATA_SIZE);
gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c
index 9c58ed7..19b3a94 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 = 0;
+ 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 */