Commit 3d3befa754fedb320f779320ac0ab11deb0a6275
1 parent
4d13cbad1c
Exists in
master
and in
54 other branches
* Patch by Philippe Robin, 09 Mar 2004:
Added ARM Integrator AP, CP and Versatile PB926EJ-S Reference Platform support. * Patch by Masami Komiya, 08 Mar 2004: Don't overwrite server IP address or boot file name when the boot server does not return values * Patch by listmember@orkun.us, 5 Mar 2004: Removed compile time restriction on CFG_I2C_SPEED for DS1338 RTC
Showing 33 changed files with 3640 additions and 23 deletions Side-by-side Diff
- CHANGELOG
- MAKEALL
- Makefile
- board/integratorap/Makefile
- board/integratorap/config.mk
- board/integratorap/flash.c
- board/integratorap/integratorap.c
- board/integratorap/platform.S
- board/integratorap/u-boot.lds
- board/integratorcp/Makefile
- board/integratorcp/config.mk
- board/integratorcp/flash.c
- board/integratorcp/integratorcp.c
- board/integratorcp/platform.S
- board/integratorcp/u-boot.lds
- board/versatile/Makefile
- board/versatile/config.mk
- board/versatile/flash.c
- board/versatile/platform.S
- board/versatile/u-boot.lds
- board/versatile/versatile.c
- cpu/arm926ejs/interrupts.c
- drivers/Makefile
- drivers/serial_pl010.c
- drivers/serial_pl011.c
- drivers/serial_pl011.h
- drivers/smc91111.c
- include/configs/integratorap.h
- include/configs/integratorcp.h
- include/configs/versatile.h
- net/bootp.c
- net/net.c
- rtc/ds1307.c
CHANGELOG
... | ... | @@ -2,6 +2,17 @@ |
2 | 2 | Changes for U-Boot 1.0.2: |
3 | 3 | ====================================================================== |
4 | 4 | |
5 | +* Patch by Philippe Robin, 09 Mar 2004: | |
6 | + Added ARM Integrator AP, CP and Versatile PB926EJ-S Reference | |
7 | + Platform support. | |
8 | + | |
9 | +* Patch by Masami Komiya, 08 Mar 2004: | |
10 | + Don't overwrite server IP address or boot file name | |
11 | + when the boot server does not return values | |
12 | + | |
13 | +* Patch by listmember@orkun.us, 5 Mar 2004: | |
14 | + Removed compile time restriction on CFG_I2C_SPEED for DS1338 RTC | |
15 | + | |
5 | 16 | * Patch by Tolunay Orkun, 5 Mar 2004: |
6 | 17 | Fix early board initialization for Cogent CSB272 board |
7 | 18 |
MAKEALL
... | ... | @@ -135,9 +135,10 @@ |
135 | 135 | ######################################################################### |
136 | 136 | |
137 | 137 | LIST_ARM9=" \ |
138 | - at91rm9200dk omap1510inn omap1610h2 omap1610inn \ | |
138 | + at91rm9200dk integratorcp integratorap \ | |
139 | + omap1510inn omap1610h2 omap1610inn \ | |
139 | 140 | smdk2400 smdk2410 trab \ |
140 | - VCMA9 \ | |
141 | + VCMA9 versatile \ | |
141 | 142 | " |
142 | 143 | |
143 | 144 | ######################################################################### |
Makefile
... | ... | @@ -111,8 +111,9 @@ |
111 | 111 | .PHONY : $(LIBS) |
112 | 112 | |
113 | 113 | # Add GCC lib |
114 | -PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc | |
114 | +PLATFORM_LIBS += --no-warn-mismatch -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc | |
115 | 115 | |
116 | + | |
116 | 117 | # The "tools" are needed early, so put this first |
117 | 118 | # Don't include stuff already done in $(LIBS) |
118 | 119 | SUBDIRS = tools \ |
... | ... | @@ -926,6 +927,15 @@ |
926 | 927 | |
927 | 928 | SX1_config : unconfig |
928 | 929 | @./mkconfig $(@:_config=) arm arm925t sx1 |
930 | + | |
931 | +integratorcp_config : unconfig | |
932 | + @./mkconfig $(@:_config=) arm arm926ejs integratorcp | |
933 | + | |
934 | +integratorap_config : unconfig | |
935 | + @./mkconfig $(@:_config=) arm arm926ejs integratorap | |
936 | + | |
937 | +versatile_config : unconfig | |
938 | + @./mkconfig $(@:_config=) arm arm926ejs versatile | |
929 | 939 | |
930 | 940 | omap1510inn_config : unconfig |
931 | 941 | @./mkconfig $(@:_config=) arm arm925t omap1510inn |
board/integratorap/Makefile
1 | +# | |
2 | +# (C) Copyright 2000-2004 | |
3 | +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
4 | +# | |
5 | +# (C) Copyright 2004 | |
6 | +# ARM Ltd. | |
7 | +# Philippe Robin, <philippe.robin@arm.com> | |
8 | +# | |
9 | +# See file CREDITS for list of people who contributed to this | |
10 | +# project. | |
11 | +# | |
12 | +# This program is free software; you can redistribute it and/or | |
13 | +# modify it under the terms of the GNU General Public License as | |
14 | +# published by the Free Software Foundation; either version 2 of | |
15 | +# the License, or (at your option) any later version. | |
16 | +# | |
17 | +# This program is distributed in the hope that it will be useful, | |
18 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | +# GNU General Public License for more details. | |
21 | +# | |
22 | +# You should have received a copy of the GNU General Public License | |
23 | +# along with this program; if not, write to the Free Software | |
24 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
25 | +# MA 02111-1307 USA | |
26 | +# | |
27 | + | |
28 | +include $(TOPDIR)/config.mk | |
29 | + | |
30 | +LIB = lib$(BOARD).a | |
31 | + | |
32 | +OBJS := integratorap.o flash.o | |
33 | +SOBJS := platform.o | |
34 | + | |
35 | +$(LIB): $(OBJS) $(SOBJS) | |
36 | + $(AR) crv $@ $^ | |
37 | + | |
38 | +clean: | |
39 | + rm -f $(SOBJS) $(OBJS) | |
40 | + | |
41 | +distclean: clean | |
42 | + rm -f $(LIB) core *.bak .depend | |
43 | + | |
44 | +######################################################################### | |
45 | + | |
46 | +.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) | |
47 | + $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@ | |
48 | + | |
49 | +-include .depend | |
50 | + | |
51 | +######################################################################### |
board/integratorap/config.mk
board/integratorap/flash.c
1 | +/* | |
2 | + * (C) Copyright 2001 | |
3 | + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net | |
4 | + * | |
5 | + * (C) Copyright 2001-2004 | |
6 | + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
7 | + * | |
8 | + * (C) Copyright 2003 | |
9 | + * Texas Instruments, <www.ti.com> | |
10 | + * Kshitij Gupta <Kshitij@ti.com> | |
11 | + * | |
12 | + * See file CREDITS for list of people who contributed to this | |
13 | + * project. | |
14 | + * | |
15 | + * This program is free software; you can redistribute it and/or | |
16 | + * modify it under the terms of the GNU General Public License as | |
17 | + * published by the Free Software Foundation; either version 2 of | |
18 | + * the License, or (at your option) any later version. | |
19 | + * | |
20 | + * This program is distributed in the hope that it will be useful, | |
21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | + * GNU General Public License for more details. | |
24 | + * | |
25 | + * You should have received a copy of the GNU General Public License | |
26 | + * along with this program; if not, write to the Free Software | |
27 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
28 | + * MA 02111-1307 USA | |
29 | + */ | |
30 | + | |
31 | +#include <common.h> | |
32 | +#include <linux/byteorder/swab.h> | |
33 | + | |
34 | +#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */ | |
35 | +flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ | |
36 | + | |
37 | +/* Board support for 1 or 2 flash devices */ | |
38 | +#undef FLASH_PORT_WIDTH32 | |
39 | +#define FLASH_PORT_WIDTH16 | |
40 | + | |
41 | +#ifdef FLASH_PORT_WIDTH16 | |
42 | +#define FLASH_PORT_WIDTH ushort | |
43 | +#define FLASH_PORT_WIDTHV vu_short | |
44 | +#define SWAP(x) __swab16(x) | |
45 | +#else | |
46 | +#define FLASH_PORT_WIDTH ulong | |
47 | +#define FLASH_PORT_WIDTHV vu_long | |
48 | +#define SWAP(x) __swab32(x) | |
49 | +#endif | |
50 | + | |
51 | +#define FPW FLASH_PORT_WIDTH | |
52 | +#define FPWV FLASH_PORT_WIDTHV | |
53 | + | |
54 | +#define mb() __asm__ __volatile__ ("" : : : "memory") | |
55 | + | |
56 | + | |
57 | +/* Flash Organization Structure */ | |
58 | +typedef struct OrgDef { | |
59 | + unsigned int sector_number; | |
60 | + unsigned int sector_size; | |
61 | +} OrgDef; | |
62 | + | |
63 | + | |
64 | +/* Flash Organizations */ | |
65 | +OrgDef OrgIntel_28F256L18T[] = { | |
66 | + {4, 32 * 1024}, /* 4 * 32kBytes sectors */ | |
67 | + {255, 128 * 1024}, /* 255 * 128kBytes sectors */ | |
68 | +}; | |
69 | + | |
70 | + | |
71 | +/*----------------------------------------------------------------------- | |
72 | + * Functions | |
73 | + */ | |
74 | +unsigned long flash_init (void); | |
75 | +static ulong flash_get_size (FPW * addr, flash_info_t * info); | |
76 | +static int write_data (flash_info_t * info, ulong dest, FPW data); | |
77 | +static void flash_get_offsets (ulong base, flash_info_t * info); | |
78 | +void inline spin_wheel (void); | |
79 | +void flash_print_info (flash_info_t * info); | |
80 | +void flash_unprotect_sectors (FPWV * addr); | |
81 | +int flash_erase (flash_info_t * info, int s_first, int s_last); | |
82 | +int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt); | |
83 | + | |
84 | +/*----------------------------------------------------------------------- | |
85 | + */ | |
86 | + | |
87 | +unsigned long flash_init (void) | |
88 | +{ | |
89 | + int i; | |
90 | + ulong size = 0; | |
91 | + for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) { | |
92 | + switch (i) { | |
93 | + case 0: | |
94 | + flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]); | |
95 | + flash_get_offsets (PHYS_FLASH_1, &flash_info[i]); | |
96 | + break; | |
97 | + default: | |
98 | + panic ("configured too many flash banks!\n"); | |
99 | + break; | |
100 | + } | |
101 | + size += flash_info[i].size; | |
102 | + } | |
103 | + | |
104 | + /* Protect monitor and environment sectors | |
105 | + */ | |
106 | + flash_protect (FLAG_PROTECT_SET, | |
107 | + CFG_FLASH_BASE, | |
108 | + CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]); | |
109 | + | |
110 | + return size; | |
111 | +} | |
112 | + | |
113 | +/*----------------------------------------------------------------------- | |
114 | + */ | |
115 | +static void flash_get_offsets (ulong base, flash_info_t * info) | |
116 | +{ | |
117 | + int i; | |
118 | + OrgDef *pOrgDef; | |
119 | + | |
120 | + pOrgDef = OrgIntel_28F256L18T; | |
121 | + if (info->flash_id == FLASH_UNKNOWN) { | |
122 | + return; | |
123 | + } | |
124 | + | |
125 | + if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) { | |
126 | + for (i = 0; i < info->sector_count; i++) { | |
127 | + if (i > 255) { | |
128 | + info->start[i] = base + (i * 0x8000); | |
129 | + info->protect[i] = 0; | |
130 | + } else { | |
131 | + info->start[i] = base + | |
132 | + (i * PHYS_FLASH_SECT_SIZE); | |
133 | + info->protect[i] = 0; | |
134 | + } | |
135 | + } | |
136 | + } | |
137 | +} | |
138 | + | |
139 | +/*----------------------------------------------------------------------- | |
140 | + */ | |
141 | +void flash_print_info (flash_info_t * info) | |
142 | +{ | |
143 | + int i; | |
144 | + | |
145 | + if (info->flash_id == FLASH_UNKNOWN) { | |
146 | + printf ("missing or unknown FLASH type\n"); | |
147 | + return; | |
148 | + } | |
149 | + | |
150 | + switch (info->flash_id & FLASH_VENDMASK) { | |
151 | + case FLASH_MAN_INTEL: | |
152 | + printf ("INTEL "); | |
153 | + break; | |
154 | + default: | |
155 | + printf ("Unknown Vendor "); | |
156 | + break; | |
157 | + } | |
158 | + | |
159 | + switch (info->flash_id & FLASH_TYPEMASK) { | |
160 | + case FLASH_28F256L18T: | |
161 | + printf ("FLASH 28F256L18T\n"); | |
162 | + break; | |
163 | + default: | |
164 | + printf ("Unknown Chip Type\n"); | |
165 | + break; | |
166 | + } | |
167 | + | |
168 | + printf (" Size: %ld MB in %d Sectors\n", | |
169 | + info->size >> 20, info->sector_count); | |
170 | + | |
171 | + printf (" Sector Start Addresses:"); | |
172 | + for (i = 0; i < info->sector_count; ++i) { | |
173 | + if ((i % 5) == 0) | |
174 | + printf ("\n "); | |
175 | + printf (" %08lX%s", | |
176 | + info->start[i], info->protect[i] ? " (RO)" : " "); | |
177 | + } | |
178 | + printf ("\n"); | |
179 | + return; | |
180 | +} | |
181 | + | |
182 | +/* | |
183 | + * The following code cannot be run from FLASH! | |
184 | + */ | |
185 | +static ulong flash_get_size (FPW * addr, flash_info_t * info) | |
186 | +{ | |
187 | + volatile FPW value; | |
188 | + | |
189 | + /* Write auto select command: read Manufacturer ID */ | |
190 | + addr[0x5555] = (FPW) 0x00AA00AA; | |
191 | + addr[0x2AAA] = (FPW) 0x00550055; | |
192 | + addr[0x5555] = (FPW) 0x00900090; | |
193 | + | |
194 | + mb (); | |
195 | + value = addr[0]; | |
196 | + | |
197 | + switch (value) { | |
198 | + | |
199 | + case (FPW) INTEL_MANUFACT: | |
200 | + info->flash_id = FLASH_MAN_INTEL; | |
201 | + break; | |
202 | + | |
203 | + default: | |
204 | + info->flash_id = FLASH_UNKNOWN; | |
205 | + info->sector_count = 0; | |
206 | + info->size = 0; | |
207 | + addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ | |
208 | + return (0); /* no or unknown flash */ | |
209 | + } | |
210 | + | |
211 | + mb (); | |
212 | + value = addr[1]; /* device ID */ | |
213 | + switch (value) { | |
214 | + | |
215 | + case (FPW) (INTEL_ID_28F256L18T): | |
216 | + info->flash_id += FLASH_28F256L18T; | |
217 | + info->sector_count = 259; | |
218 | + info->size = 0x02000000; | |
219 | + break; /* => 32 MB */ | |
220 | + | |
221 | + default: | |
222 | + info->flash_id = FLASH_UNKNOWN; | |
223 | + break; | |
224 | + } | |
225 | + | |
226 | + if (info->sector_count > CFG_MAX_FLASH_SECT) { | |
227 | + printf ("** ERROR: sector count %d > max (%d) **\n", | |
228 | + info->sector_count, CFG_MAX_FLASH_SECT); | |
229 | + info->sector_count = CFG_MAX_FLASH_SECT; | |
230 | + } | |
231 | + | |
232 | + addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ | |
233 | + | |
234 | + return (info->size); | |
235 | +} | |
236 | + | |
237 | + | |
238 | +/* unprotects a sector for write and erase | |
239 | + * on some intel parts, this unprotects the entire chip, but it | |
240 | + * wont hurt to call this additional times per sector... | |
241 | + */ | |
242 | +void flash_unprotect_sectors (FPWV * addr) | |
243 | +{ | |
244 | +#define PD_FINTEL_WSMS_READY_MASK 0x0080 | |
245 | + | |
246 | + *addr = (FPW) 0x00500050; /* clear status register */ | |
247 | + | |
248 | + /* this sends the clear lock bit command */ | |
249 | + *addr = (FPW) 0x00600060; | |
250 | + *addr = (FPW) 0x00D000D0; | |
251 | +} | |
252 | + | |
253 | + | |
254 | +/*----------------------------------------------------------------------- | |
255 | + */ | |
256 | + | |
257 | +int flash_erase (flash_info_t * info, int s_first, int s_last) | |
258 | +{ | |
259 | + int flag, prot, sect; | |
260 | + ulong type, start, last; | |
261 | + int rcode = 0; | |
262 | + | |
263 | + if ((s_first < 0) || (s_first > s_last)) { | |
264 | + if (info->flash_id == FLASH_UNKNOWN) { | |
265 | + printf ("- missing\n"); | |
266 | + } else { | |
267 | + printf ("- no sectors to erase\n"); | |
268 | + } | |
269 | + return 1; | |
270 | + } | |
271 | + | |
272 | + type = (info->flash_id & FLASH_VENDMASK); | |
273 | + if ((type != FLASH_MAN_INTEL)) { | |
274 | + printf ("Can't erase unknown flash type %08lx - aborted\n", | |
275 | + info->flash_id); | |
276 | + return 1; | |
277 | + } | |
278 | + | |
279 | + prot = 0; | |
280 | + for (sect = s_first; sect <= s_last; ++sect) { | |
281 | + if (info->protect[sect]) { | |
282 | + prot++; | |
283 | + } | |
284 | + } | |
285 | + | |
286 | + if (prot) { | |
287 | + printf ("- Warning: %d protected sectors will not be erased!\n", | |
288 | + prot); | |
289 | + } else { | |
290 | + printf ("\n"); | |
291 | + } | |
292 | + | |
293 | + | |
294 | + start = get_timer (0); | |
295 | + last = start; | |
296 | + | |
297 | + /* Disable interrupts which might cause a timeout here */ | |
298 | + flag = disable_interrupts (); | |
299 | + | |
300 | + /* Start erase on unprotected sectors */ | |
301 | + for (sect = s_first; sect <= s_last; sect++) { | |
302 | + if (info->protect[sect] == 0) { /* not protected */ | |
303 | + FPWV *addr = (FPWV *) (info->start[sect]); | |
304 | + FPW status; | |
305 | + | |
306 | + printf ("Erasing sector %2d ... ", sect); | |
307 | + | |
308 | + flash_unprotect_sectors (addr); | |
309 | + | |
310 | + /* arm simple, non interrupt dependent timer */ | |
311 | + reset_timer_masked (); | |
312 | + | |
313 | + *addr = (FPW) 0x00500050;/* clear status register */ | |
314 | + *addr = (FPW) 0x00200020;/* erase setup */ | |
315 | + *addr = (FPW) 0x00D000D0;/* erase confirm */ | |
316 | + | |
317 | + while (((status = | |
318 | + *addr) & (FPW) 0x00800080) != | |
319 | + (FPW) 0x00800080) { | |
320 | + if (get_timer_masked () > | |
321 | + CFG_FLASH_ERASE_TOUT) { | |
322 | + printf ("Timeout\n"); | |
323 | + /* suspend erase */ | |
324 | + *addr = (FPW) 0x00B000B0; | |
325 | + /* reset to read mode */ | |
326 | + *addr = (FPW) 0x00FF00FF; | |
327 | + rcode = 1; | |
328 | + break; | |
329 | + } | |
330 | + } | |
331 | + | |
332 | + /* clear status register cmd. */ | |
333 | + *addr = (FPW) 0x00500050; | |
334 | + *addr = (FPW) 0x00FF00FF;/* resest to read mode */ | |
335 | + printf (" done\n"); | |
336 | + } | |
337 | + } | |
338 | + return rcode; | |
339 | +} | |
340 | + | |
341 | +/*----------------------------------------------------------------------- | |
342 | + * Copy memory to flash, returns: | |
343 | + * 0 - OK | |
344 | + * 1 - write timeout | |
345 | + * 2 - Flash not erased | |
346 | + * 4 - Flash not identified | |
347 | + */ | |
348 | + | |
349 | +int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) | |
350 | +{ | |
351 | + ulong cp, wp; | |
352 | + FPW data; | |
353 | + int count, i, l, rc, port_width; | |
354 | + | |
355 | + if (info->flash_id == FLASH_UNKNOWN) { | |
356 | + return 4; | |
357 | + } | |
358 | +/* get lower word aligned address */ | |
359 | +#ifdef FLASH_PORT_WIDTH16 | |
360 | + wp = (addr & ~1); | |
361 | + port_width = 2; | |
362 | +#else | |
363 | + wp = (addr & ~3); | |
364 | + port_width = 4; | |
365 | +#endif | |
366 | + | |
367 | + /* | |
368 | + * handle unaligned start bytes | |
369 | + */ | |
370 | + if ((l = addr - wp) != 0) { | |
371 | + data = 0; | |
372 | + for (i = 0, cp = wp; i < l; ++i, ++cp) { | |
373 | + data = (data << 8) | (*(uchar *) cp); | |
374 | + } | |
375 | + for (; i < port_width && cnt > 0; ++i) { | |
376 | + data = (data << 8) | *src++; | |
377 | + --cnt; | |
378 | + ++cp; | |
379 | + } | |
380 | + for (; cnt == 0 && i < port_width; ++i, ++cp) { | |
381 | + data = (data << 8) | (*(uchar *) cp); | |
382 | + } | |
383 | + | |
384 | + if ((rc = write_data (info, wp, SWAP (data))) != 0) { | |
385 | + return (rc); | |
386 | + } | |
387 | + wp += port_width; | |
388 | + } | |
389 | + | |
390 | + /* | |
391 | + * handle word aligned part | |
392 | + */ | |
393 | + count = 0; | |
394 | + while (cnt >= port_width) { | |
395 | + data = 0; | |
396 | + for (i = 0; i < port_width; ++i) { | |
397 | + data = (data << 8) | *src++; | |
398 | + } | |
399 | + if ((rc = write_data (info, wp, SWAP (data))) != 0) { | |
400 | + return (rc); | |
401 | + } | |
402 | + wp += port_width; | |
403 | + cnt -= port_width; | |
404 | + if (count++ > 0x800) { | |
405 | + spin_wheel (); | |
406 | + count = 0; | |
407 | + } | |
408 | + } | |
409 | + | |
410 | + if (cnt == 0) { | |
411 | + return (0); | |
412 | + } | |
413 | + | |
414 | + /* | |
415 | + * handle unaligned tail bytes | |
416 | + */ | |
417 | + data = 0; | |
418 | + for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) { | |
419 | + data = (data << 8) | *src++; | |
420 | + --cnt; | |
421 | + } | |
422 | + for (; i < port_width; ++i, ++cp) { | |
423 | + data = (data << 8) | (*(uchar *) cp); | |
424 | + } | |
425 | + | |
426 | + return (write_data (info, wp, SWAP (data))); | |
427 | +} | |
428 | + | |
429 | +/*----------------------------------------------------------------------- | |
430 | + * Write a word or halfword to Flash, returns: | |
431 | + * 0 - OK | |
432 | + * 1 - write timeout | |
433 | + * 2 - Flash not erased | |
434 | + */ | |
435 | +static int write_data (flash_info_t * info, ulong dest, FPW data) | |
436 | +{ | |
437 | + FPWV *addr = (FPWV *) dest; | |
438 | + ulong status; | |
439 | + int flag; | |
440 | + | |
441 | + /* Check if Flash is (sufficiently) erased */ | |
442 | + if ((*addr & data) != data) { | |
443 | + printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr); | |
444 | + return (2); | |
445 | + } | |
446 | + flash_unprotect_sectors (addr); | |
447 | + /* Disable interrupts which might cause a timeout here */ | |
448 | + flag = disable_interrupts (); | |
449 | + *addr = (FPW) 0x00400040; /* write setup */ | |
450 | + *addr = data; | |
451 | + | |
452 | + /* arm simple, non interrupt dependent timer */ | |
453 | + reset_timer_masked (); | |
454 | + | |
455 | + /* wait while polling the status register */ | |
456 | + while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) { | |
457 | + if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) { | |
458 | + *addr = (FPW) 0x00FF00FF; /* restore read mode */ | |
459 | + return (1); | |
460 | + } | |
461 | + } | |
462 | + *addr = (FPW) 0x00FF00FF; /* restore read mode */ | |
463 | + return (0); | |
464 | +} | |
465 | + | |
466 | +void inline spin_wheel (void) | |
467 | +{ | |
468 | + static int p = 0; | |
469 | + static char w[] = "\\/-"; | |
470 | + | |
471 | + printf ("\010%c", w[p]); | |
472 | + (++p == 3) ? (p = 0) : 0; | |
473 | +} |
board/integratorap/integratorap.c
1 | +/* | |
2 | + * (C) Copyright 2002 | |
3 | + * Sysgo Real-Time Solutions, GmbH <www.elinos.com> | |
4 | + * Marius Groeger <mgroeger@sysgo.de> | |
5 | + * | |
6 | + * (C) Copyright 2002 | |
7 | + * David Mueller, ELSOFT AG, <d.mueller@elsoft.ch> | |
8 | + * | |
9 | + * (C) Copyright 2003 | |
10 | + * Texas Instruments, <www.ti.com> | |
11 | + * Kshitij Gupta <Kshitij@ti.com> | |
12 | + * | |
13 | + * (C) Copyright 2004 | |
14 | + * ARM Ltd. | |
15 | + * Philippe Robin, <philippe.robin@arm.com> | |
16 | + * | |
17 | + * See file CREDITS for list of people who contributed to this | |
18 | + * project. | |
19 | + * | |
20 | + * This program is free software; you can redistribute it and/or | |
21 | + * modify it under the terms of the GNU General Public License as | |
22 | + * published by the Free Software Foundation; either version 2 of | |
23 | + * the License, or (at your option) any later version. | |
24 | + * | |
25 | + * This program is distributed in the hope that it will be useful, | |
26 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
28 | + * GNU General Public License for more details. | |
29 | + * | |
30 | + * You should have received a copy of the GNU General Public License | |
31 | + * along with this program; if not, write to the Free Software | |
32 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
33 | + * MA 02111-1307 USA | |
34 | + */ | |
35 | + | |
36 | +#include <common.h> | |
37 | + | |
38 | +#ifdef CONFIG_PCI | |
39 | +# include <pci.h> | |
40 | +#endif | |
41 | + | |
42 | +void flash__init (void); | |
43 | +void ether__init (void); | |
44 | +void peripheral_power_enable (void); | |
45 | + | |
46 | +#if defined(CONFIG_SHOW_BOOT_PROGRESS) | |
47 | +void show_boot_progress(int progress) | |
48 | +{ | |
49 | + printf("Boot reached stage %d\n", progress); | |
50 | +} | |
51 | +#endif | |
52 | + | |
53 | +#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF) | |
54 | + | |
55 | +static inline void delay (unsigned long loops) | |
56 | +{ | |
57 | + __asm__ volatile ("1:\n" | |
58 | + "subs %0, %1, #1\n" | |
59 | + "bne 1b":"=r" (loops):"0" (loops)); | |
60 | +} | |
61 | + | |
62 | +/* | |
63 | + * Miscellaneous platform dependent initialisations | |
64 | + */ | |
65 | + | |
66 | +int board_init (void) | |
67 | +{ | |
68 | + DECLARE_GLOBAL_DATA_PTR; | |
69 | + | |
70 | + /* arch number of Integrator Board */ | |
71 | + gd->bd->bi_arch_number = 21; | |
72 | + | |
73 | + /* adress of boot parameters */ | |
74 | + gd->bd->bi_boot_params = 0x00000100; | |
75 | + | |
76 | + icache_enable (); | |
77 | + | |
78 | + flash__init (); | |
79 | + return 0; | |
80 | +} | |
81 | + | |
82 | + | |
83 | +int misc_init_r (void) | |
84 | +{ | |
85 | +#ifdef CONFIG_PCI | |
86 | + pci_init(); | |
87 | +#endif | |
88 | + setenv("verify", "n"); | |
89 | + return (0); | |
90 | +} | |
91 | + | |
92 | +/* | |
93 | + * Initialize PCI Devices, report devices found. | |
94 | + */ | |
95 | +#ifdef CONFIG_PCI | |
96 | + | |
97 | +#ifndef CONFIG_PCI_PNP | |
98 | + | |
99 | +static struct pci_config_table pci_integrator_config_table[] = { | |
100 | + { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID, | |
101 | + pci_cfgfunc_config_device, { PCI_ENET0_IOADDR, | |
102 | + PCI_ENET0_MEMADDR, | |
103 | + PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, | |
104 | + { } | |
105 | +}; | |
106 | +#endif | |
107 | + | |
108 | +// V3 access routines | |
109 | +#define _V3Write16(o,v) (*(volatile unsigned short *)(PCI_V3_BASE + (unsigned int)(o)) = (unsigned short)(v)) | |
110 | +#define _V3Read16(o) (*(volatile unsigned short *)(PCI_V3_BASE + (unsigned int)(o))) | |
111 | + | |
112 | +#define _V3Write32(o,v) (*(volatile unsigned int *)(PCI_V3_BASE + (unsigned int)(o)) = (unsigned int)(v)) | |
113 | +#define _V3Read32(o) (*(volatile unsigned int *)(PCI_V3_BASE + (unsigned int)(o))) | |
114 | + | |
115 | +// Compute address necessary to access PCI config space for the given | |
116 | +// bus and device. | |
117 | +#define PCI_CONFIG_ADDRESS( __bus, __devfn, __offset ) \ | |
118 | + ({ \ | |
119 | + unsigned int __address, __devicebit; \ | |
120 | + unsigned short __mapaddress; \ | |
121 | + unsigned int __dev = PCI_DEV(__devfn); /* FIXME to check!! (slot?) */ \ | |
122 | + \ | |
123 | + if (__bus == 0) { \ | |
124 | + /* local bus segment so need a type 0 config cycle */ \ | |
125 | + /* build the PCI configuration "address" with one-hot in A31-A11 */ \ | |
126 | + __address = PCI_CONFIG_BASE; \ | |
127 | + __address |= ((__devfn & 0x07) << 8); \ | |
128 | + __address |= __offset & 0xFF; \ | |
129 | + __mapaddress = 0x000A; /* 101=>config cycle, 0=>A1=A0=0 */ \ | |
130 | + __devicebit = (1 << (__dev + 11)); \ | |
131 | + \ | |
132 | + if ((__devicebit & 0xFF000000) != 0) { \ | |
133 | + /* high order bits are handled by the MAP register */ \ | |
134 | + __mapaddress |= (__devicebit >> 16); \ | |
135 | + } else { \ | |
136 | + /* low order bits handled directly in the address */ \ | |
137 | + __address |= __devicebit; \ | |
138 | + } \ | |
139 | + } else { /* bus !=0 */ \ | |
140 | + /* not the local bus segment so need a type 1 config cycle */ \ | |
141 | + /* A31-A24 are don't care (so clear to 0) */ \ | |
142 | + __mapaddress = 0x000B; /* 101=>config cycle, 1=>A1&A0 from PCI_CFG */ \ | |
143 | + __address = PCI_CONFIG_BASE; \ | |
144 | + __address |= ((__bus & 0xFF) << 16); /* bits 23..16 = bus number */ \ | |
145 | + __address |= ((__dev & 0x1F) << 11); /* bits 15..11 = device number */ \ | |
146 | + __address |= ((__devfn & 0x07) << 8); /* bits 10..8 = function number*/ \ | |
147 | + __address |= __offset & 0xFF; /* bits 7..0 = register number*/ \ | |
148 | + } \ | |
149 | + _V3Write16(V3_LB_MAP1, __mapaddress); \ | |
150 | + \ | |
151 | + __address; \ | |
152 | + }) | |
153 | + | |
154 | +// _V3OpenConfigWindow - open V3 configuration window | |
155 | +#define _V3OpenConfigWindow() \ | |
156 | + { \ | |
157 | + /* Set up base0 to see all 512Mbytes of memory space (not */ \ | |
158 | + /* prefetchable), this frees up base1 for re-use by configuration*/ \ | |
159 | + /* memory */ \ | |
160 | + \ | |
161 | + _V3Write32 (V3_LB_BASE0, ((INTEGRATOR_PCI_BASE & 0xFFF00000) | \ | |
162 | + 0x90 | V3_LB_BASE_M_ENABLE)); \ | |
163 | + /* Set up base1 to point into configuration space, note that MAP1 */ \ | |
164 | + /* register is set up by pciMakeConfigAddress(). */ \ | |
165 | + \ | |
166 | + _V3Write32 (V3_LB_BASE1, ((CPU_PCI_CNFG_ADRS & 0xFFF00000) | \ | |
167 | + 0x40 | V3_LB_BASE_M_ENABLE)); \ | |
168 | + } | |
169 | + | |
170 | +// _V3CloseConfigWindow - close V3 configuration window | |
171 | +#define _V3CloseConfigWindow() \ | |
172 | + { \ | |
173 | + /* Reassign base1 for use by prefetchable PCI memory */ \ | |
174 | + _V3Write32 (V3_LB_BASE1, (((INTEGRATOR_PCI_BASE + 0x10000000) & 0xFFF00000) \ | |
175 | + | 0x84 | V3_LB_BASE_M_ENABLE)); \ | |
176 | + _V3Write16 (V3_LB_MAP1, \ | |
177 | + (((INTEGRATOR_PCI_BASE + 0x10000000) & 0xFFF00000) >> 16) | 0x0006); \ | |
178 | + \ | |
179 | + /* And shrink base0 back to a 256M window (NOTE: MAP0 already correct) */ \ | |
180 | + \ | |
181 | + _V3Write32 (V3_LB_BASE0, ((INTEGRATOR_PCI_BASE & 0xFFF00000) | \ | |
182 | + 0x80 | V3_LB_BASE_M_ENABLE)); \ | |
183 | + } | |
184 | + | |
185 | + | |
186 | +static int pci_integrator_read_byte(struct pci_controller *hose, pci_dev_t dev, | |
187 | + int offset, unsigned char *val) | |
188 | +{ | |
189 | + _V3OpenConfigWindow(); | |
190 | + *val = *(volatile unsigned char *)PCI_CONFIG_ADDRESS(PCI_BUS(dev), PCI_FUNC(dev), offset); | |
191 | + _V3CloseConfigWindow(); | |
192 | + | |
193 | + return 0; | |
194 | +} | |
195 | + | |
196 | +static int pci_integrator_read__word(struct pci_controller *hose, pci_dev_t dev, | |
197 | + int offset, unsigned short *val) | |
198 | +{ | |
199 | + _V3OpenConfigWindow(); | |
200 | + *val = *(volatile unsigned short *)PCI_CONFIG_ADDRESS(PCI_BUS(dev), PCI_FUNC(dev), offset); | |
201 | + _V3CloseConfigWindow(); | |
202 | + | |
203 | + return 0; | |
204 | +} | |
205 | + | |
206 | +static int pci_integrator_read_dword(struct pci_controller *hose, pci_dev_t dev, | |
207 | + int offset, unsigned int *val) | |
208 | +{ | |
209 | + _V3OpenConfigWindow(); | |
210 | + *val = *(volatile unsigned short *)PCI_CONFIG_ADDRESS(PCI_BUS(dev), PCI_FUNC(dev), offset); | |
211 | + *val |= (*(volatile unsigned int *)PCI_CONFIG_ADDRESS(PCI_BUS(dev), PCI_FUNC(dev), (offset+2))) << 16; | |
212 | + _V3CloseConfigWindow(); | |
213 | + | |
214 | + return 0; | |
215 | +} | |
216 | + | |
217 | +static int pci_integrator_write_byte(struct pci_controller *hose, pci_dev_t dev, | |
218 | + int offset, unsigned char val) | |
219 | +{ | |
220 | + _V3OpenConfigWindow(); | |
221 | + *(volatile unsigned char *)PCI_CONFIG_ADDRESS(PCI_BUS(dev), PCI_FUNC(dev), offset) = val; | |
222 | + _V3CloseConfigWindow(); | |
223 | + | |
224 | + return 0; | |
225 | +} | |
226 | + | |
227 | +static int pci_integrator_write_word(struct pci_controller *hose, pci_dev_t dev, | |
228 | + int offset,unsigned short val) | |
229 | +{ | |
230 | + _V3OpenConfigWindow(); | |
231 | + *(volatile unsigned short *)PCI_CONFIG_ADDRESS(PCI_BUS(dev), PCI_FUNC(dev), offset) = val; | |
232 | + _V3CloseConfigWindow(); | |
233 | + | |
234 | + return 0; | |
235 | +} | |
236 | + | |
237 | +static int pci_integrator_write_dword(struct pci_controller *hose, pci_dev_t dev, | |
238 | + int offset, unsigned int val) | |
239 | +{ | |
240 | + _V3OpenConfigWindow(); | |
241 | + *(volatile unsigned short *)PCI_CONFIG_ADDRESS(PCI_BUS(dev), PCI_FUNC(dev), offset) = (val & 0xFFFF); | |
242 | + *(volatile unsigned short *)PCI_CONFIG_ADDRESS(PCI_BUS(dev), PCI_FUNC(dev), (offset + 2)) = ((val >> 16) & 0xFFFF); | |
243 | + _V3CloseConfigWindow(); | |
244 | + | |
245 | + return 0; | |
246 | +} | |
247 | + | |
248 | +/****************************** | |
249 | + * PCI initialisation | |
250 | + ******************************/ | |
251 | + | |
252 | +struct pci_controller integrator_hose = { | |
253 | +#ifndef CONFIG_PCI_PNP | |
254 | + config_table: pci_integrator_config_table, | |
255 | +#endif | |
256 | +}; | |
257 | + | |
258 | +void pci_init_board(void) | |
259 | +{ | |
260 | + volatile int i, j; | |
261 | + struct pci_controller *hose = &integrator_hose; | |
262 | + | |
263 | + /* setting this register will take the V3 out of reset */ | |
264 | + | |
265 | + *(volatile unsigned int *)(INTEGRATOR_SC_PCIENABLE) = 1; | |
266 | + | |
267 | + /* wait a few usecs to settle the device and the PCI bus */ | |
268 | + | |
269 | + for (i = 0; i < 100 ; i++) | |
270 | + j = i + 1; | |
271 | + | |
272 | + /* Now write the Base I/O Address Word to V3_BASE + 0x6C */ | |
273 | + | |
274 | + *(volatile unsigned short *)(V3_BASE + V3_LB_IO_BASE) = (unsigned short)(V3_BASE >> 16); | |
275 | + | |
276 | + do { | |
277 | + *(volatile unsigned char *)(V3_BASE + V3_MAIL_DATA) = 0xAA; | |
278 | + *(volatile unsigned char *)(V3_BASE + V3_MAIL_DATA + 4) = 0x55; | |
279 | + } while (*(volatile unsigned char *)(V3_BASE + V3_MAIL_DATA) != 0xAA || | |
280 | + *(volatile unsigned char *)(V3_BASE + V3_MAIL_DATA + 4) != 0x55); | |
281 | + | |
282 | + /* Make sure that V3 register access is not locked, if it is, unlock it */ | |
283 | + | |
284 | + if ((*(volatile unsigned short *)(V3_BASE + V3_SYSTEM) & V3_SYSTEM_M_LOCK) | |
285 | + == V3_SYSTEM_M_LOCK) | |
286 | + *(volatile unsigned short *)(V3_BASE + V3_SYSTEM) = 0xA05F; | |
287 | + | |
288 | + /* Ensure that the slave accesses from PCI are disabled while we */ | |
289 | + /* setup windows */ | |
290 | + | |
291 | + *(volatile unsigned short *)(V3_BASE + V3_PCI_CMD) &= | |
292 | + ~(V3_COMMAND_M_MEM_EN | V3_COMMAND_M_IO_EN); | |
293 | + | |
294 | + /* Clear RST_OUT to 0; keep the PCI bus in reset until we've finished */ | |
295 | + | |
296 | + *(volatile unsigned short *)(V3_BASE + V3_SYSTEM) &= ~V3_SYSTEM_M_RST_OUT; | |
297 | + | |
298 | + /* Make all accesses from PCI space retry until we're ready for them */ | |
299 | + | |
300 | + *(volatile unsigned short *)(V3_BASE + V3_PCI_CFG) |= V3_PCI_CFG_M_RETRY_EN; | |
301 | + | |
302 | + /* Set up any V3 PCI Configuration Registers that we absolutely have to */ | |
303 | + /* LB_CFG controls Local Bus protocol. */ | |
304 | + /* Enable LocalBus byte strobes for READ accesses too. */ | |
305 | + /* set bit 7 BE_IMODE and bit 6 BE_OMODE */ | |
306 | + | |
307 | + *(volatile unsigned short *)(V3_BASE + V3_LB_CFG) |= 0x0C0; | |
308 | + | |
309 | + /* PCI_CMD controls overall PCI operation. */ | |
310 | + /* Enable PCI bus master. */ | |
311 | + | |
312 | + *(volatile unsigned short *)(V3_BASE + V3_PCI_CMD) |= 0x04; | |
313 | + | |
314 | + /* PCI_MAP0 controls where the PCI to CPU memory window is on Local Bus*/ | |
315 | + | |
316 | + *(volatile unsigned int *)(V3_BASE + V3_PCI_MAP0) = (INTEGRATOR_BOOT_ROM_BASE) | | |
317 | + (V3_PCI_MAP_M_ADR_SIZE_512M | | |
318 | + V3_PCI_MAP_M_REG_EN | | |
319 | + V3_PCI_MAP_M_ENABLE); | |
320 | + | |
321 | + /* PCI_BASE0 is the PCI address of the start of the window */ | |
322 | + | |
323 | + *(volatile unsigned int *)(V3_BASE + V3_PCI_BASE0) = INTEGRATOR_BOOT_ROM_BASE; | |
324 | + | |
325 | + /* PCI_MAP1 is LOCAL address of the start of the window */ | |
326 | + | |
327 | + *(volatile unsigned int *)(V3_BASE + V3_PCI_MAP1) = (INTEGRATOR_HDR0_SDRAM_BASE) | | |
328 | + (V3_PCI_MAP_M_ADR_SIZE_1024M | V3_PCI_MAP_M_REG_EN | | |
329 | + V3_PCI_MAP_M_ENABLE); | |
330 | + | |
331 | + /* PCI_BASE1 is the PCI address of the start of the window */ | |
332 | + | |
333 | + *(volatile unsigned int *)(V3_BASE + V3_PCI_BASE1) = INTEGRATOR_HDR0_SDRAM_BASE; | |
334 | + | |
335 | + /* Set up the windows from local bus memory into PCI configuration, */ | |
336 | + /* I/O and Memory. */ | |
337 | + /* PCI I/O, LB_BASE2 and LB_MAP2 are used exclusively for this. */ | |
338 | + | |
339 | + *(volatile unsigned short *)(V3_BASE +V3_LB_BASE2) = | |
340 | + ((CPU_PCI_IO_ADRS >> 24) << 8) | V3_LB_BASE_M_ENABLE; | |
341 | + *(volatile unsigned short *)(V3_BASE + V3_LB_MAP2) = 0; | |
342 | + | |
343 | + /* PCI Configuration, use LB_BASE1/LB_MAP1. */ | |
344 | + | |
345 | + /* PCI Memory use LB_BASE0/LB_MAP0 and LB_BASE1/LB_MAP1 */ | |
346 | + /* Map first 256Mbytes as non-prefetchable via BASE0/MAP0 */ | |
347 | + /* (INTEGRATOR_PCI_BASE == PCI_MEM_BASE) */ | |
348 | + | |
349 | + *(volatile unsigned int *)(V3_BASE + V3_LB_BASE0) = | |
350 | + INTEGRATOR_PCI_BASE | (0x80 | V3_LB_BASE_M_ENABLE); | |
351 | + | |
352 | + *(volatile unsigned short *)(V3_BASE + V3_LB_MAP0) = | |
353 | + ((INTEGRATOR_PCI_BASE >> 20) << 0x4) | 0x0006; | |
354 | + | |
355 | + /* Map second 256 Mbytes as prefetchable via BASE1/MAP1 */ | |
356 | + | |
357 | + *(volatile unsigned int *)(V3_BASE + V3_LB_BASE1) = | |
358 | + INTEGRATOR_PCI_BASE | (0x84 | V3_LB_BASE_M_ENABLE); | |
359 | + | |
360 | + *(volatile unsigned short *)(V3_BASE + V3_LB_MAP1) = | |
361 | + (((INTEGRATOR_PCI_BASE + 0x10000000) >> 20) << 4) | 0x0006; | |
362 | + | |
363 | + /* Allow accesses to PCI Configuration space */ | |
364 | + /* and set up A1, A0 for type 1 config cycles */ | |
365 | + | |
366 | + *(volatile unsigned short *)(V3_BASE + V3_PCI_CFG) = | |
367 | + ((*(volatile unsigned short *)(V3_BASE + V3_PCI_CFG)) & | |
368 | + ~(V3_PCI_CFG_M_RETRY_EN | V3_PCI_CFG_M_AD_LOW1) ) | | |
369 | + V3_PCI_CFG_M_AD_LOW0; | |
370 | + | |
371 | + /* now we can allow in PCI MEMORY accesses */ | |
372 | + | |
373 | + *(volatile unsigned short *)(V3_BASE + V3_PCI_CMD) = | |
374 | + (*(volatile unsigned short *)(V3_BASE + V3_PCI_CMD)) | V3_COMMAND_M_MEM_EN; | |
375 | + | |
376 | + /* Set RST_OUT to take the PCI bus is out of reset, PCI devices can */ | |
377 | + /* initialise and lock the V3 system register so that no one else */ | |
378 | + /* can play with it */ | |
379 | + | |
380 | + *(volatile unsigned short *)(V3_BASE + V3_SYSTEM) = | |
381 | + (*(volatile unsigned short *)(V3_BASE + V3_SYSTEM)) | V3_SYSTEM_M_RST_OUT; | |
382 | + | |
383 | + *(volatile unsigned short *)(V3_BASE + V3_SYSTEM) = | |
384 | + (*(volatile unsigned short *)(V3_BASE + V3_SYSTEM)) | V3_SYSTEM_M_LOCK; | |
385 | + | |
386 | + /* | |
387 | + * Register the hose | |
388 | + */ | |
389 | + hose->first_busno = 0; | |
390 | + hose->last_busno = 0xff; | |
391 | + | |
392 | + /* System memory space */ | |
393 | + pci_set_region(hose->regions + 0, | |
394 | + 0x00000000, 0x40000000, 0x01000000, | |
395 | + PCI_REGION_MEM | PCI_REGION_MEMORY); | |
396 | + | |
397 | + /* PCI Memory - config space */ | |
398 | + pci_set_region(hose->regions + 1, | |
399 | + 0x00000000, 0x62000000, 0x01000000, | |
400 | + PCI_REGION_MEM); | |
401 | + | |
402 | + /* PCI V3 regs */ | |
403 | + pci_set_region(hose->regions + 2, | |
404 | + 0x00000000, 0x61000000, 0x00080000, | |
405 | + PCI_REGION_MEM); | |
406 | + | |
407 | + /* PCI I/O space */ | |
408 | + pci_set_region(hose->regions + 3, | |
409 | + 0x00000000, 0x60000000, 0x00010000, | |
410 | + PCI_REGION_IO); | |
411 | + | |
412 | + pci_set_ops(hose, | |
413 | + pci_integrator_read_byte, | |
414 | + pci_integrator_read__word, | |
415 | + pci_integrator_read_dword, | |
416 | + pci_integrator_write_byte, | |
417 | + pci_integrator_write_word, | |
418 | + pci_integrator_write_dword); | |
419 | + | |
420 | + hose->region_count = 4; | |
421 | + | |
422 | + pci_register_hose(hose); | |
423 | + | |
424 | + pciauto_config_init(hose); | |
425 | + pciauto_config_device(hose, 0); | |
426 | + | |
427 | + hose->last_busno = pci_hose_scan(hose); | |
428 | +} | |
429 | +#endif | |
430 | + | |
431 | +/****************************** | |
432 | + Routine: | |
433 | + Description: | |
434 | +******************************/ | |
435 | +void flash__init (void) | |
436 | +{ | |
437 | +} | |
438 | +/************************************************************* | |
439 | + Routine:ether__init | |
440 | + Description: take the Ethernet controller out of reset and wait | |
441 | + for the EEPROM load to complete. | |
442 | +*************************************************************/ | |
443 | +void ether__init (void) | |
444 | +{ | |
445 | +} | |
446 | + | |
447 | +/****************************** | |
448 | + Routine: | |
449 | + Description: | |
450 | +******************************/ | |
451 | +int dram_init (void) | |
452 | +{ | |
453 | + return 0; | |
454 | +} |
board/integratorap/platform.S
1 | +/* | |
2 | + * Board specific setup info | |
3 | + * | |
4 | + * (C) Copyright 2004, ARM Ltd. | |
5 | + * Philippe Robin, <philippe.robin@arm.com> | |
6 | + * | |
7 | + * See file CREDITS for list of people who contributed to this | |
8 | + * project. | |
9 | + * | |
10 | + * This program is free software; you can redistribute it and/or | |
11 | + * modify it under the terms of the GNU General Public License as | |
12 | + * published by the Free Software Foundation; either version 2 of | |
13 | + * the License, or (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program; if not, write to the Free Software | |
22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
23 | + * MA 02111-1307 USA | |
24 | + */ | |
25 | + | |
26 | +#include <config.h> | |
27 | +#include <version.h> | |
28 | + | |
29 | +.globl platformsetup | |
30 | +platformsetup: | |
31 | + | |
32 | + /* All done by Integrator's boot monitor! */ | |
33 | + mov pc, lr |
board/integratorap/u-boot.lds
1 | +/* | |
2 | + * (C) Copyright 2002 | |
3 | + * Gary Jennejohn, DENX Software Engineering, <gj@denx.de> | |
4 | + * | |
5 | + * See file CREDITS for list of people who contributed to this | |
6 | + * project. | |
7 | + * | |
8 | + * This program is free software; you can redistribute it and/or | |
9 | + * modify it under the terms of the GNU General Public License as | |
10 | + * published by the Free Software Foundation; either version 2 of | |
11 | + * the License, or (at your option) any later version. | |
12 | + * | |
13 | + * This program is distributed in the hope that it will be useful, | |
14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | + * GNU General Public License for more details. | |
17 | + * | |
18 | + * You should have received a copy of the GNU General Public License | |
19 | + * along with this program; if not, write to the Free Software | |
20 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
21 | + * MA 02111-1307 USA | |
22 | + */ | |
23 | + | |
24 | +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") | |
25 | +OUTPUT_ARCH(arm) | |
26 | +ENTRY(_start) | |
27 | +SECTIONS | |
28 | +{ | |
29 | + . = 0x00000000; | |
30 | + . = ALIGN(4); | |
31 | + .text : | |
32 | + { | |
33 | + cpu/arm926ejs/start.o (.text) | |
34 | + *(.text) | |
35 | + } | |
36 | + .rodata : { *(.rodata) } | |
37 | + . = ALIGN(4); | |
38 | + .data : { *(.data) } | |
39 | + . = ALIGN(4); | |
40 | + .got : { *(.got) } | |
41 | + | |
42 | + __u_boot_cmd_start = .; | |
43 | + .u_boot_cmd : { *(.u_boot_cmd) } | |
44 | + __u_boot_cmd_end = .; | |
45 | + | |
46 | + armboot_end_data = .; | |
47 | + . = ALIGN(4); | |
48 | + .bss : { *(.bss) } | |
49 | + armboot_end = .; | |
50 | +} |
board/integratorcp/Makefile
1 | +# | |
2 | +# (C) Copyright 2000-2004 | |
3 | +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
4 | +# | |
5 | +# See file CREDITS for list of people who contributed to this | |
6 | +# project. | |
7 | +# | |
8 | +# This program is free software; you can redistribute it and/or | |
9 | +# modify it under the terms of the GNU General Public License as | |
10 | +# published by the Free Software Foundation; either version 2 of | |
11 | +# the License, or (at your option) any later version. | |
12 | +# | |
13 | +# This program is distributed in the hope that it will be useful, | |
14 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | +# GNU General Public License for more details. | |
17 | +# | |
18 | +# You should have received a copy of the GNU General Public License | |
19 | +# along with this program; if not, write to the Free Software | |
20 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
21 | +# MA 02111-1307 USA | |
22 | +# | |
23 | + | |
24 | +include $(TOPDIR)/config.mk | |
25 | + | |
26 | +LIB = lib$(BOARD).a | |
27 | + | |
28 | +OBJS := integratorcp.o flash.o | |
29 | +SOBJS := platform.o | |
30 | + | |
31 | +$(LIB): $(OBJS) $(SOBJS) | |
32 | + $(AR) crv $@ $^ | |
33 | + | |
34 | +clean: | |
35 | + rm -f $(SOBJS) $(OBJS) | |
36 | + | |
37 | +distclean: clean | |
38 | + rm -f $(LIB) core *.bak .depend | |
39 | + | |
40 | +######################################################################### | |
41 | + | |
42 | +.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) | |
43 | + $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@ | |
44 | + | |
45 | +-include .depend | |
46 | + | |
47 | +######################################################################### |
board/integratorcp/config.mk
board/integratorcp/flash.c
1 | +/* | |
2 | + * (C) Copyright 2001 | |
3 | + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net | |
4 | + * | |
5 | + * (C) Copyright 2001-2004 | |
6 | + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
7 | + * | |
8 | + * (C) Copyright 2003 | |
9 | + * Texas Instruments, <www.ti.com> | |
10 | + * Kshitij Gupta <Kshitij@ti.com> | |
11 | + * | |
12 | + * See file CREDITS for list of people who contributed to this | |
13 | + * project. | |
14 | + * | |
15 | + * This program is free software; you can redistribute it and/or | |
16 | + * modify it under the terms of the GNU General Public License as | |
17 | + * published by the Free Software Foundation; either version 2 of | |
18 | + * the License, or (at your option) any later version. | |
19 | + * | |
20 | + * This program is distributed in the hope that it will be useful, | |
21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | + * GNU General Public License for more details. | |
24 | + * | |
25 | + * You should have received a copy of the GNU General Public License | |
26 | + * along with this program; if not, write to the Free Software | |
27 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
28 | + * MA 02111-1307 USA | |
29 | + */ | |
30 | + | |
31 | +#include <common.h> | |
32 | +#include <linux/byteorder/swab.h> | |
33 | + | |
34 | +#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */ | |
35 | +flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ | |
36 | + | |
37 | +/* Board support for 1 or 2 flash devices */ | |
38 | +#undef FLASH_PORT_WIDTH32 | |
39 | +#define FLASH_PORT_WIDTH16 | |
40 | + | |
41 | +#ifdef FLASH_PORT_WIDTH16 | |
42 | +#define FLASH_PORT_WIDTH ushort | |
43 | +#define FLASH_PORT_WIDTHV vu_short | |
44 | +#define SWAP(x) __swab16(x) | |
45 | +#else | |
46 | +#define FLASH_PORT_WIDTH ulong | |
47 | +#define FLASH_PORT_WIDTHV vu_long | |
48 | +#define SWAP(x) __swab32(x) | |
49 | +#endif | |
50 | + | |
51 | +#define FPW FLASH_PORT_WIDTH | |
52 | +#define FPWV FLASH_PORT_WIDTHV | |
53 | + | |
54 | +#define mb() __asm__ __volatile__ ("" : : : "memory") | |
55 | + | |
56 | + | |
57 | +/* Flash Organization Structure */ | |
58 | +typedef struct OrgDef { | |
59 | + unsigned int sector_number; | |
60 | + unsigned int sector_size; | |
61 | +} OrgDef; | |
62 | + | |
63 | + | |
64 | +/* Flash Organizations */ | |
65 | +OrgDef OrgIntel_28F256L18T[] = { | |
66 | + {4, 32 * 1024}, /* 4 * 32kBytes sectors */ | |
67 | + {255, 128 * 1024}, /* 255 * 128kBytes sectors */ | |
68 | +}; | |
69 | + | |
70 | + | |
71 | +/*----------------------------------------------------------------------- | |
72 | + * Functions | |
73 | + */ | |
74 | +unsigned long flash_init (void); | |
75 | +static ulong flash_get_size (FPW * addr, flash_info_t * info); | |
76 | +static int write_data (flash_info_t * info, ulong dest, FPW data); | |
77 | +static void flash_get_offsets (ulong base, flash_info_t * info); | |
78 | +void inline spin_wheel (void); | |
79 | +void flash_print_info (flash_info_t * info); | |
80 | +void flash_unprotect_sectors (FPWV * addr); | |
81 | +int flash_erase (flash_info_t * info, int s_first, int s_last); | |
82 | +int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt); | |
83 | + | |
84 | +/*----------------------------------------------------------------------- | |
85 | + */ | |
86 | + | |
87 | +unsigned long flash_init (void) | |
88 | +{ | |
89 | + int i; | |
90 | + ulong size = 0; | |
91 | + for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) { | |
92 | + switch (i) { | |
93 | + case 0: | |
94 | + flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]); | |
95 | + flash_get_offsets (PHYS_FLASH_1, &flash_info[i]); | |
96 | + break; | |
97 | + default: | |
98 | + panic ("configured too many flash banks!\n"); | |
99 | + break; | |
100 | + } | |
101 | + size += flash_info[i].size; | |
102 | + } | |
103 | + | |
104 | + /* Protect monitor and environment sectors | |
105 | + */ | |
106 | + flash_protect (FLAG_PROTECT_SET, | |
107 | + CFG_FLASH_BASE, | |
108 | + CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]); | |
109 | + | |
110 | + return size; | |
111 | +} | |
112 | + | |
113 | +/*----------------------------------------------------------------------- | |
114 | + */ | |
115 | +static void flash_get_offsets (ulong base, flash_info_t * info) | |
116 | +{ | |
117 | + int i; | |
118 | + OrgDef *pOrgDef; | |
119 | + | |
120 | + pOrgDef = OrgIntel_28F256L18T; | |
121 | + if (info->flash_id == FLASH_UNKNOWN) { | |
122 | + return; | |
123 | + } | |
124 | + | |
125 | + if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) { | |
126 | + for (i = 0; i < info->sector_count; i++) { | |
127 | + if (i > 255) { | |
128 | + info->start[i] = base + (i * 0x8000); | |
129 | + info->protect[i] = 0; | |
130 | + } else { | |
131 | + info->start[i] = base + | |
132 | + (i * PHYS_FLASH_SECT_SIZE); | |
133 | + info->protect[i] = 0; | |
134 | + } | |
135 | + } | |
136 | + } | |
137 | +} | |
138 | + | |
139 | +/*----------------------------------------------------------------------- | |
140 | + */ | |
141 | +void flash_print_info (flash_info_t * info) | |
142 | +{ | |
143 | + int i; | |
144 | + | |
145 | + if (info->flash_id == FLASH_UNKNOWN) { | |
146 | + printf ("missing or unknown FLASH type\n"); | |
147 | + return; | |
148 | + } | |
149 | + | |
150 | + switch (info->flash_id & FLASH_VENDMASK) { | |
151 | + case FLASH_MAN_INTEL: | |
152 | + printf ("INTEL "); | |
153 | + break; | |
154 | + default: | |
155 | + printf ("Unknown Vendor "); | |
156 | + break; | |
157 | + } | |
158 | + | |
159 | + switch (info->flash_id & FLASH_TYPEMASK) { | |
160 | + case FLASH_28F256L18T: | |
161 | + printf ("FLASH 28F256L18T\n"); | |
162 | + break; | |
163 | + default: | |
164 | + printf ("Unknown Chip Type\n"); | |
165 | + break; | |
166 | + } | |
167 | + | |
168 | + printf (" Size: %ld MB in %d Sectors\n", | |
169 | + info->size >> 20, info->sector_count); | |
170 | + | |
171 | + printf (" Sector Start Addresses:"); | |
172 | + for (i = 0; i < info->sector_count; ++i) { | |
173 | + if ((i % 5) == 0) | |
174 | + printf ("\n "); | |
175 | + printf (" %08lX%s", | |
176 | + info->start[i], info->protect[i] ? " (RO)" : " "); | |
177 | + } | |
178 | + printf ("\n"); | |
179 | + return; | |
180 | +} | |
181 | + | |
182 | +/* | |
183 | + * The following code cannot be run from FLASH! | |
184 | + */ | |
185 | +static ulong flash_get_size (FPW * addr, flash_info_t * info) | |
186 | +{ | |
187 | + volatile FPW value; | |
188 | + | |
189 | + /* Write auto select command: read Manufacturer ID */ | |
190 | + addr[0x5555] = (FPW) 0x00AA00AA; | |
191 | + addr[0x2AAA] = (FPW) 0x00550055; | |
192 | + addr[0x5555] = (FPW) 0x00900090; | |
193 | + | |
194 | + mb (); | |
195 | + value = addr[0]; | |
196 | + | |
197 | + switch (value) { | |
198 | + | |
199 | + case (FPW) INTEL_MANUFACT: | |
200 | + info->flash_id = FLASH_MAN_INTEL; | |
201 | + break; | |
202 | + | |
203 | + default: | |
204 | + info->flash_id = FLASH_UNKNOWN; | |
205 | + info->sector_count = 0; | |
206 | + info->size = 0; | |
207 | + addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ | |
208 | + return (0); /* no or unknown flash */ | |
209 | + } | |
210 | + | |
211 | + mb (); | |
212 | + value = addr[1]; /* device ID */ | |
213 | + switch (value) { | |
214 | + | |
215 | + case (FPW) (INTEL_ID_28F256L18T): | |
216 | + info->flash_id += FLASH_28F256L18T; | |
217 | + info->sector_count = 259; | |
218 | + info->size = 0x02000000; | |
219 | + break; /* => 32 MB */ | |
220 | + | |
221 | + default: | |
222 | + info->flash_id = FLASH_UNKNOWN; | |
223 | + break; | |
224 | + } | |
225 | + | |
226 | + if (info->sector_count > CFG_MAX_FLASH_SECT) { | |
227 | + printf ("** ERROR: sector count %d > max (%d) **\n", | |
228 | + info->sector_count, CFG_MAX_FLASH_SECT); | |
229 | + info->sector_count = CFG_MAX_FLASH_SECT; | |
230 | + } | |
231 | + | |
232 | + addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ | |
233 | + | |
234 | + return (info->size); | |
235 | +} | |
236 | + | |
237 | + | |
238 | +/* unprotects a sector for write and erase | |
239 | + * on some intel parts, this unprotects the entire chip, but it | |
240 | + * wont hurt to call this additional times per sector... | |
241 | + */ | |
242 | +void flash_unprotect_sectors (FPWV * addr) | |
243 | +{ | |
244 | +#define PD_FINTEL_WSMS_READY_MASK 0x0080 | |
245 | + | |
246 | + *addr = (FPW) 0x00500050; /* clear status register */ | |
247 | + | |
248 | + /* this sends the clear lock bit command */ | |
249 | + *addr = (FPW) 0x00600060; | |
250 | + *addr = (FPW) 0x00D000D0; | |
251 | +} | |
252 | + | |
253 | + | |
254 | +/*----------------------------------------------------------------------- | |
255 | + */ | |
256 | + | |
257 | +int flash_erase (flash_info_t * info, int s_first, int s_last) | |
258 | +{ | |
259 | + int flag, prot, sect; | |
260 | + ulong type, start, last; | |
261 | + int rcode = 0; | |
262 | + | |
263 | + if ((s_first < 0) || (s_first > s_last)) { | |
264 | + if (info->flash_id == FLASH_UNKNOWN) { | |
265 | + printf ("- missing\n"); | |
266 | + } else { | |
267 | + printf ("- no sectors to erase\n"); | |
268 | + } | |
269 | + return 1; | |
270 | + } | |
271 | + | |
272 | + type = (info->flash_id & FLASH_VENDMASK); | |
273 | + if ((type != FLASH_MAN_INTEL)) { | |
274 | + printf ("Can't erase unknown flash type %08lx - aborted\n", | |
275 | + info->flash_id); | |
276 | + return 1; | |
277 | + } | |
278 | + | |
279 | + prot = 0; | |
280 | + for (sect = s_first; sect <= s_last; ++sect) { | |
281 | + if (info->protect[sect]) { | |
282 | + prot++; | |
283 | + } | |
284 | + } | |
285 | + | |
286 | + if (prot) { | |
287 | + printf ("- Warning: %d protected sectors will not be erased!\n", | |
288 | + prot); | |
289 | + } else { | |
290 | + printf ("\n"); | |
291 | + } | |
292 | + | |
293 | + | |
294 | + start = get_timer (0); | |
295 | + last = start; | |
296 | + | |
297 | + /* Disable interrupts which might cause a timeout here */ | |
298 | + flag = disable_interrupts (); | |
299 | + | |
300 | + /* Start erase on unprotected sectors */ | |
301 | + for (sect = s_first; sect <= s_last; sect++) { | |
302 | + if (info->protect[sect] == 0) { /* not protected */ | |
303 | + FPWV *addr = (FPWV *) (info->start[sect]); | |
304 | + FPW status; | |
305 | + | |
306 | + printf ("Erasing sector %2d ... ", sect); | |
307 | + | |
308 | + flash_unprotect_sectors (addr); | |
309 | + | |
310 | + /* arm simple, non interrupt dependent timer */ | |
311 | + reset_timer_masked (); | |
312 | + | |
313 | + *addr = (FPW) 0x00500050;/* clear status register */ | |
314 | + *addr = (FPW) 0x00200020;/* erase setup */ | |
315 | + *addr = (FPW) 0x00D000D0;/* erase confirm */ | |
316 | + | |
317 | + while (((status = | |
318 | + *addr) & (FPW) 0x00800080) != | |
319 | + (FPW) 0x00800080) { | |
320 | + if (get_timer_masked () > | |
321 | + CFG_FLASH_ERASE_TOUT) { | |
322 | + printf ("Timeout\n"); | |
323 | + /* suspend erase */ | |
324 | + *addr = (FPW) 0x00B000B0; | |
325 | + /* reset to read mode */ | |
326 | + *addr = (FPW) 0x00FF00FF; | |
327 | + rcode = 1; | |
328 | + break; | |
329 | + } | |
330 | + } | |
331 | + | |
332 | + /* clear status register cmd. */ | |
333 | + *addr = (FPW) 0x00500050; | |
334 | + *addr = (FPW) 0x00FF00FF;/* resest to read mode */ | |
335 | + printf (" done\n"); | |
336 | + } | |
337 | + } | |
338 | + return rcode; | |
339 | +} | |
340 | + | |
341 | +/*----------------------------------------------------------------------- | |
342 | + * Copy memory to flash, returns: | |
343 | + * 0 - OK | |
344 | + * 1 - write timeout | |
345 | + * 2 - Flash not erased | |
346 | + * 4 - Flash not identified | |
347 | + */ | |
348 | + | |
349 | +int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) | |
350 | +{ | |
351 | + ulong cp, wp; | |
352 | + FPW data; | |
353 | + int count, i, l, rc, port_width; | |
354 | + | |
355 | + if (info->flash_id == FLASH_UNKNOWN) { | |
356 | + return 4; | |
357 | + } | |
358 | +/* get lower word aligned address */ | |
359 | +#ifdef FLASH_PORT_WIDTH16 | |
360 | + wp = (addr & ~1); | |
361 | + port_width = 2; | |
362 | +#else | |
363 | + wp = (addr & ~3); | |
364 | + port_width = 4; | |
365 | +#endif | |
366 | + | |
367 | + /* | |
368 | + * handle unaligned start bytes | |
369 | + */ | |
370 | + if ((l = addr - wp) != 0) { | |
371 | + data = 0; | |
372 | + for (i = 0, cp = wp; i < l; ++i, ++cp) { | |
373 | + data = (data << 8) | (*(uchar *) cp); | |
374 | + } | |
375 | + for (; i < port_width && cnt > 0; ++i) { | |
376 | + data = (data << 8) | *src++; | |
377 | + --cnt; | |
378 | + ++cp; | |
379 | + } | |
380 | + for (; cnt == 0 && i < port_width; ++i, ++cp) { | |
381 | + data = (data << 8) | (*(uchar *) cp); | |
382 | + } | |
383 | + | |
384 | + if ((rc = write_data (info, wp, SWAP (data))) != 0) { | |
385 | + return (rc); | |
386 | + } | |
387 | + wp += port_width; | |
388 | + } | |
389 | + | |
390 | + /* | |
391 | + * handle word aligned part | |
392 | + */ | |
393 | + count = 0; | |
394 | + while (cnt >= port_width) { | |
395 | + data = 0; | |
396 | + for (i = 0; i < port_width; ++i) { | |
397 | + data = (data << 8) | *src++; | |
398 | + } | |
399 | + if ((rc = write_data (info, wp, SWAP (data))) != 0) { | |
400 | + return (rc); | |
401 | + } | |
402 | + wp += port_width; | |
403 | + cnt -= port_width; | |
404 | + if (count++ > 0x800) { | |
405 | + spin_wheel (); | |
406 | + count = 0; | |
407 | + } | |
408 | + } | |
409 | + | |
410 | + if (cnt == 0) { | |
411 | + return (0); | |
412 | + } | |
413 | + | |
414 | + /* | |
415 | + * handle unaligned tail bytes | |
416 | + */ | |
417 | + data = 0; | |
418 | + for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) { | |
419 | + data = (data << 8) | *src++; | |
420 | + --cnt; | |
421 | + } | |
422 | + for (; i < port_width; ++i, ++cp) { | |
423 | + data = (data << 8) | (*(uchar *) cp); | |
424 | + } | |
425 | + | |
426 | + return (write_data (info, wp, SWAP (data))); | |
427 | +} | |
428 | + | |
429 | +/*----------------------------------------------------------------------- | |
430 | + * Write a word or halfword to Flash, returns: | |
431 | + * 0 - OK | |
432 | + * 1 - write timeout | |
433 | + * 2 - Flash not erased | |
434 | + */ | |
435 | +static int write_data (flash_info_t * info, ulong dest, FPW data) | |
436 | +{ | |
437 | + FPWV *addr = (FPWV *) dest; | |
438 | + ulong status; | |
439 | + int flag; | |
440 | + | |
441 | + /* Check if Flash is (sufficiently) erased */ | |
442 | + if ((*addr & data) != data) { | |
443 | + printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr); | |
444 | + return (2); | |
445 | + } | |
446 | + flash_unprotect_sectors (addr); | |
447 | + /* Disable interrupts which might cause a timeout here */ | |
448 | + flag = disable_interrupts (); | |
449 | + *addr = (FPW) 0x00400040; /* write setup */ | |
450 | + *addr = data; | |
451 | + | |
452 | + /* arm simple, non interrupt dependent timer */ | |
453 | + reset_timer_masked (); | |
454 | + | |
455 | + /* wait while polling the status register */ | |
456 | + while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) { | |
457 | + if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) { | |
458 | + *addr = (FPW) 0x00FF00FF; /* restore read mode */ | |
459 | + return (1); | |
460 | + } | |
461 | + } | |
462 | + *addr = (FPW) 0x00FF00FF; /* restore read mode */ | |
463 | + return (0); | |
464 | +} | |
465 | + | |
466 | +void inline spin_wheel (void) | |
467 | +{ | |
468 | + static int p = 0; | |
469 | + static char w[] = "\\/-"; | |
470 | + | |
471 | + printf ("\010%c", w[p]); | |
472 | + (++p == 3) ? (p = 0) : 0; | |
473 | +} |
board/integratorcp/integratorcp.c
1 | +/* | |
2 | + * (C) Copyright 2002 | |
3 | + * Sysgo Real-Time Solutions, GmbH <www.elinos.com> | |
4 | + * Marius Groeger <mgroeger@sysgo.de> | |
5 | + * | |
6 | + * (C) Copyright 2002 | |
7 | + * David Mueller, ELSOFT AG, <d.mueller@elsoft.ch> | |
8 | + * | |
9 | + * (C) Copyright 2003 | |
10 | + * Texas Instruments, <www.ti.com> | |
11 | + * Kshitij Gupta <Kshitij@ti.com> | |
12 | + * | |
13 | + * (C) Copyright 2004 | |
14 | + * ARM Ltd. | |
15 | + * Philippe Robin, <philippe.robin@arm.com> | |
16 | + * | |
17 | + * See file CREDITS for list of people who contributed to this | |
18 | + * project. | |
19 | + * | |
20 | + * This program is free software; you can redistribute it and/or | |
21 | + * modify it under the terms of the GNU General Public License as | |
22 | + * published by the Free Software Foundation; either version 2 of | |
23 | + * the License, or (at your option) any later version. | |
24 | + * | |
25 | + * This program is distributed in the hope that it will be useful, | |
26 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
28 | + * GNU General Public License for more details. | |
29 | + * | |
30 | + * You should have received a copy of the GNU General Public License | |
31 | + * along with this program; if not, write to the Free Software | |
32 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
33 | + * MA 02111-1307 USA | |
34 | + */ | |
35 | + | |
36 | +#include <common.h> | |
37 | + | |
38 | +void flash__init (void); | |
39 | +void ether__init (void); | |
40 | +void peripheral_power_enable (void); | |
41 | + | |
42 | +#if defined(CONFIG_SHOW_BOOT_PROGRESS) | |
43 | +void show_boot_progress(int progress) | |
44 | +{ | |
45 | + printf("Boot reached stage %d\n", progress); | |
46 | +} | |
47 | +#endif | |
48 | + | |
49 | +#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF) | |
50 | + | |
51 | +static inline void delay (unsigned long loops) | |
52 | +{ | |
53 | + __asm__ volatile ("1:\n" | |
54 | + "subs %0, %1, #1\n" | |
55 | + "bne 1b":"=r" (loops):"0" (loops)); | |
56 | +} | |
57 | + | |
58 | +/* | |
59 | + * Miscellaneous platform dependent initialisations | |
60 | + */ | |
61 | + | |
62 | +int board_init (void) | |
63 | +{ | |
64 | + DECLARE_GLOBAL_DATA_PTR; | |
65 | + | |
66 | + /* arch number of Integrator Board */ | |
67 | + gd->bd->bi_arch_number = 275; | |
68 | + | |
69 | + /* adress of boot parameters */ | |
70 | + gd->bd->bi_boot_params = 0x00000100; | |
71 | + | |
72 | + icache_enable (); | |
73 | + | |
74 | + flash__init (); | |
75 | + ether__init (); | |
76 | + return 0; | |
77 | +} | |
78 | + | |
79 | + | |
80 | +int misc_init_r (void) | |
81 | +{ | |
82 | + setenv("verify", "n"); | |
83 | + return (0); | |
84 | +} | |
85 | + | |
86 | +/****************************** | |
87 | + Routine: | |
88 | + Description: | |
89 | +******************************/ | |
90 | +void flash__init (void) | |
91 | +{ | |
92 | +} | |
93 | +/************************************************************* | |
94 | + Routine:ether__init | |
95 | + Description: take the Ethernet controller out of reset and wait | |
96 | + for the EEPROM load to complete. | |
97 | +*************************************************************/ | |
98 | +void ether__init (void) | |
99 | +{ | |
100 | +} | |
101 | + | |
102 | +/****************************** | |
103 | + Routine: | |
104 | + Description: | |
105 | +******************************/ | |
106 | +int dram_init (void) | |
107 | +{ | |
108 | + return 0; | |
109 | +} |
board/integratorcp/platform.S
1 | +/* | |
2 | + * Board specific setup info | |
3 | + * | |
4 | + * (C) Copyright 2003, ARM Ltd. | |
5 | + * Philippe Robin, <philippe.robin@arm.com> | |
6 | + * | |
7 | + * See file CREDITS for list of people who contributed to this | |
8 | + * project. | |
9 | + * | |
10 | + * This program is free software; you can redistribute it and/or | |
11 | + * modify it under the terms of the GNU General Public License as | |
12 | + * published by the Free Software Foundation; either version 2 of | |
13 | + * the License, or (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program; if not, write to the Free Software | |
22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
23 | + * MA 02111-1307 USA | |
24 | + */ | |
25 | + | |
26 | +#include <config.h> | |
27 | +#include <version.h> | |
28 | + | |
29 | +.globl platformsetup | |
30 | +platformsetup: | |
31 | + | |
32 | + /* All done by IntegratorCP's boot monitor! */ | |
33 | + mov pc, lr |
board/integratorcp/u-boot.lds
1 | +/* | |
2 | + * (C) Copyright 2002 | |
3 | + * Gary Jennejohn, DENX Software Engineering, <gj@denx.de> | |
4 | + * | |
5 | + * See file CREDITS for list of people who contributed to this | |
6 | + * project. | |
7 | + * | |
8 | + * This program is free software; you can redistribute it and/or | |
9 | + * modify it under the terms of the GNU General Public License as | |
10 | + * published by the Free Software Foundation; either version 2 of | |
11 | + * the License, or (at your option) any later version. | |
12 | + * | |
13 | + * This program is distributed in the hope that it will be useful, | |
14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | + * GNU General Public License for more details. | |
17 | + * | |
18 | + * You should have received a copy of the GNU General Public License | |
19 | + * along with this program; if not, write to the Free Software | |
20 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
21 | + * MA 02111-1307 USA | |
22 | + */ | |
23 | + | |
24 | +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") | |
25 | +OUTPUT_ARCH(arm) | |
26 | +ENTRY(_start) | |
27 | +SECTIONS | |
28 | +{ | |
29 | + . = 0x00000000; | |
30 | + . = ALIGN(4); | |
31 | + .text : | |
32 | + { | |
33 | + cpu/arm926ejs/start.o (.text) | |
34 | + *(.text) | |
35 | + } | |
36 | + .rodata : { *(.rodata) } | |
37 | + . = ALIGN(4); | |
38 | + .data : { *(.data) } | |
39 | + . = ALIGN(4); | |
40 | + .got : { *(.got) } | |
41 | + | |
42 | + __u_boot_cmd_start = .; | |
43 | + .u_boot_cmd : { *(.u_boot_cmd) } | |
44 | + __u_boot_cmd_end = .; | |
45 | + | |
46 | + armboot_end_data = .; | |
47 | + . = ALIGN(4); | |
48 | + .bss : { *(.bss) } | |
49 | + armboot_end = .; | |
50 | +} |
board/versatile/Makefile
1 | +# | |
2 | +# (C) Copyright 2000-2004 | |
3 | +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
4 | +# | |
5 | +# See file CREDITS for list of people who contributed to this | |
6 | +# project. | |
7 | +# | |
8 | +# This program is free software; you can redistribute it and/or | |
9 | +# modify it under the terms of the GNU General Public License as | |
10 | +# published by the Free Software Foundation; either version 2 of | |
11 | +# the License, or (at your option) any later version. | |
12 | +# | |
13 | +# This program is distributed in the hope that it will be useful, | |
14 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | +# GNU General Public License for more details. | |
17 | +# | |
18 | +# You should have received a copy of the GNU General Public License | |
19 | +# along with this program; if not, write to the Free Software | |
20 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
21 | +# MA 02111-1307 USA | |
22 | +# | |
23 | + | |
24 | +include $(TOPDIR)/config.mk | |
25 | + | |
26 | +LIB = lib$(BOARD).a | |
27 | + | |
28 | +OBJS := versatile.o flash.o | |
29 | +SOBJS := platform.o | |
30 | + | |
31 | +$(LIB): $(OBJS) $(SOBJS) | |
32 | + $(AR) crv $@ $^ | |
33 | + | |
34 | +clean: | |
35 | + rm -f $(SOBJS) $(OBJS) | |
36 | + | |
37 | +distclean: clean | |
38 | + rm -f $(LIB) core *.bak .depend | |
39 | + | |
40 | +######################################################################### | |
41 | + | |
42 | +.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) | |
43 | + $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@ | |
44 | + | |
45 | +-include .depend | |
46 | + | |
47 | +######################################################################### |
board/versatile/config.mk
board/versatile/flash.c
1 | +/* | |
2 | + * (C) Copyright 2001 | |
3 | + * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net | |
4 | + * | |
5 | + * (C) Copyright 2001-2004 | |
6 | + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
7 | + * | |
8 | + * (C) Copyright 2003 | |
9 | + * Texas Instruments, <www.ti.com> | |
10 | + * Kshitij Gupta <Kshitij@ti.com> | |
11 | + * | |
12 | + * See file CREDITS for list of people who contributed to this | |
13 | + * project. | |
14 | + * | |
15 | + * This program is free software; you can redistribute it and/or | |
16 | + * modify it under the terms of the GNU General Public License as | |
17 | + * published by the Free Software Foundation; either version 2 of | |
18 | + * the License, or (at your option) any later version. | |
19 | + * | |
20 | + * This program is distributed in the hope that it will be useful, | |
21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | + * GNU General Public License for more details. | |
24 | + * | |
25 | + * You should have received a copy of the GNU General Public License | |
26 | + * along with this program; if not, write to the Free Software | |
27 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
28 | + * MA 02111-1307 USA | |
29 | + */ | |
30 | + | |
31 | +#include <common.h> | |
32 | +#include <linux/byteorder/swab.h> | |
33 | + | |
34 | +#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */ | |
35 | +flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ | |
36 | + | |
37 | +/* Board support for 1 or 2 flash devices */ | |
38 | +#undef FLASH_PORT_WIDTH32 | |
39 | +#define FLASH_PORT_WIDTH16 | |
40 | + | |
41 | +#ifdef FLASH_PORT_WIDTH16 | |
42 | +#define FLASH_PORT_WIDTH ushort | |
43 | +#define FLASH_PORT_WIDTHV vu_short | |
44 | +#define SWAP(x) __swab16(x) | |
45 | +#else | |
46 | +#define FLASH_PORT_WIDTH ulong | |
47 | +#define FLASH_PORT_WIDTHV vu_long | |
48 | +#define SWAP(x) __swab32(x) | |
49 | +#endif | |
50 | + | |
51 | +#define FPW FLASH_PORT_WIDTH | |
52 | +#define FPWV FLASH_PORT_WIDTHV | |
53 | + | |
54 | +#define mb() __asm__ __volatile__ ("" : : : "memory") | |
55 | + | |
56 | + | |
57 | +/* Flash Organization Structure */ | |
58 | +typedef struct OrgDef { | |
59 | + unsigned int sector_number; | |
60 | + unsigned int sector_size; | |
61 | +} OrgDef; | |
62 | + | |
63 | + | |
64 | +/* Flash Organizations */ | |
65 | +OrgDef OrgIntel_28F256L18T[] = { | |
66 | + {4, 32 * 1024}, /* 4 * 32kBytes sectors */ | |
67 | + {255, 128 * 1024}, /* 255 * 128kBytes sectors */ | |
68 | +}; | |
69 | + | |
70 | + | |
71 | +/*----------------------------------------------------------------------- | |
72 | + * Functions | |
73 | + */ | |
74 | +unsigned long flash_init (void); | |
75 | +static ulong flash_get_size (FPW * addr, flash_info_t * info); | |
76 | +static int write_data (flash_info_t * info, ulong dest, FPW data); | |
77 | +static void flash_get_offsets (ulong base, flash_info_t * info); | |
78 | +void inline spin_wheel (void); | |
79 | +void flash_print_info (flash_info_t * info); | |
80 | +void flash_unprotect_sectors (FPWV * addr); | |
81 | +int flash_erase (flash_info_t * info, int s_first, int s_last); | |
82 | +int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt); | |
83 | + | |
84 | +/*----------------------------------------------------------------------- | |
85 | + */ | |
86 | + | |
87 | +unsigned long flash_init (void) | |
88 | +{ | |
89 | + int i; | |
90 | + ulong size = 0; | |
91 | + for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) { | |
92 | + switch (i) { | |
93 | + case 0: | |
94 | + flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]); | |
95 | + flash_get_offsets (PHYS_FLASH_1, &flash_info[i]); | |
96 | + break; | |
97 | + default: | |
98 | + panic ("configured too many flash banks!\n"); | |
99 | + break; | |
100 | + } | |
101 | + size += flash_info[i].size; | |
102 | + } | |
103 | + | |
104 | + /* Protect monitor and environment sectors | |
105 | + */ | |
106 | + flash_protect (FLAG_PROTECT_SET, | |
107 | + CFG_FLASH_BASE, | |
108 | + CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]); | |
109 | + | |
110 | + return size; | |
111 | +} | |
112 | + | |
113 | +/*----------------------------------------------------------------------- | |
114 | + */ | |
115 | +static void flash_get_offsets (ulong base, flash_info_t * info) | |
116 | +{ | |
117 | + int i; | |
118 | + OrgDef *pOrgDef; | |
119 | + | |
120 | + pOrgDef = OrgIntel_28F256L18T; | |
121 | + if (info->flash_id == FLASH_UNKNOWN) { | |
122 | + return; | |
123 | + } | |
124 | + | |
125 | + if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) { | |
126 | + for (i = 0; i < info->sector_count; i++) { | |
127 | + if (i > 255) { | |
128 | + info->start[i] = base + (i * 0x8000); | |
129 | + info->protect[i] = 0; | |
130 | + } else { | |
131 | + info->start[i] = base + | |
132 | + (i * PHYS_FLASH_SECT_SIZE); | |
133 | + info->protect[i] = 0; | |
134 | + } | |
135 | + } | |
136 | + } | |
137 | +} | |
138 | + | |
139 | +/*----------------------------------------------------------------------- | |
140 | + */ | |
141 | +void flash_print_info (flash_info_t * info) | |
142 | +{ | |
143 | + int i; | |
144 | + | |
145 | + if (info->flash_id == FLASH_UNKNOWN) { | |
146 | + printf ("missing or unknown FLASH type\n"); | |
147 | + return; | |
148 | + } | |
149 | + | |
150 | + switch (info->flash_id & FLASH_VENDMASK) { | |
151 | + case FLASH_MAN_INTEL: | |
152 | + printf ("INTEL "); | |
153 | + break; | |
154 | + default: | |
155 | + printf ("Unknown Vendor "); | |
156 | + break; | |
157 | + } | |
158 | + | |
159 | + switch (info->flash_id & FLASH_TYPEMASK) { | |
160 | + case FLASH_28F256L18T: | |
161 | + printf ("FLASH 28F256L18T\n"); | |
162 | + break; | |
163 | + default: | |
164 | + printf ("Unknown Chip Type\n"); | |
165 | + break; | |
166 | + } | |
167 | + | |
168 | + printf (" Size: %ld MB in %d Sectors\n", | |
169 | + info->size >> 20, info->sector_count); | |
170 | + | |
171 | + printf (" Sector Start Addresses:"); | |
172 | + for (i = 0; i < info->sector_count; ++i) { | |
173 | + if ((i % 5) == 0) | |
174 | + printf ("\n "); | |
175 | + printf (" %08lX%s", | |
176 | + info->start[i], info->protect[i] ? " (RO)" : " "); | |
177 | + } | |
178 | + printf ("\n"); | |
179 | + return; | |
180 | +} | |
181 | + | |
182 | +/* | |
183 | + * The following code cannot be run from FLASH! | |
184 | + */ | |
185 | +static ulong flash_get_size (FPW * addr, flash_info_t * info) | |
186 | +{ | |
187 | + volatile FPW value; | |
188 | + | |
189 | + /* Write auto select command: read Manufacturer ID */ | |
190 | + addr[0x5555] = (FPW) 0x00AA00AA; | |
191 | + addr[0x2AAA] = (FPW) 0x00550055; | |
192 | + addr[0x5555] = (FPW) 0x00900090; | |
193 | + | |
194 | + mb (); | |
195 | + value = addr[0]; | |
196 | + | |
197 | + switch (value) { | |
198 | + | |
199 | + case (FPW) INTEL_MANUFACT: | |
200 | + info->flash_id = FLASH_MAN_INTEL; | |
201 | + break; | |
202 | + | |
203 | + default: | |
204 | + info->flash_id = FLASH_UNKNOWN; | |
205 | + info->sector_count = 0; | |
206 | + info->size = 0; | |
207 | + addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ | |
208 | + return (0); /* no or unknown flash */ | |
209 | + } | |
210 | + | |
211 | + mb (); | |
212 | + value = addr[1]; /* device ID */ | |
213 | + switch (value) { | |
214 | + | |
215 | + case (FPW) (INTEL_ID_28F256L18T): | |
216 | + info->flash_id += FLASH_28F256L18T; | |
217 | + info->sector_count = 259; | |
218 | + info->size = 0x02000000; | |
219 | + break; /* => 32 MB */ | |
220 | + | |
221 | + default: | |
222 | + info->flash_id = FLASH_UNKNOWN; | |
223 | + break; | |
224 | + } | |
225 | + | |
226 | + if (info->sector_count > CFG_MAX_FLASH_SECT) { | |
227 | + printf ("** ERROR: sector count %d > max (%d) **\n", | |
228 | + info->sector_count, CFG_MAX_FLASH_SECT); | |
229 | + info->sector_count = CFG_MAX_FLASH_SECT; | |
230 | + } | |
231 | + | |
232 | + addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ | |
233 | + | |
234 | + return (info->size); | |
235 | +} | |
236 | + | |
237 | + | |
238 | +/* unprotects a sector for write and erase | |
239 | + * on some intel parts, this unprotects the entire chip, but it | |
240 | + * wont hurt to call this additional times per sector... | |
241 | + */ | |
242 | +void flash_unprotect_sectors (FPWV * addr) | |
243 | +{ | |
244 | +#define PD_FINTEL_WSMS_READY_MASK 0x0080 | |
245 | + | |
246 | + *addr = (FPW) 0x00500050; /* clear status register */ | |
247 | + | |
248 | + /* this sends the clear lock bit command */ | |
249 | + *addr = (FPW) 0x00600060; | |
250 | + *addr = (FPW) 0x00D000D0; | |
251 | +} | |
252 | + | |
253 | + | |
254 | +/*----------------------------------------------------------------------- | |
255 | + */ | |
256 | + | |
257 | +int flash_erase (flash_info_t * info, int s_first, int s_last) | |
258 | +{ | |
259 | + int flag, prot, sect; | |
260 | + ulong type, start, last; | |
261 | + int rcode = 0; | |
262 | + | |
263 | + if ((s_first < 0) || (s_first > s_last)) { | |
264 | + if (info->flash_id == FLASH_UNKNOWN) { | |
265 | + printf ("- missing\n"); | |
266 | + } else { | |
267 | + printf ("- no sectors to erase\n"); | |
268 | + } | |
269 | + return 1; | |
270 | + } | |
271 | + | |
272 | + type = (info->flash_id & FLASH_VENDMASK); | |
273 | + if ((type != FLASH_MAN_INTEL)) { | |
274 | + printf ("Can't erase unknown flash type %08lx - aborted\n", | |
275 | + info->flash_id); | |
276 | + return 1; | |
277 | + } | |
278 | + | |
279 | + prot = 0; | |
280 | + for (sect = s_first; sect <= s_last; ++sect) { | |
281 | + if (info->protect[sect]) { | |
282 | + prot++; | |
283 | + } | |
284 | + } | |
285 | + | |
286 | + if (prot) { | |
287 | + printf ("- Warning: %d protected sectors will not be erased!\n", | |
288 | + prot); | |
289 | + } else { | |
290 | + printf ("\n"); | |
291 | + } | |
292 | + | |
293 | + | |
294 | + start = get_timer (0); | |
295 | + last = start; | |
296 | + | |
297 | + /* Disable interrupts which might cause a timeout here */ | |
298 | + flag = disable_interrupts (); | |
299 | + | |
300 | + /* Start erase on unprotected sectors */ | |
301 | + for (sect = s_first; sect <= s_last; sect++) { | |
302 | + if (info->protect[sect] == 0) { /* not protected */ | |
303 | + FPWV *addr = (FPWV *) (info->start[sect]); | |
304 | + FPW status; | |
305 | + | |
306 | + printf ("Erasing sector %2d ... ", sect); | |
307 | + | |
308 | + flash_unprotect_sectors (addr); | |
309 | + | |
310 | + /* arm simple, non interrupt dependent timer */ | |
311 | + reset_timer_masked (); | |
312 | + | |
313 | + *addr = (FPW) 0x00500050;/* clear status register */ | |
314 | + *addr = (FPW) 0x00200020;/* erase setup */ | |
315 | + *addr = (FPW) 0x00D000D0;/* erase confirm */ | |
316 | + | |
317 | + while (((status = | |
318 | + *addr) & (FPW) 0x00800080) != | |
319 | + (FPW) 0x00800080) { | |
320 | + if (get_timer_masked () > | |
321 | + CFG_FLASH_ERASE_TOUT) { | |
322 | + printf ("Timeout\n"); | |
323 | + /* suspend erase */ | |
324 | + *addr = (FPW) 0x00B000B0; | |
325 | + /* reset to read mode */ | |
326 | + *addr = (FPW) 0x00FF00FF; | |
327 | + rcode = 1; | |
328 | + break; | |
329 | + } | |
330 | + } | |
331 | + | |
332 | + /* clear status register cmd. */ | |
333 | + *addr = (FPW) 0x00500050; | |
334 | + *addr = (FPW) 0x00FF00FF;/* resest to read mode */ | |
335 | + printf (" done\n"); | |
336 | + } | |
337 | + } | |
338 | + return rcode; | |
339 | +} | |
340 | + | |
341 | +/*----------------------------------------------------------------------- | |
342 | + * Copy memory to flash, returns: | |
343 | + * 0 - OK | |
344 | + * 1 - write timeout | |
345 | + * 2 - Flash not erased | |
346 | + * 4 - Flash not identified | |
347 | + */ | |
348 | + | |
349 | +int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) | |
350 | +{ | |
351 | + ulong cp, wp; | |
352 | + FPW data; | |
353 | + int count, i, l, rc, port_width; | |
354 | + | |
355 | + if (info->flash_id == FLASH_UNKNOWN) { | |
356 | + return 4; | |
357 | + } | |
358 | +/* get lower word aligned address */ | |
359 | +#ifdef FLASH_PORT_WIDTH16 | |
360 | + wp = (addr & ~1); | |
361 | + port_width = 2; | |
362 | +#else | |
363 | + wp = (addr & ~3); | |
364 | + port_width = 4; | |
365 | +#endif | |
366 | + | |
367 | + /* | |
368 | + * handle unaligned start bytes | |
369 | + */ | |
370 | + if ((l = addr - wp) != 0) { | |
371 | + data = 0; | |
372 | + for (i = 0, cp = wp; i < l; ++i, ++cp) { | |
373 | + data = (data << 8) | (*(uchar *) cp); | |
374 | + } | |
375 | + for (; i < port_width && cnt > 0; ++i) { | |
376 | + data = (data << 8) | *src++; | |
377 | + --cnt; | |
378 | + ++cp; | |
379 | + } | |
380 | + for (; cnt == 0 && i < port_width; ++i, ++cp) { | |
381 | + data = (data << 8) | (*(uchar *) cp); | |
382 | + } | |
383 | + | |
384 | + if ((rc = write_data (info, wp, SWAP (data))) != 0) { | |
385 | + return (rc); | |
386 | + } | |
387 | + wp += port_width; | |
388 | + } | |
389 | + | |
390 | + /* | |
391 | + * handle word aligned part | |
392 | + */ | |
393 | + count = 0; | |
394 | + while (cnt >= port_width) { | |
395 | + data = 0; | |
396 | + for (i = 0; i < port_width; ++i) { | |
397 | + data = (data << 8) | *src++; | |
398 | + } | |
399 | + if ((rc = write_data (info, wp, SWAP (data))) != 0) { | |
400 | + return (rc); | |
401 | + } | |
402 | + wp += port_width; | |
403 | + cnt -= port_width; | |
404 | + if (count++ > 0x800) { | |
405 | + spin_wheel (); | |
406 | + count = 0; | |
407 | + } | |
408 | + } | |
409 | + | |
410 | + if (cnt == 0) { | |
411 | + return (0); | |
412 | + } | |
413 | + | |
414 | + /* | |
415 | + * handle unaligned tail bytes | |
416 | + */ | |
417 | + data = 0; | |
418 | + for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) { | |
419 | + data = (data << 8) | *src++; | |
420 | + --cnt; | |
421 | + } | |
422 | + for (; i < port_width; ++i, ++cp) { | |
423 | + data = (data << 8) | (*(uchar *) cp); | |
424 | + } | |
425 | + | |
426 | + return (write_data (info, wp, SWAP (data))); | |
427 | +} | |
428 | + | |
429 | +/*----------------------------------------------------------------------- | |
430 | + * Write a word or halfword to Flash, returns: | |
431 | + * 0 - OK | |
432 | + * 1 - write timeout | |
433 | + * 2 - Flash not erased | |
434 | + */ | |
435 | +static int write_data (flash_info_t * info, ulong dest, FPW data) | |
436 | +{ | |
437 | + FPWV *addr = (FPWV *) dest; | |
438 | + ulong status; | |
439 | + int flag; | |
440 | + | |
441 | + /* Check if Flash is (sufficiently) erased */ | |
442 | + if ((*addr & data) != data) { | |
443 | + printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr); | |
444 | + return (2); | |
445 | + } | |
446 | + flash_unprotect_sectors (addr); | |
447 | + /* Disable interrupts which might cause a timeout here */ | |
448 | + flag = disable_interrupts (); | |
449 | + *addr = (FPW) 0x00400040; /* write setup */ | |
450 | + *addr = data; | |
451 | + | |
452 | + /* arm simple, non interrupt dependent timer */ | |
453 | + reset_timer_masked (); | |
454 | + | |
455 | + /* wait while polling the status register */ | |
456 | + while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) { | |
457 | + if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) { | |
458 | + *addr = (FPW) 0x00FF00FF; /* restore read mode */ | |
459 | + return (1); | |
460 | + } | |
461 | + } | |
462 | + *addr = (FPW) 0x00FF00FF; /* restore read mode */ | |
463 | + return (0); | |
464 | +} | |
465 | + | |
466 | +void inline spin_wheel (void) | |
467 | +{ | |
468 | + static int p = 0; | |
469 | + static char w[] = "\\/-"; | |
470 | + | |
471 | + printf ("\010%c", w[p]); | |
472 | + (++p == 3) ? (p = 0) : 0; | |
473 | +} |
board/versatile/platform.S
1 | +/* | |
2 | + * Board specific setup info | |
3 | + * | |
4 | + * (C) Copyright 2003, ARM Ltd. | |
5 | + * Philippe Robin, <philippe.robin@arm.com> | |
6 | + * | |
7 | + * See file CREDITS for list of people who contributed to this | |
8 | + * project. | |
9 | + * | |
10 | + * This program is free software; you can redistribute it and/or | |
11 | + * modify it under the terms of the GNU General Public License as | |
12 | + * published by the Free Software Foundation; either version 2 of | |
13 | + * the License, or (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program; if not, write to the Free Software | |
22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
23 | + * MA 02111-1307 USA | |
24 | + */ | |
25 | + | |
26 | +#include <config.h> | |
27 | +#include <version.h> | |
28 | + | |
29 | +.globl platformsetup | |
30 | +platformsetup: | |
31 | + | |
32 | + /* All done by Versatile's boot monitor! */ | |
33 | + mov pc, lr |
board/versatile/u-boot.lds
1 | +/* | |
2 | + * (C) Copyright 2002 | |
3 | + * Gary Jennejohn, DENX Software Engineering, <gj@denx.de> | |
4 | + * | |
5 | + * See file CREDITS for list of people who contributed to this | |
6 | + * project. | |
7 | + * | |
8 | + * This program is free software; you can redistribute it and/or | |
9 | + * modify it under the terms of the GNU General Public License as | |
10 | + * published by the Free Software Foundation; either version 2 of | |
11 | + * the License, or (at your option) any later version. | |
12 | + * | |
13 | + * This program is distributed in the hope that it will be useful, | |
14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | + * GNU General Public License for more details. | |
17 | + * | |
18 | + * You should have received a copy of the GNU General Public License | |
19 | + * along with this program; if not, write to the Free Software | |
20 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
21 | + * MA 02111-1307 USA | |
22 | + */ | |
23 | + | |
24 | +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") | |
25 | +OUTPUT_ARCH(arm) | |
26 | +ENTRY(_start) | |
27 | +SECTIONS | |
28 | +{ | |
29 | + . = 0x00000000; | |
30 | + . = ALIGN(4); | |
31 | + .text : | |
32 | + { | |
33 | + cpu/arm926ejs/start.o (.text) | |
34 | + *(.text) | |
35 | + } | |
36 | + .rodata : { *(.rodata) } | |
37 | + . = ALIGN(4); | |
38 | + .data : { *(.data) } | |
39 | + . = ALIGN(4); | |
40 | + .got : { *(.got) } | |
41 | + | |
42 | + __u_boot_cmd_start = .; | |
43 | + .u_boot_cmd : { *(.u_boot_cmd) } | |
44 | + __u_boot_cmd_end = .; | |
45 | + | |
46 | + armboot_end_data = .; | |
47 | + . = ALIGN(4); | |
48 | + .bss : { *(.bss) } | |
49 | + armboot_end = .; | |
50 | +} |
board/versatile/versatile.c
1 | +/* | |
2 | + * (C) Copyright 2002 | |
3 | + * Sysgo Real-Time Solutions, GmbH <www.elinos.com> | |
4 | + * Marius Groeger <mgroeger@sysgo.de> | |
5 | + * | |
6 | + * (C) Copyright 2002 | |
7 | + * David Mueller, ELSOFT AG, <d.mueller@elsoft.ch> | |
8 | + * | |
9 | + * (C) Copyright 2003 | |
10 | + * Texas Instruments, <www.ti.com> | |
11 | + * Kshitij Gupta <Kshitij@ti.com> | |
12 | + * | |
13 | + * (C) Copyright 2004 | |
14 | + * ARM Ltd. | |
15 | + * Philippe Robin, <philippe.robin@arm.com> | |
16 | + * | |
17 | + * See file CREDITS for list of people who contributed to this | |
18 | + * project. | |
19 | + * | |
20 | + * This program is free software; you can redistribute it and/or | |
21 | + * modify it under the terms of the GNU General Public License as | |
22 | + * published by the Free Software Foundation; either version 2 of | |
23 | + * the License, or (at your option) any later version. | |
24 | + * | |
25 | + * This program is distributed in the hope that it will be useful, | |
26 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
28 | + * GNU General Public License for more details. | |
29 | + * | |
30 | + * You should have received a copy of the GNU General Public License | |
31 | + * along with this program; if not, write to the Free Software | |
32 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
33 | + * MA 02111-1307 USA | |
34 | + */ | |
35 | + | |
36 | +#include <common.h> | |
37 | + | |
38 | +void flash__init (void); | |
39 | +void ether__init (void); | |
40 | +void peripheral_power_enable (void); | |
41 | + | |
42 | +#if defined(CONFIG_SHOW_BOOT_PROGRESS) | |
43 | +void show_boot_progress(int progress) | |
44 | +{ | |
45 | + printf("Boot reached stage %d\n", progress); | |
46 | +} | |
47 | +#endif | |
48 | + | |
49 | +#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF) | |
50 | + | |
51 | +static inline void delay (unsigned long loops) | |
52 | +{ | |
53 | + __asm__ volatile ("1:\n" | |
54 | + "subs %0, %1, #1\n" | |
55 | + "bne 1b":"=r" (loops):"0" (loops)); | |
56 | +} | |
57 | + | |
58 | +/* | |
59 | + * Miscellaneous platform dependent initialisations | |
60 | + */ | |
61 | + | |
62 | +int board_init (void) | |
63 | +{ | |
64 | + DECLARE_GLOBAL_DATA_PTR; | |
65 | + | |
66 | + | |
67 | + /* | |
68 | + * set clock frequency: | |
69 | + * VERSATILE_REFCLK is 32KHz | |
70 | + * VERSATILE_TIMCLK is 1MHz | |
71 | + */ | |
72 | + *(volatile unsigned int *)(VERSATILE_SCTL_BASE) |= | |
73 | + ((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | | |
74 | + (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel)); | |
75 | + | |
76 | + /* arch number of Versatile Board */ | |
77 | + gd->bd->bi_arch_number = 387; | |
78 | + | |
79 | + /* adress of boot parameters */ | |
80 | + gd->bd->bi_boot_params = 0x00000100; | |
81 | + | |
82 | + icache_enable (); | |
83 | + | |
84 | + flash__init (); | |
85 | + ether__init (); | |
86 | + return 0; | |
87 | +} | |
88 | + | |
89 | + | |
90 | +int misc_init_r (void) | |
91 | +{ | |
92 | + setenv("verify", "n"); | |
93 | + return (0); | |
94 | +} | |
95 | + | |
96 | +/****************************** | |
97 | + Routine: | |
98 | + Description: | |
99 | +******************************/ | |
100 | +void flash__init (void) | |
101 | +{ | |
102 | +} | |
103 | +/************************************************************* | |
104 | + Routine:ether__init | |
105 | + Description: take the Ethernet controller out of reset and wait | |
106 | + for the EEPROM load to complete. | |
107 | +*************************************************************/ | |
108 | +void ether__init (void) | |
109 | +{ | |
110 | +} | |
111 | + | |
112 | +/****************************** | |
113 | + Routine: | |
114 | + Description: | |
115 | +******************************/ | |
116 | +int dram_init (void) | |
117 | +{ | |
118 | + return 0; | |
119 | +} |
cpu/arm926ejs/interrupts.c
... | ... | @@ -10,9 +10,12 @@ |
10 | 10 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
11 | 11 | * Alex Zuepke <azu@sysgo.de> |
12 | 12 | * |
13 | - * (C) Copyright 2002 | |
13 | + * (C) Copyright 2002-2004 | |
14 | 14 | * Gary Jennejohn, DENX Software Engineering, <gj@denx.de> |
15 | 15 | * |
16 | + * (C) Copyright 2004 | |
17 | + * Philippe Robin, ARM Ltd. <philippe.robin@arm.com> | |
18 | + * | |
16 | 19 | * See file CREDITS for list of people who contributed to this |
17 | 20 | * project. |
18 | 21 | * |
19 | 22 | |
... | ... | @@ -41,7 +44,15 @@ |
41 | 44 | #define TIMER_LOAD_VAL 0xffffffff |
42 | 45 | |
43 | 46 | /* macro to read the 32 bit timer */ |
47 | +#ifdef CONFIG_OMAP | |
44 | 48 | #define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+8)) |
49 | +#endif | |
50 | +#ifdef CONFIG_INTEGRATOR | |
51 | +#define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+4)) | |
52 | +#endif | |
53 | +#ifdef CONFIG_VERSATILE | |
54 | +#define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+4)) | |
55 | +#endif | |
45 | 56 | |
46 | 57 | #ifdef CONFIG_USE_IRQ |
47 | 58 | /* enable IRQ interrupts */ |
48 | 59 | |
... | ... | @@ -182,12 +193,26 @@ |
182 | 193 | /* nothing really to do with interrupts, just starts up a counter. */ |
183 | 194 | int interrupt_init (void) |
184 | 195 | { |
196 | +#ifdef CONFIG_OMAP | |
185 | 197 | int32_t val; |
186 | 198 | |
187 | 199 | /* Start the decrementer ticking down from 0xffffffff */ |
188 | 200 | *((int32_t *) (CFG_TIMERBASE + LOAD_TIM)) = TIMER_LOAD_VAL; |
189 | 201 | val = MPUTIM_ST | MPUTIM_AR | MPUTIM_CLOCK_ENABLE | (CFG_PVT << MPUTIM_PTV_BIT); |
190 | 202 | *((int32_t *) (CFG_TIMERBASE + CNTL_TIMER)) = val; |
203 | +#endif /* CONFIG_OMAP */ | |
204 | +#ifdef CONFIG_INTEGRATOR | |
205 | + /* Load timer with initial value */ | |
206 | + *(volatile ulong *)(CFG_TIMERBASE + 0) = TIMER_LOAD_VAL; | |
207 | + /* Set timer to be enabled, free-running, no interrupts, 256 divider */ | |
208 | + *(volatile ulong *)(CFG_TIMERBASE + 8) = 0x8C; | |
209 | +#endif /* CONFIG_INTEGRATOR */ | |
210 | +#ifdef CONFIG_VERSATILE | |
211 | + *(volatile ulong *)(CFG_TIMERBASE + 0) = CFG_TIMER_RELOAD; /* TimerLoad */ | |
212 | + *(volatile ulong *)(CFG_TIMERBASE + 4) = CFG_TIMER_RELOAD; /* TimerValue */ | |
213 | + *(volatile ulong *)(CFG_TIMERBASE + 8) = 0x8C; | |
214 | + /* *(volatile ulong *)(CFG_TIMERBASE + 8) = CFG_TIMER_CTRL | 0x40; Periodic */ | |
215 | +#endif /* CONFIG_VERSATILE */ | |
191 | 216 | |
192 | 217 | /* init the timestamp and lastdec value */ |
193 | 218 | reset_timer_masked(); |
drivers/Makefile
... | ... | @@ -38,7 +38,8 @@ |
38 | 38 | pcnet.o plb2800_eth.o \ |
39 | 39 | ps2ser.o ps2mult.o pc_keyb.o keyboard.o \ |
40 | 40 | rtl8019.o rtl8139.o \ |
41 | - s3c24x0_i2c.o sed13806.o serial.o serial_max3100.o \ | |
41 | + s3c24x0_i2c.o sed13806.o \ | |
42 | + serial.o serial_max3100.o serial_pl011.o serial_pl010.o \ | |
42 | 43 | smc91111.o smiLynxEM.o status_led.o sym53c8xx.o \ |
43 | 44 | ti_pci1410a.o tigon3.o w83c553f.o omap1510_i2c.o \ |
44 | 45 | usbdcore.o usbdcore_ep0.o usbdcore_omap1510.o usbtty.o |
drivers/serial_pl010.c
1 | +/* | |
2 | + * (C) Copyright 2000 | |
3 | + * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. | |
4 | + * | |
5 | + * (C) Copyright 2004 | |
6 | + * ARM Ltd. | |
7 | + * Philippe Robin, <philippe.robin@arm.com> | |
8 | + * | |
9 | + * See file CREDITS for list of people who contributed to this | |
10 | + * project. | |
11 | + * | |
12 | + * This program is free software; you can redistribute it and/or | |
13 | + * modify it under the terms of the GNU General Public License as | |
14 | + * published by the Free Software Foundation; either version 2 of | |
15 | + * the License, or (at your option) any later version. | |
16 | + * | |
17 | + * This program is distributed in the hope that it will be useful, | |
18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | + * GNU General Public License for more details. | |
21 | + * | |
22 | + * You should have received a copy of the GNU General Public License | |
23 | + * along with this program; if not, write to the Free Software | |
24 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
25 | + * MA 02111-1307 USA | |
26 | + */ | |
27 | + | |
28 | +/* Simple U-Boot driver for the PrimeCell PL011 UARTs on the IntegratorCP */ | |
29 | +/* Should be fairly simple to make it work with the PL010 as well */ | |
30 | + | |
31 | +#include <common.h> | |
32 | + | |
33 | +#ifdef CFG_PL010_SERIAL | |
34 | + | |
35 | +#include "serial_pl011.h" | |
36 | + | |
37 | +#define IO_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (val)) | |
38 | +#define IO_READ(addr) (*(volatile unsigned int *)(addr)) | |
39 | + | |
40 | +/* Integrator AP has two UARTs, we use the first one, at 38400-8-N-1 */ | |
41 | +#define NUM_PORTS 2 | |
42 | +#define CONSOLE_PORT CONFIG_CONS_INDEX | |
43 | +#define baudRate CONFIG_BAUDRATE | |
44 | +static volatile unsigned char * const port[NUM_PORTS] = {(void*)(CFG_SERIAL0), | |
45 | + (void*)(CFG_SERIAL1)}; | |
46 | + | |
47 | + | |
48 | +static void pl010_putc(int portnum, char c); | |
49 | +static int pl010_getc(int portnum); | |
50 | +static int pl010_tstc(int portnum); | |
51 | + | |
52 | + | |
53 | +int serial_init (void) | |
54 | +{ | |
55 | + unsigned int temp; | |
56 | + unsigned int divisor; | |
57 | + | |
58 | + /* | |
59 | + ** First, disable everything. | |
60 | + */ | |
61 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL010_CR, 0x0); | |
62 | + | |
63 | + /* | |
64 | + ** Set baud rate | |
65 | + ** | |
66 | + */ | |
67 | + switch (baudRate) { | |
68 | + case 9600: | |
69 | + divisor = UART_PL010_BAUD_9600; | |
70 | + break; | |
71 | + | |
72 | + case 19200: | |
73 | + divisor = UART_PL010_BAUD_9600; | |
74 | + break; | |
75 | + | |
76 | + case 38400: | |
77 | + divisor = UART_PL010_BAUD_38400; | |
78 | + break; | |
79 | + | |
80 | + case 57600: | |
81 | + divisor = UART_PL010_BAUD_57600; | |
82 | + break; | |
83 | + | |
84 | + case 115200: | |
85 | + divisor = UART_PL010_BAUD_115200; | |
86 | + break; | |
87 | + | |
88 | + default: | |
89 | + divisor = UART_PL010_BAUD_38400; | |
90 | + } | |
91 | + | |
92 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL010_LCRM, ((divisor & 0xf00) >> 8)); | |
93 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL010_LCRL, (divisor & 0xff)); | |
94 | + | |
95 | + /* | |
96 | + ** Set the UART to be 8 bits, 1 stop bit, no parity, fifo enabled. | |
97 | + */ | |
98 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL010_LCRH, | |
99 | + (UART_PL010_LCRH_WLEN_8 | UART_PL010_LCRH_FEN)); | |
100 | + | |
101 | + /* | |
102 | + ** Finally, enable the UART | |
103 | + */ | |
104 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL010_CR, (UART_PL010_CR_UARTEN)); | |
105 | + | |
106 | + return (0); | |
107 | +} | |
108 | + | |
109 | +void | |
110 | +serial_putc(const char c) | |
111 | +{ | |
112 | + if (c == '\n') | |
113 | + pl010_putc(CONSOLE_PORT, '\r'); | |
114 | + | |
115 | + pl010_putc(CONSOLE_PORT, c); | |
116 | +} | |
117 | + | |
118 | +void | |
119 | +serial_puts (const char *s) | |
120 | +{ | |
121 | + while (*s) { | |
122 | + serial_putc (*s++); | |
123 | + } | |
124 | +} | |
125 | + | |
126 | +int | |
127 | +serial_getc(void) | |
128 | +{ | |
129 | + return pl010_getc(CONSOLE_PORT); | |
130 | +} | |
131 | + | |
132 | +int | |
133 | +serial_tstc(void) | |
134 | +{ | |
135 | + return pl010_tstc(CONSOLE_PORT); | |
136 | +} | |
137 | + | |
138 | +void | |
139 | +serial_setbrg (void) | |
140 | +{ | |
141 | +} | |
142 | + | |
143 | +static void pl010_putc(int portnum, char c) | |
144 | +{ | |
145 | + /* Wait until there is space in the FIFO */ | |
146 | + while (IO_READ(port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_TXFF); | |
147 | + | |
148 | + /* Send the character */ | |
149 | + IO_WRITE(port[portnum] + UART_PL01x_DR, c); | |
150 | +} | |
151 | + | |
152 | +static int pl010_getc(int portnum) | |
153 | +{ | |
154 | + unsigned int data; | |
155 | + | |
156 | + /* Wait until there is data in the FIFO */ | |
157 | + while (IO_READ(port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_RXFE); | |
158 | + | |
159 | + data = IO_READ(port[portnum] + UART_PL01x_DR); | |
160 | + | |
161 | + /* Check for an error flag */ | |
162 | + if (data & 0xFFFFFF00) | |
163 | + { | |
164 | + /* Clear the error */ | |
165 | + IO_WRITE(port[portnum] + UART_PL01x_ECR, 0xFFFFFFFF); | |
166 | + return -1; | |
167 | + } | |
168 | + | |
169 | + return (int)data; | |
170 | +} | |
171 | + | |
172 | +static int pl010_tstc(int portnum) | |
173 | +{ | |
174 | + return !(IO_READ(port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_RXFE); | |
175 | +} | |
176 | + | |
177 | +#endif |
drivers/serial_pl011.c
1 | +/* | |
2 | + * (C) Copyright 2000 | |
3 | + * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. | |
4 | + * | |
5 | + * (C) Copyright 2004 | |
6 | + * ARM Ltd. | |
7 | + * Philippe Robin, <philippe.robin@arm.com> | |
8 | + * | |
9 | + * See file CREDITS for list of people who contributed to this | |
10 | + * project. | |
11 | + * | |
12 | + * This program is free software; you can redistribute it and/or | |
13 | + * modify it under the terms of the GNU General Public License as | |
14 | + * published by the Free Software Foundation; either version 2 of | |
15 | + * the License, or (at your option) any later version. | |
16 | + * | |
17 | + * This program is distributed in the hope that it will be useful, | |
18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | + * GNU General Public License for more details. | |
21 | + * | |
22 | + * You should have received a copy of the GNU General Public License | |
23 | + * along with this program; if not, write to the Free Software | |
24 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
25 | + * MA 02111-1307 USA | |
26 | + */ | |
27 | + | |
28 | +/* Simple U-Boot driver for the PrimeCell PL011 UARTs on the IntegratorCP */ | |
29 | +/* Should be fairly simple to make it work with the PL010 as well */ | |
30 | + | |
31 | +#include <common.h> | |
32 | + | |
33 | +#ifdef CFG_PL011_SERIAL | |
34 | + | |
35 | +#include "serial_pl011.h" | |
36 | + | |
37 | +#define IO_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (val)) | |
38 | +#define IO_READ(addr) (*(volatile unsigned int *)(addr)) | |
39 | + | |
40 | +/* | |
41 | + * IntegratorCP has two UARTs, use the first one, at 38400-8-N-1 | |
42 | + * Versatile PB has four UARTs. | |
43 | + */ | |
44 | +#define NUM_PORTS 2 | |
45 | +#define CONSOLE_PORT CONFIG_CONS_INDEX | |
46 | +#define baudRate CONFIG_BAUDRATE | |
47 | +static volatile unsigned char * const port[NUM_PORTS] = {(void*)(CFG_SERIAL0), | |
48 | + (void*)(CFG_SERIAL1)}; | |
49 | + | |
50 | + | |
51 | +static void pl011_putc(int portnum, char c); | |
52 | +static int pl011_getc(int portnum); | |
53 | +static int pl011_tstc(int portnum); | |
54 | + | |
55 | + | |
56 | +int serial_init (void) | |
57 | +{ | |
58 | + unsigned int temp; | |
59 | + unsigned int divider; | |
60 | + unsigned int remainder; | |
61 | + unsigned int fraction; | |
62 | + | |
63 | + /* | |
64 | + ** First, disable everything. | |
65 | + */ | |
66 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL011_CR, 0x0); | |
67 | + | |
68 | + /* | |
69 | + ** Set baud rate | |
70 | + ** | |
71 | + ** IBRD = UART_CLK / (16 * BAUD_RATE) | |
72 | + ** FBRD = ROUND((64 * MOD(UART_CLK,(16 * BAUD_RATE))) / (16 * BAUD_RATE)) | |
73 | + */ | |
74 | +#ifdef CONFIG_VERSATILE | |
75 | + temp = 16 * baudRate; | |
76 | + divider = 24000000 / temp; | |
77 | + remainder = 24000000 % temp; | |
78 | + temp = (8 * remainder) / baudRate; | |
79 | + fraction = (temp >> 1) + (temp & 1); | |
80 | +#endif | |
81 | +#ifdef CONFIG_INTEGRATOR | |
82 | + temp = 16 * baudRate; | |
83 | + divider = 14745600 / temp; | |
84 | + remainder = 14745600 % temp; | |
85 | + temp = (8 * remainder) / baudRate; | |
86 | + fraction = (temp >> 1) + (temp & 1); | |
87 | +#endif | |
88 | + | |
89 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL011_IBRD, divider); | |
90 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL011_FBRD, fraction); | |
91 | + | |
92 | + /* | |
93 | + ** Set the UART to be 8 bits, 1 stop bit, no parity, fifo enabled. | |
94 | + */ | |
95 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL011_LCRH, | |
96 | + (UART_PL011_LCRH_WLEN_8 | UART_PL011_LCRH_FEN)); | |
97 | + | |
98 | + /* | |
99 | + ** Finally, enable the UART | |
100 | + */ | |
101 | + IO_WRITE(port[CONSOLE_PORT] + UART_PL011_CR, | |
102 | + (UART_PL011_CR_UARTEN | UART_PL011_CR_TXE | UART_PL011_CR_RXE)); | |
103 | + | |
104 | + return (0); | |
105 | +} | |
106 | + | |
107 | +void | |
108 | +serial_putc(const char c) | |
109 | +{ | |
110 | + if (c == '\n') | |
111 | + pl011_putc(CONSOLE_PORT, '\r'); | |
112 | + | |
113 | + pl011_putc(CONSOLE_PORT, c); | |
114 | +} | |
115 | + | |
116 | +void | |
117 | +serial_puts (const char *s) | |
118 | +{ | |
119 | + while (*s) { | |
120 | + serial_putc (*s++); | |
121 | + } | |
122 | +} | |
123 | + | |
124 | +int | |
125 | +serial_getc(void) | |
126 | +{ | |
127 | + return pl011_getc(CONSOLE_PORT); | |
128 | +} | |
129 | + | |
130 | +int | |
131 | +serial_tstc(void) | |
132 | +{ | |
133 | + return pl011_tstc(CONSOLE_PORT); | |
134 | +} | |
135 | + | |
136 | +void | |
137 | +serial_setbrg (void) | |
138 | +{ | |
139 | +} | |
140 | + | |
141 | +static void pl011_putc(int portnum, char c) | |
142 | +{ | |
143 | + /* Wait until there is space in the FIFO */ | |
144 | + while (IO_READ(port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_TXFF); | |
145 | + | |
146 | + /* Send the character */ | |
147 | + IO_WRITE(port[portnum] + UART_PL01x_DR, c); | |
148 | +} | |
149 | + | |
150 | +static int pl011_getc(int portnum) | |
151 | +{ | |
152 | + unsigned int data; | |
153 | + | |
154 | + /* Wait until there is data in the FIFO */ | |
155 | + while (IO_READ(port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_RXFE); | |
156 | + | |
157 | + data = IO_READ(port[portnum] + UART_PL01x_DR); | |
158 | + | |
159 | + /* Check for an error flag */ | |
160 | + if (data & 0xFFFFFF00) | |
161 | + { | |
162 | + /* Clear the error */ | |
163 | + IO_WRITE(port[portnum] + UART_PL01x_ECR, 0xFFFFFFFF); | |
164 | + return -1; | |
165 | + } | |
166 | + | |
167 | + return (int)data; | |
168 | +} | |
169 | + | |
170 | +static int pl011_tstc(int portnum) | |
171 | +{ | |
172 | + return !(IO_READ(port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_RXFE); | |
173 | +} | |
174 | + | |
175 | +#endif |
drivers/serial_pl011.h
1 | +/* | |
2 | + * (C) Copyright 2003, 2004 | |
3 | + * ARM Ltd. | |
4 | + * Philippe Robin, <philippe.robin@arm.com> | |
5 | + * | |
6 | + * See file CREDITS for list of people who contributed to this | |
7 | + * project. | |
8 | + * | |
9 | + * This program is free software; you can redistribute it and/or | |
10 | + * modify it under the terms of the GNU General Public License as | |
11 | + * published by the Free Software Foundation; either version 2 of | |
12 | + * the License, or (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program; if not, write to the Free Software | |
21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
22 | + * MA 02111-1307 USA | |
23 | + */ | |
24 | + | |
25 | +/* | |
26 | + * ARM PrimeCell UART's (PL010 & PL011) | |
27 | + * ------------------------------------ | |
28 | + * | |
29 | + * Definitions common to both PL010 & PL011 | |
30 | + * | |
31 | + */ | |
32 | +#define UART_PL01x_DR 0x00 /* Data read or written from the interface. */ | |
33 | +#define UART_PL01x_RSR 0x04 /* Receive status register (Read). */ | |
34 | +#define UART_PL01x_ECR 0x04 /* Error clear register (Write). */ | |
35 | +#define UART_PL01x_FR 0x18 /* Flag register (Read only). */ | |
36 | + | |
37 | +#define UART_PL01x_RSR_OE 0x08 | |
38 | +#define UART_PL01x_RSR_BE 0x04 | |
39 | +#define UART_PL01x_RSR_PE 0x02 | |
40 | +#define UART_PL01x_RSR_FE 0x01 | |
41 | + | |
42 | +#define UART_PL01x_FR_TXFE 0x80 | |
43 | +#define UART_PL01x_FR_RXFF 0x40 | |
44 | +#define UART_PL01x_FR_TXFF 0x20 | |
45 | +#define UART_PL01x_FR_RXFE 0x10 | |
46 | +#define UART_PL01x_FR_BUSY 0x08 | |
47 | +#define UART_PL01x_FR_TMSK (UART_PL01x_FR_TXFF + UART_PL01x_FR_BUSY) | |
48 | + | |
49 | +/* | |
50 | + * PL010 definitions | |
51 | + * | |
52 | + */ | |
53 | +#define UART_PL010_LCRH 0x08 /* Line control register, high byte. */ | |
54 | +#define UART_PL010_LCRM 0x0C /* Line control register, middle byte. */ | |
55 | +#define UART_PL010_LCRL 0x10 /* Line control register, low byte. */ | |
56 | +#define UART_PL010_CR 0x14 /* Control register. */ | |
57 | +#define UART_PL010_IIR 0x1C /* Interrupt indentification register (Read). */ | |
58 | +#define UART_PL010_ICR 0x1C /* Interrupt clear register (Write). */ | |
59 | +#define UART_PL010_ILPR 0x20 /* IrDA low power counter register. */ | |
60 | + | |
61 | +#define UART_PL010_CR_LPE (1 << 7) | |
62 | +#define UART_PL010_CR_RTIE (1 << 6) | |
63 | +#define UART_PL010_CR_TIE (1 << 5) | |
64 | +#define UART_PL010_CR_RIE (1 << 4) | |
65 | +#define UART_PL010_CR_MSIE (1 << 3) | |
66 | +#define UART_PL010_CR_IIRLP (1 << 2) | |
67 | +#define UART_PL010_CR_SIREN (1 << 1) | |
68 | +#define UART_PL010_CR_UARTEN (1 << 0) | |
69 | + | |
70 | +#define UART_PL010_LCRH_WLEN_8 (3 << 5) | |
71 | +#define UART_PL010_LCRH_WLEN_7 (2 << 5) | |
72 | +#define UART_PL010_LCRH_WLEN_6 (1 << 5) | |
73 | +#define UART_PL010_LCRH_WLEN_5 (0 << 5) | |
74 | +#define UART_PL010_LCRH_FEN (1 << 4) | |
75 | +#define UART_PL010_LCRH_STP2 (1 << 3) | |
76 | +#define UART_PL010_LCRH_EPS (1 << 2) | |
77 | +#define UART_PL010_LCRH_PEN (1 << 1) | |
78 | +#define UART_PL010_LCRH_BRK (1 << 0) | |
79 | + | |
80 | + | |
81 | +#define UART_PL010_BAUD_460800 1 | |
82 | +#define UART_PL010_BAUD_230400 3 | |
83 | +#define UART_PL010_BAUD_115200 7 | |
84 | +#define UART_PL010_BAUD_57600 15 | |
85 | +#define UART_PL010_BAUD_38400 23 | |
86 | +#define UART_PL010_BAUD_19200 47 | |
87 | +#define UART_PL010_BAUD_14400 63 | |
88 | +#define UART_PL010_BAUD_9600 95 | |
89 | +#define UART_PL010_BAUD_4800 191 | |
90 | +#define UART_PL010_BAUD_2400 383 | |
91 | +#define UART_PL010_BAUD_1200 767 | |
92 | +/* | |
93 | + * PL011 definitions | |
94 | + * | |
95 | + */ | |
96 | +#define UART_PL011_IBRD 0x24 | |
97 | +#define UART_PL011_FBRD 0x28 | |
98 | +#define UART_PL011_LCRH 0x2C | |
99 | +#define UART_PL011_CR 0x30 | |
100 | +#define UART_PL011_IMSC 0x38 | |
101 | +#define UART_PL011_PERIPH_ID0 0xFE0 | |
102 | + | |
103 | +#define UART_PL011_LCRH_SPS (1 << 7) | |
104 | +#define UART_PL011_LCRH_WLEN_8 (3 << 5) | |
105 | +#define UART_PL011_LCRH_WLEN_7 (2 << 5) | |
106 | +#define UART_PL011_LCRH_WLEN_6 (1 << 5) | |
107 | +#define UART_PL011_LCRH_WLEN_5 (0 << 5) | |
108 | +#define UART_PL011_LCRH_FEN (1 << 4) | |
109 | +#define UART_PL011_LCRH_STP2 (1 << 3) | |
110 | +#define UART_PL011_LCRH_EPS (1 << 2) | |
111 | +#define UART_PL011_LCRH_PEN (1 << 1) | |
112 | +#define UART_PL011_LCRH_BRK (1 << 0) | |
113 | + | |
114 | +#define UART_PL011_CR_CTSEN (1 << 15) | |
115 | +#define UART_PL011_CR_RTSEN (1 << 14) | |
116 | +#define UART_PL011_CR_OUT2 (1 << 13) | |
117 | +#define UART_PL011_CR_OUT1 (1 << 12) | |
118 | +#define UART_PL011_CR_RTS (1 << 11) | |
119 | +#define UART_PL011_CR_DTR (1 << 10) | |
120 | +#define UART_PL011_CR_RXE (1 << 9) | |
121 | +#define UART_PL011_CR_TXE (1 << 8) | |
122 | +#define UART_PL011_CR_LPE (1 << 7) | |
123 | +#define UART_PL011_CR_IIRLP (1 << 2) | |
124 | +#define UART_PL011_CR_SIREN (1 << 1) | |
125 | +#define UART_PL011_CR_UARTEN (1 << 0) | |
126 | + | |
127 | +#define UART_PL011_IMSC_OEIM (1 << 10) | |
128 | +#define UART_PL011_IMSC_BEIM (1 << 9) | |
129 | +#define UART_PL011_IMSC_PEIM (1 << 8) | |
130 | +#define UART_PL011_IMSC_FEIM (1 << 7) | |
131 | +#define UART_PL011_IMSC_RTIM (1 << 6) | |
132 | +#define UART_PL011_IMSC_TXIM (1 << 5) | |
133 | +#define UART_PL011_IMSC_RXIM (1 << 4) | |
134 | +#define UART_PL011_IMSC_DSRMIM (1 << 3) | |
135 | +#define UART_PL011_IMSC_DCDMIM (1 << 2) | |
136 | +#define UART_PL011_IMSC_CTSMIM (1 << 1) | |
137 | +#define UART_PL011_IMSC_RIMIM (1 << 0) |
drivers/smc91111.c
... | ... | @@ -1313,7 +1313,6 @@ |
1313 | 1313 | #if SMC_DEBUG > 2 |
1314 | 1314 | static void print_packet( byte * buf, int length ) |
1315 | 1315 | { |
1316 | -#if 0 | |
1317 | 1316 | int i; |
1318 | 1317 | int remainder; |
1319 | 1318 | int lines; |
... | ... | @@ -1345,7 +1344,6 @@ |
1345 | 1344 | } |
1346 | 1345 | printf("\n"); |
1347 | 1346 | #endif |
1348 | -#endif | |
1349 | 1347 | } |
1350 | 1348 | #endif |
1351 | 1349 | |
1352 | 1350 | |
1353 | 1351 | |
1354 | 1352 | |
... | ... | @@ -1423,28 +1421,26 @@ |
1423 | 1421 | } |
1424 | 1422 | memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */ |
1425 | 1423 | smc_set_mac_addr (v_mac); /* use old function to update smc default */ |
1424 | + PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1], | |
1425 | + v_mac[2], v_mac[3], v_mac[4], v_mac[5]); | |
1426 | 1426 | return (0); |
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | int get_rom_mac (char *v_rom_mac) |
1430 | 1430 | { |
1431 | - int is_rom_present = 0; | |
1432 | - | |
1433 | 1431 | #ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */ |
1434 | 1432 | char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 }; |
1435 | 1433 | |
1436 | 1434 | memcpy (v_rom_mac, hw_mac_addr, 6); |
1437 | 1435 | return (1); |
1438 | 1436 | #else |
1439 | - if (is_rom_present) { | |
1440 | - /* if eeprom contents are valid | |
1441 | - * extract mac address into hw_mac_addr, 8 or 16 bit accesses | |
1442 | - * memcpy (v_rom_mac, hc_mac_addr, 6); | |
1443 | - * return(1); | |
1444 | - */ | |
1437 | + int i; | |
1438 | + SMC_SELECT_BANK (1); | |
1439 | + for (i=0; i<6; i++) | |
1440 | + { | |
1441 | + v_rom_mac[i] = SMC_inb (ADDR0_REG + i); | |
1445 | 1442 | } |
1446 | - memset (v_rom_mac, 0, 6); | |
1447 | - return (0); | |
1443 | + return (1); | |
1448 | 1444 | #endif |
1449 | 1445 | } |
1450 | 1446 | #endif /* CONFIG_DRIVER_SMC91111 */ |
include/configs/integratorap.h
1 | +/* | |
2 | + * (C) Copyright 2003 | |
3 | + * Texas Instruments. | |
4 | + * Kshitij Gupta <kshitij@ti.com> | |
5 | + * Configuation settings for the TI OMAP Innovator board. | |
6 | + * | |
7 | + * (C) Copyright 2004 | |
8 | + * ARM Ltd. | |
9 | + * Philippe Robin, <philippe.robin@arm.com> | |
10 | + * Configuration for Integrator AP board. | |
11 | + *. | |
12 | + * See file CREDITS for list of people who contributed to this | |
13 | + * project. | |
14 | + * | |
15 | + * This program is free software; you can redistribute it and/or | |
16 | + * modify it under the terms of the GNU General Public License as | |
17 | + * published by the Free Software Foundation; either version 2 of | |
18 | + * the License, or (at your option) any later version. | |
19 | + * | |
20 | + * This program is distributed in the hope that it will be useful, | |
21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | + * GNU General Public License for more details. | |
24 | + * | |
25 | + * You should have received a copy of the GNU General Public License | |
26 | + * along with this program; if not, write to the Free Software | |
27 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
28 | + * MA 02111-1307 USA | |
29 | + */ | |
30 | + | |
31 | +#ifndef __CONFIG_H | |
32 | +#define __CONFIG_H | |
33 | + | |
34 | +/* | |
35 | + * High Level Configuration Options | |
36 | + * (easy to change) | |
37 | + */ | |
38 | +#define CONFIG_ARM926EJS 1 /* This is an arm926ejs CPU core */ | |
39 | +#define CONFIG_INTEGRATOR 1 /* in an Integrator board */ | |
40 | +#define CONFIG_ARCH_CINTEGRATOR 1 /* Specifically, a CP */ | |
41 | + | |
42 | + | |
43 | +#define CFG_MEMTEST_START 0x100000 | |
44 | +#define CFG_MEMTEST_END 0x10000000 | |
45 | +#define CFG_HZ (1000000 / 256) /* Timer 1 is clocked at 1Mhz, with 256 divider */ | |
46 | +#define CFG_TIMERBASE 0x13000100 | |
47 | + | |
48 | +#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ | |
49 | +#define CONFIG_SETUP_MEMORY_TAGS 1 | |
50 | +#define CONFIG_MISC_INIT_R 1 /* call misc_init_r during start up */ | |
51 | +/* | |
52 | + * Size of malloc() pool | |
53 | + */ | |
54 | +#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) | |
55 | + | |
56 | +/* | |
57 | + * PL010 Configuration | |
58 | + */ | |
59 | +#define CFG_PL010_SERIAL | |
60 | +#define CONFIG_CONS_INDEX 0 | |
61 | +#define CONFIG_BAUDRATE 38400 | |
62 | +#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } | |
63 | +#define CFG_SERIAL0 0x16000000 | |
64 | +#define CFG_SERIAL1 0x17000000 | |
65 | + | |
66 | +//#define CONFIG_COMMANDS (CFG_CMD_DHCP | CFG_CMD_IMI | CFG_CMD_NET | CFG_CMD_PING | CFG_CMD_BDI | CFG_CMD_PCI) | |
67 | +//#define CONFIG_NET_MULTI | |
68 | +//#define CONFIG_BOOTP_MASK CONFIG_BOOTP_DEFAULT | |
69 | + | |
70 | +#define CONFIG_COMMANDS (CFG_CMD_IMI | CFG_CMD_BDI | CFG_CMD_MEMORY) | |
71 | + | |
72 | + | |
73 | +/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ | |
74 | +#include <cmd_confdefs.h> | |
75 | + | |
76 | +#define CONFIG_BOOTDELAY 2 | |
77 | +#define CONFIG_BOOTARGS "root=/dev/mtdblock0 mem=32M console=ttyAM0 console=tty" | |
78 | +#define CONFIG_BOOTCOMMAND "" | |
79 | + | |
80 | +/* | |
81 | + * Miscellaneous configurable options | |
82 | + */ | |
83 | +#define CFG_LONGHELP /* undef to save memory */ | |
84 | +#define CFG_PROMPT "Integrator-AP # " /* Monitor Command Prompt */ | |
85 | +#define CFG_CBSIZE 256 /* Console I/O Buffer Size */ | |
86 | +/* Print Buffer Size */ | |
87 | +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) | |
88 | +#define CFG_MAXARGS 16 /* max number of command args */ | |
89 | +#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ | |
90 | + | |
91 | +#undef CFG_CLKS_IN_HZ /* everything, incl board info, in Hz */ | |
92 | +#define CFG_LOAD_ADDR 0x7fc0 /* default load address */ | |
93 | + | |
94 | +/*----------------------------------------------------------------------- | |
95 | + * Stack sizes | |
96 | + * | |
97 | + * The stack sizes are set up in start.S using the settings below | |
98 | + */ | |
99 | +#define CONFIG_STACKSIZE (128*1024) /* regular stack */ | |
100 | +#ifdef CONFIG_USE_IRQ | |
101 | +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ | |
102 | +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ | |
103 | +#endif | |
104 | + | |
105 | +/*----------------------------------------------------------------------- | |
106 | + * Physical Memory Map | |
107 | + */ | |
108 | +#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ | |
109 | +#define PHYS_SDRAM_1 0x00000000 /* SDRAM Bank #1 */ | |
110 | +#define PHYS_SDRAM_1_SIZE 0x02000000 /* 32 MB */ | |
111 | + | |
112 | +#define CFG_FLASH_BASE 0x24000000 | |
113 | + | |
114 | +/*----------------------------------------------------------------------- | |
115 | + * FLASH and environment organization | |
116 | + */ | |
117 | +#define CFG_ENV_IS_NOWHERE | |
118 | +#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ | |
119 | +#define PHYS_FLASH_SIZE 0x01000000 /* 16MB */ | |
120 | +/* timeout values are in ticks */ | |
121 | +#define CFG_FLASH_ERASE_TOUT (20*CFG_HZ) /* Timeout for Flash Erase */ | |
122 | +#define CFG_FLASH_WRITE_TOUT (20*CFG_HZ) /* Timeout for Flash Write */ | |
123 | +#define CFG_MAX_FLASH_SECT 128 | |
124 | +#define CFG_ENV_SIZE 32768 | |
125 | + | |
126 | +#define PHYS_FLASH_1 (CFG_FLASH_BASE) | |
127 | + | |
128 | +/*----------------------------------------------------------------------- | |
129 | + * PCI definitions | |
130 | + */ | |
131 | + | |
132 | +//#define CONFIG_PCI /* include pci support */ | |
133 | +#undef CONFIG_PCI_PNP | |
134 | +#define CONFIG_PCI_SCAN_SHOW 1 /* show pci devices on startup */ | |
135 | +#define DEBUG | |
136 | + | |
137 | +#define CONFIG_EEPRO100 | |
138 | +#define CFG_RX_ETH_BUFFER 8 /* use 8 rx buffer on eepro100 */ | |
139 | + | |
140 | + | |
141 | +#define INTEGRATOR_BOOT_ROM_BASE 0x20000000 | |
142 | +#define INTEGRATOR_HDR0_SDRAM_BASE 0x80000000 | |
143 | + | |
144 | +// PCI Base area | |
145 | +#define INTEGRATOR_PCI_BASE 0x40000000 | |
146 | +#define INTEGRATOR_PCI_SIZE 0x3FFFFFFF | |
147 | + | |
148 | +// memory map as seen by the CPU on the local bus | |
149 | +#define CPU_PCI_IO_ADRS 0x60000000 // PCI I/O space base | |
150 | +#define CPU_PCI_IO_SIZE 0x10000 | |
151 | + | |
152 | +#define CPU_PCI_CNFG_ADRS 0x61000000 // PCI config space | |
153 | +#define CPU_PCI_CNFG_SIZE 0x1000000 | |
154 | + | |
155 | +#define PCI_MEM_BASE 0x40000000 // 512M to xxx | |
156 | +// unused 256M from A0000000-AFFFFFFF might be used for I2O ??? | |
157 | +#define INTEGRATOR_PCI_IO_BASE 0x60000000 // 16M to xxx | |
158 | +// unused (128-16)M from B1000000-B7FFFFFF | |
159 | +#define PCI_CONFIG_BASE 0x61000000 // 16M to xxx | |
160 | +// unused ((128-16)M - 64K) from XXX | |
161 | + | |
162 | +#define PCI_V3_BASE 0x62000000 | |
163 | + | |
164 | +// V3 PCI bridge controller | |
165 | +#define V3_BASE 0x62000000 // V360EPC registers | |
166 | + | |
167 | +#define PCI_ENET0_IOADDR (CPU_PCI_IO_ADRS) | |
168 | +#define PCI_ENET0_MEMADDR (PCI_MEM_BASE) | |
169 | + | |
170 | + | |
171 | +#define V3_PCI_VENDOR 0x00000000 | |
172 | +#define V3_PCI_DEVICE 0x00000002 | |
173 | +#define V3_PCI_CMD 0x00000004 | |
174 | +#define V3_PCI_STAT 0x00000006 | |
175 | +#define V3_PCI_CC_REV 0x00000008 | |
176 | +#define V3_PCI_HDR_CF 0x0000000C | |
177 | +#define V3_PCI_IO_BASE 0x00000010 | |
178 | +#define V3_PCI_BASE0 0x00000014 | |
179 | +#define V3_PCI_BASE1 0x00000018 | |
180 | +#define V3_PCI_SUB_VENDOR 0x0000002C | |
181 | +#define V3_PCI_SUB_ID 0x0000002E | |
182 | +#define V3_PCI_ROM 0x00000030 | |
183 | +#define V3_PCI_BPARAM 0x0000003C | |
184 | +#define V3_PCI_MAP0 0x00000040 | |
185 | +#define V3_PCI_MAP1 0x00000044 | |
186 | +#define V3_PCI_INT_STAT 0x00000048 | |
187 | +#define V3_PCI_INT_CFG 0x0000004C | |
188 | +#define V3_LB_BASE0 0x00000054 | |
189 | +#define V3_LB_BASE1 0x00000058 | |
190 | +#define V3_LB_MAP0 0x0000005E | |
191 | +#define V3_LB_MAP1 0x00000062 | |
192 | +#define V3_LB_BASE2 0x00000064 | |
193 | +#define V3_LB_MAP2 0x00000066 | |
194 | +#define V3_LB_SIZE 0x00000068 | |
195 | +#define V3_LB_IO_BASE 0x0000006E | |
196 | +#define V3_FIFO_CFG 0x00000070 | |
197 | +#define V3_FIFO_PRIORITY 0x00000072 | |
198 | +#define V3_FIFO_STAT 0x00000074 | |
199 | +#define V3_LB_ISTAT 0x00000076 | |
200 | +#define V3_LB_IMASK 0x00000077 | |
201 | +#define V3_SYSTEM 0x00000078 | |
202 | +#define V3_LB_CFG 0x0000007A | |
203 | +#define V3_PCI_CFG 0x0000007C | |
204 | +#define V3_DMA_PCI_ADR0 0x00000080 | |
205 | +#define V3_DMA_PCI_ADR1 0x00000090 | |
206 | +#define V3_DMA_LOCAL_ADR0 0x00000084 | |
207 | +#define V3_DMA_LOCAL_ADR1 0x00000094 | |
208 | +#define V3_DMA_LENGTH0 0x00000088 | |
209 | +#define V3_DMA_LENGTH1 0x00000098 | |
210 | +#define V3_DMA_CSR0 0x0000008B | |
211 | +#define V3_DMA_CSR1 0x0000009B | |
212 | +#define V3_DMA_CTLB_ADR0 0x0000008C | |
213 | +#define V3_DMA_CTLB_ADR1 0x0000009C | |
214 | +#define V3_DMA_DELAY 0x000000E0 | |
215 | +#define V3_MAIL_DATA 0x000000C0 | |
216 | +#define V3_PCI_MAIL_IEWR 0x000000D0 | |
217 | +#define V3_PCI_MAIL_IERD 0x000000D2 | |
218 | +#define V3_LB_MAIL_IEWR 0x000000D4 | |
219 | +#define V3_LB_MAIL_IERD 0x000000D6 | |
220 | +#define V3_MAIL_WR_STAT 0x000000D8 | |
221 | +#define V3_MAIL_RD_STAT 0x000000DA | |
222 | +#define V3_QBA_MAP 0x000000DC | |
223 | + | |
224 | +// SYSTEM register bits | |
225 | +#define V3_SYSTEM_M_RST_OUT (1 << 15) | |
226 | +#define V3_SYSTEM_M_LOCK (1 << 14) | |
227 | + | |
228 | +// PCI_CFG bits | |
229 | +#define V3_PCI_CFG_M_RETRY_EN (1 << 10) | |
230 | +#define V3_PCI_CFG_M_AD_LOW1 (1 << 9) | |
231 | +#define V3_PCI_CFG_M_AD_LOW0 (1 << 8) | |
232 | + | |
233 | +// PCI MAP register bits (PCI -> Local bus) | |
234 | +#define V3_PCI_MAP_M_MAP_ADR 0xFFF00000 | |
235 | +#define V3_PCI_MAP_M_RD_POST_INH (1 << 15) | |
236 | +#define V3_PCI_MAP_M_ROM_SIZE (1 << 11 | 1 << 10) | |
237 | +#define V3_PCI_MAP_M_SWAP (1 << 9 | 1 << 8) | |
238 | +#define V3_PCI_MAP_M_ADR_SIZE 0x000000F0 | |
239 | +#define V3_PCI_MAP_M_REG_EN (1 << 1) | |
240 | +#define V3_PCI_MAP_M_ENABLE (1 << 0) | |
241 | + | |
242 | +// 9 => 512M window size | |
243 | +#define V3_PCI_MAP_M_ADR_SIZE_512M 0x00000090 | |
244 | + | |
245 | +// A => 1024M window size | |
246 | +#define V3_PCI_MAP_M_ADR_SIZE_1024M 0x000000A0 | |
247 | + | |
248 | +// LB_BASE register bits (Local bus -> PCI) | |
249 | +#define V3_LB_BASE_M_MAP_ADR 0xFFF00000 | |
250 | +#define V3_LB_BASE_M_SWAP (1 << 8 | 1 << 9) | |
251 | +#define V3_LB_BASE_M_ADR_SIZE 0x000000F0 | |
252 | +#define V3_LB_BASE_M_PREFETCH (1 << 3) | |
253 | +#define V3_LB_BASE_M_ENABLE (1 << 0) | |
254 | + | |
255 | +// PCI COMMAND REGISTER bits | |
256 | +#define V3_COMMAND_M_FBB_EN (1 << 9) | |
257 | +#define V3_COMMAND_M_SERR_EN (1 << 8) | |
258 | +#define V3_COMMAND_M_PAR_EN (1 << 6) | |
259 | +#define V3_COMMAND_M_MASTER_EN (1 << 2) | |
260 | +#define V3_COMMAND_M_MEM_EN (1 << 1) | |
261 | +#define V3_COMMAND_M_IO_EN (1 << 0) | |
262 | + | |
263 | +#define INTEGRATOR_SC_BASE 0x11000000 | |
264 | +#define INTEGRATOR_SC_PCIENABLE_OFFSET 0x18 | |
265 | +#define INTEGRATOR_SC_PCIENABLE \ | |
266 | + (INTEGRATOR_SC_BASE + INTEGRATOR_SC_PCIENABLE_OFFSET) | |
267 | + | |
268 | + | |
269 | +#endif /* __CONFIG_H */ |
include/configs/integratorcp.h
1 | +/* | |
2 | + * (C) Copyright 2003 | |
3 | + * Texas Instruments. | |
4 | + * Kshitij Gupta <kshitij@ti.com> | |
5 | + * Configuation settings for the TI OMAP Innovator board. | |
6 | + * | |
7 | + * (C) Copyright 2004 | |
8 | + * ARM Ltd. | |
9 | + * Philippe Robin, <philippe.robin@arm.com> | |
10 | + * Configuration for Compact Integrator board. | |
11 | + * | |
12 | + * See file CREDITS for list of people who contributed to this | |
13 | + * project. | |
14 | + * | |
15 | + * This program is free software; you can redistribute it and/or | |
16 | + * modify it under the terms of the GNU General Public License as | |
17 | + * published by the Free Software Foundation; either version 2 of | |
18 | + * the License, or (at your option) any later version. | |
19 | + * | |
20 | + * This program is distributed in the hope that it will be useful, | |
21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | + * GNU General Public License for more details. | |
24 | + * | |
25 | + * You should have received a copy of the GNU General Public License | |
26 | + * along with this program; if not, write to the Free Software | |
27 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
28 | + * MA 02111-1307 USA | |
29 | + */ | |
30 | + | |
31 | +#ifndef __CONFIG_H | |
32 | +#define __CONFIG_H | |
33 | + | |
34 | +/* | |
35 | + * High Level Configuration Options | |
36 | + * (easy to change) | |
37 | + */ | |
38 | +#define CONFIG_ARM926EJS 1 /* This is an arm926ejs CPU core */ | |
39 | +#define CONFIG_INTEGRATOR 1 /* in an Integrator board */ | |
40 | +#define CONFIG_ARCH_CINTEGRATOR 1 /* Specifically, a CP */ | |
41 | + | |
42 | + | |
43 | +#define CFG_MEMTEST_START 0x100000 | |
44 | +#define CFG_MEMTEST_END 0x10000000 | |
45 | +#define CFG_HZ (1000000 / 256) /* Timer 1 is clocked at 1Mhz, with 256 divider */ | |
46 | +#define CFG_TIMERBASE 0x13000100 | |
47 | + | |
48 | +#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ | |
49 | +#define CONFIG_SETUP_MEMORY_TAGS 1 | |
50 | +#define CONFIG_MISC_INIT_R 1 /* call misc_init_r during start up */ | |
51 | +/* | |
52 | + * Size of malloc() pool | |
53 | + */ | |
54 | +#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) | |
55 | + | |
56 | +/* | |
57 | + * Hardware drivers | |
58 | + */ | |
59 | +#define CONFIG_DRIVER_SMC91111 | |
60 | +#define CONFIG_SMC_USE_32_BIT | |
61 | +#define CONFIG_SMC91111_BASE 0xC8000000 | |
62 | +#undef CONFIG_SMC91111_EXT_PHY | |
63 | + | |
64 | +/* | |
65 | + * NS16550 Configuration | |
66 | + */ | |
67 | +#define CFG_PL011_SERIAL | |
68 | +#define CONFIG_CONS_INDEX 0 | |
69 | +#define CONFIG_BAUDRATE 38400 | |
70 | +#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } | |
71 | +#define CFG_SERIAL0 0x16000000 | |
72 | +#define CFG_SERIAL1 0x17000000 | |
73 | + | |
74 | +#define CONFIG_COMMANDS (CFG_CMD_DHCP | CFG_CMD_IMI | CFG_CMD_NET | CFG_CMD_PING | CFG_CMD_BDI | CFG_CMD_MEMORY) | |
75 | +#define CONFIG_BOOTP_MASK CONFIG_BOOTP_DEFAULT | |
76 | + | |
77 | +/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ | |
78 | +#include <cmd_confdefs.h> | |
79 | + | |
80 | +#define CONFIG_BOOTDELAY 2 | |
81 | +#define CONFIG_BOOTARGS "root=/dev/nfs mem=128M ip=dhcp netdev=27,0,0xfc800000,0xfc800010,eth0" | |
82 | +#define CONFIG_BOOTCOMMAND "bootp ; bootm" | |
83 | + | |
84 | +/* | |
85 | + * Miscellaneous configurable options | |
86 | + */ | |
87 | +#define CFG_LONGHELP /* undef to save memory */ | |
88 | +#define CFG_PROMPT "Integrator-CP # " /* Monitor Command Prompt */ | |
89 | +#define CFG_CBSIZE 256 /* Console I/O Buffer Size */ | |
90 | +/* Print Buffer Size */ | |
91 | +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) | |
92 | +#define CFG_MAXARGS 16 /* max number of command args */ | |
93 | +#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ | |
94 | + | |
95 | +#undef CFG_CLKS_IN_HZ /* everything, incl board info, in Hz */ | |
96 | +#define CFG_LOAD_ADDR 0x7fc0 /* default load address */ | |
97 | + | |
98 | +/*----------------------------------------------------------------------- | |
99 | + * Stack sizes | |
100 | + * | |
101 | + * The stack sizes are set up in start.S using the settings below | |
102 | + */ | |
103 | +#define CONFIG_STACKSIZE (128*1024) /* regular stack */ | |
104 | +#ifdef CONFIG_USE_IRQ | |
105 | +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ | |
106 | +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ | |
107 | +#endif | |
108 | + | |
109 | +/*----------------------------------------------------------------------- | |
110 | + * Physical Memory Map | |
111 | + */ | |
112 | +#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ | |
113 | +#define PHYS_SDRAM_1 0x00000000 /* SDRAM Bank #1 */ | |
114 | +#define PHYS_SDRAM_1_SIZE 0x02000000 /* 32 MB */ | |
115 | + | |
116 | +#define CFG_FLASH_BASE 0x24000000 | |
117 | +#define PHYS_FLASH_1 (CFG_FLASH_BASE) | |
118 | + | |
119 | +/*----------------------------------------------------------------------- | |
120 | + * FLASH and environment organization | |
121 | + */ | |
122 | +#define CFG_ENV_IS_NOWHERE | |
123 | +#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ | |
124 | +#define PHYS_FLASH_SIZE 0x01000000 /* 16MB */ | |
125 | +/* timeout values are in ticks */ | |
126 | +#define CFG_FLASH_ERASE_TOUT (20*CFG_HZ) /* Timeout for Flash Erase */ | |
127 | +#define CFG_FLASH_WRITE_TOUT (20*CFG_HZ) /* Timeout for Flash Write */ | |
128 | +#define CFG_MAX_FLASH_SECT 128 | |
129 | +#define CFG_ENV_SIZE 32768 | |
130 | + | |
131 | +#endif /* __CONFIG_H */ |
include/configs/versatile.h
1 | +/* | |
2 | + * (C) Copyright 2003 | |
3 | + * Texas Instruments. | |
4 | + * Kshitij Gupta <kshitij@ti.com> | |
5 | + * Configuation settings for the TI OMAP Innovator board. | |
6 | + * | |
7 | + * (C) Copyright 2004 | |
8 | + * ARM Ltd. | |
9 | + * Philippe Robin, <philippe.robin@arm.com> | |
10 | + * Configuration for Versatile PB. | |
11 | + * | |
12 | + * See file CREDITS for list of people who contributed to this | |
13 | + * project. | |
14 | + * | |
15 | + * This program is free software; you can redistribute it and/or | |
16 | + * modify it under the terms of the GNU General Public License as | |
17 | + * published by the Free Software Foundation; either version 2 of | |
18 | + * the License, or (at your option) any later version. | |
19 | + * | |
20 | + * This program is distributed in the hope that it will be useful, | |
21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | + * GNU General Public License for more details. | |
24 | + * | |
25 | + * You should have received a copy of the GNU General Public License | |
26 | + * along with this program; if not, write to the Free Software | |
27 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
28 | + * MA 02111-1307 USA | |
29 | + */ | |
30 | + | |
31 | +#ifndef __CONFIG_H | |
32 | +#define __CONFIG_H | |
33 | + | |
34 | +/* | |
35 | + * High Level Configuration Options | |
36 | + * (easy to change) | |
37 | + */ | |
38 | +#define CONFIG_ARM926EJS 1 /* This is an arm926ejs CPU core */ | |
39 | +#define CONFIG_VERSATILE 1 /* in Versatile Platform Board */ | |
40 | +#define CONFIG_ARCH_VERSATILE 1 /* Specifically, a Versatile */ | |
41 | + | |
42 | + | |
43 | +#define CFG_MEMTEST_START 0x100000 | |
44 | +#define CFG_MEMTEST_END 0x10000000 | |
45 | +#define CFG_HZ (1000000 / 256) | |
46 | +#define CFG_TIMERBASE 0x101E2000 /* Timer 0 and 1 base */ | |
47 | + | |
48 | +#define CFG_TIMER_INTERVAL 10000 | |
49 | +#define CFG_TIMER_RELOAD (CFG_TIMER_INTERVAL >> 4) /* Divide by 16 */ | |
50 | +#define CFG_TIMER_CTRL 0x84 /* Enable, Clock / 16 */ | |
51 | + | |
52 | +/* | |
53 | + * control registers | |
54 | + */ | |
55 | +#define VERSATILE_SCTL_BASE 0x101E0000 /* System controller */ | |
56 | + | |
57 | +/* | |
58 | + * System controller bit assignment | |
59 | + */ | |
60 | +#define VERSATILE_REFCLK 0 | |
61 | +#define VERSATILE_TIMCLK 1 | |
62 | + | |
63 | +#define VERSATILE_TIMER1_EnSel 15 | |
64 | +#define VERSATILE_TIMER2_EnSel 17 | |
65 | +#define VERSATILE_TIMER3_EnSel 19 | |
66 | +#define VERSATILE_TIMER4_EnSel 21 | |
67 | + | |
68 | +#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ | |
69 | +#define CONFIG_SETUP_MEMORY_TAGS 1 | |
70 | +#define CONFIG_MISC_INIT_R 1 /* call misc_init_r during start up */ | |
71 | +/* | |
72 | + * Size of malloc() pool | |
73 | + */ | |
74 | +#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) | |
75 | + | |
76 | +/* | |
77 | + * Hardware drivers | |
78 | + */ | |
79 | + | |
80 | +#define CONFIG_DRIVER_SMC91111 | |
81 | +#define CONFIG_SMC_USE_32_BIT | |
82 | +#define CONFIG_SMC91111_BASE 0x10010000 | |
83 | +#undef CONFIG_SMC91111_EXT_PHY | |
84 | + | |
85 | +/* | |
86 | + * NS16550 Configuration | |
87 | + */ | |
88 | +#define CFG_PL011_SERIAL | |
89 | +#define CONFIG_CONS_INDEX 0 | |
90 | +#define CONFIG_BAUDRATE 38400 | |
91 | +#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } | |
92 | +#define CFG_SERIAL0 0x101F1000 | |
93 | +#define CFG_SERIAL1 0x101F2000 | |
94 | + | |
95 | +#define CONFIG_COMMANDS (CFG_CMD_DHCP | CFG_CMD_IMI | CFG_CMD_NET | CFG_CMD_PING | CFG_CMD_BDI | CFG_CMD_MEMORY) | |
96 | + | |
97 | +//#define CONFIG_COMMANDS (CFG_CMD_IMI | CFG_CMD_BDI | CFG_CMD_MEMORY) | |
98 | + | |
99 | +#define CONFIG_BOOTP_MASK CONFIG_BOOTP_DEFAULT | |
100 | + | |
101 | +/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ | |
102 | +#include <cmd_confdefs.h> | |
103 | + | |
104 | +#define CONFIG_BOOTDELAY 2 | |
105 | +#define CONFIG_BOOTARGS "root=/dev/nfs mem=128M ip=dhcp netdev=27,0,0xfc800000,0xfc800010,eth0" | |
106 | +//#define CONFIG_BOOTCOMMAND "bootp ; bootm" | |
107 | + | |
108 | +/* | |
109 | + * Static configuration when assigning fixed address | |
110 | + */ | |
111 | +//#define CONFIG_NETMASK 255.255.255.0 /* talk on MY local net */ | |
112 | +//#define CONFIG_IPADDR xx.xx.xx.xx /* static IP I currently own */ | |
113 | +//#define CONFIG_SERVERIP xx.xx.xx.xx /* current IP of my dev pc */ | |
114 | +#define CONFIG_BOOTFILE "/tftpboot/uImage" /* file to load */ | |
115 | + | |
116 | + | |
117 | +/* | |
118 | + * Miscellaneous configurable options | |
119 | + */ | |
120 | +#define CFG_LONGHELP /* undef to save memory */ | |
121 | +#define CFG_PROMPT "Versatile # " /* Monitor Command Prompt */ | |
122 | +#define CFG_CBSIZE 256 /* Console I/O Buffer Size */ | |
123 | +/* Print Buffer Size */ | |
124 | +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) | |
125 | +#define CFG_MAXARGS 16 /* max number of command args */ | |
126 | +#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ | |
127 | + | |
128 | +#undef CFG_CLKS_IN_HZ /* everything, incl board info, in Hz */ | |
129 | +#define CFG_LOAD_ADDR 0x7fc0 /* default load address */ | |
130 | + | |
131 | +/*----------------------------------------------------------------------- | |
132 | + * Stack sizes | |
133 | + * | |
134 | + * The stack sizes are set up in start.S using the settings below | |
135 | + */ | |
136 | +#define CONFIG_STACKSIZE (128*1024) /* regular stack */ | |
137 | +#ifdef CONFIG_USE_IRQ | |
138 | +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ | |
139 | +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ | |
140 | +#endif | |
141 | + | |
142 | +/*----------------------------------------------------------------------- | |
143 | + * Physical Memory Map | |
144 | + */ | |
145 | +#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ | |
146 | +#define PHYS_SDRAM_1 0x00000000 /* SDRAM Bank #1 */ | |
147 | +#define PHYS_SDRAM_1_SIZE 0x08000000 /* 128 MB */ | |
148 | + | |
149 | +#define CFG_FLASH_BASE 0x34000000 | |
150 | + | |
151 | +/*----------------------------------------------------------------------- | |
152 | + * FLASH and environment organization | |
153 | + */ | |
154 | +#define CFG_ENV_IS_NOWHERE | |
155 | +#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ | |
156 | +#define PHYS_FLASH_SIZE 0x34000000 /* 64MB */ | |
157 | +/* timeout values are in ticks */ | |
158 | +#define CFG_FLASH_ERASE_TOUT (20*CFG_HZ) /* Timeout for Flash Erase */ | |
159 | +#define CFG_FLASH_WRITE_TOUT (20*CFG_HZ) /* Timeout for Flash Write */ | |
160 | +#define CFG_MAX_FLASH_SECT 128 | |
161 | +#define CFG_ENV_SIZE 32768 | |
162 | + | |
163 | +#define PHYS_FLASH_1 (CFG_FLASH_BASE) | |
164 | + | |
165 | +#endif /* __CONFIG_H */ |
net/bootp.c
... | ... | @@ -117,10 +117,15 @@ |
117 | 117 | */ |
118 | 118 | static void BootpCopyNetParams(Bootp_t *bp) |
119 | 119 | { |
120 | + IPaddr_t tmp_ip; | |
121 | + | |
120 | 122 | NetCopyIP(&NetOurIP, &bp->bp_yiaddr); |
121 | - NetCopyIP(&NetServerIP, &bp->bp_siaddr); | |
123 | + NetCopyIP(&tmp_ip, &bp->bp_siaddr); | |
124 | + if (tmp_ip != 0) | |
125 | + NetCopyIP(&NetServerIP, &bp->bp_siaddr); | |
122 | 126 | memcpy (NetServerEther, ((Ethernet_t *)NetRxPkt)->et_src, 6); |
123 | - copy_filename (BootFile, bp->bp_file, sizeof(BootFile)); | |
127 | + if (strlen(bp->bp_file) > 0) | |
128 | + copy_filename (BootFile, bp->bp_file, sizeof(BootFile)); | |
124 | 129 | |
125 | 130 | debug ("Bootfile: %s\n", BootFile); |
126 | 131 |
net/net.c
... | ... | @@ -323,7 +323,7 @@ |
323 | 323 | * IP addr assigned to us by the BOOTP / RARP server |
324 | 324 | */ |
325 | 325 | NetOurIP = 0; |
326 | - NetServerIP = 0; | |
326 | + NetServerIP = getenv_IPaddr ("serverip"); | |
327 | 327 | break; |
328 | 328 | default: |
329 | 329 | break; |
... | ... | @@ -354,7 +354,7 @@ |
354 | 354 | case DHCP: |
355 | 355 | /* Start with a clean slate... */ |
356 | 356 | NetOurIP = 0; |
357 | - NetServerIP = 0; | |
357 | + NetServerIP = getenv_IPaddr ("serverip"); | |
358 | 358 | DhcpRequest(); /* Basically same as BOOTP */ |
359 | 359 | break; |
360 | 360 | #endif /* CFG_CMD_DHCP */ |
... | ... | @@ -832,7 +832,8 @@ |
832 | 832 | printf("invalid RARP header\n"); |
833 | 833 | } else { |
834 | 834 | NetCopyIP(&NetOurIP, &arp->ar_data[16]); |
835 | - NetCopyIP(&NetServerIP, &arp->ar_data[ 6]); | |
835 | + if (NetServerIP == 0) | |
836 | + NetCopyIP(&NetServerIP, &arp->ar_data[ 6]); | |
836 | 837 | memcpy (NetServerEther, &arp->ar_data[ 0], 6); |
837 | 838 | |
838 | 839 | (*packetHandler)(0,0,0,0); |