blob: 93933b7931d76181f1924433858d24057ab5fd2e [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu45ce6f92010-12-08 13:49:12 +09002/*
3 * (C) Copyright 2010
4 * Renesas Solutions Corp.
5 * Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Nobuhiro Iwamatsu45ce6f92010-12-08 13:49:12 +09006 */
7
8/*
9 * Linux SuperH zImage loading and boot
10 */
11
12#include <common.h>
13#include <asm/io.h>
14#include <asm/zimage.h>
15
16int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
17{
18 ulong (*zboot_entry)(int, char * const []) = NULL;
19 char *s0, *s1;
20 unsigned char *param = NULL;
21 char *cmdline;
22 char *bootargs;
23
24 disable_interrupts();
25
26 if (argc >= 3) {
27 /* argv[1] holds the address of the zImage */
28 s0 = argv[1];
29 /* argv[2] holds the address of zero page */
30 s1 = argv[2];
31 } else {
32 goto exit;
33 }
34
35 if (s0)
36 zboot_entry = (ulong (*)(int, char * const []))simple_strtoul(s0, NULL, 16);
37
38 /* empty_zero_page */
39 if (s1)
40 param = (unsigned char*)simple_strtoul(s1, NULL, 16);
41
42 /* Linux kernel command line */
43 cmdline = (char *)param + COMMAND_LINE;
Simon Glass00caae62017-08-03 12:22:12 -060044 bootargs = env_get("bootargs");
Nobuhiro Iwamatsu45ce6f92010-12-08 13:49:12 +090045
46 /* Clear zero page */
Wolfgang Denk00605172014-11-06 14:02:57 +010047 /* cppcheck-suppress nullPointer */
Nobuhiro Iwamatsu45ce6f92010-12-08 13:49:12 +090048 memset(param, 0, 0x1000);
49
50 /* Set commandline */
51 strcpy(cmdline, bootargs);
52
53 /* Boot */
54 zboot_entry(0, NULL);
55
56exit:
57 return -1;
58}
59
60U_BOOT_CMD(
61 zimageboot, 3, 0, do_sh_zimageboot,
62 "Boot zImage for Renesas SH",
63 ""
64);