Commit 6beecd5d09f1fab5b8e6cc0a48d1441a4548dbac
Committed by
Tom Rini
1 parent
470ee8b125
Exists in
v2017.01-smarct4x
and in
37 other branches
powerpc: ppc4xx: remove W7OLMC/W7OLMG board support
They have not been converted to Generic Board, so should be removed. (See doc/README.generic-board for details.) Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Erik Theisen <etheisen@mindspring.com>
Showing 23 changed files with 2 additions and 4262 deletions Side-by-side Diff
- arch/powerpc/cpu/ppc4xx/Kconfig
- board/w7o/Kconfig
- board/w7o/MAINTAINERS
- board/w7o/Makefile
- board/w7o/cmd_vpd.c
- board/w7o/errors.h
- board/w7o/flash.c
- board/w7o/fpga.c
- board/w7o/fsboot.c
- board/w7o/init.S
- board/w7o/post1.S
- board/w7o/post2.c
- board/w7o/u-boot.lds.debug
- board/w7o/vpd.c
- board/w7o/vpd.h
- board/w7o/w7o.c
- board/w7o/w7o.h
- board/w7o/watchdog.c
- configs/W7OLMC_defconfig
- configs/W7OLMG_defconfig
- doc/README.scrapyard
- include/configs/W7OLMC.h
- include/configs/W7OLMG.h
arch/powerpc/cpu/ppc4xx/Kconfig
... | ... | @@ -32,12 +32,6 @@ |
32 | 32 | config TARGET_T3CORP |
33 | 33 | bool "Support t3corp" |
34 | 34 | |
35 | -config TARGET_W7OLMC | |
36 | - bool "Support W7OLMC" | |
37 | - | |
38 | -config TARGET_W7OLMG | |
39 | - bool "Support W7OLMG" | |
40 | - | |
41 | 35 | config TARGET_ZEUS |
42 | 36 | bool "Support zeus" |
43 | 37 | |
... | ... | @@ -212,7 +206,6 @@ |
212 | 206 | source "board/sbc405/Kconfig" |
213 | 207 | source "board/sc3/Kconfig" |
214 | 208 | source "board/t3corp/Kconfig" |
215 | -source "board/w7o/Kconfig" | |
216 | 209 | source "board/xes/xpedite1000/Kconfig" |
217 | 210 | source "board/xilinx/ml507/Kconfig" |
218 | 211 | source "board/xilinx/ppc405-generic/Kconfig" |
board/w7o/Kconfig
board/w7o/MAINTAINERS
board/w7o/Makefile
1 | -# | |
2 | -# (C) Copyright 2006 | |
3 | -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
4 | -# | |
5 | -# (C) Copyright 2001 | |
6 | -# Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. | |
7 | -# | |
8 | -# SPDX-License-Identifier: GPL-2.0+ | |
9 | -# | |
10 | - | |
11 | -obj-y = w7o.o flash.o fpga.o fsboot.o post2.o vpd.o cmd_vpd.o \ | |
12 | - watchdog.o | |
13 | -obj-y += init.o post1.o |
board/w7o/cmd_vpd.c
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -#include <common.h> | |
9 | -#include <command.h> | |
10 | - | |
11 | -#if defined(CONFIG_CMD_BSP) | |
12 | - | |
13 | -#include "vpd.h" | |
14 | - | |
15 | -/* ====================================================================== | |
16 | - * Interpreter command to retrieve board specific Vital Product Data, "VPD" | |
17 | - * ====================================================================== | |
18 | - */ | |
19 | -int do_vpd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) | |
20 | -{ | |
21 | - VPD vpd; /* Board specific data struct */ | |
22 | - uchar dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR; | |
23 | - | |
24 | - /* Validate usage */ | |
25 | - if (argc > 2) | |
26 | - return cmd_usage(cmdtp); | |
27 | - | |
28 | - /* Passed in EEPROM address */ | |
29 | - if (argc == 2) | |
30 | - dev_addr = (uchar) simple_strtoul (argv[1], NULL, 16); | |
31 | - | |
32 | - /* Read VPD and output it */ | |
33 | - if (!vpd_get_data (dev_addr, &vpd)) { | |
34 | - vpd_print (&vpd); | |
35 | - return 0; | |
36 | - } | |
37 | - | |
38 | - return 1; | |
39 | -} | |
40 | - | |
41 | -U_BOOT_CMD( | |
42 | - vpd, 2, 1, do_vpd, | |
43 | - "Read Vital Product Data", | |
44 | - "[dev_addr]\n" | |
45 | - " - Read VPD Data from default address, or device address 'dev_addr'." | |
46 | -); | |
47 | - | |
48 | -#endif |
board/w7o/errors.h
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Bill Hunter, Wave 7 Optics, william.hunter@mediaone.net | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | -#ifndef _ERRORS_H_ | |
8 | -#define _ERRORS_H_ | |
9 | - | |
10 | -#define ERR_FF -1 /* led test value(2) */ | |
11 | -#define ERR_00 0x0000 /* led test value(2) */ | |
12 | -#define ERR_LED 0x01 /* led test failed (1)(3)(4) */ | |
13 | -#define ERR_RAMG 0x04 /* start SDRAM data bus test (2) */ | |
14 | -#define ERR_RAML 0x05 /* SDRAM data bus fault in LSW chip (5) */ | |
15 | -#define ERR_RAMH 0x06 /* SDRAM data bus fault in MSW chip (6) */ | |
16 | -#define ERR_RAMB 0x07 /* SDRAM data bus fault both chips (5)(6)(7) */ | |
17 | -#define ERR_ADDG 0x08 /* start Address ghosting test (13) */ | |
18 | -#define ERR_ADDF 0x09 /* fault during Address ghosting test (13) */ | |
19 | -#define ERR_POST1 0x0a /* post1 tests complete */ | |
20 | -#define ERR_TMP1 0x0b /* */ | |
21 | -#define ERR_R55G 0x0c /* start SDRAM fill 55 test (2) */ | |
22 | -#define ERR_R55L 0x0d /* SDRAM fill test 55 failed in LSW chip (8) */ | |
23 | -#define ERR_R55H 0x0e /* SDRAM fill test 55 failed in MSW chip (9) */ | |
24 | -#define ERR_R55B 0x0f /* SDRAM fill test 55 fail in both chips (10) */ | |
25 | -#define ERR_RAAG 0x10 /* start SDRAM fill aa test (2) */ | |
26 | -#define ERR_RAAL 0x11 /* SDRAM fill test aa failed in LSW chip (8) */ | |
27 | -#define ERR_RAAH 0x12 /* SDRAM fill test aa failed in MSW chip (9) */ | |
28 | -#define ERR_RAAB 0x13 /* SDRAM fill test aa fail in both chips (10) */ | |
29 | -#define ERR_R00G 0x14 /* start SDRAM fill 00 test (2) */ | |
30 | -#define ERR_R00L 0x15 /* SDRAM fill test 00 failed in LSW chip (8) */ | |
31 | -#define ERR_R00H 0x16 /* SDRAM fill test 00 failed in MSW chip (9) */ | |
32 | -#define ERR_R00B 0x17 /* SDRAM fill test 00 fail in both chips (10) */ | |
33 | -#define ERR_RTCG 0x18 /* start RTC test */ | |
34 | -#define ERR_RTCBAT 0x19 /* RTC battery failure */ | |
35 | -#define ERR_RTCTIM 0x1A /* RTC invalid time/date values */ | |
36 | -#define ERR_RTCVAL 0x1B /* RTC NVRAM not accessable */ | |
37 | -#define ERR_FPGAG 0x20 /* fault during FPGA programming */ | |
38 | -#define ERR_XRW1 0x21 /* Xilinx - can't read/write regs on FPGA 1 */ | |
39 | -#define ERR_XRW2 0x22 /* Xilinx - can't read/write regs on FPGA 2 */ | |
40 | -#define ERR_XRW3 0x23 /* Xilinx - can't read/write regs on FPGA 3 */ | |
41 | -#define ERR_XRW4 0x24 /* Xilinx - can't read/write regs on FPGA 4 */ | |
42 | -#define ERR_XRW5 0x25 /* Xilinx - can't read/write regs on FPGA 5 */ | |
43 | -#define ERR_XRW6 0x26 /* Xilinx - can't read/write regs on FPGA 6 */ | |
44 | -#define ERR_XINIT0 0x27 /* Xilinx - INIT line failed to go low */ | |
45 | -#define ERR_XINIT1 0x28 /* Xilinx - INIT line failed to go high */ | |
46 | -#define ERR_XDONE1 0x29 /* Xilinx - DONE line failed to go high */ | |
47 | -#define ERR_XIMAGE 0x2A /* Xilinx - Bad FPGA image in Flash */ | |
48 | -#define ERR_TempG 0x2b /* start temp sensor tests */ | |
49 | -#define ERR_Tinit0 0x2C /* temp sensor 0 failed to init */ | |
50 | -#define ERR_Tinit1 0x2D /* temp sensor 1 failed to init */ | |
51 | -#define ERR_Ttest0 0x2E /* temp sensor 0 failed test */ | |
52 | -#define ERR_Ttest1 0x2F /* temp sensor 1 failed test */ | |
53 | -#define ERR_lm75r 0x30 /* temp sensor read failure */ | |
54 | -#define ERR_lm75w 0x31 /* temp sensor write failure */ | |
55 | - | |
56 | - | |
57 | -#define ERR_POSTOK 0x55 /* PANIC: psych... OK */ | |
58 | - | |
59 | -#if !defined(__ASSEMBLY__) | |
60 | -extern void log_stat(int errcode); | |
61 | -extern void log_warn(int errcode); | |
62 | -extern void log_err(int errcode); | |
63 | -#endif | |
64 | - | |
65 | -/* | |
66 | -Debugging suggestions: | |
67 | -(1) periferal data bus shorted or crossed | |
68 | -(2) general processor halt, check reset, watch dog, power supply ripple, processor clock. | |
69 | -(3) check p_we, p_r/w, p_oe, p_rdy lines. | |
70 | -(4) check LED buffers | |
71 | -(5) check SDRAM data bus bits 16-31, check LSW SDRAM chip. | |
72 | -(6) check SDRAM data bus bits 0-15, check MSW SDRAM chip. | |
73 | -(7) check SDRAM control lines and clocks | |
74 | -(8) check decoupling caps, replace LSW SDRAM | |
75 | -(9) check decoupling caps, replace MSW SDRAM | |
76 | -(10) | |
77 | -(11) | |
78 | -(12) | |
79 | -(13) SDRAM address shorted or unconnected, check sdram caps | |
80 | -*/ | |
81 | -#endif /* _ERRORS_H_ */ |
board/w7o/flash.c
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. | |
4 | - * Based on code by: | |
5 | - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
6 | - * | |
7 | - * SPDX-License-Identifier: GPL-2.0+ | |
8 | - */ | |
9 | - | |
10 | -#include <common.h> | |
11 | -#include <asm/ppc4xx.h> | |
12 | -#include <asm/processor.h> | |
13 | - | |
14 | -#include <watchdog.h> | |
15 | - | |
16 | -/* info for FLASH chips */ | |
17 | -flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; | |
18 | - | |
19 | -/* | |
20 | - * Functions | |
21 | - */ | |
22 | -static ulong flash_get_size(vu_long *addr, flash_info_t *info); | |
23 | -static int write_word8(flash_info_t *info, ulong dest, ulong data); | |
24 | -static int write_word32(flash_info_t *info, ulong dest, ulong data); | |
25 | -static void flash_get_offsets(ulong base, flash_info_t *info); | |
26 | - | |
27 | -unsigned long flash_init(void) | |
28 | -{ | |
29 | - int i; | |
30 | - unsigned long size_b0, base_b0; | |
31 | - unsigned long size_b1; | |
32 | - | |
33 | - /* Init: no FLASHes known */ | |
34 | - for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; ++i) | |
35 | - flash_info[i].flash_id = FLASH_UNKNOWN; | |
36 | - | |
37 | - /* Get Size of Boot and Main Flashes */ | |
38 | - size_b0 = flash_get_size((vu_long *) FLASH_BASE0_PRELIM, | |
39 | - &flash_info[0]); | |
40 | - if (flash_info[0].flash_id == FLASH_UNKNOWN) { | |
41 | - printf("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n", | |
42 | - size_b0, size_b0 << 20); | |
43 | - return 0; | |
44 | - } | |
45 | - size_b1 = | |
46 | - flash_get_size((vu_long *) FLASH_BASE1_PRELIM, | |
47 | - &flash_info[1]); | |
48 | - if (flash_info[1].flash_id == FLASH_UNKNOWN) { | |
49 | - printf("## Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n", | |
50 | - size_b1, size_b1 << 20); | |
51 | - return 0; | |
52 | - } | |
53 | - | |
54 | - /* Calculate base addresses */ | |
55 | - base_b0 = -size_b0; | |
56 | - | |
57 | - /* Setup offsets for Boot Flash */ | |
58 | - flash_get_offsets(base_b0, &flash_info[0]); | |
59 | - | |
60 | - /* Protect board level data */ | |
61 | - (void) flash_protect(FLAG_PROTECT_SET, | |
62 | - base_b0, | |
63 | - flash_info[0].start[1] - 1, &flash_info[0]); | |
64 | - | |
65 | - /* Monitor protection ON by default */ | |
66 | - (void) flash_protect(FLAG_PROTECT_SET, | |
67 | - base_b0 + size_b0 - monitor_flash_len, | |
68 | - base_b0 + size_b0 - 1, &flash_info[0]); | |
69 | - | |
70 | - /* Protect the FPGA image */ | |
71 | - (void) flash_protect(FLAG_PROTECT_SET, | |
72 | - FLASH_BASE1_PRELIM, | |
73 | - FLASH_BASE1_PRELIM + CONFIG_SYS_FPGA_IMAGE_LEN - | |
74 | - 1, &flash_info[1]); | |
75 | - | |
76 | - /* Protect the default boot image */ | |
77 | - (void) flash_protect(FLAG_PROTECT_SET, | |
78 | - FLASH_BASE1_PRELIM + CONFIG_SYS_FPGA_IMAGE_LEN, | |
79 | - FLASH_BASE1_PRELIM + CONFIG_SYS_FPGA_IMAGE_LEN + | |
80 | - 0x600000 - 1, &flash_info[1]); | |
81 | - | |
82 | - /* Setup offsets for Main Flash */ | |
83 | - flash_get_offsets(FLASH_BASE1_PRELIM, &flash_info[1]); | |
84 | - | |
85 | - return size_b0 + size_b1; | |
86 | -} | |
87 | - | |
88 | -static void flash_get_offsets(ulong base, flash_info_t *info) | |
89 | -{ | |
90 | - int i; | |
91 | - | |
92 | - /* set up sector start address table - FOR BOOT ROM ONLY!!! */ | |
93 | - if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) { | |
94 | - for (i = 0; i < info->sector_count; i++) | |
95 | - info->start[i] = base + (i * 0x00010000); | |
96 | - } | |
97 | -} /* end flash_get_offsets() */ | |
98 | - | |
99 | -void flash_print_info(flash_info_t *info) | |
100 | -{ | |
101 | - int i; | |
102 | - int k; | |
103 | - int size; | |
104 | - int erased; | |
105 | - volatile unsigned long *flash; | |
106 | - | |
107 | - if (info->flash_id == FLASH_UNKNOWN) { | |
108 | - printf("missing or unknown FLASH type\n"); | |
109 | - return; | |
110 | - } | |
111 | - | |
112 | - switch (info->flash_id & FLASH_VENDMASK) { | |
113 | - case FLASH_MAN_AMD: | |
114 | - printf("1 x AMD "); | |
115 | - break; | |
116 | - case FLASH_MAN_STM: | |
117 | - printf("1 x STM "); | |
118 | - break; | |
119 | - case FLASH_MAN_INTEL: | |
120 | - printf("2 x Intel "); | |
121 | - break; | |
122 | - default: | |
123 | - printf("Unknown Vendor "); | |
124 | - } | |
125 | - | |
126 | - switch (info->flash_id & FLASH_TYPEMASK) { | |
127 | - case FLASH_AM040: | |
128 | - if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_AMD) | |
129 | - printf("AM29LV040 (4096 Kbit, uniform sector size)\n"); | |
130 | - else if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_STM) | |
131 | - printf("M29W040B (4096 Kbit, uniform block size)\n"); | |
132 | - else | |
133 | - printf("UNKNOWN 29x040x (4096 Kbit, uniform sector size)\n"); | |
134 | - break; | |
135 | - case FLASH_28F320J3A: | |
136 | - printf("28F320J3A (32 Mbit = 128K x 32)\n"); | |
137 | - break; | |
138 | - case FLASH_28F640J3A: | |
139 | - printf("28F640J3A (64 Mbit = 128K x 64)\n"); | |
140 | - break; | |
141 | - case FLASH_28F128J3A: | |
142 | - printf("28F128J3A (128 Mbit = 128K x 128)\n"); | |
143 | - break; | |
144 | - default: | |
145 | - printf("Unknown Chip Type\n"); | |
146 | - } | |
147 | - | |
148 | - if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_STM) { | |
149 | - printf(" Size: %ld KB in %d Blocks\n", | |
150 | - info->size >> 10, info->sector_count); | |
151 | - } else { | |
152 | - printf(" Size: %ld KB in %d Sectors\n", | |
153 | - info->size >> 10, info->sector_count); | |
154 | - } | |
155 | - | |
156 | - printf(" Sector Start Addresses:"); | |
157 | - for (i = 0; i < info->sector_count; ++i) { | |
158 | - /* | |
159 | - * Check if whole sector is erased | |
160 | - */ | |
161 | - if (i != (info->sector_count - 1)) | |
162 | - size = info->start[i + 1] - info->start[i]; | |
163 | - else | |
164 | - size = info->start[0] + info->size - info->start[i]; | |
165 | - erased = 1; | |
166 | - flash = (volatile unsigned long *) info->start[i]; | |
167 | - size = size >> 2; /* divide by 4 for longword access */ | |
168 | - for (k = 0; k < size; k++) { | |
169 | - if (*flash++ != 0xffffffff) { | |
170 | - erased = 0; | |
171 | - break; | |
172 | - } | |
173 | - } | |
174 | - | |
175 | - if ((i % 5) == 0) | |
176 | - printf("\n "); | |
177 | - printf(" %08lX%s%s", | |
178 | - info->start[i], | |
179 | - erased ? " E" : " ", | |
180 | - info->protect[i] ? "RO " : " "); | |
181 | - } | |
182 | - printf("\n"); | |
183 | -} /* end flash_print_info() */ | |
184 | - | |
185 | -/* | |
186 | - * The following code cannot be run from FLASH! | |
187 | - */ | |
188 | -static ulong flash_get_size(vu_long *addr, flash_info_t *info) | |
189 | -{ | |
190 | - short i; | |
191 | - ulong base = (ulong) addr; | |
192 | - | |
193 | - /* Setup default type */ | |
194 | - info->flash_id = FLASH_UNKNOWN; | |
195 | - info->sector_count = 0; | |
196 | - info->size = 0; | |
197 | - | |
198 | - /* Test for Boot Flash */ | |
199 | - if (base == FLASH_BASE0_PRELIM) { | |
200 | - unsigned char value; | |
201 | - volatile unsigned char *addr2 = (unsigned char *) addr; | |
202 | - | |
203 | - /* Write auto select command: read Manufacturer ID */ | |
204 | - *(addr2 + 0x555) = 0xaa; | |
205 | - *(addr2 + 0x2aa) = 0x55; | |
206 | - *(addr2 + 0x555) = 0x90; | |
207 | - | |
208 | - /* Manufacture ID */ | |
209 | - value = *addr2; | |
210 | - switch (value) { | |
211 | - case (unsigned char) AMD_MANUFACT: | |
212 | - info->flash_id = FLASH_MAN_AMD; | |
213 | - break; | |
214 | - case (unsigned char) STM_MANUFACT: | |
215 | - info->flash_id = FLASH_MAN_STM; | |
216 | - break; | |
217 | - default: | |
218 | - *addr2 = 0xf0; /* no or unknown flash */ | |
219 | - return 0; | |
220 | - } | |
221 | - | |
222 | - /* Device ID */ | |
223 | - value = *(addr2 + 1); | |
224 | - switch (value) { | |
225 | - case (unsigned char) AMD_ID_LV040B: | |
226 | - case (unsigned char) STM_ID_29W040B: | |
227 | - info->flash_id += FLASH_AM040; | |
228 | - info->sector_count = 8; | |
229 | - info->size = 0x00080000; | |
230 | - break; /* => 512Kb */ | |
231 | - default: | |
232 | - *addr2 = 0xf0; /* => no or unknown flash */ | |
233 | - return 0; | |
234 | - } | |
235 | - } else { /* MAIN Flash */ | |
236 | - unsigned long value; | |
237 | - volatile unsigned long *addr2 = (unsigned long *) addr; | |
238 | - | |
239 | - /* Write auto select command: read Manufacturer ID */ | |
240 | - *addr2 = 0x90909090; | |
241 | - | |
242 | - /* Manufacture ID */ | |
243 | - value = *addr2; | |
244 | - switch (value) { | |
245 | - case (unsigned long) INTEL_MANUFACT: | |
246 | - info->flash_id = FLASH_MAN_INTEL; | |
247 | - break; | |
248 | - default: | |
249 | - *addr2 = 0xff; /* no or unknown flash */ | |
250 | - return 0; | |
251 | - } | |
252 | - | |
253 | - /* Device ID - This shit is interleaved... */ | |
254 | - value = *(addr2 + 1); | |
255 | - switch (value) { | |
256 | - case (unsigned long) INTEL_ID_28F320J3A: | |
257 | - info->flash_id += FLASH_28F320J3A; | |
258 | - info->sector_count = 32; | |
259 | - info->size = 0x00400000 * 2; | |
260 | - break; /* => 2 X 4 MB */ | |
261 | - case (unsigned long) INTEL_ID_28F640J3A: | |
262 | - info->flash_id += FLASH_28F640J3A; | |
263 | - info->sector_count = 64; | |
264 | - info->size = 0x00800000 * 2; | |
265 | - break; /* => 2 X 8 MB */ | |
266 | - case (unsigned long) INTEL_ID_28F128J3A: | |
267 | - info->flash_id += FLASH_28F128J3A; | |
268 | - info->sector_count = 128; | |
269 | - info->size = 0x01000000 * 2; | |
270 | - break; /* => 2 X 16 MB */ | |
271 | - default: | |
272 | - *addr2 = 0xff; /* => no or unknown flash */ | |
273 | - } | |
274 | - } | |
275 | - | |
276 | - /* Make sure we don't exceed CONFIG_SYS_MAX_FLASH_SECT */ | |
277 | - if (info->sector_count > CONFIG_SYS_MAX_FLASH_SECT) { | |
278 | - printf("** ERROR: sector count %d > max (%d) **\n", | |
279 | - info->sector_count, CONFIG_SYS_MAX_FLASH_SECT); | |
280 | - info->sector_count = CONFIG_SYS_MAX_FLASH_SECT; | |
281 | - } | |
282 | - | |
283 | - /* set up sector start address table */ | |
284 | - switch (info->flash_id & FLASH_TYPEMASK) { | |
285 | - case FLASH_AM040: | |
286 | - for (i = 0; i < info->sector_count; i++) | |
287 | - info->start[i] = base + (i * 0x00010000); | |
288 | - break; | |
289 | - case FLASH_28F320J3A: | |
290 | - case FLASH_28F640J3A: | |
291 | - case FLASH_28F128J3A: | |
292 | - for (i = 0; i < info->sector_count; i++) | |
293 | - info->start[i] = base + | |
294 | - (i * 0x00020000 * 2); /* 2 Banks */ | |
295 | - break; | |
296 | - } | |
297 | - | |
298 | - /* Test for Boot Flash */ | |
299 | - if (base == FLASH_BASE0_PRELIM) { | |
300 | - volatile unsigned char *addr2; | |
301 | - | |
302 | - /* check for protected sectors */ | |
303 | - for (i = 0; i < info->sector_count; i++) { | |
304 | - /* | |
305 | - * read sector protection at sector address, | |
306 | - * (AX .. A0) = 0x02 | |
307 | - * D0 = 1 if protected | |
308 | - */ | |
309 | - addr2 = (volatile unsigned char *) (info->start[i]); | |
310 | - info->protect[i] = *(addr2 + 2) & 1; | |
311 | - } | |
312 | - | |
313 | - /* Restore read mode */ | |
314 | - *(unsigned char *) base = 0xF0; /* Reset NORMAL Flash */ | |
315 | - } else { /* Main Flash */ | |
316 | - volatile unsigned long *addr2; | |
317 | - | |
318 | - /* check for protected sectors */ | |
319 | - for (i = 0; i < info->sector_count; i++) { | |
320 | - /* | |
321 | - * read sector protection at sector address, | |
322 | - * (AX .. A0) = 0x02 | |
323 | - * D0 = 1 if protected | |
324 | - */ | |
325 | - addr2 = (volatile unsigned long *) (info->start[i]); | |
326 | - info->protect[i] = *(addr2 + 2) & 0x1; | |
327 | - } | |
328 | - | |
329 | - /* Restore read mode */ | |
330 | - *(unsigned long *) base = 0xFFFFFFFF; /* Reset Flash */ | |
331 | - } | |
332 | - | |
333 | - return info->size; | |
334 | -} /* end flash_get_size() */ | |
335 | - | |
336 | -static int wait_for_DQ7(ulong addr, uchar cmp_val, ulong tout) | |
337 | -{ | |
338 | - int i; | |
339 | - | |
340 | - volatile uchar *vaddr = (uchar *) addr; | |
341 | - | |
342 | - /* Loop X times */ | |
343 | - for (i = 1; i <= (100 * tout); i++) { /* Wait up to tout ms */ | |
344 | - udelay(10); | |
345 | - /* Pause 10 us */ | |
346 | - | |
347 | - /* Check for completion */ | |
348 | - if ((vaddr[0] & 0x80) == (cmp_val & 0x80)) | |
349 | - return 0; | |
350 | - | |
351 | - /* KEEP THE LUSER HAPPY - Print a dot every 1.1 seconds */ | |
352 | - if (!(i % 110000)) | |
353 | - putc('.'); | |
354 | - | |
355 | - /* Kick the dog if needed */ | |
356 | - WATCHDOG_RESET(); | |
357 | - } | |
358 | - | |
359 | - return 1; | |
360 | -} /* wait_for_DQ7() */ | |
361 | - | |
362 | -static int flash_erase8(flash_info_t *info, int s_first, int s_last) | |
363 | -{ | |
364 | - int tcode, rcode = 0; | |
365 | - volatile uchar *addr = (uchar *) (info->start[0]); | |
366 | - volatile uchar *sector_addr; | |
367 | - int flag, prot, sect; | |
368 | - | |
369 | - /* Validate arguments */ | |
370 | - if ((s_first < 0) || (s_first > s_last)) { | |
371 | - if (info->flash_id == FLASH_UNKNOWN) | |
372 | - printf("- missing\n"); | |
373 | - else | |
374 | - printf("- no sectors to erase\n"); | |
375 | - return 1; | |
376 | - } | |
377 | - | |
378 | - /* Check for KNOWN flash type */ | |
379 | - if (info->flash_id == FLASH_UNKNOWN) { | |
380 | - printf("Can't erase unknown flash type - aborted\n"); | |
381 | - return 1; | |
382 | - } | |
383 | - | |
384 | - /* Check for protected sectors */ | |
385 | - prot = 0; | |
386 | - for (sect = s_first; sect <= s_last; ++sect) { | |
387 | - if (info->protect[sect]) | |
388 | - prot++; | |
389 | - } | |
390 | - if (prot) { | |
391 | - printf("- Warning: %d protected sectors will not be erased!\n", | |
392 | - prot); | |
393 | - } else { | |
394 | - printf("\n"); | |
395 | - } | |
396 | - | |
397 | - /* Start erase on unprotected sectors */ | |
398 | - for (sect = s_first; sect <= s_last; sect++) { | |
399 | - if (info->protect[sect] == 0) { /* not protected */ | |
400 | - sector_addr = (uchar *) (info->start[sect]); | |
401 | - | |
402 | - if ((info->flash_id & FLASH_VENDMASK) == | |
403 | - FLASH_MAN_STM) | |
404 | - printf("Erasing block %p\n", sector_addr); | |
405 | - else | |
406 | - printf("Erasing sector %p\n", sector_addr); | |
407 | - | |
408 | - /* Disable interrupts which might cause timeout */ | |
409 | - flag = disable_interrupts(); | |
410 | - | |
411 | - *(addr + 0x555) = (uchar) 0xAA; | |
412 | - *(addr + 0x2aa) = (uchar) 0x55; | |
413 | - *(addr + 0x555) = (uchar) 0x80; | |
414 | - *(addr + 0x555) = (uchar) 0xAA; | |
415 | - *(addr + 0x2aa) = (uchar) 0x55; | |
416 | - *sector_addr = (uchar) 0x30; /* sector erase */ | |
417 | - | |
418 | - /* | |
419 | - * Wait for each sector to complete, it's more | |
420 | - * reliable. According to AMD Spec, you must | |
421 | - * issue all erase commands within a specified | |
422 | - * timeout. This has been seen to fail, especially | |
423 | - * if printf()s are included (for debug)!! | |
424 | - * Takes up to 6 seconds. | |
425 | - */ | |
426 | - tcode = wait_for_DQ7((ulong) sector_addr, 0x80, 6000); | |
427 | - | |
428 | - /* re-enable interrupts if necessary */ | |
429 | - if (flag) | |
430 | - enable_interrupts(); | |
431 | - | |
432 | - /* Make sure we didn't timeout */ | |
433 | - if (tcode) { | |
434 | - printf("Timeout\n"); | |
435 | - rcode = 1; | |
436 | - } | |
437 | - } | |
438 | - } | |
439 | - | |
440 | - /* wait at least 80us - let's wait 1 ms */ | |
441 | - udelay(1000); | |
442 | - | |
443 | - /* reset to read mode */ | |
444 | - addr = (uchar *) info->start[0]; | |
445 | - *addr = (uchar) 0xF0; /* reset bank */ | |
446 | - | |
447 | - printf(" done\n"); | |
448 | - return rcode; | |
449 | -} /* end flash_erase8() */ | |
450 | - | |
451 | -static int flash_erase32(flash_info_t *info, int s_first, int s_last) | |
452 | -{ | |
453 | - int flag, sect; | |
454 | - ulong start, now, last; | |
455 | - int prot = 0; | |
456 | - | |
457 | - /* Validate arguments */ | |
458 | - if ((s_first < 0) || (s_first > s_last)) { | |
459 | - if (info->flash_id == FLASH_UNKNOWN) | |
460 | - printf("- missing\n"); | |
461 | - else | |
462 | - printf("- no sectors to erase\n"); | |
463 | - return 1; | |
464 | - } | |
465 | - | |
466 | - /* Check for KNOWN flash type */ | |
467 | - if ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_INTEL) { | |
468 | - printf("Can erase only Intel flash types - aborted\n"); | |
469 | - return 1; | |
470 | - } | |
471 | - | |
472 | - /* Check for protected sectors */ | |
473 | - for (sect = s_first; sect <= s_last; ++sect) { | |
474 | - if (info->protect[sect]) | |
475 | - prot++; | |
476 | - } | |
477 | - if (prot) { | |
478 | - printf("- Warning: %d protected sectors will not be erased!\n", | |
479 | - prot); | |
480 | - } else { | |
481 | - printf("\n"); | |
482 | - } | |
483 | - | |
484 | - start = get_timer(0); | |
485 | - last = start; | |
486 | - /* Start erase on unprotected sectors */ | |
487 | - for (sect = s_first; sect <= s_last; sect++) { | |
488 | - WATCHDOG_RESET(); | |
489 | - if (info->protect[sect] == 0) { /* not protected */ | |
490 | - vu_long *addr = (vu_long *) (info->start[sect]); | |
491 | - unsigned long status; | |
492 | - | |
493 | - /* Disable interrupts which might cause a timeout */ | |
494 | - flag = disable_interrupts(); | |
495 | - | |
496 | - *addr = 0x00500050; /* clear status register */ | |
497 | - *addr = 0x00200020; /* erase setup */ | |
498 | - *addr = 0x00D000D0; /* erase confirm */ | |
499 | - | |
500 | - /* re-enable interrupts if necessary */ | |
501 | - if (flag) | |
502 | - enable_interrupts(); | |
503 | - | |
504 | - /* Wait at least 80us - let's wait 1 ms */ | |
505 | - udelay(1000); | |
506 | - | |
507 | - while (((status = *addr) & 0x00800080) != 0x00800080) { | |
508 | - now = get_timer(start); | |
509 | - if (now > CONFIG_SYS_FLASH_ERASE_TOUT) { | |
510 | - printf("Timeout\n"); | |
511 | - /* suspend erase */ | |
512 | - *addr = 0x00B000B0; | |
513 | - /* reset to read mode */ | |
514 | - *addr = 0x00FF00FF; | |
515 | - return 1; | |
516 | - } | |
517 | - | |
518 | - /* | |
519 | - * show that we're waiting | |
520 | - * every second (?) | |
521 | - */ | |
522 | - if ((now - last) > 990) { | |
523 | - putc('.'); | |
524 | - last = now; | |
525 | - } | |
526 | - } | |
527 | - *addr = 0x00FF00FF; /* reset to read mode */ | |
528 | - } | |
529 | - } | |
530 | - printf(" done\n"); | |
531 | - return 0; | |
532 | -} | |
533 | - | |
534 | -int flash_erase(flash_info_t *info, int s_first, int s_last) | |
535 | -{ | |
536 | - if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) | |
537 | - return flash_erase8(info, s_first, s_last); | |
538 | - else | |
539 | - return flash_erase32(info, s_first, s_last); | |
540 | -} | |
541 | - | |
542 | -/* | |
543 | - * Copy memory to flash, returns: | |
544 | - * 0 - OK | |
545 | - * 1 - write timeout | |
546 | - * 2 - Flash not erased | |
547 | - */ | |
548 | -static int write_buff8(flash_info_t *info, uchar *src, ulong addr, | |
549 | - ulong cnt) | |
550 | -{ | |
551 | - ulong cp, wp, data; | |
552 | - ulong start; | |
553 | - int i, l, rc; | |
554 | - | |
555 | - start = get_timer(0); | |
556 | - | |
557 | - wp = (addr & ~3); /* get lower word | |
558 | - aligned address */ | |
559 | - | |
560 | - /* | |
561 | - * handle unaligned start bytes | |
562 | - */ | |
563 | - l = addr - wp; | |
564 | - if (l != 0) { | |
565 | - data = 0; | |
566 | - for (i = 0, cp = wp; i < l; ++i, ++cp) | |
567 | - data = (data << 8) | (*(uchar *) cp); | |
568 | - | |
569 | - for (; i < 4 && cnt > 0; ++i) { | |
570 | - data = (data << 8) | *src++; | |
571 | - --cnt; | |
572 | - ++cp; | |
573 | - } | |
574 | - | |
575 | - for (; cnt == 0 && i < 4; ++i, ++cp) | |
576 | - data = (data << 8) | (*(uchar *) cp); | |
577 | - | |
578 | - rc = write_word8(info, wp, data); | |
579 | - if (rc != 0) | |
580 | - return rc; | |
581 | - | |
582 | - wp += 4; | |
583 | - } | |
584 | - | |
585 | - /* | |
586 | - * handle word aligned part | |
587 | - */ | |
588 | - while (cnt >= 4) { | |
589 | - data = 0; | |
590 | - for (i = 0; i < 4; ++i) | |
591 | - data = (data << 8) | *src++; | |
592 | - | |
593 | - rc = write_word8(info, wp, data); | |
594 | - if (rc != 0) | |
595 | - return rc; | |
596 | - | |
597 | - wp += 4; | |
598 | - cnt -= 4; | |
599 | - if (get_timer(start) > 1000) { /* every second */ | |
600 | - WATCHDOG_RESET(); | |
601 | - putc('.'); | |
602 | - start = get_timer(0); | |
603 | - } | |
604 | - } | |
605 | - | |
606 | - if (cnt == 0) | |
607 | - return 0; | |
608 | - | |
609 | - /* | |
610 | - * handle unaligned tail bytes | |
611 | - */ | |
612 | - data = 0; | |
613 | - for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) { | |
614 | - data = (data << 8) | *src++; | |
615 | - --cnt; | |
616 | - } | |
617 | - | |
618 | - for (; i < 4; ++i, ++cp) | |
619 | - data = (data << 8) | (*(uchar *) cp); | |
620 | - | |
621 | - return write_word8(info, wp, data); | |
622 | -} | |
623 | - | |
624 | -#define FLASH_WIDTH 4 /* flash bus width in bytes */ | |
625 | -static int write_buff32(flash_info_t *info, uchar *src, ulong addr, | |
626 | - ulong cnt) | |
627 | -{ | |
628 | - ulong cp, wp, data; | |
629 | - int i, l, rc; | |
630 | - ulong start; | |
631 | - | |
632 | - start = get_timer(0); | |
633 | - | |
634 | - if (info->flash_id == FLASH_UNKNOWN) | |
635 | - return 4; | |
636 | - | |
637 | - /* get lower FLASH_WIDTH aligned address */ | |
638 | - wp = (addr & ~(FLASH_WIDTH - 1)); | |
639 | - | |
640 | - /* | |
641 | - * handle unaligned start bytes | |
642 | - */ | |
643 | - if ((l = addr - wp) != 0) { | |
644 | - data = 0; | |
645 | - for (i = 0, cp = wp; i < l; ++i, ++cp) | |
646 | - data = (data << 8) | (*(uchar *) cp); | |
647 | - | |
648 | - for (; i < FLASH_WIDTH && cnt > 0; ++i) { | |
649 | - data = (data << 8) | *src++; | |
650 | - --cnt; | |
651 | - ++cp; | |
652 | - } | |
653 | - | |
654 | - for (; cnt == 0 && i < FLASH_WIDTH; ++i, ++cp) | |
655 | - data = (data << 8) | (*(uchar *) cp); | |
656 | - | |
657 | - rc = write_word32(info, wp, data); | |
658 | - if (rc != 0) | |
659 | - return rc; | |
660 | - | |
661 | - wp += FLASH_WIDTH; | |
662 | - } | |
663 | - | |
664 | - /* | |
665 | - * handle FLASH_WIDTH aligned part | |
666 | - */ | |
667 | - while (cnt >= FLASH_WIDTH) { | |
668 | - data = 0; | |
669 | - for (i = 0; i < FLASH_WIDTH; ++i) | |
670 | - data = (data << 8) | *src++; | |
671 | - | |
672 | - rc = write_word32(info, wp, data); | |
673 | - if (rc != 0) | |
674 | - return rc; | |
675 | - | |
676 | - wp += FLASH_WIDTH; | |
677 | - cnt -= FLASH_WIDTH; | |
678 | - if (get_timer(start) > 990) { /* every second */ | |
679 | - putc('.'); | |
680 | - start = get_timer(0); | |
681 | - } | |
682 | - } | |
683 | - | |
684 | - if (cnt == 0) | |
685 | - return 0; | |
686 | - | |
687 | - /* | |
688 | - * handle unaligned tail bytes | |
689 | - */ | |
690 | - data = 0; | |
691 | - for (i = 0, cp = wp; i < FLASH_WIDTH && cnt > 0; ++i, ++cp) { | |
692 | - data = (data << 8) | *src++; | |
693 | - --cnt; | |
694 | - } | |
695 | - | |
696 | - for (; i < FLASH_WIDTH; ++i, ++cp) | |
697 | - data = (data << 8) | (*(uchar *) cp); | |
698 | - | |
699 | - return write_word32(info, wp, data); | |
700 | -} | |
701 | - | |
702 | -int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) | |
703 | -{ | |
704 | - int retval; | |
705 | - | |
706 | - if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) | |
707 | - retval = write_buff8(info, src, addr, cnt); | |
708 | - else | |
709 | - retval = write_buff32(info, src, addr, cnt); | |
710 | - | |
711 | - return retval; | |
712 | -} | |
713 | - | |
714 | -/* | |
715 | - * Write a word to Flash, returns: | |
716 | - * 0 - OK | |
717 | - * 1 - write timeout | |
718 | - * 2 - Flash not erased | |
719 | - */ | |
720 | - | |
721 | -static int write_word8(flash_info_t *info, ulong dest, ulong data) | |
722 | -{ | |
723 | - volatile uchar *addr2 = (uchar *) (info->start[0]); | |
724 | - volatile uchar *dest2 = (uchar *) dest; | |
725 | - volatile uchar *data2 = (uchar *) &data; | |
726 | - int flag; | |
727 | - int i, tcode, rcode = 0; | |
728 | - | |
729 | - /* Check if Flash is (sufficently) erased */ | |
730 | - if ((*((volatile uchar *)dest) & (uchar)data) != (uchar)data) | |
731 | - return 2; | |
732 | - | |
733 | - for (i = 0; i < (4 / sizeof(uchar)); i++) { | |
734 | - /* Disable interrupts which might cause a timeout here */ | |
735 | - flag = disable_interrupts(); | |
736 | - | |
737 | - *(addr2 + 0x555) = (uchar) 0xAA; | |
738 | - *(addr2 + 0x2aa) = (uchar) 0x55; | |
739 | - *(addr2 + 0x555) = (uchar) 0xA0; | |
740 | - | |
741 | - dest2[i] = data2[i]; | |
742 | - | |
743 | - /* Wait for write to complete, up to 1ms */ | |
744 | - tcode = wait_for_DQ7((ulong) &dest2[i], data2[i], 1); | |
745 | - | |
746 | - /* re-enable interrupts if necessary */ | |
747 | - if (flag) | |
748 | - enable_interrupts(); | |
749 | - | |
750 | - /* Make sure we didn't timeout */ | |
751 | - if (tcode) | |
752 | - rcode = 1; | |
753 | - } | |
754 | - | |
755 | - return rcode; | |
756 | -} | |
757 | - | |
758 | -static int write_word32(flash_info_t *info, ulong dest, ulong data) | |
759 | -{ | |
760 | - vu_long *addr = (vu_long *) dest; | |
761 | - ulong status; | |
762 | - ulong start; | |
763 | - int flag; | |
764 | - | |
765 | - /* Check if Flash is (sufficiently) erased */ | |
766 | - if ((*addr & data) != data) | |
767 | - return 2; | |
768 | - | |
769 | - /* Disable interrupts which might cause a timeout here */ | |
770 | - flag = disable_interrupts(); | |
771 | - | |
772 | - *addr = 0x00400040; /* write setup */ | |
773 | - *addr = data; | |
774 | - | |
775 | - /* re-enable interrupts if necessary */ | |
776 | - if (flag) | |
777 | - enable_interrupts(); | |
778 | - | |
779 | - start = get_timer(0); | |
780 | - | |
781 | - while (((status = *addr) & 0x00800080) != 0x00800080) { | |
782 | - WATCHDOG_RESET(); | |
783 | - if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { | |
784 | - *addr = 0x00FF00FF; /* restore read mode */ | |
785 | - return 1; | |
786 | - } | |
787 | - } | |
788 | - | |
789 | - *addr = 0x00FF00FF; /* restore read mode */ | |
790 | - | |
791 | - return 0; | |
792 | -} | |
793 | - | |
794 | -static int _flash_protect(flash_info_t *info, long sector) | |
795 | -{ | |
796 | - int i; | |
797 | - int flag; | |
798 | - ulong status; | |
799 | - int rcode = 0; | |
800 | - volatile long *addr = (long *)sector; | |
801 | - | |
802 | - switch (info->flash_id & FLASH_TYPEMASK) { | |
803 | - case FLASH_28F320J3A: | |
804 | - case FLASH_28F640J3A: | |
805 | - case FLASH_28F128J3A: | |
806 | - /* Disable interrupts which might cause Flash to timeout */ | |
807 | - flag = disable_interrupts(); | |
808 | - | |
809 | - /* Issue command */ | |
810 | - *addr = 0x00500050L; /* Clear the status register */ | |
811 | - *addr = 0x00600060L; /* Set lock bit setup */ | |
812 | - *addr = 0x00010001L; /* Set lock bit confirm */ | |
813 | - | |
814 | - /* Wait for command completion */ | |
815 | - for (i = 0; i < 10; i++) { /* 75us timeout, wait 100us */ | |
816 | - udelay(10); | |
817 | - if ((*addr & 0x00800080L) == 0x00800080L) | |
818 | - break; | |
819 | - } | |
820 | - | |
821 | - /* Not successful? */ | |
822 | - status = *addr; | |
823 | - if (status != 0x00800080L) { | |
824 | - printf("Protect %x sector failed: %x\n", | |
825 | - (uint) sector, (uint) status); | |
826 | - rcode = 1; | |
827 | - } | |
828 | - | |
829 | - /* Restore read mode */ | |
830 | - *addr = 0x00ff00ffL; | |
831 | - | |
832 | - /* re-enable interrupts if necessary */ | |
833 | - if (flag) | |
834 | - enable_interrupts(); | |
835 | - | |
836 | - break; | |
837 | - case FLASH_AM040: /* No soft sector protection */ | |
838 | - break; | |
839 | - } | |
840 | - | |
841 | - /* Turn protection on for this sector */ | |
842 | - for (i = 0; i < info->sector_count; i++) { | |
843 | - if (info->start[i] == sector) { | |
844 | - info->protect[i] = 1; | |
845 | - break; | |
846 | - } | |
847 | - } | |
848 | - | |
849 | - return rcode; | |
850 | -} | |
851 | - | |
852 | -static int _flash_unprotect(flash_info_t *info, long sector) | |
853 | -{ | |
854 | - int i; | |
855 | - int flag; | |
856 | - ulong status; | |
857 | - int rcode = 0; | |
858 | - volatile long *addr = (long *) sector; | |
859 | - | |
860 | - switch (info->flash_id & FLASH_TYPEMASK) { | |
861 | - case FLASH_28F320J3A: | |
862 | - case FLASH_28F640J3A: | |
863 | - case FLASH_28F128J3A: | |
864 | - /* Disable interrupts which might cause Flash to timeout */ | |
865 | - flag = disable_interrupts(); | |
866 | - | |
867 | - *addr = 0x00500050L; /* Clear the status register */ | |
868 | - *addr = 0x00600060L; /* Clear lock bit setup */ | |
869 | - *addr = 0x00D000D0L; /* Clear lock bit confirm */ | |
870 | - | |
871 | - /* Wait for command completion */ | |
872 | - for (i = 0; i < 80; i++) { /* 700ms timeout, wait 800 */ | |
873 | - udelay(10000); /* Delay 10ms */ | |
874 | - if ((*addr & 0x00800080L) == 0x00800080L) | |
875 | - break; | |
876 | - } | |
877 | - | |
878 | - /* Not successful? */ | |
879 | - status = *addr; | |
880 | - if (status != 0x00800080L) { | |
881 | - printf("Un-protect %x sector failed: %x\n", | |
882 | - (uint) sector, (uint) status); | |
883 | - *addr = 0x00ff00ffL; | |
884 | - rcode = 1; | |
885 | - } | |
886 | - | |
887 | - /* restore read mode */ | |
888 | - *addr = 0x00ff00ffL; | |
889 | - | |
890 | - /* re-enable interrupts if necessary */ | |
891 | - if (flag) | |
892 | - enable_interrupts(); | |
893 | - | |
894 | - break; | |
895 | - case FLASH_AM040: /* No soft sector protection */ | |
896 | - break; | |
897 | - } | |
898 | - | |
899 | - /* | |
900 | - * Fix Intel's little red wagon. Reprotect | |
901 | - * sectors that were protected before we undid | |
902 | - * protection on a specific sector. | |
903 | - */ | |
904 | - for (i = 0; i < info->sector_count; i++) { | |
905 | - if (info->start[i] != sector) { | |
906 | - if (info->protect[i]) { | |
907 | - if (_flash_protect(info, info->start[i])) | |
908 | - rcode = 1; | |
909 | - } | |
910 | - } else /* Turn protection off for this sector */ | |
911 | - info->protect[i] = 0; | |
912 | - } | |
913 | - | |
914 | - return rcode; | |
915 | -} | |
916 | - | |
917 | -int flash_real_protect(flash_info_t *info, long sector, int prot) | |
918 | -{ | |
919 | - int rcode; | |
920 | - | |
921 | - if (prot) | |
922 | - rcode = _flash_protect(info, info->start[sector]); | |
923 | - else | |
924 | - rcode = _flash_unprotect(info, info->start[sector]); | |
925 | - | |
926 | - return rcode; | |
927 | -} |
board/w7o/fpga.c
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com | |
4 | - * and | |
5 | - * Bill Hunter, Wave 7 Optics, william.hunter@mediaone.net | |
6 | - * | |
7 | - * SPDX-License-Identifier: GPL-2.0+ | |
8 | - */ | |
9 | -#include <config.h> | |
10 | -#include <common.h> | |
11 | -#include "w7o.h" | |
12 | -#include <asm/processor.h> | |
13 | -#include <linux/compiler.h> | |
14 | -#include "errors.h" | |
15 | - | |
16 | -static void | |
17 | -fpga_img_write(unsigned long *src, unsigned long len, unsigned short *daddr) | |
18 | -{ | |
19 | - unsigned long i; | |
20 | - volatile unsigned long val; | |
21 | - volatile unsigned short *dest = daddr; /* volatile-bypass optimizer */ | |
22 | - | |
23 | - for (i = 0; i < len; i++, src++) { | |
24 | - val = *src; | |
25 | - *dest = (unsigned short) ((val & 0xff000000L) >> 16); | |
26 | - *dest = (unsigned short) ((val & 0x00ff0000L) >> 8); | |
27 | - *dest = (unsigned short) (val & 0x0000ff00L); | |
28 | - *dest = (unsigned short) ((val & 0x000000ffL) << 8); | |
29 | - } | |
30 | - | |
31 | - /* Terminate programming with 4 C clocks */ | |
32 | - dest = daddr; | |
33 | - val = *(unsigned short *) dest; | |
34 | - val = *(unsigned short *) dest; | |
35 | - val = *(unsigned short *) dest; | |
36 | - val = *(unsigned short *) dest; | |
37 | - | |
38 | -} | |
39 | - | |
40 | - | |
41 | -int | |
42 | -fpgaDownload(unsigned char *saddr, unsigned long size, unsigned short *daddr) | |
43 | -{ | |
44 | - int i; /* index, intr disable flag */ | |
45 | - int start; /* timer */ | |
46 | - unsigned long greg, grego; /* GPIO & output register */ | |
47 | - unsigned long length; /* image size in words */ | |
48 | - unsigned long *source; /* image source addr */ | |
49 | - unsigned short *dest; /* destination FPGA addr */ | |
50 | - volatile unsigned short *ndest; /* temp dest FPGA addr */ | |
51 | - unsigned long cnfg = GPIO_XCV_CNFG; /* FPGA CNFG */ | |
52 | - unsigned long eirq = GPIO_XCV_IRQ; | |
53 | - int retval = -1; /* Function return value */ | |
54 | - __maybe_unused volatile unsigned short val; /* temp val */ | |
55 | - | |
56 | - /* Setup some basic values */ | |
57 | - length = (size / 4) + 1; /* size in words, rounding UP | |
58 | - is OK */ | |
59 | - source = (unsigned long *) saddr; | |
60 | - dest = (unsigned short *) daddr; | |
61 | - | |
62 | - /* Get DCR output register */ | |
63 | - grego = in32(PPC405GP_GPIO0_OR); | |
64 | - | |
65 | - /* Reset FPGA */ | |
66 | - grego &= ~GPIO_XCV_PROG; /* PROG line low */ | |
67 | - out32(PPC405GP_GPIO0_OR, grego); | |
68 | - | |
69 | - /* Setup timeout timer */ | |
70 | - start = get_timer(0); | |
71 | - | |
72 | - /* Wait for FPGA init line to go low */ | |
73 | - while (in32(PPC405GP_GPIO0_IR) & GPIO_XCV_INIT) { | |
74 | - /* Check for timeout - 100us max, so use 3ms */ | |
75 | - if (get_timer(start) > 3) { | |
76 | - printf(" failed to start init.\n"); | |
77 | - log_warn(ERR_XINIT0); /* Don't halt */ | |
78 | - | |
79 | - /* Reset line stays low */ | |
80 | - goto done; /* I like gotos... */ | |
81 | - } | |
82 | - } | |
83 | - | |
84 | - /* Unreset FPGA */ | |
85 | - grego |= GPIO_XCV_PROG; /* PROG line high */ | |
86 | - out32(PPC405GP_GPIO0_OR, grego); | |
87 | - | |
88 | - /* Wait for FPGA end of init period = init line go hi */ | |
89 | - while (!(in32(PPC405GP_GPIO0_IR) & GPIO_XCV_INIT)) { | |
90 | - | |
91 | - /* Check for timeout */ | |
92 | - if (get_timer(start) > 3) { | |
93 | - printf(" failed to exit init.\n"); | |
94 | - log_warn(ERR_XINIT1); | |
95 | - | |
96 | - /* Reset FPGA */ | |
97 | - grego &= ~GPIO_XCV_PROG; /* PROG line low */ | |
98 | - out32(PPC405GP_GPIO0_OR, grego); | |
99 | - | |
100 | - goto done; | |
101 | - } | |
102 | - } | |
103 | - | |
104 | - /* Now program FPGA ... */ | |
105 | - ndest = dest; | |
106 | - for (i = 0; i < CONFIG_NUM_FPGAS; i++) { | |
107 | - /* Toggle IRQ/GPIO */ | |
108 | - greg = mfdcr(CPC0_CR0); /* get chip ctrl register */ | |
109 | - greg |= eirq; /* toggle irq/gpio */ | |
110 | - mtdcr(CPC0_CR0, greg); /* ... just do it */ | |
111 | - | |
112 | - /* turn on open drain for CNFG */ | |
113 | - greg = in32(PPC405GP_GPIO0_ODR); /* get open drain register */ | |
114 | - greg |= cnfg; /* CNFG open drain */ | |
115 | - out32(PPC405GP_GPIO0_ODR, greg); /* .. just do it */ | |
116 | - | |
117 | - /* Turn output enable on for CNFG */ | |
118 | - greg = in32(PPC405GP_GPIO0_TCR); /* get tristate register */ | |
119 | - greg |= cnfg; /* CNFG tristate inactive */ | |
120 | - out32(PPC405GP_GPIO0_TCR, greg); /* ... just do it */ | |
121 | - | |
122 | - /* Setup FPGA for programming */ | |
123 | - grego &= ~cnfg; /* CONFIG line low */ | |
124 | - out32(PPC405GP_GPIO0_OR, grego); | |
125 | - | |
126 | - /* | |
127 | - * Program the FPGA | |
128 | - */ | |
129 | - printf("\n destination: 0x%lx ", (unsigned long) ndest); | |
130 | - | |
131 | - fpga_img_write(source, length, (unsigned short *) ndest); | |
132 | - | |
133 | - /* Done programming */ | |
134 | - grego |= cnfg; /* CONFIG line high */ | |
135 | - out32(PPC405GP_GPIO0_OR, grego); | |
136 | - | |
137 | - /* Turn output enable OFF for CNFG */ | |
138 | - greg = in32(PPC405GP_GPIO0_TCR); /* get tristate register */ | |
139 | - greg &= ~cnfg; /* CNFG tristate inactive */ | |
140 | - out32(PPC405GP_GPIO0_TCR, greg); /* ... just do it */ | |
141 | - | |
142 | - /* Toggle IRQ/GPIO */ | |
143 | - greg = mfdcr(CPC0_CR0); /* get chip ctrl register */ | |
144 | - greg &= ~eirq; /* toggle irq/gpio */ | |
145 | - mtdcr(CPC0_CR0, greg); /* ... just do it */ | |
146 | - | |
147 | - /* XXX - Next FPGA addr */ | |
148 | - ndest = (unsigned short *) ((char *) ndest + 0x00100000L); | |
149 | - cnfg >>= 1; /* XXX - Next */ | |
150 | - eirq >>= 1; | |
151 | - } | |
152 | - | |
153 | - /* Terminate programming with 4 C clocks */ | |
154 | - ndest = dest; | |
155 | - for (i = 0; i < CONFIG_NUM_FPGAS; i++) { | |
156 | - val = *ndest; | |
157 | - val = *ndest; | |
158 | - val = *ndest; | |
159 | - val = *ndest; | |
160 | - ndest = (unsigned short *) ((char *) ndest + 0x00100000L); | |
161 | - } | |
162 | - | |
163 | - /* Setup timer */ | |
164 | - start = get_timer(0); | |
165 | - | |
166 | - /* Wait for FPGA end of programming period = Test DONE low */ | |
167 | - while (!(in32(PPC405GP_GPIO0_IR) & GPIO_XCV_DONE)) { | |
168 | - | |
169 | - /* Check for timeout */ | |
170 | - if (get_timer(start) > 3) { | |
171 | - printf(" done failed to come high.\n"); | |
172 | - log_warn(ERR_XDONE1); | |
173 | - | |
174 | - /* Reset FPGA */ | |
175 | - grego &= ~GPIO_XCV_PROG; /* PROG line low */ | |
176 | - out32(PPC405GP_GPIO0_OR, grego); | |
177 | - | |
178 | - goto done; | |
179 | - } | |
180 | - } | |
181 | - | |
182 | - printf("\n FPGA load succeeded\n"); | |
183 | - retval = 0; /* Program OK */ | |
184 | - | |
185 | -done: | |
186 | - return retval; | |
187 | -} | |
188 | - | |
189 | -/* FPGA image is stored in flash */ | |
190 | -extern flash_info_t flash_info[]; | |
191 | - | |
192 | -int init_fpga(void) | |
193 | -{ | |
194 | - unsigned int i, j, ptr; /* General purpose */ | |
195 | - unsigned char bufchar; /* General purpose character */ | |
196 | - unsigned char *buf; /* Start of image pointer */ | |
197 | - unsigned long len; /* Length of image */ | |
198 | - unsigned char *fn_buf; /* Start of filename string */ | |
199 | - unsigned int fn_len; /* Length of filename string */ | |
200 | - unsigned char *xcv_buf; /* Pointer to start of image */ | |
201 | - unsigned long xcv_len; /* Length of image */ | |
202 | - unsigned long crc; /* 30bit crc in image */ | |
203 | - unsigned long calc_crc; /* Calc'd 30bit crc */ | |
204 | - int retval = -1; | |
205 | - | |
206 | - /* Tell the world what we are doing */ | |
207 | - printf("FPGA: "); | |
208 | - | |
209 | - /* | |
210 | - * Get address of first sector where the FPGA | |
211 | - * image is stored. | |
212 | - */ | |
213 | - buf = (unsigned char *) flash_info[1].start[0]; | |
214 | - | |
215 | - /* | |
216 | - * Get the stored image's CRC & length. | |
217 | - */ | |
218 | - crc = *(unsigned long *) (buf + 4); /* CRC is first long word */ | |
219 | - len = *(unsigned long *) (buf + 8); /* Image len is next long */ | |
220 | - | |
221 | - /* Pedantic */ | |
222 | - if ((len < 0x133A4) || (len > 0x80000)) | |
223 | - goto bad_image; | |
224 | - | |
225 | - /* | |
226 | - * Get the file name pointer and length. | |
227 | - * filename length is next short | |
228 | - */ | |
229 | - fn_len = (*(unsigned short *) (buf + 12) & 0xff); | |
230 | - fn_buf = buf + 14; | |
231 | - | |
232 | - /* | |
233 | - * Get the FPGA image pointer and length length. | |
234 | - */ | |
235 | - xcv_buf = fn_buf + fn_len; /* pointer to fpga image */ | |
236 | - xcv_len = len - 14 - fn_len; /* fpga image length */ | |
237 | - | |
238 | - /* Check for uninitialized FLASH */ | |
239 | - if ((strncmp((char *) buf, "w7o", 3) != 0) || (len > 0x0007ffffL) | |
240 | - || (len == 0)) | |
241 | - goto bad_image; | |
242 | - | |
243 | - /* | |
244 | - * Calculate and Check the image's CRC. | |
245 | - */ | |
246 | - calc_crc = crc32(0, xcv_buf, xcv_len); | |
247 | - if (crc != calc_crc) { | |
248 | - printf("\nfailed - bad CRC\n"); | |
249 | - goto done; | |
250 | - } | |
251 | - | |
252 | - /* Output the file name */ | |
253 | - printf("file name : "); | |
254 | - for (i = 0; i < fn_len; i++) { | |
255 | - bufchar = fn_buf[+i]; | |
256 | - if (bufchar < ' ' || bufchar > '~') | |
257 | - bufchar = '.'; | |
258 | - putc(bufchar); | |
259 | - } | |
260 | - | |
261 | - /* | |
262 | - * find rest of display data | |
263 | - */ | |
264 | - ptr = 15; /* Offset to ncd filename | |
265 | - length in fpga image */ | |
266 | - j = xcv_buf[ptr]; /* Get len of ncd filename */ | |
267 | - if (j > 32) | |
268 | - goto bad_image; | |
269 | - ptr = ptr + j + 3; /* skip ncd filename string + | |
270 | - 3 bytes more bytes */ | |
271 | - | |
272 | - /* | |
273 | - * output target device string | |
274 | - */ | |
275 | - j = xcv_buf[ptr++] - 1; /* len of targ str less term */ | |
276 | - if (j > 32) | |
277 | - goto bad_image; | |
278 | - printf("\n target : "); | |
279 | - for (i = 0; i < j; i++) { | |
280 | - bufchar = (xcv_buf[ptr++]); | |
281 | - if (bufchar < ' ' || bufchar > '~') | |
282 | - bufchar = '.'; | |
283 | - putc(bufchar); | |
284 | - } | |
285 | - | |
286 | - /* | |
287 | - * output compilation date string and time string | |
288 | - */ | |
289 | - ptr += 3; /* skip 2 bytes */ | |
290 | - printf("\n synth time : "); | |
291 | - j = (xcv_buf[ptr++] - 1); /* len of date str less term */ | |
292 | - if (j > 32) | |
293 | - goto bad_image; | |
294 | - for (i = 0; i < j; i++) { | |
295 | - bufchar = (xcv_buf[ptr++]); | |
296 | - if (bufchar < ' ' || bufchar > '~') | |
297 | - bufchar = '.'; | |
298 | - putc(bufchar); | |
299 | - } | |
300 | - | |
301 | - ptr += 3; /* Skip 2 bytes */ | |
302 | - printf(" - "); | |
303 | - j = (xcv_buf[ptr++] - 1); /* slen = targ dev str len */ | |
304 | - if (j > 32) | |
305 | - goto bad_image; | |
306 | - for (i = 0; i < j; i++) { | |
307 | - bufchar = (xcv_buf[ptr++]); | |
308 | - if (bufchar < ' ' || bufchar > '~') | |
309 | - bufchar = '.'; | |
310 | - putc(bufchar); | |
311 | - } | |
312 | - | |
313 | - /* | |
314 | - * output crc and length strings | |
315 | - */ | |
316 | - printf("\n len & crc : 0x%lx 0x%lx", len, crc); | |
317 | - | |
318 | - /* | |
319 | - * Program the FPGA. | |
320 | - */ | |
321 | - retval = fpgaDownload((unsigned char *) xcv_buf, xcv_len, | |
322 | - (unsigned short *) 0xfd000000L); | |
323 | - return retval; | |
324 | - | |
325 | -bad_image: | |
326 | - printf("\n BAD FPGA image format @ %lx\n", | |
327 | - flash_info[1].start[0]); | |
328 | - log_warn(ERR_XIMAGE); | |
329 | -done: | |
330 | - return retval; | |
331 | -} | |
332 | - | |
333 | -void test_fpga(unsigned short *daddr) | |
334 | -{ | |
335 | - int i; | |
336 | - volatile unsigned short *ndest = daddr; | |
337 | - | |
338 | - for (i = 0; i < CONFIG_NUM_FPGAS; i++) { | |
339 | -#if defined(CONFIG_W7OLMG) | |
340 | - ndest[0x7e] = 0x55aa; | |
341 | - if (ndest[0x7e] != 0x55aa) | |
342 | - log_warn(ERR_XRW1 + i); | |
343 | - ndest[0x7e] = 0xaa55; | |
344 | - if (ndest[0x7e] != 0xaa55) | |
345 | - log_warn(ERR_XRW1 + i); | |
346 | - ndest[0x7e] = 0xc318; | |
347 | - if (ndest[0x7e] != 0xc318) | |
348 | - log_warn(ERR_XRW1 + i); | |
349 | - | |
350 | -#elif defined(CONFIG_W7OLMC) | |
351 | - ndest[0x800] = 0x55aa; | |
352 | - ndest[0x801] = 0xaa55; | |
353 | - ndest[0x802] = 0xc318; | |
354 | - ndest[0x4800] = 0x55aa; | |
355 | - ndest[0x4801] = 0xaa55; | |
356 | - ndest[0x4802] = 0xc318; | |
357 | - if ((ndest[0x800] != 0x55aa) || | |
358 | - (ndest[0x801] != 0xaa55) || (ndest[0x802] != 0xc318)) | |
359 | - log_warn(ERR_XRW1 + (2 * i)); /* Auto gen error code */ | |
360 | - if ((ndest[0x4800] != 0x55aa) || | |
361 | - (ndest[0x4801] != 0xaa55) || (ndest[0x4802] != 0xc318)) | |
362 | - log_warn(ERR_XRW2 + (2 * i)); /* Auto gen error code */ | |
363 | - | |
364 | -#else | |
365 | -#error "Unknown W7O board configuration" | |
366 | -#endif | |
367 | - } | |
368 | - | |
369 | - printf(" FPGA ready\n"); | |
370 | - return; | |
371 | -} |
board/w7o/fsboot.c
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Wave 7 Optics, Inc. | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -#include <common.h> | |
9 | -#include <config.h> | |
10 | -#include <command.h> | |
11 | -#include <elf.h> | |
12 | - | |
13 | -/* | |
14 | - * FIXME: Add code to test image and it's header. | |
15 | - */ | |
16 | -static int | |
17 | -image_check(ulong addr) | |
18 | -{ | |
19 | - return valid_elf_image(addr); | |
20 | -} | |
21 | - | |
22 | -void | |
23 | -init_fsboot(void) | |
24 | -{ | |
25 | - char *envp; | |
26 | - ulong loadaddr; | |
27 | - ulong testaddr; | |
28 | - ulong alt_loadaddr; | |
29 | - char buf[9]; | |
30 | - | |
31 | - /* | |
32 | - * Get test image address | |
33 | - */ | |
34 | - if ((envp = getenv("testaddr")) != NULL) | |
35 | - testaddr = simple_strtoul(envp, NULL, 16); | |
36 | - else | |
37 | - testaddr = -1; | |
38 | - | |
39 | - /* | |
40 | - * Are we going to test boot and image? | |
41 | - */ | |
42 | - if ((testaddr != -1) && image_check(testaddr)) { | |
43 | - | |
44 | - /* Set alt_loadaddr */ | |
45 | - alt_loadaddr = testaddr; | |
46 | - sprintf(buf, "%lX", alt_loadaddr); | |
47 | - setenv("alt_loadaddr", buf); | |
48 | - | |
49 | - /* Clear test_addr */ | |
50 | - setenv("testaddr", NULL); | |
51 | - | |
52 | - /* | |
53 | - * Save current environment with alt_loadaddr, | |
54 | - * and cleared testaddr. | |
55 | - */ | |
56 | - saveenv(); | |
57 | - | |
58 | - /* | |
59 | - * Setup temporary loadaddr to alt_loadaddr | |
60 | - * XXX - DO NOT SAVE ENVIRONMENT! | |
61 | - */ | |
62 | - loadaddr = alt_loadaddr; | |
63 | - sprintf(buf, "%lX", loadaddr); | |
64 | - setenv("loadaddr", buf); | |
65 | - | |
66 | - } else { /* Normal boot */ | |
67 | - setenv("alt_loadaddr", NULL); /* Clear alt_loadaddr */ | |
68 | - setenv("testaddr", NULL); /* Clear testaddr */ | |
69 | - saveenv(); | |
70 | - } | |
71 | - | |
72 | - return; | |
73 | -} |
board/w7o/init.S
1 | -/* | |
2 | - * SPDX-License-Identifier: GPL-2.0 IBM-pibs | |
3 | - */ | |
4 | -#include <config.h> | |
5 | -#include <asm/ppc4xx.h> | |
6 | - | |
7 | -#include <ppc_asm.tmpl> | |
8 | -#include <ppc_defs.h> | |
9 | - | |
10 | -#include <asm/cache.h> | |
11 | -#include <asm/mmu.h> | |
12 | - | |
13 | -/****************************************************************************** | |
14 | - * Function: ext_bus_cntlr_init | |
15 | - * | |
16 | - * Description: Configures EBC Controller and a few basic chip selects. | |
17 | - * | |
18 | - * CS0 is setup to get the Boot Flash out of the addresss range | |
19 | - * so that we may setup a stack. CS7 is setup so that we can | |
20 | - * access and reset the hardware watchdog. | |
21 | - * | |
22 | - * IMPORTANT: For pass1 this code must run from | |
23 | - * cache since you can not reliably change a peripheral banks | |
24 | - * timing register (pbxap) while running code from that bank. | |
25 | - * For ex., since we are running from ROM on bank 0, we can NOT | |
26 | - * execute the code that modifies bank 0 timings from ROM, so | |
27 | - * we run it from cache. | |
28 | - * | |
29 | - * Notes: Does NOT use the stack. | |
30 | - *****************************************************************************/ | |
31 | - .section ".text" | |
32 | - .align 2 | |
33 | - .globl ext_bus_cntlr_init | |
34 | - .type ext_bus_cntlr_init, @function | |
35 | -ext_bus_cntlr_init: | |
36 | - mflr r0 | |
37 | - /******************************************************************** | |
38 | - * Prefetch entire ext_bus_cntrl_init function into the icache. | |
39 | - * This is necessary because we are going to change the same CS we | |
40 | - * are executing from. Otherwise a CPU lockup may occur. | |
41 | - *******************************************************************/ | |
42 | - bl ..getAddr | |
43 | -..getAddr: | |
44 | - mflr r3 /* get address of ..getAddr */ | |
45 | - | |
46 | - /* Calculate number of cache lines for this function */ | |
47 | - addi r4, 0, (((.Lfe0 - ..getAddr) / CONFIG_SYS_CACHELINE_SIZE) + 2) | |
48 | - mtctr r4 | |
49 | -..ebcloop: | |
50 | - icbt r0, r3 /* prefetch cache line for addr in r3*/ | |
51 | - addi r3, r3, CONFIG_SYS_CACHELINE_SIZE /* move to next cache line */ | |
52 | - bdnz ..ebcloop /* continue for $CTR cache lines */ | |
53 | - | |
54 | - /******************************************************************** | |
55 | - * Delay to ensure all accesses to ROM are complete before changing | |
56 | - * bank 0 timings. 200usec should be enough. | |
57 | - * 200,000,000 (cycles/sec) X .000200 (sec) = 0x9C40 cycles. | |
58 | - *******************************************************************/ | |
59 | - addis r3, 0, 0x0 | |
60 | - ori r3, r3, 0xA000 /* wait 200us from reset */ | |
61 | - mtctr r3 | |
62 | -..spinlp: | |
63 | - bdnz ..spinlp /* spin loop */ | |
64 | - | |
65 | - /******************************************************************** | |
66 | - * Setup External Bus Controller (EBC). | |
67 | - *******************************************************************/ | |
68 | - addi r3, 0, EBC0_CFG | |
69 | - mtdcr EBC0_CFGADDR, r3 | |
70 | - addis r4, 0, 0xb040 /* Device base timeout = 1024 cycles */ | |
71 | - ori r4, r4, 0x0 /* Drive CS with external master */ | |
72 | - mtdcr EBC0_CFGDATA, r4 | |
73 | - | |
74 | - /******************************************************************** | |
75 | - * Change PCIINT signal to PerWE | |
76 | - *******************************************************************/ | |
77 | - mfdcr r4, CPC0_CR1 | |
78 | - ori r4, r4, 0x4000 | |
79 | - mtdcr CPC0_CR1, r4 | |
80 | - | |
81 | - /******************************************************************** | |
82 | - * Memory Bank 0 (Flash Bank 0) initialization | |
83 | - *******************************************************************/ | |
84 | - addi r3, 0, PB1AP | |
85 | - mtdcr EBC0_CFGADDR, r3 | |
86 | - addis r4, 0, CONFIG_SYS_W7O_EBC_PB0AP@h | |
87 | - ori r4, r4, CONFIG_SYS_W7O_EBC_PB0AP@l | |
88 | - mtdcr EBC0_CFGDATA, r4 | |
89 | - | |
90 | - addi r3, 0, PB0CR | |
91 | - mtdcr EBC0_CFGADDR, r3 | |
92 | - addis r4, 0, CONFIG_SYS_W7O_EBC_PB0CR@h | |
93 | - ori r4, r4, CONFIG_SYS_W7O_EBC_PB0CR@l | |
94 | - mtdcr EBC0_CFGDATA, r4 | |
95 | - | |
96 | - /******************************************************************** | |
97 | - * Memory Bank 7 LEDs - NEEDED BECAUSE OF HW WATCHDOG AND LEDs. | |
98 | - *******************************************************************/ | |
99 | - addi r3, 0, PB7AP | |
100 | - mtdcr EBC0_CFGADDR, r3 | |
101 | - addis r4, 0, CONFIG_SYS_W7O_EBC_PB7AP@h | |
102 | - ori r4, r4, CONFIG_SYS_W7O_EBC_PB7AP@l | |
103 | - mtdcr EBC0_CFGDATA, r4 | |
104 | - | |
105 | - addi r3, 0, PB7CR | |
106 | - mtdcr EBC0_CFGADDR, r3 | |
107 | - addis r4, 0, CONFIG_SYS_W7O_EBC_PB7CR@h | |
108 | - ori r4, r4, CONFIG_SYS_W7O_EBC_PB7CR@l | |
109 | - mtdcr EBC0_CFGDATA, r4 | |
110 | - | |
111 | - /* We are all done */ | |
112 | - mtlr r0 /* Restore link register */ | |
113 | - blr /* Return to calling function */ | |
114 | -.Lfe0: .size ext_bus_cntlr_init,.Lfe0-ext_bus_cntlr_init | |
115 | -/* end ext_bus_cntlr_init() */ | |
116 | - | |
117 | -/****************************************************************************** | |
118 | - * Function: sdram_init | |
119 | - * | |
120 | - * Description: Configures SDRAM memory banks. | |
121 | - * | |
122 | - * Serial Presence Detect, "SPD," reads the SDRAM EEPROM | |
123 | - * via the IIC bus and then configures the SDRAM memory | |
124 | - * banks appropriately. If Auto Memory Configuration is | |
125 | - * is not used, it is assumed that a 4MB 11x8x2, non-ECC, | |
126 | - * SDRAM is soldered down. | |
127 | - * | |
128 | - * Notes: Expects that the stack is already setup. | |
129 | - *****************************************************************************/ | |
130 | - .section ".text" | |
131 | - .align 2 | |
132 | - .globl sdram_init | |
133 | - .type sdram_init, @function | |
134 | -sdram_init: | |
135 | - /* save the return info on stack */ | |
136 | - mflr r0 /* Get link register */ | |
137 | - stwu r1, -8(r1) /* Save back chain and move SP */ | |
138 | - stw r0, +12(r1) /* Save link register */ | |
139 | - | |
140 | - /* | |
141 | - * First call spd_sdram to try to init SDRAM according to the | |
142 | - * contents of the SPD EEPROM. If the SPD EEPROM is blank or | |
143 | - * erronious, spd_sdram returns 0 in R3. | |
144 | - */ | |
145 | - li r3,0 | |
146 | - bl spd_sdram | |
147 | - addic. r3, r3, 0 /* Check for error, save dram size */ | |
148 | - bne ..sdri_done /* If it worked, we're done... */ | |
149 | - | |
150 | - /******************************************************************** | |
151 | - * If SPD detection fails, we'll default to 4MB, 11x8x2, as this | |
152 | - * is the SMALLEST SDRAM size the 405 supports. We can do this | |
153 | - * because W7O boards have soldered on RAM, and there will always | |
154 | - * be some amount present. If we were using DIMMs, we should hang | |
155 | - * the board instead, since it doesn't have any RAM to continue | |
156 | - * running with. | |
157 | - *******************************************************************/ | |
158 | - | |
159 | - /* | |
160 | - * Disable memory controller to allow | |
161 | - * values to be changed. | |
162 | - */ | |
163 | - addi r3, 0, SDRAM0_CFG | |
164 | - mtdcr SDRAM0_CFGADDR, r3 | |
165 | - addis r4, 0, 0x0 | |
166 | - ori r4, r4, 0x0 | |
167 | - mtdcr SDRAM0_CFGDATA, r4 | |
168 | - | |
169 | - /* | |
170 | - * Set MB0CF for ext bank 0. (0-4MB) Address Mode 5 since 11x8x2 | |
171 | - * All other banks are disabled. | |
172 | - */ | |
173 | - addi r3, 0, SDRAM0_B0CR | |
174 | - mtdcr SDRAM0_CFGADDR, r3 | |
175 | - addis r4, 0, 0x0000 /* BA=0x0, SZ=4MB */ | |
176 | - ori r4, r4, 0x8001 /* Mode is 5, 11x8x2or4, BE=Enabled */ | |
177 | - mtdcr SDRAM0_CFGDATA, r4 | |
178 | - | |
179 | - /* Clear MB1CR,MB2CR,MB3CR to turn other banks off */ | |
180 | - addi r4, 0, 0 /* Zero the data reg */ | |
181 | - | |
182 | - addi r3, r3, 4 /* Point to MB1CF reg */ | |
183 | - mtdcr SDRAM0_CFGADDR, r3 /* Set the address */ | |
184 | - mtdcr SDRAM0_CFGDATA, r4 /* Zero the reg */ | |
185 | - | |
186 | - addi r3, r3, 4 /* Point to MB2CF reg */ | |
187 | - mtdcr SDRAM0_CFGADDR, r3 /* Set the address */ | |
188 | - mtdcr SDRAM0_CFGDATA, r4 /* Zero the reg */ | |
189 | - | |
190 | - addi r3, r3, 4 /* Point to MB3CF reg */ | |
191 | - mtdcr SDRAM0_CFGADDR, r3 /* Set the address */ | |
192 | - mtdcr SDRAM0_CFGDATA, r4 /* Zero the reg */ | |
193 | - | |
194 | - /******************************************************************** | |
195 | - * Set the SDRAM Timing reg, SDTR1 and the refresh timer reg, RTR. | |
196 | - * To set the appropriate timings, we assume sdram is | |
197 | - * 100MHz (pc100 compliant). | |
198 | - *******************************************************************/ | |
199 | - | |
200 | - /* | |
201 | - * Set up SDTR1 | |
202 | - */ | |
203 | - addi r3, 0, SDRAM0_TR | |
204 | - mtdcr SDRAM0_CFGADDR, r3 | |
205 | - addis r4, 0, 0x0086 /* SDTR1 value for 100Mhz */ | |
206 | - ori r4, r4, 0x400D | |
207 | - mtdcr SDRAM0_CFGDATA, r4 | |
208 | - | |
209 | - /* | |
210 | - * Set RTR | |
211 | - */ | |
212 | - addi r3, 0, SDRAM0_RTR | |
213 | - mtdcr SDRAM0_CFGADDR, r3 | |
214 | - addis r4, 0, 0x05F0 /* RTR refresh val = 15.625ms@100Mhz */ | |
215 | - mtdcr SDRAM0_CFGDATA, r4 | |
216 | - | |
217 | - /******************************************************************** | |
218 | - * Delay to ensure 200usec have elapsed since reset. Assume worst | |
219 | - * case that the core is running 200Mhz: | |
220 | - * 200,000,000 (cycles/sec) X .000200 (sec) = 0x9C40 cycles | |
221 | - *******************************************************************/ | |
222 | - addis r3, 0, 0x0000 | |
223 | - ori r3, r3, 0xA000 /* Wait 200us from reset */ | |
224 | - mtctr r3 | |
225 | -..spinlp2: | |
226 | - bdnz ..spinlp2 /* spin loop */ | |
227 | - | |
228 | - /******************************************************************** | |
229 | - * Set memory controller options reg, MCOPT1. | |
230 | - *******************************************************************/ | |
231 | - addi r3, 0, SDRAM0_CFG | |
232 | - mtdcr SDRAM0_CFGADDR, r3 | |
233 | - addis r4, 0, 0x80E0 /* DC_EN=1,SRE=0,PME=0,MEMCHK=0 */ | |
234 | - ori r4, r4, 0x0000 /* REGEN=0,DRW=00,BRPF=01,ECCDD=1 */ | |
235 | - mtdcr SDRAM0_CFGDATA, r4 /* EMDULR=1 */ | |
236 | - | |
237 | -..sdri_done: | |
238 | - /* restore and return */ | |
239 | - lwz r0, +12(r1) /* Get saved link register */ | |
240 | - addi r1, r1, +8 /* Remove frame from stack */ | |
241 | - mtlr r0 /* Restore link register */ | |
242 | - blr /* Return to calling function */ | |
243 | -.Lfe1: .size sdram_init,.Lfe1-sdram_init | |
244 | -/* end sdram_init() */ |
board/w7o/post1.S
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Bill Hunter, Wave 7 Optics, william.hunter@mediaone.net | |
4 | - * and | |
5 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com | |
6 | - * | |
7 | - * SPDX-License-Identifier: GPL-2.0+ | |
8 | - */ | |
9 | -/* | |
10 | - * Description: | |
11 | - * Routine to exercise memory for the bringing up of our boards. | |
12 | - */ | |
13 | -#include <config.h> | |
14 | -#include <asm/ppc4xx.h> | |
15 | - | |
16 | -#include <ppc_asm.tmpl> | |
17 | -#include <ppc_defs.h> | |
18 | - | |
19 | -#include <asm/cache.h> | |
20 | -#include <asm/mmu.h> | |
21 | - | |
22 | -#include <watchdog.h> | |
23 | - | |
24 | -#include "errors.h" | |
25 | - | |
26 | -#define _ASMLANGUAGE | |
27 | - | |
28 | - .globl test_sdram | |
29 | - .globl test_led | |
30 | - .globl log_stat | |
31 | - .globl log_warn | |
32 | - .globl log_err | |
33 | - .globl temp_uart_init | |
34 | - .globl post_puts | |
35 | - .globl disp_hex | |
36 | - | |
37 | -/***************************************************** | |
38 | -******* Text Strings for low level printing ****** | |
39 | -******* In section got2 ******* | |
40 | -*****************************************************/ | |
41 | - | |
42 | -/* | |
43 | - * Define the text strings for errors and warnings. | |
44 | - * Switch to .data section. | |
45 | - */ | |
46 | - .section ".data" | |
47 | -err_str: .asciz "*** POST ERROR = " | |
48 | -warn_str: .asciz "*** POST WARNING = " | |
49 | -end_str: .asciz "\r\n" | |
50 | - | |
51 | -/* | |
52 | - * Enter the labels in Global Entry Table (GOT). | |
53 | - * Switch to .got2 section. | |
54 | - */ | |
55 | - START_GOT | |
56 | - GOT_ENTRY(err_str) | |
57 | - GOT_ENTRY(warn_str) | |
58 | - GOT_ENTRY(end_str) | |
59 | - END_GOT | |
60 | - | |
61 | -/* | |
62 | - * Switch back to .text section. | |
63 | - */ | |
64 | - .text | |
65 | - | |
66 | -/**************************************** | |
67 | - **************************************** | |
68 | - ******** LED register test ******** | |
69 | - **************************************** | |
70 | - ***************************************/ | |
71 | -test_led: | |
72 | - /* save the return info on stack */ | |
73 | - mflr r0 /* Get link register */ | |
74 | - stwu r1, -12(r1) /* Save back chain and move SP */ | |
75 | - stw r0, +16(r1) /* Save link register */ | |
76 | - stw r4, +8(r1) /* save R4 */ | |
77 | - | |
78 | - WATCHDOG_RESET /* Reset the watchdog */ | |
79 | - | |
80 | - addi r3, 0, ERR_FF /* first test value is ffff */ | |
81 | - addi r4, r3, 0 /* save copy of pattern */ | |
82 | - bl set_led /* store first test value */ | |
83 | - bl get_led /* read it back */ | |
84 | - xor. r4, r4, r3 /* compare to original */ | |
85 | -#if defined(CONFIG_W7OLMC) | |
86 | - andi. r4, r4, 0x00ff /* lmc has 8 bits */ | |
87 | -#else | |
88 | - andi. r4, r4, 0xffff /* lmg has 16 bits */ | |
89 | -#endif | |
90 | - beq LED2 /* next test */ | |
91 | - addi r3, 0, ERR_LED /* error code = 1 */ | |
92 | - bl log_err /* display error and halt */ | |
93 | -LED2: addi r3, 0, ERR_00 /* 2nd test value is 0000 */ | |
94 | - addi r4, r3, 0 /* save copy of pattern */ | |
95 | - bl set_led /* store first test value */ | |
96 | - bl get_led /* read it back */ | |
97 | - xor. r4, r4, r3 /* compare to original */ | |
98 | -#if defined(CONFIG_W7OLMC) | |
99 | - andi. r4, r4, 0x00ff /* lmc has 8 bits */ | |
100 | -#else | |
101 | - andi. r4, r4, 0xffff /* lmg has 16 bits */ | |
102 | -#endif | |
103 | - beq LED3 /* next test */ | |
104 | - addi r3, 0, ERR_LED /* error code = 1 */ | |
105 | - bl log_err /* display error and halt */ | |
106 | - | |
107 | -LED3: /* restore stack and return */ | |
108 | - lwz r0, +16(r1) /* Get saved link register */ | |
109 | - mtlr r0 /* Restore link register */ | |
110 | - lwz r4, +8(r1) /* restore r4 */ | |
111 | - addi r1, r1, +12 /* Remove frame from stack */ | |
112 | - blr /* Return to calling function */ | |
113 | - | |
114 | -/**************************************** | |
115 | - **************************************** | |
116 | - ******** SDRAM TESTS ******** | |
117 | - **************************************** | |
118 | - ***************************************/ | |
119 | -test_sdram: | |
120 | - /* called with mem size in r3 */ | |
121 | - /* save the return info on stack */ | |
122 | - mflr r0 /* Get link register */ | |
123 | - stwu r1, -16(r1) /* Save back chain and move SP */ | |
124 | - stw r0, +20(r1) /* Save link register */ | |
125 | - stmw r30, +8(r1) /* save R30,R31 */ | |
126 | - /* r30 is log2(mem size) */ | |
127 | - /* r31 is mem size */ | |
128 | - | |
129 | - /* take log2 of total mem size */ | |
130 | - addi r31, r3, 0 /* save total mem size */ | |
131 | - addi r30, 0, 0 /* clear r30 */ | |
132 | -l2_loop: | |
133 | - srwi. r31, r31, 1 /* shift right 1 */ | |
134 | - addi r30, r30, 1 /* count shifts */ | |
135 | - bne l2_loop /* loop till done */ | |
136 | - addi r30, r30, -1 /* correct for over count */ | |
137 | - addi r31, r3, 0 /* save original size */ | |
138 | - | |
139 | - /* now kick the dog and test the mem */ | |
140 | - WATCHDOG_RESET /* Reset the watchdog */ | |
141 | - bl Data_Buster /* test crossed/shorted data lines */ | |
142 | - addi r3, r30, 0 /* get log2(memsize) */ | |
143 | - addi r4, r31, 0 /* get memsize */ | |
144 | - bl Ghost_Buster /* test crossed/shorted addr lines */ | |
145 | - addi r3, r31, 0 /* get mem size */ | |
146 | - bl Bit_Buster /* check for bad internal bits */ | |
147 | - | |
148 | - /* restore stack and return */ | |
149 | - lmw r30, +8(r1) /* Restore r30, r31 */ | |
150 | - lwz r0, +20(r1) /* Get saved link register */ | |
151 | - mtlr r0 /* Restore link register */ | |
152 | - addi r1, r1, +16 /* Remove frame from stack */ | |
153 | - blr /* Return to calling function */ | |
154 | - | |
155 | - | |
156 | -/**************************************** | |
157 | - ******** sdram data bus test ******** | |
158 | - ***************************************/ | |
159 | -Data_Buster: | |
160 | - /* save the return info on stack */ | |
161 | - mflr r0 /* Get link register */ | |
162 | - stwu r1, -24(r1) /* Save back chain and move SP */ | |
163 | - stw r0, +28(r1) /* Save link register */ | |
164 | - stmw r28, 8(r1) /* save r28 - r31 on stack */ | |
165 | - /* r31 i/o register */ | |
166 | - /* r30 sdram base address */ | |
167 | - /* r29 5555 syndrom */ | |
168 | - /* r28 aaaa syndrom */ | |
169 | - | |
170 | - /* set up led register for this test */ | |
171 | - addi r3, 0, ERR_RAMG /* set led code to 1 */ | |
172 | - bl log_stat /* store test value */ | |
173 | - /* now test the dram data bus */ | |
174 | - xor r30, r30, r30 /* load r30 with base addr of sdram */ | |
175 | - addis r31, 0, 0x5555 /* load r31 with test value */ | |
176 | - ori r31, r31, 0x5555 | |
177 | - stw r31,0(r30) /* sto the value */ | |
178 | - lwz r29,0(r30) /* read it back */ | |
179 | - xor r29,r31,r29 /* compare it to original */ | |
180 | - addis r31, 0, 0xaaaa /* load r31 with test value */ | |
181 | - ori r31, r31, 0xaaaa | |
182 | - stw r31,0(r30) /* sto the value */ | |
183 | - lwz r28,0(r30) /* read it back */ | |
184 | - xor r28,r31,r28 /* compare it to original */ | |
185 | - or r3,r28,r29 /* or together both error terms */ | |
186 | - /* | |
187 | - * Now that we have the error bits, | |
188 | - * we have to decide which part they are in. | |
189 | - */ | |
190 | - bl get_idx /* r5 is now index to error */ | |
191 | - addi r3, r3, ERR_RAMG | |
192 | - cmpwi r3, ERR_RAMG /* check for errors */ | |
193 | - beq db_done /* skip if no errors */ | |
194 | - bl log_err /* log the error */ | |
195 | - | |
196 | -db_done: | |
197 | - lmw r28, 8(r1) /* restore r28 - r31 from stack */ | |
198 | - lwz r0, +28(r1) /* Get saved link register */ | |
199 | - addi r1, r1, +24 /* Remove frame from stack */ | |
200 | - mtlr r0 /* Restore link register */ | |
201 | - blr /* Return to calling function */ | |
202 | - | |
203 | - | |
204 | -/**************************************************** | |
205 | - ******** test for address ghosting in dram ******** | |
206 | - ***************************************************/ | |
207 | - | |
208 | -Ghost_Buster: | |
209 | - /* save the return info on stack */ | |
210 | - mflr r0 /* Get link register */ | |
211 | - stwu r1, -36(r1) /* Save back chain and move SP */ | |
212 | - stw r0, +40(r1) /* Save link register */ | |
213 | - stmw r25, 8(r1) /* save r25 - r31 on stack */ | |
214 | - /* r31 = scratch register */ | |
215 | - /* r30 is main referance loop counter, | |
216 | - 0 to 23 */ | |
217 | - /* r29 is ghost loop count, 0 to 22 */ | |
218 | - /* r28 is referance address */ | |
219 | - /* r27 is ghost address */ | |
220 | - /* r26 is log2 (mem size) = | |
221 | - number of byte addr bits */ | |
222 | - /* r25 is mem size */ | |
223 | - | |
224 | - /* save the log2(mem size) and mem size */ | |
225 | - addi r26, r3, 0 /* r26 is number of byte addr bits */ | |
226 | - addi r25, r4, 0 /* r25 is mem size in bytes */ | |
227 | - | |
228 | - /* set the leds for address ghost test */ | |
229 | - addi r3, 0, ERR_ADDG | |
230 | - bl set_led | |
231 | - | |
232 | - /* first fill memory with zeros */ | |
233 | - srwi r31, r25, 2 /* convert bytes to longs */ | |
234 | - mtctr r31 /* setup byte counter */ | |
235 | - addi r28, 0, 0 /* start at address at 0 */ | |
236 | - addi r31, 0, 0 /* data value = 0 */ | |
237 | -clr_loop: | |
238 | - stw r31, 0(r28) /* Store zero value */ | |
239 | - addi r28, r28, 4 /* Increment to next word */ | |
240 | - andi. r27, r28, 0xffff /* check for 2^16 loops */ | |
241 | - bne clr_skip /* if not there, then skip */ | |
242 | - WATCHDOG_RESET /* kick the dog every now and then */ | |
243 | -clr_skip: | |
244 | - bdnz clr_loop /* Round and round... */ | |
245 | - | |
246 | - /* now do main test */ | |
247 | - addi r30, 0, 0 /* start referance counter at 0 */ | |
248 | -outside: | |
249 | - /* | |
250 | - * Calculate the referance address | |
251 | - * the referance address is calculated by setting the (r30-1) | |
252 | - * bit of the base address | |
253 | - * when r30=0, the referance address is the base address. | |
254 | - * thus the sequence 0,1,2,4,8,..,2^(n-1) | |
255 | - * setting the bit is done with the following shift functions. | |
256 | - */ | |
257 | - WATCHDOG_RESET /* Reset the watchdog */ | |
258 | - | |
259 | - addi r31, 0, 1 /* r31 = 1 */ | |
260 | - slw r28, r31, r30 /* set bit coresponding to loop cnt */ | |
261 | - srwi r28, r28, 1 /* then shift it right one so */ | |
262 | - /* we start at location 0 */ | |
263 | - /* fill referance address with Fs */ | |
264 | - addi r31, 0, 0x00ff /* r31 = one byte of set bits */ | |
265 | - stb r31,0(r28) /* save ff in referance address */ | |
266 | - | |
267 | - /* ghost (inner) loop, now check all posible ghosted addresses */ | |
268 | - addi r29, 0, 0 /* start ghosted loop counter at 0 */ | |
269 | -inside: | |
270 | - /* | |
271 | - * Calculate the ghost address by flipping one | |
272 | - * bit of referance address. This gives the | |
273 | - * sequence 1,2,4,8,...,2^(n-1) | |
274 | - */ | |
275 | - addi r31, 0, 1 /* r31 = 1 */ | |
276 | - slw r27, r31, r29 /* set bit coresponding to loop cnt */ | |
277 | - xor r27, r28, r27 /* ghost address = ref addr with | |
278 | - bit flipped*/ | |
279 | - | |
280 | - /* now check for ghosting */ | |
281 | - lbz r31,0(r27) /* get content of ghost addr */ | |
282 | - cmpwi r31, 0 /* compare read value to 0 */ | |
283 | - bne Casper /* we found a ghost! */ | |
284 | - | |
285 | - /* now close ghost ( inner ) loop */ | |
286 | - addi r29, r29, 1 /* increment inner loop counter */ | |
287 | - cmpw r29, r26 /* check for last inner loop */ | |
288 | - blt inside /* do more inner loops */ | |
289 | - | |
290 | - /* now close referance ( outer ) loop */ | |
291 | - addi r31, 0, 0 /* r31 = zero */ | |
292 | - stb r31, 0(28) /* zero out the altered address loc. */ | |
293 | - /* | |
294 | - * Increment and check for end, count is zero based. | |
295 | - * With the ble, this gives us one more loops than | |
296 | - * address bits for sequence 0,1,2,4,8,...2^(n-1) | |
297 | - */ | |
298 | - addi r30, r30, 1 /* increment outer loop counter */ | |
299 | - cmpw r30, r26 /* check for last inner loop */ | |
300 | - ble outside /* do more outer loops */ | |
301 | - | |
302 | - /* were done, lets go home */ | |
303 | - b gb_done | |
304 | -Casper: /* we found a ghost !! */ | |
305 | - addi r3, 0, ERR_ADDF /* get indexed error message */ | |
306 | - bl log_err /* log error led error code */ | |
307 | -gb_done: /* pack your bags, and go home */ | |
308 | - lmw r25, 8(r1) /* restore r25 - r31 from stack */ | |
309 | - lwz r0, +40(r1) /* Get saved link register */ | |
310 | - addi r1, r1, +36 /* Remove frame from stack */ | |
311 | - mtlr r0 /* Restore link register */ | |
312 | - blr /* Return to calling function */ | |
313 | - | |
314 | -/**************************************************** | |
315 | - ******** SDRAM data fill tests ********** | |
316 | - ***************************************************/ | |
317 | -Bit_Buster: | |
318 | - /* called with mem size in r3 */ | |
319 | - /* save the return info on stack */ | |
320 | - mflr r0 /* Get link register */ | |
321 | - stwu r1, -16(r1) /* Save back chain and move SP */ | |
322 | - stw r0, +20(r1) /* Save link register */ | |
323 | - stw r4, +8(r1) /* save R4 */ | |
324 | - stw r5, +12(r1) /* save r5 */ | |
325 | - | |
326 | - addis r5, r3, 0 /* save mem size */ | |
327 | - | |
328 | - /* Test 55555555 */ | |
329 | - addi r3, 0, ERR_R55G /* set up error code in case we fail */ | |
330 | - bl log_stat /* store test value */ | |
331 | - addis r4, 0, 0x5555 | |
332 | - ori r4, r4, 0x5555 | |
333 | - bl fill_test | |
334 | - | |
335 | - /* Test aaaaaaaa */ | |
336 | - addi r3, 0, ERR_RAAG /* set up error code in case we fail */ | |
337 | - bl log_stat /* store test value */ | |
338 | - addis r4, 0, 0xAAAA | |
339 | - ori r4, r4, 0xAAAA | |
340 | - bl fill_test | |
341 | - | |
342 | - /* Test 00000000 */ | |
343 | - addi r3, 0, ERR_R00G /* set up error code in case we fail */ | |
344 | - bl log_stat /* store test value */ | |
345 | - addis r4, 0, 0 | |
346 | - ori r4, r4, 0 | |
347 | - bl fill_test | |
348 | - | |
349 | - /* restore stack and return */ | |
350 | - lwz r5, +12(r1) /* restore r4 */ | |
351 | - lwz r4, +8(r1) /* restore r4 */ | |
352 | - lwz r0, +20(r1) /* Get saved link register */ | |
353 | - addi r1, r1, +16 /* Remove frame from stack */ | |
354 | - mtlr r0 /* Restore link register */ | |
355 | - blr /* Return to calling function */ | |
356 | - | |
357 | - | |
358 | -/**************************************************** | |
359 | - ******** fill test ******** | |
360 | - ***************************************************/ | |
361 | -/* tests memory by filling with value, and reading back */ | |
362 | -/* r5 = Size of memory in bytes */ | |
363 | -/* r4 = Value to write */ | |
364 | -/* r3 = Error code */ | |
365 | -fill_test: | |
366 | - mflr r0 /* Get link register */ | |
367 | - stwu r1, -32(r1) /* Save back chain and move SP */ | |
368 | - stw r0, +36(r1) /* Save link register */ | |
369 | - stmw r27, 8(r1) /* save r27 - r31 on stack */ | |
370 | - /* r31 - scratch register */ | |
371 | - /* r30 - memory address */ | |
372 | - mr r27, r3 | |
373 | - mr r28, r4 | |
374 | - mr r29, r5 | |
375 | - | |
376 | - WATCHDOG_RESET /* Reset the watchdog */ | |
377 | - | |
378 | - /* first fill memory with Value */ | |
379 | - srawi r31, r29, 2 /* convert bytes to longs */ | |
380 | - mtctr r31 /* setup counter */ | |
381 | - addi r30, 0, 0 /* Make r30 = addr 0 */ | |
382 | -ft_0: stw r28, 0(r30) /* Store value */ | |
383 | - addi r30, r30, 4 /* Increment to next word */ | |
384 | - andi. r31, r30, 0xffff /* check for 2^16 loops */ | |
385 | - bne ft_0a /* if not there, then skip */ | |
386 | - WATCHDOG_RESET /* kick the dog every now and then */ | |
387 | -ft_0a: bdnz ft_0 /* Round and round... */ | |
388 | - | |
389 | - WATCHDOG_RESET /* Reset the watchdog */ | |
390 | - | |
391 | - /* Now confirm Value is in memory */ | |
392 | - srawi r31, r29, 2 /* convert bytes to longs */ | |
393 | - mtctr r31 /* setup counter */ | |
394 | - addi r30, 0, 0 /* Make r30 = addr 0 */ | |
395 | -ft_1: lwz r31, 0(r30) /* get value from memory */ | |
396 | - xor. r31, r31, r28 /* Writen = Read ? */ | |
397 | - bne ft_err /* If bad, than halt */ | |
398 | - addi r30, r30, 4 /* Increment to next word */ | |
399 | - andi. r31, r30, 0xffff /* check for 2^16 loops*/ | |
400 | - bne ft_1a /* if not there, then skip */ | |
401 | - WATCHDOG_RESET /* kick the dog every now and then */ | |
402 | -ft_1a: bdnz ft_1 /* Round and round... */ | |
403 | - | |
404 | - WATCHDOG_RESET /* Reset the watchdog */ | |
405 | - | |
406 | - b fill_done /* restore and return */ | |
407 | - | |
408 | -ft_err: addi r29, r27, 0 /* save current led code */ | |
409 | - addi r27, r31, 0 /* get pattern in r27 */ | |
410 | - bl get_idx /* get index from r27 */ | |
411 | - add r27, r27, r29 /* add index to old led code */ | |
412 | - bl log_err /* output led err code, halt CPU */ | |
413 | - | |
414 | -fill_done: | |
415 | - lmw r27, 8(r1) /* restore r27 - r31 from stack */ | |
416 | - lwz r0, +36(r1) /* Get saved link register */ | |
417 | - addi r1, r1, +32 /* Remove frame from stack */ | |
418 | - mtlr r0 /* Restore link register */ | |
419 | - blr /* Return to calling function */ | |
420 | - | |
421 | - | |
422 | -/**************************************************** | |
423 | - ******* get error index from r3 pattern ******** | |
424 | - ***************************************************/ | |
425 | -get_idx: /* r3 = (MSW(r3) !=0)*2 + | |
426 | - (LSW(r3) !=0) */ | |
427 | - /* save the return info on stack */ | |
428 | - mflr r0 /* Get link register */ | |
429 | - stwu r1, -12(r1) /* Save back chain and move SP */ | |
430 | - stw r0, +16(r1) /* Save link register */ | |
431 | - stw r4, +8(r1) /* save R4 */ | |
432 | - | |
433 | - andi. r4, r3, 0xffff /* check for lower bits */ | |
434 | - beq gi2 /* skip if no bits set */ | |
435 | - andis. r4, r3, 0xffff /* check for upper bits */ | |
436 | - beq gi3 /* skip if no bits set */ | |
437 | - addi r3, 0, 3 /* both upper and lower bits set */ | |
438 | - b gi_done | |
439 | -gi2: andis. r4, r3, 0xffff /* check for upper bits*/ | |
440 | - beq gi4 /* skip if no bits set */ | |
441 | - addi r3, 0, 2 /* only upper bits set */ | |
442 | - b gi_done | |
443 | -gi3: addi r3, 0, 1 /* only lower bits set */ | |
444 | - b gi_done | |
445 | -gi4: addi r3, 0, 0 /* no bits set */ | |
446 | -gi_done: | |
447 | - /* restore stack and return */ | |
448 | - lwz r0, +16(r1) /* Get saved link register */ | |
449 | - mtlr r0 /* Restore link register */ | |
450 | - lwz r4, +8(r1) /* restore r4 */ | |
451 | - addi r1, r1, +12 /* Remove frame from stack */ | |
452 | - blr /* Return to calling function */ | |
453 | - | |
454 | -/**************************************************** | |
455 | - ******** set LED to R5 and hang ******** | |
456 | - ***************************************************/ | |
457 | -log_stat: /* output a led code and continue */ | |
458 | -set_led: | |
459 | - /* save the return info on stack */ | |
460 | - mflr r0 /* Get link register */ | |
461 | - stwu r1, -12(r1) /* Save back chain and move SP */ | |
462 | - stw r0, +16(r1) /* Save link register */ | |
463 | - stw r4, +8(r1) /* save R4 */ | |
464 | - | |
465 | - addis r4, 0, 0xfe00 /* LED buffer is at 0xfe000000 */ | |
466 | -#if defined(CONFIG_W7OLMG) /* only on gateway, invert outputs */ | |
467 | - xori r3,r3, 0xffff /* complement led code, active low */ | |
468 | - sth r3, 0(r4) /* store first test value */ | |
469 | - xori r3,r3, 0xffff /* complement led code, active low */ | |
470 | -#else /* if not gateway, then don't invert */ | |
471 | - sth r3, 0(r4) /* store first test value */ | |
472 | -#endif | |
473 | - | |
474 | - /* restore stack and return */ | |
475 | - lwz r0, +16(r1) /* Get saved link register */ | |
476 | - mtlr r0 /* Restore link register */ | |
477 | - lwz r4, +8(r1) /* restore r4 */ | |
478 | - addi r1, r1, +12 /* Remove frame from stack */ | |
479 | - blr /* Return to calling function */ | |
480 | - | |
481 | -get_led: | |
482 | - /* save the return info on stack */ | |
483 | - mflr r0 /* Get link register */ | |
484 | - stwu r1, -12(r1) /* Save back chain and move SP */ | |
485 | - stw r0, +16(r1) /* Save link register */ | |
486 | - stw r4, +8(r1) /* save R4 */ | |
487 | - | |
488 | - addis r4, 0, 0xfe00 /* LED buffer is at 0xfe000000 */ | |
489 | - lhz r3, 0(r4) /* store first test value */ | |
490 | -#if defined(CONFIG_W7OLMG) /* only on gateway, invert inputs */ | |
491 | - xori r3,r3, 0xffff /* complement led code, active low */ | |
492 | -#endif | |
493 | - | |
494 | - /* restore stack and return */ | |
495 | - lwz r0, +16(r1) /* Get saved link register */ | |
496 | - mtlr r0 /* Restore link register */ | |
497 | - lwz r4, +8(r1) /* restore r4 */ | |
498 | - addi r1, r1, +12 /* Remove frame from stack */ | |
499 | - blr /* Return to calling function */ | |
500 | - | |
501 | -log_err: /* output the error and hang the board ( for now ) */ | |
502 | - /* save the return info on stack */ | |
503 | - mflr r0 /* Get link register */ | |
504 | - stwu r1, -12(r1) /* Save back chain and move SP */ | |
505 | - stw r0, +16(r1) /* Save link register */ | |
506 | - stw r3, +8(r1) /* save a copy of error code */ | |
507 | - bl set_led /* set the led pattern */ | |
508 | - GET_GOT /* get GOT address in r14 */ | |
509 | - lwz r3,GOT(err_str) /* get address of string */ | |
510 | - bl post_puts /* output the warning string */ | |
511 | - lwz r3, +8(r1) /* get error code */ | |
512 | - addi r4, 0, 2 /* set disp length to 2 nibbles */ | |
513 | - bl disp_hex /* output the error code */ | |
514 | - lwz r3,GOT(end_str) /* get address of string */ | |
515 | - bl post_puts /* output the warning string */ | |
516 | -halt: | |
517 | - b halt /* hang */ | |
518 | - | |
519 | - /* restore stack and return */ | |
520 | - lwz r0, +16(r1) /* Get saved link register */ | |
521 | - mtlr r0 /* Restore link register */ | |
522 | - addi r1, r1, +12 /* Remove frame from stack */ | |
523 | - blr /* Return to calling function */ | |
524 | - | |
525 | -log_warn: /* output a warning, then continue with operations */ | |
526 | - /* save the return info on stack */ | |
527 | - mflr r0 /* Get link register */ | |
528 | - stwu r1, -16(r1) /* Save back chain and move SP */ | |
529 | - stw r0, +20(r1) /* Save link register */ | |
530 | - stw r3, +8(r1) /* save a copy of error code */ | |
531 | - stw r14, +12(r1) /* save a copy of r14 (used by GOT) */ | |
532 | - | |
533 | - bl set_led /* set the led pattern */ | |
534 | - GET_GOT /* get GOT address in r14 */ | |
535 | - lwz r3,GOT(warn_str) /* get address of string */ | |
536 | - bl post_puts /* output the warning string */ | |
537 | - lwz r3, +8(r1) /* get error code */ | |
538 | - addi r4, 0, 2 /* set disp length to 2 nibbles */ | |
539 | - bl disp_hex /* output the error code */ | |
540 | - lwz r3,GOT(end_str) /* get address of string */ | |
541 | - bl post_puts /* output the warning string */ | |
542 | - | |
543 | - addis r3, 0, 64 /* has a long delay */ | |
544 | - mtctr r3 | |
545 | -log_2: | |
546 | - WATCHDOG_RESET /* this keeps dog from barking, */ | |
547 | - /* and takes time */ | |
548 | - bdnz log_2 /* loop till time expires */ | |
549 | - | |
550 | - /* restore stack and return */ | |
551 | - lwz r0, +20(r1) /* Get saved link register */ | |
552 | - lwz r14, +12(r1) /* restore r14 */ | |
553 | - mtlr r0 /* Restore link register */ | |
554 | - addi r1, r1, +16 /* Remove frame from stack */ | |
555 | - blr /* Return to calling function */ | |
556 | - | |
557 | -/******************************************************************* | |
558 | - * temp_uart_init | |
559 | - * Temporary UART initialization routine | |
560 | - * Sets up UART0 to run at 9600N81 off of the internal clock. | |
561 | - * R3-R4 are used. | |
562 | - ******************************************************************/ | |
563 | -temp_uart_init: | |
564 | - /* save the return info on stack */ | |
565 | - mflr r0 /* Get link register */ | |
566 | - stwu r1, -8(r1) /* Save back chain and move SP */ | |
567 | - stw r0, +12(r1) /* Save link register */ | |
568 | - | |
569 | - addis r3, 0, 0xef60 | |
570 | - ori r3, r3, 0x0303 /* r3 = UART0_LCR */ | |
571 | - addi r4, 0, 0x83 /* n81 format, divisor regs enabled */ | |
572 | - stb r4, 0(r3) | |
573 | - | |
574 | - /* set baud rate to use internal clock, | |
575 | - baud = (200e6/16)/31/42 = 9600 */ | |
576 | - | |
577 | - addis r3, 0, 0xef60 /* Address of baud divisor reg */ | |
578 | - ori r3, r3, 0x0300 /* UART0_DLM */ | |
579 | - addi r4, 0, +42 /* uart baud divisor LSB = 93 */ | |
580 | - stb r4, 0(r3) /* baud = (200 /16)/14/93 */ | |
581 | - | |
582 | - addi r3, r3, 0x0001 /* uart baud divisor addr */ | |
583 | - addi r4, 0, 0 | |
584 | - stb r4, 0(r3) /* Divisor Latch MSB = 0 */ | |
585 | - | |
586 | - addis r3, 0, 0xef60 | |
587 | - ori r3, r3, 0x0303 /* r3 = UART0_LCR */ | |
588 | - addi r4, 0, 0x03 /* n81 format, tx/rx regs enabled */ | |
589 | - stb r4, 0(r3) | |
590 | - | |
591 | - /* output a few line feeds */ | |
592 | - addi r3, 0, '\n' /* load line feed */ | |
593 | - bl post_putc /* output the char */ | |
594 | - addi r3, 0, '\n' /* load line feed */ | |
595 | - bl post_putc /* output the char */ | |
596 | - | |
597 | - /* restore stack and return */ | |
598 | - lwz r0, +12(r1) /* Get saved link register */ | |
599 | - mtlr r0 /* Restore link register */ | |
600 | - addi r1, r1, +8 /* Remove frame from stack */ | |
601 | - blr /* Return to calling function */ | |
602 | - | |
603 | -/********************************************************************** | |
604 | - ** post_putc | |
605 | - ** outputs charactor in R3 | |
606 | - ** r3 returns the error code ( -1 if there is an error ) | |
607 | - *********************************************************************/ | |
608 | - | |
609 | -post_putc: | |
610 | - | |
611 | - /* save the return info on stack */ | |
612 | - mflr r0 /* Get link register */ | |
613 | - stwu r1, -20(r1) /* Save back chain and move SP */ | |
614 | - stw r0, +24(r1) /* Save link register */ | |
615 | - stmw r29, 8(r1) /* save r29 - r31 on stack | |
616 | - r31 - uart base address | |
617 | - r30 - delay counter | |
618 | - r29 - scratch reg */ | |
619 | - | |
620 | - addis r31, 0, 0xef60 /* Point to uart base */ | |
621 | - ori r31, r31, 0x0300 | |
622 | - addis r30, 0, 152 /* Load about 10,000,000 ticks. */ | |
623 | -pputc_lp: | |
624 | - lbz r29, 5(r31) /* Read Line Status Register */ | |
625 | - andi. r29, r29, 0x20 /* Check THRE status */ | |
626 | - bne thre_set /* Branch if FIFO empty */ | |
627 | - addic. r30, r30, -1 /* Decrement and check if empty. */ | |
628 | - bne pputc_lp /* Try, try again */ | |
629 | - addi r3, 0, -1 /* Load error code for timeout */ | |
630 | - b pputc_done /* Bail out with error code set */ | |
631 | -thre_set: | |
632 | - stb r3, 0(r31) /* Store character to UART */ | |
633 | - addi r3, 0, 0 /* clear error code */ | |
634 | -pputc_done: | |
635 | - lmw r29, 8(r1) /*restore r29 - r31 from stack */ | |
636 | - lwz r0, +24(r1) /* Get saved link register */ | |
637 | - addi r1, r1, +20 /* Remove frame from stack */ | |
638 | - mtlr r0 /* Restore link register */ | |
639 | - blr /* Return to calling function */ | |
640 | - | |
641 | - | |
642 | -/**************************************************************** | |
643 | - post_puts | |
644 | - Accepts a null-terminated string pointed to by R3 | |
645 | - Outputs to the serial port until 0x00 is found. | |
646 | - r3 returns the error code ( -1 if there is an error ) | |
647 | -*****************************************************************/ | |
648 | -post_puts: | |
649 | - | |
650 | - /* save the return info on stack */ | |
651 | - mflr r0 /* Get link register */ | |
652 | - stwu r1, -12(r1) /* Save back chain and move SP */ | |
653 | - stw r0, +16(r1) /* Save link register */ | |
654 | - stw r31, 8(r1) /* save r31 - char pointer */ | |
655 | - | |
656 | - addi r31, r3, 0 /* move pointer to R31 */ | |
657 | -pputs_nxt: | |
658 | - lbz r3, 0(r31) /* Get next character */ | |
659 | - addic. r3, r3, 0 /* Check for zero */ | |
660 | - beq pputs_term /* bail out if zero */ | |
661 | - bl post_putc /* output the char */ | |
662 | - addic. r3, r3, 0 /* check for error */ | |
663 | - bne pputs_err | |
664 | - addi r31, r31, 1 /* point to next char */ | |
665 | - b pputs_nxt /* loop till term */ | |
666 | -pputs_err: | |
667 | - addi r3, 0, -1 /* set error code */ | |
668 | - b pputs_end /* were outa here */ | |
669 | -pputs_term: | |
670 | - addi r3, 0, 1 /* set success code */ | |
671 | - /* restore stack and return */ | |
672 | -pputs_end: | |
673 | - lwz r31, 8(r1) /* restore r27 - r31 from stack */ | |
674 | - lwz r0, +16(r1) /* Get saved link register */ | |
675 | - addi r1, r1, +12 /* Remove frame from stack */ | |
676 | - mtlr r0 /* Restore link register */ | |
677 | - blr /* Return to calling function */ | |
678 | - | |
679 | - | |
680 | -/******************************************************************** | |
681 | - ***** disp_hex | |
682 | - ***** Routine to display a hex value from a register. | |
683 | - ***** R3 is value to display | |
684 | - ***** R4 is number of nibbles to display ie 2 for byte 8 for (long)word | |
685 | - ***** Returns -1 in R3 if there is an error ( ie serial port hangs ) | |
686 | - ***** Returns 0 in R3 if no error | |
687 | - *******************************************************************/ | |
688 | -disp_hex: | |
689 | - /* save the return info on stack */ | |
690 | - mflr r0 /* Get link register */ | |
691 | - stwu r1, -16(r1) /* Save back chain and move SP */ | |
692 | - stw r0, +20(r1) /* Save link register */ | |
693 | - stmw r30, 8(r1) /* save r30 - r31 on stack */ | |
694 | - /* r31 output char */ | |
695 | - /* r30 uart base address */ | |
696 | - addi r30, 0, 8 /* Go through 8 nibbles. */ | |
697 | - addi r31, r3, 0 | |
698 | -pputh_nxt: | |
699 | - rlwinm r31, r31, 4, 0, 31 /* Rotate next nibble into position */ | |
700 | - andi. r3, r31, 0x0f /* Get nibble. */ | |
701 | - addi r3, r3, 0x30 /* Add zero's ASCII code. */ | |
702 | - cmpwi r3, 0x03a | |
703 | - blt pputh_out | |
704 | - addi r3, r3, 0x07 /* 0x27 for lower case. */ | |
705 | -pputh_out: | |
706 | - cmpw r30, r4 | |
707 | - bgt pputh_skip | |
708 | - bl post_putc | |
709 | - addic. r3, r3, 0 /* check for error */ | |
710 | - bne pputh_err | |
711 | -pputh_skip: | |
712 | - addic. r30, r30, -1 | |
713 | - bne pputh_nxt | |
714 | - xor r3, r3, r3 /* Clear error code */ | |
715 | - b pputh_done | |
716 | -pputh_err: | |
717 | - addi r3, 0, -1 /* set error code */ | |
718 | -pputh_done: | |
719 | - /* restore stack and return */ | |
720 | - lmw r30, 8(r1) /* restore r30 - r31 from stack */ | |
721 | - lwz r0, +20(r1) /* Get saved link register */ | |
722 | - addi r1, r1, +16 /* Remove frame from stack */ | |
723 | - mtlr r0 /* Restore link register */ | |
724 | - blr /* Return to calling function */ |
board/w7o/post2.c
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Bill Hunter, Wave 7 Optics, williamhunter@mediaone.net | |
4 | - * and | |
5 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. | |
6 | - * | |
7 | - * SPDX-License-Identifier: GPL-2.0+ | |
8 | - */ | |
9 | - | |
10 | -#include <common.h> | |
11 | -#include <config.h> | |
12 | -#include <rtc.h> | |
13 | -#include "errors.h" | |
14 | -#include "dtt.h" | |
15 | - | |
16 | -/* for LM75 DTT POST test */ | |
17 | -#define DTT_READ_TEMP 0x0 | |
18 | -#define DTT_CONFIG 0x1 | |
19 | -#define DTT_TEMP_HYST 0x2 | |
20 | -#define DTT_TEMP_SET 0x3 | |
21 | - | |
22 | -#if defined(CONFIG_RTC_M48T35A) | |
23 | -void rtctest(void) | |
24 | -{ | |
25 | - volatile uchar *tchar = (uchar*)(CONFIG_SYS_NVRAM_BASE_ADDR + CONFIG_SYS_NVRAM_SIZE - 9); | |
26 | - struct rtc_time tmp; | |
27 | - | |
28 | - /* set up led code for RTC tests */ | |
29 | - log_stat(ERR_RTCG); | |
30 | - | |
31 | - /* | |
32 | - * Do RTC battery test. The first write after power up | |
33 | - * fails if battery is low. | |
34 | - */ | |
35 | - *tchar = 0xaa; | |
36 | - if ((*tchar ^ 0xaa) != 0x0) log_warn(ERR_RTCBAT); | |
37 | - *tchar = 0x55; /* Reset test address */ | |
38 | - | |
39 | - /* | |
40 | - * Now lets check the validity of the values in the RTC. | |
41 | - */ | |
42 | - rtc_get(&tmp); | |
43 | - if ((tmp.tm_sec < 0) | (tmp.tm_sec > 59) | | |
44 | - (tmp.tm_min < 0) | (tmp.tm_min > 59) | | |
45 | - (tmp.tm_hour < 0) | (tmp.tm_hour > 23) | | |
46 | - (tmp.tm_mday < 1 ) | (tmp.tm_mday > 31) | | |
47 | - (tmp.tm_mon < 1 ) | (tmp.tm_mon > 12) | | |
48 | - (tmp.tm_year < 2000) | (tmp.tm_year > 2500) | | |
49 | - (tmp.tm_wday < 1 ) | (tmp.tm_wday > 7)) { | |
50 | - log_warn(ERR_RTCTIM); | |
51 | - rtc_reset(); | |
52 | - } | |
53 | - | |
54 | - /* | |
55 | - * Now lets do a check to see if the NV RAM is there. | |
56 | - */ | |
57 | - *tchar = 0xaa; | |
58 | - if ((*tchar ^ 0xaa) != 0x0) log_err(ERR_RTCVAL); | |
59 | - *tchar = 0x55; /* Reset test address */ | |
60 | - | |
61 | -} /* rtctest() */ | |
62 | -#endif /* CONFIG_RTC_M48T35A */ | |
63 | - | |
64 | - | |
65 | -#ifdef CONFIG_DTT_LM75 | |
66 | -int dtt_test(int sensor) | |
67 | -{ | |
68 | - short temp, trip, hyst; | |
69 | - | |
70 | - /* get values */ | |
71 | - temp = dtt_read(sensor, DTT_READ_TEMP) / 256; | |
72 | - trip = dtt_read(sensor, DTT_TEMP_SET) / 256; | |
73 | - hyst = dtt_read(sensor, DTT_TEMP_HYST) / 256; | |
74 | - | |
75 | - /* check values */ | |
76 | - if ((hyst != (CONFIG_SYS_DTT_MAX_TEMP - CONFIG_SYS_DTT_HYSTERESIS)) || | |
77 | - (trip != CONFIG_SYS_DTT_MAX_TEMP) || | |
78 | - (temp < CONFIG_SYS_DTT_LOW_TEMP) || (temp > CONFIG_SYS_DTT_MAX_TEMP)) | |
79 | - return 1; | |
80 | - | |
81 | - return 0; | |
82 | -} /* dtt_test() */ | |
83 | -#endif /* CONFIG_DTT_LM75 */ | |
84 | - | |
85 | -/*****************************************/ | |
86 | - | |
87 | -void post2(void) | |
88 | -{ | |
89 | -#if defined(CONFIG_RTC_M48T35A) | |
90 | - rtctest(); | |
91 | -#endif /* CONFIG_RTC_M48T35A */ | |
92 | - | |
93 | -#ifdef CONFIG_DTT_LM75 | |
94 | - log_stat(ERR_TempG); | |
95 | - if(dtt_test(2) != 0) log_warn(ERR_Ttest0); | |
96 | - if(dtt_test(4) != 0) log_warn(ERR_Ttest1); | |
97 | -#endif /* CONFIG_DTT_LM75 */ | |
98 | -} /* post2() */ |
board/w7o/u-boot.lds.debug
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -OUTPUT_ARCH(powerpc) | |
9 | -/* Do we need any of these for elf? | |
10 | - __DYNAMIC = 0; */ | |
11 | -SECTIONS | |
12 | -{ | |
13 | - /* Read-only sections, merged into text segment: */ | |
14 | - . = + SIZEOF_HEADERS; | |
15 | - .interp : { *(.interp) } | |
16 | - .hash : { *(.hash) } | |
17 | - .dynsym : { *(.dynsym) } | |
18 | - .dynstr : { *(.dynstr) } | |
19 | - .rel.text : { *(.rel.text) } | |
20 | - .rela.text : { *(.rela.text) } | |
21 | - .rel.data : { *(.rel.data) } | |
22 | - .rela.data : { *(.rela.data) } | |
23 | - .rel.rodata : { *(.rel.rodata) } | |
24 | - .rela.rodata : { *(.rela.rodata) } | |
25 | - .rel.got : { *(.rel.got) } | |
26 | - .rela.got : { *(.rela.got) } | |
27 | - .rel.ctors : { *(.rel.ctors) } | |
28 | - .rela.ctors : { *(.rela.ctors) } | |
29 | - .rel.dtors : { *(.rel.dtors) } | |
30 | - .rela.dtors : { *(.rela.dtors) } | |
31 | - .rel.bss : { *(.rel.bss) } | |
32 | - .rela.bss : { *(.rela.bss) } | |
33 | - .rel.plt : { *(.rel.plt) } | |
34 | - .rela.plt : { *(.rela.plt) } | |
35 | - .init : { *(.init) } | |
36 | - .plt : { *(.plt) } | |
37 | - .text : | |
38 | - { | |
39 | - /* WARNING - the following is hand-optimized to fit within */ | |
40 | - /* the sector layout of our flash chips! XXX FIXME XXX */ | |
41 | - | |
42 | - mpc8xx/start.o (.text) | |
43 | - common/dlmalloc.o (.text) | |
44 | - lib/vsprintf.o (.text) | |
45 | - lib/crc32.o (.text) | |
46 | - arch/powerpc/lib/extable.o (.text) | |
47 | - | |
48 | - common/env_embedded.o(.text) | |
49 | - | |
50 | - *(.text) | |
51 | - *(.got1) | |
52 | - } | |
53 | - _etext = .; | |
54 | - PROVIDE (etext = .); | |
55 | - .rodata : | |
56 | - { | |
57 | - *(.rodata) | |
58 | - *(.rodata1) | |
59 | - *(.rodata.str1.4) | |
60 | - *(.eh_frame) | |
61 | - } | |
62 | - .fini : { *(.fini) } =0 | |
63 | - .ctors : { *(.ctors) } | |
64 | - .dtors : { *(.dtors) } | |
65 | - | |
66 | - /* Read-write section, merged into data segment: */ | |
67 | - . = (. + 0x0FFF) & 0xFFFFF000; | |
68 | - _erotext = .; | |
69 | - PROVIDE (erotext = .); | |
70 | - .reloc : | |
71 | - { | |
72 | - *(.got) | |
73 | - _GOT2_TABLE_ = .; | |
74 | - *(.got2) | |
75 | - _FIXUP_TABLE_ = .; | |
76 | - *(.fixup) | |
77 | - } | |
78 | - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; | |
79 | - __fixup_entries = (. - _FIXUP_TABLE_)>>2; | |
80 | - | |
81 | - .data : | |
82 | - { | |
83 | - *(.data) | |
84 | - *(.data1) | |
85 | - *(.sdata) | |
86 | - *(.sdata2) | |
87 | - *(.dynamic) | |
88 | - CONSTRUCTORS | |
89 | - } | |
90 | - _edata = .; | |
91 | - PROVIDE (edata = .); | |
92 | - | |
93 | - | |
94 | - . = ALIGN(4); | |
95 | - .u_boot_list : { | |
96 | - KEEP(*(SORT(.u_boot_list*))); | |
97 | - } | |
98 | - | |
99 | - | |
100 | - __start___ex_table = .; | |
101 | - __ex_table : { *(__ex_table) } | |
102 | - __stop___ex_table = .; | |
103 | - | |
104 | - . = ALIGN(4096); | |
105 | - __init_begin = .; | |
106 | - .text.init : { *(.text.init) } | |
107 | - .data.init : { *(.data.init) } | |
108 | - . = ALIGN(4096); | |
109 | - __init_end = .; | |
110 | - | |
111 | - __bss_start = .; | |
112 | - .bss : | |
113 | - { | |
114 | - *(.sbss) *(.scommon) | |
115 | - *(.dynbss) | |
116 | - *(.bss) | |
117 | - *(COMMON) | |
118 | - } | |
119 | - __bss_end = . ; | |
120 | - PROVIDE (end = .); | |
121 | -} |
board/w7o/vpd.c
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -#if defined(VXWORKS) | |
9 | -#include <stdio.h> | |
10 | -#include <string.h> | |
11 | -#define CONFIG_SYS_DEF_EEPROM_ADDR 0xa0 | |
12 | -extern char iicReadByte(char, char); | |
13 | -extern ulong_t crc32(unsigned char *, unsigned long); | |
14 | -#else | |
15 | -#include <common.h> | |
16 | -#endif | |
17 | - | |
18 | -#include "vpd.h" | |
19 | - | |
20 | -/* | |
21 | - * vpd_reader() - reads VPD data from I2C EEPROMS. | |
22 | - * returns pointer to buffer or NULL. | |
23 | - */ | |
24 | -static unsigned char *vpd_reader(unsigned char *buf, unsigned dev_addr, | |
25 | - unsigned off, unsigned count) | |
26 | -{ | |
27 | - unsigned offset = off; /* Calculated offset */ | |
28 | - | |
29 | - /* | |
30 | - * The main board EEPROM contains | |
31 | - * SDRAM SPD in the first 128 bytes, | |
32 | - * so skew the offset. | |
33 | - */ | |
34 | - if (dev_addr == CONFIG_SYS_DEF_EEPROM_ADDR) | |
35 | - offset += SDRAM_SPD_DATA_SIZE; | |
36 | - | |
37 | - /* Try to read the I2C EEPROM */ | |
38 | -#if defined(VXWORKS) | |
39 | - { | |
40 | - int i; | |
41 | - | |
42 | - for (i = 0; i < count; ++i) | |
43 | - buf[i] = iicReadByte(dev_addr, offset + i); | |
44 | - } | |
45 | -#else | |
46 | - if (eeprom_read(dev_addr, offset, buf, count)) { | |
47 | - printf("Failed to read %d bytes from VPD EEPROM 0x%x @ 0x%x\n", | |
48 | - count, dev_addr, offset); | |
49 | - return NULL; | |
50 | - } | |
51 | -#endif | |
52 | - | |
53 | - return buf; | |
54 | -} | |
55 | - | |
56 | - | |
57 | -/* | |
58 | - * vpd_get_packet() - returns next VPD packet or NULL. | |
59 | - */ | |
60 | -static vpd_packet_t *vpd_get_packet(vpd_packet_t * vpd_packet) | |
61 | -{ | |
62 | - vpd_packet_t *packet = vpd_packet; | |
63 | - | |
64 | - if (packet != NULL) { | |
65 | - if (packet->identifier == VPD_PID_TERM) | |
66 | - return NULL; | |
67 | - else | |
68 | - packet = (vpd_packet_t *) ((char *) packet + | |
69 | - packet->size + 2); | |
70 | - } | |
71 | - | |
72 | - return packet; | |
73 | -} | |
74 | - | |
75 | - | |
76 | -/* | |
77 | - * vpd_find_packet() - Locates and returns the specified | |
78 | - * VPD packet or NULL on error. | |
79 | - */ | |
80 | -static vpd_packet_t *vpd_find_packet(vpd_t * vpd, unsigned char ident) | |
81 | -{ | |
82 | - vpd_packet_t *packet = (vpd_packet_t *) &vpd->packets; | |
83 | - | |
84 | - /* Guaranteed illegal */ | |
85 | - if (ident == VPD_PID_GI) | |
86 | - return NULL; | |
87 | - | |
88 | - /* Scan tuples looking for a match */ | |
89 | - while ((packet->identifier != ident) && | |
90 | - (packet->identifier != VPD_PID_TERM)) | |
91 | - packet = vpd_get_packet(packet); | |
92 | - | |
93 | - /* Did we find it? */ | |
94 | - if ((packet->identifier) && (packet->identifier != ident)) | |
95 | - return NULL; | |
96 | - return packet; | |
97 | -} | |
98 | - | |
99 | - | |
100 | -/* | |
101 | - * vpd_is_valid() - Validates contents of VPD data | |
102 | - * in I2C EEPROM. Returns 1 for | |
103 | - * success or 0 for failure. | |
104 | - */ | |
105 | -static int vpd_is_valid(unsigned dev_addr, unsigned char *buf) | |
106 | -{ | |
107 | - unsigned num_bytes; | |
108 | - vpd_packet_t *packet; | |
109 | - vpd_t *vpd = (vpd_t *) buf; | |
110 | - unsigned short stored_crc16, calc_crc16 = 0xffff; | |
111 | - | |
112 | - /* Check Eyecatcher */ | |
113 | - if (strncmp | |
114 | - ((char *) (vpd->header.eyecatcher), VPD_EYECATCHER, | |
115 | - VPD_EYE_SIZE) != 0) { | |
116 | - unsigned offset = 0; | |
117 | - | |
118 | - if (dev_addr == CONFIG_SYS_DEF_EEPROM_ADDR) | |
119 | - offset += SDRAM_SPD_DATA_SIZE; | |
120 | - printf("Error: VPD EEPROM 0x%x corrupt @ 0x%x\n", dev_addr, | |
121 | - offset); | |
122 | - | |
123 | - return 0; | |
124 | - } | |
125 | - | |
126 | - /* Check Length */ | |
127 | - if (vpd->header.size > VPD_MAX_EEPROM_SIZE) { | |
128 | - printf("Error: VPD EEPROM 0x%x contains bad size 0x%x\n", | |
129 | - dev_addr, vpd->header.size); | |
130 | - return 0; | |
131 | - } | |
132 | - | |
133 | - /* Now find the termination packet */ | |
134 | - packet = vpd_find_packet(vpd, VPD_PID_TERM); | |
135 | - if (packet == NULL) { | |
136 | - printf("Error: VPD EEPROM 0x%x missing termination packet\n", | |
137 | - dev_addr); | |
138 | - return 0; | |
139 | - } | |
140 | - | |
141 | - /* Calculate data size */ | |
142 | - num_bytes = (unsigned long) ((unsigned char *) packet - | |
143 | - (unsigned char *) vpd + | |
144 | - sizeof(vpd_packet_t)); | |
145 | - | |
146 | - /* Find stored CRC and clear it */ | |
147 | - packet = vpd_find_packet(vpd, VPD_PID_CRC); | |
148 | - if (packet == NULL) { | |
149 | - printf("Error: VPD EEPROM 0x%x missing CRC\n", dev_addr); | |
150 | - return 0; | |
151 | - } | |
152 | - memcpy(&stored_crc16, packet->data, sizeof(ushort)); | |
153 | - memset(packet->data, 0, sizeof(ushort)); | |
154 | - | |
155 | - /* OK, lets calculate the CRC and check it */ | |
156 | -#if defined(VXWORKS) | |
157 | - calc_crc16 = (0xffff & crc32(buf, num_bytes)); | |
158 | -#else | |
159 | - calc_crc16 = (0xffff & crc32(0, buf, num_bytes)); | |
160 | -#endif | |
161 | - /* Now restore the CRC */ | |
162 | - memcpy(packet->data, &stored_crc16, sizeof(ushort)); | |
163 | - if (stored_crc16 != calc_crc16) { | |
164 | - printf("Error: VPD EEPROM 0x%x has bad CRC 0x%x\n", | |
165 | - dev_addr, stored_crc16); | |
166 | - return 0; | |
167 | - } | |
168 | - | |
169 | - return 1; | |
170 | -} | |
171 | - | |
172 | - | |
173 | -/* | |
174 | - * size_ok() - Check to see if packet size matches | |
175 | - * size of data we want. Returns 1 for | |
176 | - * good match or 0 for failure. | |
177 | - */ | |
178 | -static int size_ok(vpd_packet_t *packet, unsigned long size) | |
179 | -{ | |
180 | - if (packet->size != size) { | |
181 | - printf("VPD Packet 0x%x corrupt.\n", packet->identifier); | |
182 | - return 0; | |
183 | - } | |
184 | - return 1; | |
185 | -} | |
186 | - | |
187 | - | |
188 | -/* | |
189 | - * strlen_ok() - Check to see if packet size matches | |
190 | - * strlen of the string we want to populate. | |
191 | - * Returns 1 for valid length or 0 for failure. | |
192 | - */ | |
193 | -static int strlen_ok(vpd_packet_t *packet, unsigned long length) | |
194 | -{ | |
195 | - if (packet->size >= length) { | |
196 | - printf("VPD Packet 0x%x corrupt.\n", packet->identifier); | |
197 | - return 0; | |
198 | - } | |
199 | - return 1; | |
200 | -} | |
201 | - | |
202 | - | |
203 | -/* | |
204 | - * get_vpd_data() - populates the passed VPD structure 'vpdInfo' | |
205 | - * with data obtained from the specified | |
206 | - * I2C EEPROM 'dev_addr'. Returns 0 for | |
207 | - * success or 1 for failure. | |
208 | - */ | |
209 | -int vpd_get_data(unsigned char dev_addr, VPD *vpdInfo) | |
210 | -{ | |
211 | - unsigned char buf[VPD_EEPROM_SIZE]; | |
212 | - vpd_t *vpd = (vpd_t *) buf; | |
213 | - vpd_packet_t *packet; | |
214 | - | |
215 | - if (vpdInfo == NULL) | |
216 | - return 1; | |
217 | - | |
218 | - /* | |
219 | - * Fill vpdInfo with 0s to blank out | |
220 | - * unused fields, fill vpdInfo->ethAddrs | |
221 | - * with all 0xffs so that other's code can | |
222 | - * determine how many real Ethernet addresses | |
223 | - * there are. OUIs starting with 0xff are | |
224 | - * broadcast addresses, and would never be | |
225 | - * permantely stored. | |
226 | - */ | |
227 | - memset((void *) vpdInfo, 0, sizeof(VPD)); | |
228 | - memset((void *) &vpdInfo->ethAddrs, 0xff, sizeof(vpdInfo->ethAddrs)); | |
229 | - vpdInfo->_devAddr = dev_addr; | |
230 | - | |
231 | - /* Read the minimum size first */ | |
232 | - if (vpd_reader(buf, dev_addr, 0, VPD_EEPROM_SIZE) == NULL) | |
233 | - return 1; | |
234 | - | |
235 | - /* Check validity of VPD data */ | |
236 | - if (!vpd_is_valid(dev_addr, buf)) { | |
237 | - printf("VPD Data is INVALID!\n"); | |
238 | - return 1; | |
239 | - } | |
240 | - | |
241 | - /* | |
242 | - * Walk all the packets and populate | |
243 | - * the VPD info structure. | |
244 | - */ | |
245 | - packet = (vpd_packet_t *) &vpd->packets; | |
246 | - do { | |
247 | - switch (packet->identifier) { | |
248 | - case VPD_PID_GI: | |
249 | - printf("Error: Illegal VPD value\n"); | |
250 | - break; | |
251 | - case VPD_PID_PID: | |
252 | - if (strlen_ok(packet, MAX_PROD_ID)) { | |
253 | - strncpy(vpdInfo->productId, | |
254 | - (char *) (packet->data), | |
255 | - packet->size); | |
256 | - } | |
257 | - break; | |
258 | - case VPD_PID_REV: | |
259 | - if (size_ok(packet, sizeof(char))) | |
260 | - vpdInfo->revisionId = *packet->data; | |
261 | - break; | |
262 | - case VPD_PID_SN: | |
263 | - if (size_ok(packet, sizeof(unsigned long))) { | |
264 | - memcpy(&vpdInfo->serialNum, | |
265 | - packet->data, | |
266 | - sizeof(unsigned long)); | |
267 | - } | |
268 | - break; | |
269 | - case VPD_PID_MANID: | |
270 | - if (size_ok(packet, sizeof(unsigned char))) | |
271 | - vpdInfo->manuID = *packet->data; | |
272 | - break; | |
273 | - case VPD_PID_PCO: | |
274 | - if (size_ok(packet, sizeof(unsigned long))) { | |
275 | - memcpy(&vpdInfo->configOpt, | |
276 | - packet->data, | |
277 | - sizeof(unsigned long)); | |
278 | - } | |
279 | - break; | |
280 | - case VPD_PID_SYSCLK: | |
281 | - if (size_ok(packet, sizeof(unsigned long))) | |
282 | - memcpy(&vpdInfo->sysClk, | |
283 | - packet->data, | |
284 | - sizeof(unsigned long)); | |
285 | - break; | |
286 | - case VPD_PID_SERCLK: | |
287 | - if (size_ok(packet, sizeof(unsigned long))) | |
288 | - memcpy(&vpdInfo->serClk, | |
289 | - packet->data, | |
290 | - sizeof(unsigned long)); | |
291 | - break; | |
292 | - case VPD_PID_FLASH: | |
293 | - if (size_ok(packet, 9)) { /* XXX - hardcoded, | |
294 | - padding in struct */ | |
295 | - memcpy(&vpdInfo->flashCfg, packet->data, 9); | |
296 | - } | |
297 | - break; | |
298 | - case VPD_PID_ETHADDR: | |
299 | - memcpy(vpdInfo->ethAddrs, packet->data, packet->size); | |
300 | - break; | |
301 | - case VPD_PID_POTS: | |
302 | - if (size_ok(packet, sizeof(char))) | |
303 | - vpdInfo->numPOTS = (unsigned) *packet->data; | |
304 | - break; | |
305 | - case VPD_PID_DS1: | |
306 | - if (size_ok(packet, sizeof(char))) | |
307 | - vpdInfo->numDS1 = (unsigned) *packet->data; | |
308 | - case VPD_PID_GAL: | |
309 | - case VPD_PID_CRC: | |
310 | - case VPD_PID_TERM: | |
311 | - break; | |
312 | - default: | |
313 | - printf("Warning: Found unknown VPD packet ID 0x%x\n", | |
314 | - packet->identifier); | |
315 | - break; | |
316 | - } | |
317 | - } while ((packet = vpd_get_packet(packet))); | |
318 | - | |
319 | - return 0; | |
320 | -} | |
321 | - | |
322 | - | |
323 | -/* | |
324 | - * vpd_init() - Initialize default VPD environment | |
325 | - */ | |
326 | -int vpd_init(unsigned char dev_addr) | |
327 | -{ | |
328 | - return 0; | |
329 | -} | |
330 | - | |
331 | - | |
332 | -/* | |
333 | - * vpd_print() - Pretty print the VPD data. | |
334 | - */ | |
335 | -void vpd_print(VPD *vpdInfo) | |
336 | -{ | |
337 | - const char *const sp = ""; | |
338 | - const char *const sfmt = "%4s%-20s: \"%s\"\n"; | |
339 | - const char *const cfmt = "%4s%-20s: '%c'\n"; | |
340 | - const char *const dfmt = "%4s%-20s: %ld\n"; | |
341 | - const char *const hfmt = "%4s%-20s: %08lX\n"; | |
342 | - const char *const dsfmt = "%4s%-20s: %d\n"; | |
343 | - const char *const hsfmt = "%4s%-20s: %04X\n"; | |
344 | - const char *const dhfmt = "%4s%-20s: %ld (%lX)\n"; | |
345 | - | |
346 | - printf("VPD read from I2C device: %02X\n", vpdInfo->_devAddr); | |
347 | - | |
348 | - if (vpdInfo->productId[0]) | |
349 | - printf(sfmt, sp, "Product ID", vpdInfo->productId); | |
350 | - else | |
351 | - printf(sfmt, sp, "Product ID", "UNKNOWN"); | |
352 | - | |
353 | - if (vpdInfo->revisionId) | |
354 | - printf(cfmt, sp, "Revision ID", vpdInfo->revisionId); | |
355 | - | |
356 | - if (vpdInfo->serialNum) | |
357 | - printf(dfmt, sp, "Serial Number", vpdInfo->serialNum); | |
358 | - | |
359 | - if (vpdInfo->manuID) | |
360 | - printf(dfmt, sp, "Manufacture ID", (long) vpdInfo->manuID); | |
361 | - | |
362 | - if (vpdInfo->configOpt) | |
363 | - printf(hfmt, sp, "Configuration", vpdInfo->configOpt); | |
364 | - | |
365 | - if (vpdInfo->sysClk) | |
366 | - printf(dhfmt, sp, "System Clock", vpdInfo->sysClk, | |
367 | - vpdInfo->sysClk); | |
368 | - | |
369 | - if (vpdInfo->serClk) | |
370 | - printf(dhfmt, sp, "Serial Clock", vpdInfo->serClk, | |
371 | - vpdInfo->serClk); | |
372 | - | |
373 | - if (vpdInfo->numPOTS) | |
374 | - printf(dfmt, sp, "Number of POTS lines", vpdInfo->numPOTS); | |
375 | - | |
376 | - if (vpdInfo->numDS1) | |
377 | - printf(dfmt, sp, "Number of DS1s", vpdInfo->numDS1); | |
378 | - | |
379 | - /* Print Ethernet Addresses */ | |
380 | - if (vpdInfo->ethAddrs[0][0] != 0xff) { | |
381 | - int i, j; | |
382 | - | |
383 | - printf("%4sEtherNet Address(es): ", sp); | |
384 | - for (i = 0; i < MAX_ETH_ADDRS; i++) { | |
385 | - if (vpdInfo->ethAddrs[i][0] != 0xff) { | |
386 | - for (j = 0; j < 6; j++) { | |
387 | - printf("%02X", | |
388 | - vpdInfo->ethAddrs[i][j]); | |
389 | - if (((j + 1) % 6) != 0) | |
390 | - printf(":"); | |
391 | - else | |
392 | - printf(" "); | |
393 | - } | |
394 | - if (((i + 1) % 3) == 0) | |
395 | - printf("\n%24s: ", sp); | |
396 | - } | |
397 | - } | |
398 | - printf("\n"); | |
399 | - } | |
400 | - | |
401 | - if (vpdInfo->flashCfg.mfg && vpdInfo->flashCfg.dev) { | |
402 | - printf("Main Flash Configuration:\n"); | |
403 | - printf(hsfmt, sp, "Manufacture ID", vpdInfo->flashCfg.mfg); | |
404 | - printf(hsfmt, sp, "Device ID", vpdInfo->flashCfg.dev); | |
405 | - printf(dsfmt, sp, "Device Width", vpdInfo->flashCfg.devWidth); | |
406 | - printf(dsfmt, sp, "Num. Devices", vpdInfo->flashCfg.numDevs); | |
407 | - printf(dsfmt, sp, "Num. Columns", vpdInfo->flashCfg.numCols); | |
408 | - printf(dsfmt, sp, "Column Width", vpdInfo->flashCfg.colWidth); | |
409 | - printf(dsfmt, sp, "WE Data Width", | |
410 | - vpdInfo->flashCfg.weDataWidth); | |
411 | - } | |
412 | -} |
board/w7o/vpd.h
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -#ifndef _VPD_H_ | |
9 | -#define _VPD_H_ | |
10 | - | |
11 | -/* | |
12 | - * Main Flash Configuration. | |
13 | - */ | |
14 | -typedef struct flashCfg_s { | |
15 | - unsigned short mfg; /* Manufacture ID */ | |
16 | - unsigned short dev; /* Device ID */ | |
17 | - unsigned char devWidth; /* Device Width */ | |
18 | - unsigned char numDevs; /* Number of devices */ | |
19 | - unsigned char numCols; /* Number of columns */ | |
20 | - unsigned char colWidth; /* Width of a column */ | |
21 | - unsigned char weDataWidth; /* Write/Erase Data Width */ | |
22 | -} flashCfg_t; | |
23 | - | |
24 | -/* | |
25 | - * Vital Product Data - VPD | |
26 | - */ | |
27 | -#define MAX_PROD_ID 15 | |
28 | -#define MAX_ETH_ADDRS 10 | |
29 | -typedef unsigned char EthAddr[6]; | |
30 | -typedef struct vpd { | |
31 | - unsigned char _devAddr; /* Device address during read */ | |
32 | - char productId[MAX_PROD_ID]; /* Product ID */ | |
33 | - char revisionId; /* Revision ID as a char */ | |
34 | - unsigned long serialNum; /* Serial number */ | |
35 | - unsigned char manuID; /* Manufact ID - byte int */ | |
36 | - unsigned long configOpt; /* Config Option - bit field */ | |
37 | - unsigned long sysClk; /* System clock in Hertz */ | |
38 | - unsigned long serClk; /* Ext. clock in Hertz */ | |
39 | - flashCfg_t flashCfg; /* Flash configuration */ | |
40 | - unsigned long numPOTS; /* Number of POTS lines */ | |
41 | - unsigned long numDS1; /* Number of DS1 circuits */ | |
42 | - EthAddr ethAddrs[MAX_ETH_ADDRS]; /* Ethernet MAC, 1st = craft */ | |
43 | -} VPD; | |
44 | - | |
45 | - | |
46 | -#define VPD_MAX_EEPROM_SIZE 512 /* Max size VPD EEPROM */ | |
47 | -#define SDRAM_SPD_DATA_SIZE 128 /* Size SPD in VPD EEPROM */ | |
48 | - | |
49 | -/* | |
50 | - * PIDs - Packet Identifiers | |
51 | - */ | |
52 | -#define VPD_PID_GI 0x0 /* Guaranted Illegal */ | |
53 | -#define VPD_PID_PID 0x1 /* Product Identifier */ | |
54 | -#define VPD_PID_REV 0x2 /* Product Revision */ | |
55 | -#define VPD_PID_SN 0x3 /* Serial Number */ | |
56 | -#define VPD_PID_MANID 0x4 /* Manufacture ID */ | |
57 | -#define VPD_PID_PCO 0x5 /* Product configuration */ | |
58 | -#define VPD_PID_SYSCLK 0x6 /* System Clock */ | |
59 | -#define VPD_PID_SERCLK 0x7 /* Ser. Clk. Speed in Hertz */ | |
60 | -#define VPD_PID_CRC 0x8 /* VPD CRC */ | |
61 | -#define VPD_PID_FLASH 0x9 /* Flash Configuration */ | |
62 | -#define VPD_PID_ETHADDR 0xA /* Ethernet Address(es) */ | |
63 | -#define VPD_PID_GAL 0xB /* Galileo Switch Config */ | |
64 | -#define VPD_PID_POTS 0xC /* Number of POTS Lines */ | |
65 | -#define VPD_PID_DS1 0xD /* Number of DS1s */ | |
66 | -#define VPD_PID_TERM 0xFF /* Termination packet */ | |
67 | - | |
68 | -/* | |
69 | - * VPD - Eyecatcher/Magic | |
70 | - */ | |
71 | -#define VPD_EYECATCHER "W7O" | |
72 | -#define VPD_EYE_SIZE 3 | |
73 | -typedef struct vpd_header { | |
74 | - unsigned char eyecatcher[VPD_EYE_SIZE]; /* eyecatcher - "W7O" */ | |
75 | - unsigned short size __attribute__((packed)); /* size of EEPROM */ | |
76 | -} vpd_header_t; | |
77 | - | |
78 | - | |
79 | -#define VPD_DATA_SIZE (VPD_MAX_EEPROM_SIZE - SDRAM_SPD_DATA_SIZE - \ | |
80 | - sizeof(vpd_header_t)) | |
81 | -typedef struct vpd_s { | |
82 | - vpd_header_t header; | |
83 | - unsigned char packets[VPD_DATA_SIZE]; | |
84 | -} vpd_t; | |
85 | - | |
86 | -typedef struct vpd_packet { | |
87 | - unsigned char identifier; | |
88 | - unsigned char size; | |
89 | - unsigned char data[1]; | |
90 | -} vpd_packet_t; | |
91 | - | |
92 | -/* | |
93 | - * VPD configOpt bit mask | |
94 | - */ | |
95 | -#define VPD_HAS_BBRAM 0x1 /* Battery backed SRAM */ | |
96 | -#define VPD_HAS_RTC 0x2 /* Battery backed RTC */ | |
97 | -#define VPD_HAS_EXT_SER_CLK 0x4 /* External serial clock */ | |
98 | -#define VPD_HAS_SER_TRANS_1 0x8 /* COM1 transceiver */ | |
99 | -#define VPD_HAS_SER_TRANS_2 0x10 /* COM2 transceiver */ | |
100 | -#define VPD_HAS_CRAFT_PHY 0x20 /* CRAFT Ethernet */ | |
101 | -#define VPD_HAS_DTT_1 0x40 /* I2C Digital therm. #1 */ | |
102 | -#define VPD_HAS_DTT_2 0x80 /* I2C Digital therm. #2 */ | |
103 | -#define VPD_HAS_1000_UP_LASER 0x100 /* GMM - 1000Mbit Uplink */ | |
104 | -#define VPD_HAS_70KM_UP_LASER 0x200 /* CMM - 70KM Uplink laser */ | |
105 | -#define VPD_HAS_2_UPLINKS 0x400 /* CMM - 2 uplink lasers */ | |
106 | -#define VPD_HAS_FPGA 0x800 /* Has 1 or more FPGAs */ | |
107 | -#define VPD_HAS_DFA 0x1000 /* CLM - Has 2 Fiber Inter. */ | |
108 | -#define VPD_HAS_GAL_SWITCH 0x2000 /* GMM - Has a Gal switch */ | |
109 | -#define VPD_HAS_POTS_LINES 0x4000 /* GMM - Has POTS lines */ | |
110 | -#define VPD_HAS_DS1_CHANNELS 0x8000 /* GMM - Has DS1 channels */ | |
111 | -#define VPD_HAS_CABLE_RETURN 0x10000 /* GBM/GBR - Cable ret. path */ | |
112 | - | |
113 | -#define VPD_EEPROM_SIZE (256 - SDRAM_SPD_DATA_SIZE) /* Size EEPROM */ | |
114 | - | |
115 | -extern int vpd_get_data(unsigned char dev_addr, VPD *vpd); | |
116 | -extern void vpd_print(VPD *vpdInfo); | |
117 | - | |
118 | -#endif /* _VPD_H_ */ |
board/w7o/w7o.c
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -#include <common.h> | |
9 | -#include <command.h> | |
10 | -#include "w7o.h" | |
11 | -#include <asm/processor.h> | |
12 | - | |
13 | -#include "vpd.h" | |
14 | -#include "errors.h" | |
15 | -#include <watchdog.h> | |
16 | - | |
17 | -unsigned long get_dram_size (void); | |
18 | -void sdram_init(void); | |
19 | - | |
20 | -/* ------------------------------------------------------------------------- */ | |
21 | - | |
22 | -int board_early_init_f (void) | |
23 | -{ | |
24 | -#if defined(CONFIG_W7OLMG) | |
25 | - /* | |
26 | - * Setup GPIO pins - reset devices. | |
27 | - */ | |
28 | - out32 (PPC405GP_GPIO0_ODR, 0x10000000); /* one open drain pin */ | |
29 | - out32 (PPC405GP_GPIO0_OR, 0x3E000000); /* set output pins to default */ | |
30 | - out32 (PPC405GP_GPIO0_TCR, 0x7f800000); /* setup for output */ | |
31 | - | |
32 | - /* | |
33 | - * IRQ 0-15 405GP internally generated; active high; level sensitive | |
34 | - * IRQ 16 405GP internally generated; active low; level sensitive | |
35 | - * IRQ 17-24 RESERVED | |
36 | - * IRQ 25 (EXT IRQ 0) XILINX; active low; level sensitive | |
37 | - * IRQ 26 (EXT IRQ 1) PCI INT A; active low; level sensitive | |
38 | - * IRQ 27 (EXT IRQ 2) PCI INT B; active low; level sensitive | |
39 | - * IRQ 28 (EXT IRQ 3) SAM 2; active low; level sensitive | |
40 | - * IRQ 29 (EXT IRQ 4) Battery Bad; active low; level sensitive | |
41 | - * IRQ 30 (EXT IRQ 5) Level One PHY; active low; level sensitive | |
42 | - * IRQ 31 (EXT IRQ 6) SAM 1; active high; level sensitive | |
43 | - */ | |
44 | - mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */ | |
45 | - mtdcr (UIC0ER, 0x00000000); /* disable all ints */ | |
46 | - | |
47 | - mtdcr (UIC0CR, 0x00000000); /* set all to be non-critical */ | |
48 | - mtdcr (UIC0PR, 0xFFFFFF80); /* set int polarities */ | |
49 | - mtdcr (UIC0TR, 0x10000000); /* set int trigger levels */ | |
50 | - mtdcr (UIC0VCR, 0x00000001); /* set vect base=0, | |
51 | - INT0 highest priority */ | |
52 | - | |
53 | - mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */ | |
54 | - | |
55 | -#elif defined(CONFIG_W7OLMC) | |
56 | - /* | |
57 | - * Setup GPIO pins | |
58 | - */ | |
59 | - out32 (PPC405GP_GPIO0_ODR, 0x01800000); /* XCV Done Open Drain */ | |
60 | - out32 (PPC405GP_GPIO0_OR, 0x03800000); /* set out pins to default */ | |
61 | - out32 (PPC405GP_GPIO0_TCR, 0x66C00000); /* setup for output */ | |
62 | - | |
63 | - /* | |
64 | - * IRQ 0-15 405GP internally generated; active high; level sensitive | |
65 | - * IRQ 16 405GP internally generated; active low; level sensitive | |
66 | - * IRQ 17-24 RESERVED | |
67 | - * IRQ 25 (EXT IRQ 0) DBE 0; active low; level sensitive | |
68 | - * IRQ 26 (EXT IRQ 1) DBE 1; active low; level sensitive | |
69 | - * IRQ 27 (EXT IRQ 2) DBE 2; active low; level sensitive | |
70 | - * IRQ 28 (EXT IRQ 3) DBE Common; active low; level sensitive | |
71 | - * IRQ 29 (EXT IRQ 4) PCI; active low; level sensitive | |
72 | - * IRQ 30 (EXT IRQ 5) RCMM Reset; active low; level sensitive | |
73 | - * IRQ 31 (EXT IRQ 6) PHY; active high; level sensitive | |
74 | - */ | |
75 | - mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */ | |
76 | - mtdcr (UIC0ER, 0x00000000); /* disable all ints */ | |
77 | - | |
78 | - mtdcr (UIC0CR, 0x00000000); /* set all to be non-critical */ | |
79 | - mtdcr (UIC0PR, 0xFFFFFF80); /* set int polarities */ | |
80 | - mtdcr (UIC0TR, 0x10000000); /* set int trigger levels */ | |
81 | - mtdcr (UIC0VCR, 0x00000001); /* set vect base=0, | |
82 | - INT0 highest priority */ | |
83 | - | |
84 | - mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */ | |
85 | - | |
86 | -#else /* Unknown */ | |
87 | -# error "Unknown W7O board configuration" | |
88 | -#endif | |
89 | - | |
90 | - WATCHDOG_RESET (); /* Reset the watchdog */ | |
91 | - temp_uart_init (); /* init the uart for debug */ | |
92 | - WATCHDOG_RESET (); /* Reset the watchdog */ | |
93 | - test_led (); /* test the LEDs */ | |
94 | - test_sdram (get_dram_size ()); /* test the dram */ | |
95 | - log_stat (ERR_POST1); /* log status,post1 complete */ | |
96 | - return 0; | |
97 | -} | |
98 | - | |
99 | - | |
100 | -/* ------------------------------------------------------------------------- */ | |
101 | - | |
102 | -/* | |
103 | - * Check Board Identity: | |
104 | - */ | |
105 | -int checkboard (void) | |
106 | -{ | |
107 | - VPD vpd; | |
108 | - | |
109 | - puts ("Board: "); | |
110 | - | |
111 | - /* VPD data present in I2C EEPROM */ | |
112 | - if (vpd_get_data (CONFIG_SYS_DEF_EEPROM_ADDR, &vpd) == 0) { | |
113 | - /* | |
114 | - * Known board type. | |
115 | - */ | |
116 | - if (vpd.productId[0] && | |
117 | - ((strncmp (vpd.productId, "GMM", 3) == 0) || | |
118 | - (strncmp (vpd.productId, "CMM", 3) == 0))) { | |
119 | - | |
120 | - /* Output board information on startup */ | |
121 | - printf ("\"%s\", revision '%c', serial# %ld, manufacturer %u\n", vpd.productId, vpd.revisionId, vpd.serialNum, vpd.manuID); | |
122 | - return (0); | |
123 | - } | |
124 | - } | |
125 | - | |
126 | - puts ("### Unknown HW ID - assuming NOTHING\n"); | |
127 | - return (0); | |
128 | -} | |
129 | - | |
130 | -/* ------------------------------------------------------------------------- */ | |
131 | - | |
132 | -phys_size_t initdram (int board_type) | |
133 | -{ | |
134 | - /* | |
135 | - * ToDo: Move the asm init routine sdram_init() to this C file, | |
136 | - * or even better use some common ppc4xx code available | |
137 | - * in arch/powerpc/cpu/ppc4xx | |
138 | - */ | |
139 | - sdram_init(); | |
140 | - | |
141 | - return get_dram_size (); | |
142 | -} | |
143 | - | |
144 | -unsigned long get_dram_size (void) | |
145 | -{ | |
146 | - int tmp, i, regs[4]; | |
147 | - int size = 0; | |
148 | - | |
149 | - /* Get bank Size registers */ | |
150 | - mtdcr (SDRAM0_CFGADDR, SDRAM0_B0CR); /* get bank 0 config reg */ | |
151 | - regs[0] = mfdcr (SDRAM0_CFGDATA); | |
152 | - | |
153 | - mtdcr (SDRAM0_CFGADDR, SDRAM0_B1CR); /* get bank 1 config reg */ | |
154 | - regs[1] = mfdcr (SDRAM0_CFGDATA); | |
155 | - | |
156 | - mtdcr (SDRAM0_CFGADDR, SDRAM0_B2CR); /* get bank 2 config reg */ | |
157 | - regs[2] = mfdcr (SDRAM0_CFGDATA); | |
158 | - | |
159 | - mtdcr (SDRAM0_CFGADDR, SDRAM0_B3CR); /* get bank 3 config reg */ | |
160 | - regs[3] = mfdcr (SDRAM0_CFGDATA); | |
161 | - | |
162 | - /* compute the size, add each bank if enabled */ | |
163 | - for (i = 0; i < 4; i++) { | |
164 | - if (regs[i] & 0x0001) { /* if enabled, */ | |
165 | - tmp = ((regs[i] >> (31 - 14)) & 0x7); /* get size bits */ | |
166 | - tmp = 0x400000 << tmp; /* Size bits X 4MB = size */ | |
167 | - size += tmp; | |
168 | - } | |
169 | - } | |
170 | - | |
171 | - return size; | |
172 | -} | |
173 | - | |
174 | -int misc_init_f (void) | |
175 | -{ | |
176 | - return 0; | |
177 | -} | |
178 | - | |
179 | -static void w7o_env_init (VPD * vpd) | |
180 | -{ | |
181 | - /* | |
182 | - * Read VPD | |
183 | - */ | |
184 | - if (vpd_get_data (CONFIG_SYS_DEF_EEPROM_ADDR, vpd) != 0) | |
185 | - return; | |
186 | - | |
187 | - /* | |
188 | - * Known board type. | |
189 | - */ | |
190 | - if (vpd->productId[0] && | |
191 | - ((strncmp (vpd->productId, "GMM", 3) == 0) || | |
192 | - (strncmp (vpd->productId, "CMM", 3) == 0))) { | |
193 | - char buf[30]; | |
194 | - char *eth; | |
195 | - char *serial = getenv ("serial#"); | |
196 | - char *ethaddr = getenv ("ethaddr"); | |
197 | - | |
198 | - /* Set 'serial#' envvar if serial# isn't set */ | |
199 | - if (!serial) { | |
200 | - sprintf (buf, "%s-%ld", vpd->productId, | |
201 | - vpd->serialNum); | |
202 | - setenv ("serial#", buf); | |
203 | - } | |
204 | - | |
205 | - /* Set 'ethaddr' envvar if 'ethaddr' envvar is the default */ | |
206 | - eth = (char *)(vpd->ethAddrs[0]); | |
207 | - if (ethaddr | |
208 | - && (strcmp(ethaddr, __stringify(CONFIG_ETHADDR)) == 0)) { | |
209 | - /* Now setup ethaddr */ | |
210 | - sprintf (buf, "%02x:%02x:%02x:%02x:%02x:%02x", | |
211 | - eth[0], eth[1], eth[2], eth[3], eth[4], | |
212 | - eth[5]); | |
213 | - setenv ("ethaddr", buf); | |
214 | - } | |
215 | - } | |
216 | -} /* w7o_env_init() */ | |
217 | - | |
218 | - | |
219 | -int misc_init_r (void) | |
220 | -{ | |
221 | - VPD vpd; /* VPD information */ | |
222 | - | |
223 | -#if defined(CONFIG_W7OLMG) | |
224 | - unsigned long greg; /* GPIO Register */ | |
225 | - | |
226 | - greg = in32 (PPC405GP_GPIO0_OR); | |
227 | - | |
228 | - /* | |
229 | - * XXX - Unreset devices - this should be moved into VxWorks driver code | |
230 | - */ | |
231 | - greg |= 0x41800000L; /* SAM, PHY, Galileo */ | |
232 | - | |
233 | - out32 (PPC405GP_GPIO0_OR, greg); /* set output pins to default */ | |
234 | -#endif /* CONFIG_W7OLMG */ | |
235 | - | |
236 | - /* | |
237 | - * Initialize W7O environment variables | |
238 | - */ | |
239 | - w7o_env_init (&vpd); | |
240 | - | |
241 | - /* | |
242 | - * Initialize the FPGA(s). | |
243 | - */ | |
244 | - if (init_fpga () == 0) | |
245 | - test_fpga ((unsigned short *) CONFIG_FPGAS_BASE); | |
246 | - | |
247 | - /* More POST testing. */ | |
248 | - post2 (); | |
249 | - | |
250 | - /* Done with hardware initialization and POST. */ | |
251 | - log_stat (ERR_POSTOK); | |
252 | - | |
253 | - /* Call silly, fail safe boot init routine */ | |
254 | - init_fsboot (); | |
255 | - | |
256 | - return (0); | |
257 | -} |
board/w7o/w7o.h
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -#ifndef _W7O_H_ | |
9 | -#define _W7O_H_ | |
10 | -#include <config.h> | |
11 | - | |
12 | -/* AMCC 405GP PowerPC GPIO registers */ | |
13 | -#define PPC405GP_GPIO0_OR 0xef600700L /* GPIO Output */ | |
14 | -#define PPC405GP_GPIO0_TCR 0xef600704L /* GPIO Three-State Control */ | |
15 | -#define PPC405GP_GPIO0_ODR 0xef600718L /* GPIO Open Drain */ | |
16 | -#define PPC405GP_GPIO0_IR 0xef60071cL /* GPIO Input */ | |
17 | - | |
18 | -/* LMG FPGA <=> CPU GPIO signals */ | |
19 | -#define LMG_XCV_INIT 0x10000000L | |
20 | -#define LMG_XCV_PROG 0x04000000L | |
21 | -#define LMG_XCV_DONE 0x00400000L | |
22 | -#define LMG_XCV_CNFG_0 0x08000000L | |
23 | -#define LMG_XCV_IRQ_0 0x0L | |
24 | - | |
25 | -/* LMC FPGA <=> CPU GPIO signals */ | |
26 | -#define LMC_XCV_INIT 0x00800000L | |
27 | -#define LMC_XCV_PROG 0x40000000L | |
28 | -#define LMC_XCV_DONE 0x01000000L | |
29 | -#define LMC_XCV_CNFG_0 0x00004000L /* Shared with IRQ 0 */ | |
30 | -#define LMC_XCV_CNFG_1 0x00002000L /* Shared with IRQ 1 */ | |
31 | -#define LMC_XCV_CNFG_2 0x00001000L /* Shared with IRQ 2 */ | |
32 | -#define LMC_XCV_IRQ_0 0x00080000L /* Shared with GPIO 17 */ | |
33 | -#define LMC_XCV_IRQ_1 0x00040000L /* Shared with GPIO 18 */ | |
34 | -#define LMC_XCV_IRQ_3 0x00020000L /* Shared tiwht GPIO 19 */ | |
35 | - | |
36 | - | |
37 | -/* | |
38 | - * Setup FPGA <=> GPIO mappings | |
39 | - */ | |
40 | -#if defined(CONFIG_W7OLMG) | |
41 | -# define GPIO_XCV_INIT LMG_XCV_INIT | |
42 | -# define GPIO_XCV_PROG LMG_XCV_PROG | |
43 | -# define GPIO_XCV_DONE LMG_XCV_DONE | |
44 | -# define GPIO_XCV_CNFG LMG_XCV_CNFG_0 | |
45 | -# define GPIO_XCV_IRQ LMG_XCV_IRQ_0 | |
46 | -# define GPIO_GPIO_1 0x40000000L | |
47 | -# define GPIO_GPIO_6 0x02000000L | |
48 | -# define GPIO_GPIO_7 0x01000000L | |
49 | -# define GPIO_GPIO_8 0x00800000L | |
50 | -#elif defined(CONFIG_W7OLMC) | |
51 | -# define GPIO_XCV_INIT LMC_XCV_INIT | |
52 | -# define GPIO_XCV_PROG LMC_XCV_PROG | |
53 | -# define GPIO_XCV_DONE LMC_XCV_DONE | |
54 | -# define GPIO_XCV_CNFG LMC_XCV_CNFG_0 | |
55 | -# define GPIO_XCV_IRQ LMC_XCV_IRQ_0 | |
56 | -#else | |
57 | -# error "Unknown W7O board configuration" | |
58 | -#endif | |
59 | - | |
60 | -/* Power On Self Tests */ | |
61 | -extern void post2(void); | |
62 | -extern int test_led(void); | |
63 | -extern int test_sdram(unsigned long size); | |
64 | -extern void test_fpga(unsigned short *daddr); | |
65 | - | |
66 | -/* FGPA */ | |
67 | -extern int init_fpga(void); | |
68 | - | |
69 | -/* Misc */ | |
70 | -extern int temp_uart_init(void); | |
71 | -extern void init_fsboot(void); | |
72 | - | |
73 | -#endif /* _W7O_H_ */ |
board/w7o/watchdog.c
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -/* | |
9 | - * W7O board level hardware watchdog. | |
10 | - */ | |
11 | -#include <common.h> | |
12 | -#include <config.h> | |
13 | - | |
14 | -#ifdef CONFIG_HW_WATCHDOG | |
15 | -#include <watchdog.h> | |
16 | - | |
17 | -void hw_watchdog_reset(void) | |
18 | -{ | |
19 | - volatile ushort *hwd = (ushort *)(CONFIG_SYS_W7O_EBC_PB7CR & 0xfff00000); | |
20 | - | |
21 | - /* | |
22 | - * Read the LMG's hwd register and toggle the | |
23 | - * watchdog bit to reset it. On the LMC, just | |
24 | - * reading it is enough, but toggling the bit | |
25 | - * doen't hurt either. | |
26 | - */ | |
27 | - *hwd = *hwd ^ 0x8000; | |
28 | - | |
29 | -} /* hw_watchdog_reset() */ | |
30 | - | |
31 | -#endif /* CONFIG_HW_WATCHDOG */ |
configs/W7OLMC_defconfig
configs/W7OLMG_defconfig
doc/README.scrapyard
... | ... | @@ -12,6 +12,8 @@ |
12 | 12 | |
13 | 13 | Board Arch CPU Commit Removed Last known maintainer/contact |
14 | 14 | ================================================================================================= |
15 | +W7OLMC powerpc ppc4xx - - Erik Theisen <etheisen@mindspring.com> | |
16 | +W7OLMG powerpc ppc4xx - - Erik Theisen <etheisen@mindspring.com> | |
15 | 17 | aev powerpc mpc5xxx - - |
16 | 18 | TB5200 powerpc mpc5xxx - - |
17 | 19 | JSE powerpc ppc4xx - - Stephen Williams <steve@icarus.com> |
include/configs/W7OLMC.h
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -/* | |
9 | - * board/config.h - configuration options, board specific | |
10 | - */ | |
11 | - | |
12 | -#ifndef __CONFIG_H | |
13 | -#define __CONFIG_H | |
14 | - | |
15 | -/* | |
16 | - * High Level Configuration Options | |
17 | - * (easy to change) | |
18 | - */ | |
19 | - | |
20 | -#define CONFIG_405GP 1 /* This is a PPC405GP CPU */ | |
21 | -#define CONFIG_W7O 1 /* ...on a Wave 7 Optics board */ | |
22 | -#define CONFIG_W7OLMC 1 /* ...specifically an LMC */ | |
23 | - | |
24 | -#define CONFIG_SYS_TEXT_BASE 0xFFFC0000 | |
25 | - | |
26 | -#define CONFIG_BOARD_EARLY_INIT_F 1 /* Call board_early_init_f */ | |
27 | -#define CONFIG_MISC_INIT_F 1 /* and misc_init_f() */ | |
28 | -#define CONFIG_MISC_INIT_R 1 /* and misc_init_r() */ | |
29 | - | |
30 | -#define CONFIG_SYS_CLK_FREQ 33333333 /* external frequency to pll */ | |
31 | - | |
32 | -#define CONFIG_BAUDRATE 9600 | |
33 | -#define CONFIG_BOOTDELAY 3 /* autoboot after 3 seconds */ | |
34 | - | |
35 | -#if 1 | |
36 | -#define CONFIG_BOOTCOMMAND "bootvx" /* VxWorks boot command */ | |
37 | -#else | |
38 | -#define CONFIG_BOOTCOMMAND "bootp" /* autoboot command */ | |
39 | -#endif | |
40 | - | |
41 | -#undef CONFIG_BOOTARGS | |
42 | - | |
43 | -#define CONFIG_LOADADDR F0080000 | |
44 | - | |
45 | -#define CONFIG_ETHADDR 00:06:0D:00:00:00 /* Default, overridden at boot */ | |
46 | -#define CONFIG_OVERWRITE_ETHADDR_ONCE | |
47 | -#define CONFIG_IPADDR 192.168.1.1 | |
48 | -#define CONFIG_NETMASK 255.255.255.0 | |
49 | -#define CONFIG_SERVERIP 192.168.1.2 | |
50 | - | |
51 | -#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */ | |
52 | -#undef CONFIG_SYS_LOADS_BAUD_CHANGE /* disallow baudrate change */ | |
53 | - | |
54 | -#define CONFIG_PPC4xx_EMAC | |
55 | -#define CONFIG_MII 1 /* MII PHY management */ | |
56 | -#define CONFIG_PHY_ADDR 0 /* PHY address */ | |
57 | - | |
58 | -#define CONFIG_RTC_M48T35A 1 /* ST Electronics M48 timekeeper */ | |
59 | - | |
60 | -/* | |
61 | - * BOOTP options | |
62 | - */ | |
63 | -#define CONFIG_BOOTP_BOOTFILESIZE | |
64 | -#define CONFIG_BOOTP_BOOTPATH | |
65 | -#define CONFIG_BOOTP_GATEWAY | |
66 | -#define CONFIG_BOOTP_HOSTNAME | |
67 | - | |
68 | - | |
69 | -/* | |
70 | - * Command line configuration. | |
71 | - */ | |
72 | -#include <config_cmd_default.h> | |
73 | - | |
74 | -#define CONFIG_CMD_PCI | |
75 | -#define CONFIG_CMD_IRQ | |
76 | -#define CONFIG_CMD_ASKENV | |
77 | -#define CONFIG_CMD_DHCP | |
78 | -#define CONFIG_CMD_BEDBUG | |
79 | -#define CONFIG_CMD_DATE | |
80 | -#define CONFIG_CMD_I2C | |
81 | -#define CONFIG_CMD_EEPROM | |
82 | -#define CONFIG_CMD_ELF | |
83 | -#define CONFIG_CMD_BSP | |
84 | -#define CONFIG_CMD_REGINFO | |
85 | - | |
86 | -#undef CONFIG_WATCHDOG /* watchdog disabled */ | |
87 | -#define CONFIG_HW_WATCHDOG /* HW Watchdog, board specific */ | |
88 | - | |
89 | -#define CONFIG_SPD_EEPROM /* SPD EEPROM for SDRAM param. */ | |
90 | -#define CONFIG_SPDDRAM_SILENT /* No output if spd fails */ | |
91 | -/* | |
92 | - * Miscellaneous configurable options | |
93 | - */ | |
94 | -#define CONFIG_SYS_LONGHELP /* undef to save memory */ | |
95 | -#define CONFIG_SYS_PROMPT "Wave7Optics> " /* Monitor Command Prompt */ | |
96 | -#undef CONFIG_SYS_HUSH_PARSER /* No hush parse for U-Boot */ | |
97 | -#ifdef CONFIG_SYS_HUSH_PARSER | |
98 | -#endif | |
99 | -#if defined(CONFIG_CMD_KGDB) | |
100 | -#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ | |
101 | -#else | |
102 | -#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ | |
103 | -#endif | |
104 | -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */ | |
105 | -#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ | |
106 | -#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */ | |
107 | - | |
108 | -#define CONFIG_SYS_MEMTEST_START 0x0400000 /* memtest works on */ | |
109 | -#define CONFIG_SYS_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */ | |
110 | - | |
111 | -#define CONFIG_CONS_INDEX 1 /* Use UART0 */ | |
112 | -#define CONFIG_SYS_NS16550 | |
113 | -#define CONFIG_SYS_NS16550_SERIAL | |
114 | -#define CONFIG_SYS_NS16550_REG_SIZE 1 | |
115 | -#define CONFIG_SYS_NS16550_CLK get_serial_clock() | |
116 | - | |
117 | -#undef CONFIG_SYS_EXT_SERIAL_CLOCK /* external serial clock */ | |
118 | -#define CONFIG_SYS_405_UART_ERRATA_59 /* 405GP/CR Rev. D silicon */ | |
119 | -#define CONFIG_SYS_BASE_BAUD 384000 | |
120 | - | |
121 | - | |
122 | -/* The following table includes the supported baudrates */ | |
123 | -#define CONFIG_SYS_BAUDRATE_TABLE {9600} | |
124 | - | |
125 | -#define CONFIG_SYS_LOAD_ADDR 0x100000 /* default load address */ | |
126 | -#define CONFIG_SYS_EXTBDINFO 1 /* use extended board_info (bd_t) */ | |
127 | - | |
128 | -/*----------------------------------------------------------------------- | |
129 | - * PCI stuff | |
130 | - *----------------------------------------------------------------------- | |
131 | - */ | |
132 | -#define PCI_HOST_ADAPTER 0 /* configure as pci adapter */ | |
133 | -#define PCI_HOST_FORCE 1 /* configure as pci host */ | |
134 | -#define PCI_HOST_AUTO 2 /* detected via arbiter enable */ | |
135 | - | |
136 | - | |
137 | -#define CONFIG_PCI /* include pci support */ | |
138 | -#define CONFIG_PCI_INDIRECT_BRIDGE /* indirect PCI bridge support */ | |
139 | -#define CONFIG_PCI_HOST PCI_HOST_AUTO /* select pci host function */ | |
140 | -#define CONFIG_PCI_PNP /* pci plug-and-play */ | |
141 | -/* resource configuration */ | |
142 | -#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1014 /* PCI Vendor ID: IBM */ | |
143 | -#define CONFIG_SYS_PCI_SUBSYS_DEVICEID 0x0156 /* PCI Device ID: 405GP */ | |
144 | -#define CONFIG_SYS_PCI_PTM1LA 0x00000000 /* point to sdram */ | |
145 | -#define CONFIG_SYS_PCI_PTM1MS 0x80000001 /* 2GB, enable hard-wired to 1 */ | |
146 | -#define CONFIG_SYS_PCI_PTM1PCI 0x00000000 /* Host: use this pci address */ | |
147 | -#define CONFIG_SYS_PCI_PTM2LA 0x00000000 /* disabled */ | |
148 | -#define CONFIG_SYS_PCI_PTM2MS 0x00000000 /* disabled */ | |
149 | -#define CONFIG_SYS_PCI_PTM2PCI 0x00000000 /* Host: use this pci address */ | |
150 | - | |
151 | -/*----------------------------------------------------------------------- | |
152 | - * Set up values for external bus controller | |
153 | - * used by cpu_init.c | |
154 | - *----------------------------------------------------------------------- | |
155 | - */ | |
156 | - /* Don't use PerWE instead of PCI_INT ( these functions share a pin ) */ | |
157 | -#undef CONFIG_USE_PERWE | |
158 | - | |
159 | -/* use on chip memory ( OCM ) for temperary stack until sdram is tested */ | |
160 | -#define CONFIG_SYS_TEMP_STACK_OCM 1 | |
161 | - | |
162 | -/* bank 0 is boot flash */ | |
163 | -/* BME=0,TWT=6,CSN=1,OEN=1,WBN=0,WBF=0,TH=2,RE=0,SOR=0,BEM=1,PEN=0 */ | |
164 | -#define CONFIG_SYS_W7O_EBC_PB0AP 0x03050440 | |
165 | -/* BAS=0xFFE,BS=0x1(2MB),BU=0x3(R/W),BW=0x0(8 bits) */ | |
166 | -#define CONFIG_SYS_W7O_EBC_PB0CR 0xFFE38000 | |
167 | - | |
168 | -/* bank 1 is main flash */ | |
169 | -/* BME=0,TWT=11,CSN=1,OEN=1,WBN=0,WBF=0,TH=1,RE=0,SOR=0,BEM=1,PEN=0 */ | |
170 | -#define CONFIG_SYS_EBC_PB1AP 0x05850240 | |
171 | -/* BAS=0xF00,BS=0x7(128MB),BU=0x3(R/W),BW=0x10(32 bits) */ | |
172 | -#define CONFIG_SYS_EBC_PB1CR 0xF00FC000 | |
173 | - | |
174 | -/* bank 2 is RTC/NVRAM */ | |
175 | -/* BME=0,TWT=6,CSN=0,OEN=0,WBN=0,WBF=0,TH=2,RE=0,SOR=0,BEM=1,PEN=0 */ | |
176 | -#define CONFIG_SYS_EBC_PB2AP 0x03000440 | |
177 | -/* BAS=0xFC0,BS=0x0(1MB),BU=0x3(R/W),BW=0x0(8 bits) */ | |
178 | -#define CONFIG_SYS_EBC_PB2CR 0xFC018000 | |
179 | - | |
180 | -/* bank 3 is FPGA 0 */ | |
181 | -/* BME=0,TWT=4,CSN=0,OEN=0,WBN=0,WBF=0,TH=2,RE=0,SOR=0,BEM=0,PEN=0 */ | |
182 | -#define CONFIG_SYS_EBC_PB3AP 0x02000400 | |
183 | -/* BAS=0xFD0,BS=0x0(1MB),BU=0x3(R/W),BW=0x1(16 bits) */ | |
184 | -#define CONFIG_SYS_EBC_PB3CR 0xFD01A000 | |
185 | - | |
186 | -/* bank 4 is FPGA 1 */ | |
187 | -/* BME=,TWT=,CSN=,OEN=,WBN=,WBF=,TH=,RE=,SOR=,BEM=,PEN= */ | |
188 | -#define CONFIG_SYS_EBC_PB4AP 0x02000400 | |
189 | -/* BAS=,BS=,BU=0x3(R/W),BW=0x0(8 bits) */ | |
190 | -#define CONFIG_SYS_EBC_PB4CR 0xFD11A000 | |
191 | - | |
192 | -/* bank 5 is FPGA 2 */ | |
193 | -/* BME=,TWT=,CSN=,OEN=,WBN=,WBF=,TH=,RE=,SOR=,BEM=,PEN= */ | |
194 | -#define CONFIG_SYS_EBC_PB5AP 0x02000400 | |
195 | -/* BAS=,BS=,BU=0x3(R/W),BW=0x1(16 bits) */ | |
196 | -#define CONFIG_SYS_EBC_PB5CR 0xFD21A000 | |
197 | - | |
198 | -/* bank 6 is unused */ | |
199 | -/* PB6AP = 0 */ | |
200 | -#define CONFIG_SYS_EBC_PB6AP 0x00000000 | |
201 | -/* PB6CR = 0 */ | |
202 | -#define CONFIG_SYS_EBC_PB6CR 0x00000000 | |
203 | - | |
204 | -/* bank 7 is LED register */ | |
205 | -/* BME=0,TWT=6,CSN=1,OEN=1,WBN=0,WBF=0,TH=2,RE=0,SOR=0,BEM=1,PEN=0 */ | |
206 | -#define CONFIG_SYS_W7O_EBC_PB7AP 0x03050440 | |
207 | -/* BAS=0xFE0,BS=0x0(1MB),BU=0x3(R/W),BW=0x2(32 bits) */ | |
208 | -#define CONFIG_SYS_W7O_EBC_PB7CR 0xFE01C000 | |
209 | - | |
210 | -/*----------------------------------------------------------------------- | |
211 | - * Start addresses for the final memory configuration | |
212 | - * (Set up by the startup code) | |
213 | - * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0 | |
214 | - */ | |
215 | -#define CONFIG_SYS_SDRAM_BASE 0x00000000 | |
216 | -#define CONFIG_SYS_FLASH_BASE 0xFFFC0000 | |
217 | -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE | |
218 | -#define CONFIG_SYS_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Monitor */ | |
219 | -#define CONFIG_SYS_MALLOC_LEN (128 * 1024) /* Reserve 128 kB for malloc() */ | |
220 | - | |
221 | -/* | |
222 | - * For booting Linux, the board info and command line data | |
223 | - * have to be in the first 8 MB of memory, since this is | |
224 | - * the maximum mapped by the Linux kernel during initialization. | |
225 | - */ | |
226 | -#define CONFIG_SYS_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */ | |
227 | -/*----------------------------------------------------------------------- | |
228 | - * FLASH organization | |
229 | - */ | |
230 | -#define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max number of memory banks */ | |
231 | -#define CONFIG_SYS_MAX_FLASH_SECT 256 /* max number of sec on 1 chip */ | |
232 | - | |
233 | -#define CONFIG_SYS_FLASH_ERASE_TOUT 120000 /* Timeout, Flash Erase, in ms */ | |
234 | -#define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Timeout, Flash Write, in ms */ | |
235 | -#define CONFIG_SYS_FLASH_PROTECTION 1 /* Use real Flash protection */ | |
236 | - | |
237 | -#if 1 /* Use NVRAM for environment variables */ | |
238 | -/*----------------------------------------------------------------------- | |
239 | - * NVRAM organization | |
240 | - */ | |
241 | -#define CONFIG_ENV_IS_IN_NVRAM 1 /* use NVRAM for env vars */ | |
242 | -#define CONFIG_SYS_NVRAM_BASE_ADDR 0xfc000000 /* NVRAM base address */ | |
243 | -#define CONFIG_SYS_NVRAM_SIZE (32*1024) /* NVRAM size */ | |
244 | -#define CONFIG_ENV_SIZE 0x1000 /* Size of Environment vars */ | |
245 | -/*define CONFIG_ENV_ADDR \ | |
246 | - (CONFIG_SYS_NVRAM_BASE_ADDR+CONFIG_SYS_NVRAM_SIZE-CONFIG_ENV_SIZE) Env */ | |
247 | -#define CONFIG_ENV_ADDR CONFIG_SYS_NVRAM_BASE_ADDR | |
248 | - | |
249 | -#else /* Use Boot Flash for environment variables */ | |
250 | -/*----------------------------------------------------------------------- | |
251 | - * Flash EEPROM for environment | |
252 | - */ | |
253 | -#define CONFIG_ENV_IS_IN_FLASH 1 | |
254 | -#define CONFIG_ENV_OFFSET 0x00040000 /* Offset of Environment Sector */ | |
255 | -#define CONFIG_ENV_SIZE 0x10000 /* Total Size of env. sector */ | |
256 | - | |
257 | -#define CONFIG_ENV_SECT_SIZE 0x10000 /* see README - env sec tot sze */ | |
258 | -#endif | |
259 | - | |
260 | -/*----------------------------------------------------------------------- | |
261 | - * I2C EEPROM (CAT24WC08) for environment | |
262 | - */ | |
263 | -#define CONFIG_SYS_I2C | |
264 | -#define CONFIG_SYS_I2C_PPC4XX | |
265 | -#define CONFIG_SYS_I2C_PPC4XX_CH0 | |
266 | -#define CONFIG_SYS_I2C_PPC4XX_SPEED_0 400000 | |
267 | -#define CONFIG_SYS_I2C_PPC4XX_SLAVE_0 0x7F | |
268 | - | |
269 | -#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM CAT28WC08 */ | |
270 | -#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ | |
271 | -/* mask of address bits that overflow into the "EEPROM chip address" */ | |
272 | -#define CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW 0x07 | |
273 | -#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4 /* The Catalyst CAT24WC08 has */ | |
274 | - /* 16 byte page write mode using*/ | |
275 | - /* last 4 bits of the address */ | |
276 | -#define CONFIG_SYS_I2C_MULTI_EEPROMS | |
277 | -/*----------------------------------------------------------------------- | |
278 | - * Definitions for Serial Presence Detect EEPROM address | |
279 | - * (to get SDRAM settings) | |
280 | - */ | |
281 | -#define SPD_EEPROM_ADDRESS 0x50 /* XXX conflicting address!!! XXX */ | |
282 | - | |
283 | -/* | |
284 | - * Init Memory Controller: | |
285 | - */ | |
286 | -#define FLASH_BASE0_PRELIM 0xFFE00000 /* FLASH bank #0 */ | |
287 | -#define FLASH_BASE1_PRELIM 0xF0000000 /* FLASH bank #1 */ | |
288 | - | |
289 | -/* On Chip Memory location */ | |
290 | -#define CONFIG_SYS_OCM_DATA_ADDR 0xF8000000 | |
291 | -#define CONFIG_SYS_OCM_DATA_SIZE 0x1000 | |
292 | - | |
293 | -/*----------------------------------------------------------------------- | |
294 | - * Definitions for initial stack pointer and data area (in RAM) | |
295 | - */ | |
296 | -#define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_OCM_DATA_ADDR /* inside of SDRAM */ | |
297 | -#define CONFIG_SYS_INIT_RAM_SIZE CONFIG_SYS_OCM_DATA_SIZE /* Size of used area in RAM */ | |
298 | -#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) | |
299 | -#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET | |
300 | - | |
301 | -#if defined(CONFIG_CMD_KGDB) | |
302 | -#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */ | |
303 | -#endif | |
304 | - | |
305 | -/* | |
306 | - * FPGA(s) configuration | |
307 | - */ | |
308 | -#define CONFIG_SYS_FPGA_IMAGE_LEN 0x80000 /* 512KB FPGA image */ | |
309 | -#define CONFIG_NUM_FPGAS 3 /* Number of FPGAs on board */ | |
310 | -#define CONFIG_MAX_FPGAS 6 /* Maximum number of FPGAs */ | |
311 | -#define CONFIG_FPGAS_BASE 0xFD000000L /* Base address of FPGAs */ | |
312 | -#define CONFIG_FPGAS_BANK_SIZE 0x00100000L /* FPGAs' mmap bank size */ | |
313 | - | |
314 | -#endif /* __CONFIG_H */ |
include/configs/W7OLMG.h
1 | -/* | |
2 | - * (C) Copyright 2001 | |
3 | - * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com | |
4 | - * | |
5 | - * SPDX-License-Identifier: GPL-2.0+ | |
6 | - */ | |
7 | - | |
8 | -/* | |
9 | - * board/config.h - configuration options, board specific | |
10 | - */ | |
11 | - | |
12 | -#ifndef __CONFIG_H | |
13 | -#define __CONFIG_H | |
14 | - | |
15 | -/* | |
16 | - * High Level Configuration Options | |
17 | - * (easy to change) | |
18 | - */ | |
19 | - | |
20 | -#define CONFIG_405GP 1 /* This is a PPC405GP CPU */ | |
21 | -#define CONFIG_W7O 1 /* ...on a Wave 7 Optics board */ | |
22 | -#define CONFIG_W7OLMG 1 /* ...specifically an LMG */ | |
23 | - | |
24 | -#define CONFIG_SYS_TEXT_BASE 0xFFFC0000 | |
25 | - | |
26 | -#define CONFIG_BOARD_EARLY_INIT_F 1 /* Call board_early_init_f */ | |
27 | -#define CONFIG_MISC_INIT_F 1 /* and misc_init_f() */ | |
28 | -#define CONFIG_MISC_INIT_R 1 /* and misc_init_r() */ | |
29 | - | |
30 | -#define CONFIG_SYS_CLK_FREQ 33333333 /* external frequency to pll */ | |
31 | - | |
32 | -#define CONFIG_BAUDRATE 9600 | |
33 | -#define CONFIG_BOOTDELAY 3 /* autoboot after 3 seconds */ | |
34 | - | |
35 | -#if 1 | |
36 | -#define CONFIG_BOOTCOMMAND "bootvx" /* VxWorks boot command */ | |
37 | -#else | |
38 | -#define CONFIG_BOOTCOMMAND "bootp" /* autoboot command */ | |
39 | -#endif | |
40 | - | |
41 | -#undef CONFIG_BOOTARGS | |
42 | - | |
43 | -#define CONFIG_LOADADDR F0080000 | |
44 | - | |
45 | -#define CONFIG_ETHADDR 00:06:0D:00:00:00 /* Default, overridden at boot */ | |
46 | -#define CONFIG_OVERWRITE_ETHADDR_ONCE | |
47 | -#define CONFIG_IPADDR 192.168.1.1 | |
48 | -#define CONFIG_NETMASK 255.255.255.0 | |
49 | -#define CONFIG_SERVERIP 192.168.1.2 | |
50 | - | |
51 | -#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */ | |
52 | -#undef CONFIG_SYS_LOADS_BAUD_CHANGE /* disallow baudrate change */ | |
53 | - | |
54 | -#define CONFIG_PPC4xx_EMAC | |
55 | -#define CONFIG_MII 1 /* MII PHY management */ | |
56 | -#define CONFIG_PHY_ADDR 0 /* PHY address */ | |
57 | - | |
58 | -#define CONFIG_RTC_M48T35A 1 /* ST Electronics M48 timekeeper */ | |
59 | -#define CONFIG_DTT_LM75 1 /* ON Semi's LM75 */ | |
60 | -#define CONFIG_DTT_SENSORS {2, 4} /* Sensor addresses */ | |
61 | -#define CONFIG_SYS_DTT_MAX_TEMP 70 | |
62 | -#define CONFIG_SYS_DTT_LOW_TEMP -30 | |
63 | -#define CONFIG_SYS_DTT_HYSTERESIS 3 | |
64 | - | |
65 | - | |
66 | -/* | |
67 | - * BOOTP options | |
68 | - */ | |
69 | -#define CONFIG_BOOTP_BOOTFILESIZE | |
70 | -#define CONFIG_BOOTP_BOOTPATH | |
71 | -#define CONFIG_BOOTP_GATEWAY | |
72 | -#define CONFIG_BOOTP_HOSTNAME | |
73 | - | |
74 | - | |
75 | -/* | |
76 | - * Command line configuration. | |
77 | - */ | |
78 | -#include <config_cmd_default.h> | |
79 | - | |
80 | -#define CONFIG_CMD_PCI | |
81 | -#define CONFIG_CMD_IRQ | |
82 | -#define CONFIG_CMD_ASKENV | |
83 | -#define CONFIG_CMD_DHCP | |
84 | -#define CONFIG_CMD_BEDBUG | |
85 | -#define CONFIG_CMD_DATE | |
86 | -#define CONFIG_CMD_I2C | |
87 | -#define CONFIG_CMD_EEPROM | |
88 | -#define CONFIG_CMD_ELF | |
89 | -#define CONFIG_CMD_BSP | |
90 | -#define CONFIG_CMD_REGINFO | |
91 | -#define CONFIG_CMD_DTT | |
92 | - | |
93 | - | |
94 | -#undef CONFIG_WATCHDOG /* watchdog disabled */ | |
95 | -#define CONFIG_HW_WATCHDOG /* HW Watchdog, board specific */ | |
96 | - | |
97 | -#define CONFIG_SPD_EEPROM /* SPD EEPROM for SDRAM param. */ | |
98 | -#define CONFIG_SPDDRAM_SILENT /* No output if spd fails */ | |
99 | -/* | |
100 | - * Miscellaneous configurable options | |
101 | - */ | |
102 | -#define CONFIG_SYS_LONGHELP /* undef to save memory */ | |
103 | -#define CONFIG_SYS_PROMPT "Wave7Optics> " /* Monitor Command Prompt */ | |
104 | -#undef CONFIG_SYS_HUSH_PARSER /* No hush parse for U-Boot */ | |
105 | -#ifdef CONFIG_SYS_HUSH_PARSER | |
106 | -#endif | |
107 | -#if defined(CONFIG_CMD_KGDB) | |
108 | -#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ | |
109 | -#else | |
110 | -#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ | |
111 | -#endif | |
112 | -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */ | |
113 | -#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ | |
114 | -#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */ | |
115 | - | |
116 | -#define CONFIG_SYS_MEMTEST_START 0x0400000 /* memtest works on */ | |
117 | -#define CONFIG_SYS_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */ | |
118 | - | |
119 | -#define CONFIG_CONS_INDEX 1 /* Use UART0 */ | |
120 | -#define CONFIG_SYS_NS16550 | |
121 | -#define CONFIG_SYS_NS16550_SERIAL | |
122 | -#define CONFIG_SYS_NS16550_REG_SIZE 1 | |
123 | -#define CONFIG_SYS_NS16550_CLK get_serial_clock() | |
124 | - | |
125 | -#undef CONFIG_SYS_EXT_SERIAL_CLOCK /* external serial clock */ | |
126 | -#define CONFIG_SYS_405_UART_ERRATA_59 /* 405GP/CR Rev. D silicon */ | |
127 | -#define CONFIG_SYS_BASE_BAUD 384000 | |
128 | - | |
129 | - | |
130 | -/* The following table includes the supported baudrates */ | |
131 | -#define CONFIG_SYS_BAUDRATE_TABLE {9600} | |
132 | - | |
133 | -#define CONFIG_SYS_LOAD_ADDR 0x100000 /* default load address */ | |
134 | -#define CONFIG_SYS_EXTBDINFO 1 /* use extended board_info (bd_t) */ | |
135 | - | |
136 | -/*----------------------------------------------------------------------- | |
137 | - * PCI stuff | |
138 | - *----------------------------------------------------------------------- | |
139 | - */ | |
140 | -#define PCI_HOST_ADAPTER 0 /* configure as pci adapter */ | |
141 | -#define PCI_HOST_FORCE 1 /* configure as pci host */ | |
142 | -#define PCI_HOST_AUTO 2 /* detected via arbiter enable */ | |
143 | - | |
144 | -#define CONFIG_PCI /* include pci support */ | |
145 | -#define CONFIG_PCI_INDIRECT_BRIDGE /* indirect PCI bridge support */ | |
146 | -#define CONFIG_PCI_HOST PCI_HOST_AUTO /* select pci host function */ | |
147 | -#define CONFIG_PCI_PNP /* pci plug-and-play */ | |
148 | -/* resource configuration */ | |
149 | -#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1014 /* PCI Vendor ID: IBM */ | |
150 | -#define CONFIG_SYS_PCI_SUBSYS_DEVICEID 0x0156 /* PCI Device ID: 405GP */ | |
151 | -#define CONFIG_SYS_PCI_PTM1LA 0x00000000 /* point to sdram */ | |
152 | -#define CONFIG_SYS_PCI_PTM1MS 0x80000001 /* 2GB, enable hard-wired to 1 */ | |
153 | -#define CONFIG_SYS_PCI_PTM1PCI 0x00000000 /* Host: use this pci address */ | |
154 | -#define CONFIG_SYS_PCI_PTM2LA 0x00000000 /* disabled */ | |
155 | -#define CONFIG_SYS_PCI_PTM2MS 0x00000000 /* disabled */ | |
156 | -#define CONFIG_SYS_PCI_PTM2PCI 0x00000000 /* Host: use this pci address */ | |
157 | - | |
158 | -/*----------------------------------------------------------------------- | |
159 | - * Set up values for external bus controller | |
160 | - * used by cpu_init.c | |
161 | - *----------------------------------------------------------------------- | |
162 | - */ | |
163 | - /* use PerWE instead of PCI_INT ( these functions share a pin ) */ | |
164 | -#define CONFIG_USE_PERWE 1 | |
165 | - | |
166 | -/* use on chip memory ( OCM ) for temperary stack until sdram is tested */ | |
167 | -#define CONFIG_SYS_TEMP_STACK_OCM 1 | |
168 | - | |
169 | -/* bank 0 is boot flash */ | |
170 | -/* BME=0,TWT=6,CSN=1,OEN=1,WBN=0,WBF=0,TH=2,RE=0,SOR=0,BEM=1,PEN=0 */ | |
171 | -#define CONFIG_SYS_W7O_EBC_PB0AP 0x03050440 | |
172 | -/* BAS=0xFFE,BS=0x1(2MB),BU=0x3(R/W),BW=0x0(8 bits) */ | |
173 | -#define CONFIG_SYS_W7O_EBC_PB0CR 0xFFE38000 | |
174 | - | |
175 | -/* bank 1 is main flash */ | |
176 | -/* BME=0,TWT=9,CSN=1,OEN=1,WBN=0,WBF=0,TH=1,RE=0,SOR=0,BEM=1,PEN=0 */ | |
177 | -#define CONFIG_SYS_EBC_PB1AP 0x04850240 | |
178 | -/* BAS=0xF00,BS=0x7(128MB),BU=0x3(R/W),BW=0x10(32 bits) */ | |
179 | -#define CONFIG_SYS_EBC_PB1CR 0xF00FC000 | |
180 | - | |
181 | -/* bank 2 is RTC/NVRAM */ | |
182 | -/* BME=0,TWT=6,CSN=0,OEN=0,WBN=0,WBF=0,TH=2,RE=0,SOR=0,BEM=1,PEN=0 */ | |
183 | -#define CONFIG_SYS_EBC_PB2AP 0x03000440 | |
184 | -/* BAS=0xFC0,BS=0x0(1MB),BU=0x3(R/W),BW=0x0(8 bits) */ | |
185 | -#define CONFIG_SYS_EBC_PB2CR 0xFC018000 | |
186 | - | |
187 | -/* bank 3 is FPGA 0 */ | |
188 | -/* BME=0,TWT=4,CSN=0,OEN=0,WBN=0,WBF=0,TH=2,RE=0,SOR=0,BEM=0,PEN=0 */ | |
189 | -#define CONFIG_SYS_EBC_PB3AP 0x02000400 | |
190 | -/* BAS=0xFD0,BS=0x0(1MB),BU=0x3(R/W),BW=0x1(16 bits) */ | |
191 | -#define CONFIG_SYS_EBC_PB3CR 0xFD01A000 | |
192 | - | |
193 | -/* bank 4 is SAM 8 bit range */ | |
194 | -/* BME=,TWT=,CSN=,OEN=,WBN=,WBF=,TH=,RE=,SOR=,BEM=,PEN= */ | |
195 | -#define CONFIG_SYS_EBC_PB4AP 0x02840380 | |
196 | -/* BAS=,BS=,BU=0x3(R/W),BW=0x0(8 bits) */ | |
197 | -#define CONFIG_SYS_EBC_PB4CR 0xFE878000 | |
198 | - | |
199 | -/* bank 5 is SAM 16 bit range */ | |
200 | -/* BME=0,TWT=10,CSN=2,OEN=0,WBN=0,WBF=0,TH=6,RE=1,SOR=1,BEM=0,PEN=0 */ | |
201 | -#define CONFIG_SYS_EBC_PB5AP 0x05040d80 | |
202 | -/* BAS=,BS=,BU=0x3(R/W),BW=0x1(16 bits) */ | |
203 | -#define CONFIG_SYS_EBC_PB5CR 0xFD87A000 | |
204 | - | |
205 | -/* bank 6 is unused */ | |
206 | -/* PB6AP = 0 */ | |
207 | -#define CONFIG_SYS_EBC_PB6AP 0x00000000 | |
208 | -/* PB6CR = 0 */ | |
209 | -#define CONFIG_SYS_EBC_PB6CR 0x00000000 | |
210 | - | |
211 | -/* bank 7 is LED register */ | |
212 | -/* BME=0,TWT=6,CSN=1,OEN=1,WBN=0,WBF=0,TH=2,RE=0,SOR=0,BEM=1,PEN=0 */ | |
213 | -#define CONFIG_SYS_W7O_EBC_PB7AP 0x03050440 | |
214 | -/* BAS=0xFE0,BS=0x0(1MB),BU=0x3(R/W),BW=0x2(32 bits) */ | |
215 | -#define CONFIG_SYS_W7O_EBC_PB7CR 0xFE01C000 | |
216 | - | |
217 | -/*----------------------------------------------------------------------- | |
218 | - * Start addresses for the final memory configuration | |
219 | - * (Set up by the startup code) | |
220 | - * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0 | |
221 | - */ | |
222 | -#define CONFIG_SYS_SDRAM_BASE 0x00000000 | |
223 | -#define CONFIG_SYS_FLASH_BASE 0xFFFC0000 | |
224 | -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE | |
225 | -#define CONFIG_SYS_MONITOR_LEN (256 * 1024) /* Reserve 196 kB for Monitor */ | |
226 | -#define CONFIG_SYS_MALLOC_LEN (128 * 1024) /* Reserve 128 kB for malloc() */ | |
227 | - | |
228 | -/* | |
229 | - * For booting Linux, the board info and command line data | |
230 | - * have to be in the first 8 MB of memory, since this is | |
231 | - * the maximum mapped by the Linux kernel during initialization. | |
232 | - */ | |
233 | -#define CONFIG_SYS_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */ | |
234 | -/*----------------------------------------------------------------------- | |
235 | - * FLASH organization | |
236 | - */ | |
237 | -#define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max number of memory banks */ | |
238 | -#define CONFIG_SYS_MAX_FLASH_SECT 256 /* max number of sec on 1 chip */ | |
239 | - | |
240 | -#define CONFIG_SYS_FLASH_ERASE_TOUT 120000 /* Timeout, Flash Erase, in ms */ | |
241 | -#define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Timeout, Flash Write, in ms */ | |
242 | -#define CONFIG_SYS_FLASH_PROTECTION 1 /* Use real Flash protection */ | |
243 | - | |
244 | -#if 1 /* Use NVRAM for environment variables */ | |
245 | -/*----------------------------------------------------------------------- | |
246 | - * NVRAM organization | |
247 | - */ | |
248 | -#define CONFIG_ENV_IS_IN_NVRAM 1 /* use NVRAM for env vars */ | |
249 | -#define CONFIG_SYS_NVRAM_BASE_ADDR 0xfc000000 /* NVRAM base address */ | |
250 | -#define CONFIG_SYS_NVRAM_SIZE (32*1024) /* NVRAM size */ | |
251 | -#define CONFIG_ENV_SIZE 0x1000 /* Size of Environment vars */ | |
252 | -/*define CONFIG_ENV_ADDR \ | |
253 | - (CONFIG_SYS_NVRAM_BASE_ADDR+CONFIG_SYS_NVRAM_SIZE-CONFIG_ENV_SIZE) Env */ | |
254 | -#define CONFIG_ENV_ADDR CONFIG_SYS_NVRAM_BASE_ADDR | |
255 | - | |
256 | -#else /* Use Boot Flash for environment variables */ | |
257 | -/*----------------------------------------------------------------------- | |
258 | - * Flash EEPROM for environment | |
259 | - */ | |
260 | -#define CONFIG_ENV_IS_IN_FLASH 1 | |
261 | -#define CONFIG_ENV_OFFSET 0x00040000 /* Offset of Environment Sector */ | |
262 | -#define CONFIG_ENV_SIZE 0x10000 /* Total Size of env. sector */ | |
263 | - | |
264 | -#define CONFIG_ENV_SECT_SIZE 0x10000 /* see README - env sec tot sze */ | |
265 | -#endif | |
266 | - | |
267 | -/*----------------------------------------------------------------------- | |
268 | - * I2C EEPROM (ATMEL 24C04N) | |
269 | - */ | |
270 | -#define CONFIG_SYS_I2C | |
271 | -#define CONFIG_SYS_I2C_PPC4XX | |
272 | -#define CONFIG_SYS_I2C_PPC4XX_CH0 | |
273 | -#define CONFIG_SYS_I2C_PPC4XX_SPEED_0 400000 | |
274 | -#define CONFIG_SYS_I2C_PPC4XX_SLAVE_0 0x7F | |
275 | - | |
276 | -#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM ATMEL 24C04N */ | |
277 | -#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ | |
278 | -#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3 | |
279 | -#define CONFIG_SYS_I2C_MULTI_EEPROMS | |
280 | -/*----------------------------------------------------------------------- | |
281 | - * Definitions for Serial Presence Detect EEPROM address | |
282 | - * (to get SDRAM settings) | |
283 | - */ | |
284 | -#define SPD_EEPROM_ADDRESS 0x50 /* XXX conflicting address!!! XXX */ | |
285 | - | |
286 | -/* | |
287 | - * Init Memory Controller: | |
288 | - */ | |
289 | -#define FLASH_BASE0_PRELIM 0xFFE00000 /* FLASH bank #0 */ | |
290 | -#define FLASH_BASE1_PRELIM 0xF0000000 /* FLASH bank #1 */ | |
291 | - | |
292 | -/* On Chip Memory location */ | |
293 | -#define CONFIG_SYS_OCM_DATA_ADDR 0xF8000000 | |
294 | -#define CONFIG_SYS_OCM_DATA_SIZE 0x1000 | |
295 | - | |
296 | -/*----------------------------------------------------------------------- | |
297 | - * Definitions for initial stack pointer and data area (in RAM) | |
298 | - */ | |
299 | -#define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_OCM_DATA_ADDR /* inside of SDRAM */ | |
300 | -#define CONFIG_SYS_INIT_RAM_SIZE CONFIG_SYS_OCM_DATA_SIZE /* Size of used area in RAM */ | |
301 | -#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) | |
302 | -#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET | |
303 | - | |
304 | -#if defined(CONFIG_CMD_KGDB) | |
305 | -#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */ | |
306 | -#endif | |
307 | - | |
308 | -/* | |
309 | - * FPGA(s) configuration | |
310 | - */ | |
311 | -#define CONFIG_SYS_FPGA_IMAGE_LEN 0x80000 /* 512KB FPGA image */ | |
312 | -#define CONFIG_NUM_FPGAS 1 /* Number of FPGAs on board */ | |
313 | -#define CONFIG_MAX_FPGAS 6 /* Maximum number of FPGAs */ | |
314 | -#define CONFIG_FPGAS_BASE 0xFD000000L /* Base address of FPGAs */ | |
315 | -#define CONFIG_FPGAS_BANK_SIZE 0x00100000L /* FPGAs' mmap bank size */ | |
316 | - | |
317 | -#endif /* __CONFIG_H */ |