summaryrefslogtreecommitdiffstats
path: root/arch/sh/lib
diff options
context:
space:
mode:
authorH. Nikolaus Schaller <hns@goldelico.com>2011-02-24 13:21:40 +0100
committerH. Nikolaus Schaller <hns@goldelico.com>2011-02-24 13:21:40 +0100
commit67fa659acb97323da480a4a545560d4d27c5796a (patch)
tree648ab5e4cbcdf17bcfe0e79346e264c4f0187662 /arch/sh/lib
parent872ca46bf7ec07388fc06e687875204663f6080e (diff)
parentc7977858dcf1f656cbe91ea0dc3cb9139c6a8cc8 (diff)
downloadbootable_bootloader_goldelico_gta04-67fa659acb97323da480a4a545560d4d27c5796a.zip
bootable_bootloader_goldelico_gta04-67fa659acb97323da480a4a545560d4d27c5796a.tar.gz
bootable_bootloader_goldelico_gta04-67fa659acb97323da480a4a545560d4d27c5796a.tar.bz2
git pull denx master
Diffstat (limited to 'arch/sh/lib')
-rw-r--r--arch/sh/lib/Makefile3
-rw-r--r--arch/sh/lib/board.c15
-rw-r--r--arch/sh/lib/bootm.c21
-rw-r--r--arch/sh/lib/zimageboot.c80
4 files changed, 95 insertions, 24 deletions
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index 7f60396..c0670cb 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -31,6 +31,9 @@ COBJS-y += time_sh2.o
else
COBJS-y += time.o
endif
+ifeq ($(CONFIG_CMD_SH_ZIMAGEBOOT),y)
+COBJS-y += zimageboot.o
+endif
SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
index fe53ab4..968566c 100644
--- a/arch/sh/lib/board.c
+++ b/arch/sh/lib/board.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007,2008
+ * Copyright (C) 2007, 2008, 2010
* Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
*
* This program is free software; you can redistribute it and/or
@@ -32,6 +32,8 @@
#include <miiphy.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
extern int cpu_init(void);
extern int board_init(void);
extern int dram_init(void);
@@ -43,10 +45,12 @@ unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;
static int sh_flash_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
gd->bd->bi_flashsize = flash_init();
- printf("FLASH: %ldMB\n", gd->bd->bi_flashsize / (1024*1024));
+
+ if (gd->bd->bi_flashsize >= (1024 * 1024))
+ printf("Flash: %ldMB\n", gd->bd->bi_flashsize / (1024*1024));
+ else
+ printf("Flash: %ldKB\n", gd->bd->bi_flashsize / 1024);
return 0;
}
@@ -99,7 +103,6 @@ static int sh_mem_env_init(void)
#if defined(CONFIG_CMD_NET)
static int sh_net_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
return 0;
}
@@ -139,8 +142,6 @@ init_fnc_t *init_sequence[] =
void sh_generic_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
bd_t *bd;
init_fnc_t **init_fnc_ptr;
diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c
index 19b3a94..57273fa 100644
--- a/arch/sh/lib/bootm.c
+++ b/arch/sh/lib/bootm.c
@@ -27,6 +27,7 @@
#include <common.h>
#include <command.h>
#include <asm/byteorder.h>
+#include <asm/zimage.h>
#ifdef CONFIG_SYS_DEBUG
static void hexdump(unsigned char *buf, int len)
@@ -43,19 +44,6 @@ 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
@@ -94,13 +82,12 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
return 1;
- /* Setup parameters */
- memset(param, 0, size); /* Clear zero page */
+ /* Clear zero page */
+ memset(param, 0, size);
/* 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;
@@ -128,7 +115,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
/* Boot kernel */
kernel();
- /* does not return */
+ /* does not return */
return 1;
}
diff --git a/arch/sh/lib/zimageboot.c b/arch/sh/lib/zimageboot.c
new file mode 100644
index 0000000..dd413c0
--- /dev/null
+++ b/arch/sh/lib/zimageboot.c
@@ -0,0 +1,80 @@
+/*
+ * (C) Copyright 2010
+ * Renesas Solutions Corp.
+ * Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Linux SuperH zImage loading and boot
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/zimage.h>
+
+int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ ulong (*zboot_entry)(int, char * const []) = NULL;
+ char *s0, *s1;
+ unsigned char *param = NULL;
+ char *cmdline;
+ char *bootargs;
+
+ disable_interrupts();
+
+ if (argc >= 3) {
+ /* argv[1] holds the address of the zImage */
+ s0 = argv[1];
+ /* argv[2] holds the address of zero page */
+ s1 = argv[2];
+ } else {
+ goto exit;
+ }
+
+ if (s0)
+ zboot_entry = (ulong (*)(int, char * const []))simple_strtoul(s0, NULL, 16);
+
+ /* empty_zero_page */
+ if (s1)
+ param = (unsigned char*)simple_strtoul(s1, NULL, 16);
+
+ /* Linux kernel command line */
+ cmdline = (char *)param + COMMAND_LINE;
+ bootargs = getenv("bootargs");
+
+ /* Clear zero page */
+ memset(param, 0, 0x1000);
+
+ /* Set commandline */
+ strcpy(cmdline, bootargs);
+
+ /* Boot */
+ zboot_entry(0, NULL);
+
+exit:
+ return -1;
+}
+
+U_BOOT_CMD(
+ zimageboot, 3, 0, do_sh_zimageboot,
+ "Boot zImage for Renesas SH",
+ ""
+);