Commit 86a20fb920bd198105acf7b1191117f566d637ed
1 parent
b8aa57b5d4
Exists in
master
and in
54 other branches
Blackfin: move bootldr command to common code
This moves the Blackfin-common bootldr command out of the BF537-STAMP specific board directory and into the common directory so that all Blackfin boards may utilize it. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Showing 3 changed files with 65 additions and 45 deletions Side-by-side Diff
board/bf537-stamp/bf537-stamp.c
... | ... | @@ -54,51 +54,6 @@ |
54 | 54 | |
55 | 55 | #define POST_WORD_ADDR 0xFF903FFC |
56 | 56 | |
57 | -/* | |
58 | - * the bootldr command loads an address, checks to see if there | |
59 | - * is a Boot stream that the on-chip BOOTROM can understand, | |
60 | - * and loads it via the BOOTROM Callback. It is possible | |
61 | - * to also add booting from SPI, or TWI, but this function does | |
62 | - * not currently support that. | |
63 | - */ | |
64 | -int do_bootldr(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) | |
65 | -{ | |
66 | - ulong addr, entry; | |
67 | - ulong *data; | |
68 | - | |
69 | - /* Get the address */ | |
70 | - if (argc < 2) { | |
71 | - addr = load_addr; | |
72 | - } else { | |
73 | - addr = simple_strtoul(argv[1], NULL, 16); | |
74 | - } | |
75 | - | |
76 | - /* Check if it is a LDR file */ | |
77 | - data = (ulong *) addr; | |
78 | - if (*data == 0xFF800060 || *data == 0xFF800040 || *data == 0xFF800020) { | |
79 | - /* We want to boot from FLASH or SDRAM */ | |
80 | - entry = _BOOTROM_BOOT_DXE_FLASH; | |
81 | - printf("## Booting ldr image at 0x%08lx ...\n", addr); | |
82 | - if (icache_status()) | |
83 | - icache_disable(); | |
84 | - if (dcache_status()) | |
85 | - dcache_disable(); | |
86 | - | |
87 | - __asm__("R7=%[a];\n" "P0=%[b];\n" "JUMP (P0);\n": | |
88 | - :[a] "d"(addr),[b] "a"(entry) | |
89 | - :"R7", "P0"); | |
90 | - | |
91 | - } else { | |
92 | - printf("## No ldr image at address 0x%08lx\n", addr); | |
93 | - } | |
94 | - | |
95 | - return 0; | |
96 | -} | |
97 | - | |
98 | -U_BOOT_CMD(bootldr, 2, 0, do_bootldr, | |
99 | - "bootldr - boot ldr image from memory\n", | |
100 | - "[addr]\n - boot ldr image stored in memory\n"); | |
101 | - | |
102 | 57 | int checkboard(void) |
103 | 58 | { |
104 | 59 | #if (BFIN_CPU == ADSP_BF534) |
common/Makefile
... | ... | @@ -37,6 +37,7 @@ |
37 | 37 | COBJS-$(CONFIG_CMD_BEDBUG) += cmd_bedbug.o |
38 | 38 | COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o |
39 | 39 | COBJS-y += cmd_boot.o |
40 | +COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o | |
40 | 41 | COBJS-y += cmd_bootm.o |
41 | 42 | COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o |
42 | 43 | COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o |
common/cmd_bootldr.c
1 | +/* | |
2 | + * U-boot - bootldr.c | |
3 | + * | |
4 | + * Copyright (c) 2005-2008 Analog Devices Inc. | |
5 | + * | |
6 | + * See file CREDITS for list of people who contributed to this | |
7 | + * project. | |
8 | + * | |
9 | + * Licensed under the GPL-2 or later. | |
10 | + */ | |
11 | + | |
12 | +#include <config.h> | |
13 | +#include <common.h> | |
14 | +#include <command.h> | |
15 | + | |
16 | +#include <asm/blackfin.h> | |
17 | +#include <asm/mach-common/bits/bootrom.h> | |
18 | + | |
19 | +/* | |
20 | + * the bootldr command loads an address, checks to see if there | |
21 | + * is a Boot stream that the on-chip BOOTROM can understand, | |
22 | + * and loads it via the BOOTROM Callback. It is possible | |
23 | + * to also add booting from SPI, or TWI, but this function does | |
24 | + * not currently support that. | |
25 | + */ | |
26 | + | |
27 | +int do_bootldr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) | |
28 | +{ | |
29 | + void *addr; | |
30 | + uint32_t *data; | |
31 | + | |
32 | + /* Get the address */ | |
33 | + if (argc < 2) | |
34 | + addr = (void *)load_addr; | |
35 | + else | |
36 | + addr = (void *)simple_strtoul(argv[1], NULL, 16); | |
37 | + | |
38 | + /* Check if it is a LDR file */ | |
39 | + data = addr; | |
40 | +#if defined(__ADSPBF54x__) || defined(__ADSPBF52x__) | |
41 | + if ((*data & 0xFF000000) == 0xAD000000 && data[2] == 0x00000000) { | |
42 | +#else | |
43 | + if (*data == 0xFF800060 || *data == 0xFF800040 || *data == 0xFF800020) { | |
44 | +#endif | |
45 | + /* We want to boot from FLASH or SDRAM */ | |
46 | + printf("## Booting ldr image at 0x%p ...\n", addr); | |
47 | + | |
48 | + icache_disable(); | |
49 | + dcache_disable(); | |
50 | + | |
51 | + __asm__( | |
52 | + "jump (%1);" | |
53 | + : | |
54 | + : "q7" (addr), "a" (_BOOTROM_MEMBOOT)); | |
55 | + } else | |
56 | + printf("## No ldr image at address 0x%p\n", addr); | |
57 | + | |
58 | + return 0; | |
59 | +} | |
60 | + | |
61 | +U_BOOT_CMD(bootldr, 2, 0, do_bootldr, | |
62 | + "bootldr - boot ldr image from memory\n", | |
63 | + "[addr]\n" | |
64 | + " - boot ldr image stored in memory\n"); |