]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/blackfin/lib/boot.c
sunxi: Add OrangePi PC 2 initial support
[people/ms/u-boot.git] / arch / blackfin / lib / boot.c
CommitLineData
6cb142fa 1/*
a187559e 2 * U-Boot - boot.c - misc boot helper functions
6cb142fa 3 *
9171fc81 4 * Copyright (c) 2005-2008 Analog Devices Inc.
6cb142fa
WD
5 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
9171fc81 9 * Licensed under the GPL-2 or later.
6cb142fa
WD
10 */
11
6cb142fa
WD
12#include <common.h>
13#include <command.h>
14#include <image.h>
9171fc81 15#include <asm/blackfin.h>
6cb142fa 16
6cb142fa 17#ifdef SHARED_RESOURCES
3f0606ad 18extern void swap_to(int device_id);
6cb142fa
WD
19#endif
20
5fc564ed
MH
21#ifdef CONFIG_VIDEO
22extern void video_stop(void);
23#endif
24
9171fc81
MF
25static char *make_command_line(void)
26{
36cd52a0 27 char *dest = (char *)CONFIG_LINUX_CMDLINE_ADDR;
9171fc81
MF
28 char *bootargs = getenv("bootargs");
29
30 if (bootargs == NULL)
31 return NULL;
32
36cd52a0
MF
33 strncpy(dest, bootargs, CONFIG_LINUX_CMDLINE_SIZE);
34 dest[CONFIG_LINUX_CMDLINE_SIZE - 1] = 0;
9171fc81
MF
35 return dest;
36}
6cb142fa 37
b1e9435b
MF
38extern ulong bfin_poweron_retx;
39
54841ab5 40int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
6cb142fa 41{
d5934ad7
MB
42 int (*appl) (char *cmdline);
43 char *cmdline;
6cb142fa 44
7af26b16
SG
45 if (flag & BOOTM_STATE_OS_PREP)
46 return 0;
49c3a861
KG
47 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
48 return 1;
49
6cb142fa
WD
50#ifdef SHARED_RESOURCES
51 swap_to(FLASH);
52#endif
53
5fc564ed
MH
54#ifdef CONFIG_VIDEO
55 /* maybe this should be standardized and moved to bootm ... */
56 video_stop();
57#endif
58
c160a954 59 appl = (int (*)(char *))images->ep;
d5934ad7 60
fe033ad6 61 printf("Starting Kernel at = %p\n", appl);
6cb142fa 62 cmdline = make_command_line();
9171fc81
MF
63 icache_disable();
64 dcache_disable();
b1e9435b
MF
65 asm __volatile__(
66 "RETX = %[retx];"
67 "CALL (%0);"
68 :
69 : "p"(appl), "q0"(cmdline), [retx] "d"(bfin_poweron_retx)
70 );
cd7c596e 71 /* does not return */
a3a08c0c 72
40d7e99d 73 return 1;
6cb142fa 74}