add SDHC support in mmc driver
[u-boot-openmoko/mini2440.git] / lib_blackfin / bootm.c
blobbea11ed6dd36f997aa55bffb0c38d2258e79e693
1 /*
2 * U-boot - bootm.c - misc boot helper functions
4 * Copyright (c) 2005-2008 Analog Devices Inc.
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * Licensed under the GPL-2 or later.
12 #include <common.h>
13 #include <command.h>
14 #include <image.h>
15 #include <asm/blackfin.h>
17 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
19 #ifdef SHARED_RESOURCES
20 extern void swap_to(int device_id);
21 #endif
23 static char *make_command_line(void)
25 char *dest = (char *)CMD_LINE_ADDR;
26 char *bootargs = getenv("bootargs");
28 if (bootargs == NULL)
29 return NULL;
31 strncpy(dest, bootargs, 0x1000);
32 dest[0xfff] = 0;
33 return dest;
36 void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
37 bootm_headers_t *images)
39 int (*appl) (char *cmdline);
40 char *cmdline;
41 ulong ep = 0;
43 if (!images->autostart)
44 return;
46 #ifdef SHARED_RESOURCES
47 swap_to(FLASH);
48 #endif
50 /* find kernel entry point */
51 if (images->legacy_hdr_valid) {
52 ep = image_get_ep (images->legacy_hdr_os);
53 #if defined(CONFIG_FIT)
54 } else if (images->fit_uname_os) {
55 int ret = fit_image_get_entry (images->fit_hdr_os,
56 images->fit_noffset_os, &ep);
57 if (ret) {
58 puts ("Can't get entry point property!\n");
59 goto error;
61 #endif
62 } else {
63 puts ("Could not find kernel entry point!\n");
64 goto error;
66 appl = (int (*)(char *))ep;
68 printf("Starting Kernel at = %x\n", appl);
69 cmdline = make_command_line();
70 icache_disable();
71 dcache_disable();
72 (*appl) (cmdline);
73 /* does not return */
74 return;
76 error:
77 if (images->autostart)
78 do_reset (cmdtp, flag, argc, argv);