Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 1 | /* |
| 2 | * U-boot - bf533_linux.c |
| 3 | * |
Aubrey Li | 314d22f | 2007-04-05 18:31:18 +0800 | [diff] [blame] | 4 | * Copyright (c) 2005-2007 Analog Devices Inc. |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 5 | * |
| 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 Li | 314d22f | 2007-04-05 18:31:18 +0800 | [diff] [blame] | 24 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 25 | * MA 02110-1301 USA |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 26 | */ |
| 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 | |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 39 | #define CMD_LINE_ADDR 0xFF900000 /* L1 scratchpad */ |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 40 | |
| 41 | #ifdef SHARED_RESOURCES |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 42 | extern void swap_to(int device_id); |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 43 | #endif |
| 44 | |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 45 | extern void flush_instruction_cache(void); |
| 46 | extern void flush_data_cache(void); |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 47 | static char *make_command_line(void); |
| 48 | |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 49 | void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], |
Marian Balakowicz | 61fde55 | 2008-02-27 11:01:04 +0100 | [diff] [blame] | 50 | bootm_headers_t *images) |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 51 | { |
Marian Balakowicz | dbdd16a | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 52 | int (*appl) (char *cmdline); |
| 53 | char *cmdline; |
| 54 | ulong ep = 0; |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 55 | |
Kumar Gala | aa0826b | 2008-02-27 21:51:51 -0600 | [diff] [blame^] | 56 | if (!images->autostart) |
| 57 | return ; |
| 58 | |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 59 | #ifdef SHARED_RESOURCES |
| 60 | swap_to(FLASH); |
| 61 | #endif |
| 62 | |
Marian Balakowicz | dbdd16a | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 63 | /* find kernel entry point */ |
| 64 | if (images->legacy_hdr_valid) { |
| 65 | ep = image_get_ep (images->legacy_hdr_os); |
| 66 | #if defined(CONFIG_FIT) |
| 67 | } else if (images->fit_uname_os) { |
| 68 | fit_unsupported_reset ("AVR32 linux bootm"); |
| 69 | do_reset (cmdtp, flag, argc, argv); |
| 70 | #endif |
| 71 | } else { |
| 72 | puts ("Could not find kernel entry point!\n"); |
| 73 | do_reset (cmdtp, flag, argc, argv); |
| 74 | } |
| 75 | appl = (int (*)(char *))ep; |
| 76 | |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 77 | printf("Starting Kernel at = %x\n", appl); |
| 78 | cmdline = make_command_line(); |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 79 | if (icache_status()) { |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 80 | flush_instruction_cache(); |
| 81 | icache_disable(); |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 82 | } |
| 83 | if (dcache_status()) { |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 84 | flush_data_cache(); |
| 85 | dcache_disable(); |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 86 | } |
| 87 | (*appl) (cmdline); |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | char *make_command_line(void) |
| 91 | { |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 92 | char *dest = (char *)CMD_LINE_ADDR; |
| 93 | char *bootargs; |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 94 | |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 95 | if ((bootargs = getenv("bootargs")) == NULL) |
| 96 | return NULL; |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 97 | |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 98 | strncpy(dest, bootargs, 0x1000); |
| 99 | dest[0xfff] = 0; |
| 100 | return dest; |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 101 | } |