blob: 3b9c4df9883ac1805387bd6fd1d98ef69a955cc2 [file] [log] [blame]
Wolfgang Denk97caf672006-03-12 02:12:27 +01001/*
2 * U-boot - bf533_linux.c
3 *
Aubrey Li314d22f2007-04-05 18:31:18 +08004 * Copyright (c) 2005-2007 Analog Devices Inc.
Wolfgang Denk97caf672006-03-12 02:12:27 +01005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
9 * See file CREDITS for list of people who contributed to this
10 * project.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
Aubrey Li314d22f2007-04-05 18:31:18 +080024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
25 * MA 02110-1301 USA
Wolfgang Denk97caf672006-03-12 02:12:27 +010026 */
27
28/* Dummy functions, currently not in Use */
29
30#include <common.h>
31#include <command.h>
32#include <image.h>
33#include <zlib.h>
34#include <asm/byteorder.h>
35
36#define LINUX_MAX_ENVS 256
37#define LINUX_MAX_ARGS 256
38
39#ifdef CONFIG_SHOW_BOOT_PROGRESS
40#include <status_led.h>
41#define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
42#else
43#define SHOW_BOOT_PROGRESS(arg)
44#endif
45
Aubrey.Li9da597f2007-03-09 13:38:44 +080046#define CMD_LINE_ADDR 0xFF900000 /* L1 scratchpad */
Wolfgang Denk97caf672006-03-12 02:12:27 +010047
48#ifdef SHARED_RESOURCES
Aubrey.Li9da597f2007-03-09 13:38:44 +080049extern void swap_to(int device_id);
Wolfgang Denk97caf672006-03-12 02:12:27 +010050#endif
51
Aubrey.Li9da597f2007-03-09 13:38:44 +080052extern image_header_t header;
53extern void flush_instruction_cache(void);
54extern void flush_data_cache(void);
Wolfgang Denk97caf672006-03-12 02:12:27 +010055static char *make_command_line(void);
56
Wolfgang Denk97caf672006-03-12 02:12:27 +010057void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
58 ulong addr, ulong * len_ptr, int verify)
59{
Aubrey.Li9da597f2007-03-09 13:38:44 +080060 int (*appl) (char *cmdline);
Wolfgang Denk97caf672006-03-12 02:12:27 +010061 char *cmdline;
62
63#ifdef SHARED_RESOURCES
64 swap_to(FLASH);
65#endif
66
67 appl = (int (*)(char *))ntohl(header.ih_ep);
68 printf("Starting Kernel at = %x\n", appl);
69 cmdline = make_command_line();
Aubrey.Li9da597f2007-03-09 13:38:44 +080070 if (icache_status()) {
Wolfgang Denk97caf672006-03-12 02:12:27 +010071 flush_instruction_cache();
72 icache_disable();
Aubrey.Li9da597f2007-03-09 13:38:44 +080073 }
74 if (dcache_status()) {
Wolfgang Denk97caf672006-03-12 02:12:27 +010075 flush_data_cache();
76 dcache_disable();
Aubrey.Li9da597f2007-03-09 13:38:44 +080077 }
78 (*appl) (cmdline);
Wolfgang Denk97caf672006-03-12 02:12:27 +010079}
80
81char *make_command_line(void)
82{
Aubrey.Li9da597f2007-03-09 13:38:44 +080083 char *dest = (char *)CMD_LINE_ADDR;
84 char *bootargs;
Wolfgang Denk97caf672006-03-12 02:12:27 +010085
Aubrey.Li9da597f2007-03-09 13:38:44 +080086 if ((bootargs = getenv("bootargs")) == NULL)
87 return NULL;
Wolfgang Denk97caf672006-03-12 02:12:27 +010088
Aubrey.Li9da597f2007-03-09 13:38:44 +080089 strncpy(dest, bootargs, 0x1000);
90 dest[0xfff] = 0;
91 return dest;
Wolfgang Denk97caf672006-03-12 02:12:27 +010092}