5b0859c3be6b19621aeb496f63562d602b054228
[openwrt/svn-archive/archive.git] / package / uboot-ifxmips / patches / 100-ifx.patch
1 Index: u-boot-1.1.5/Makefile
2 ===================================================================
3 --- u-boot-1.1.5.orig/Makefile 2006-10-20 17:54:33.000000000 +0200
4 +++ u-boot-1.1.5/Makefile 2009-11-09 16:35:03.000000000 +0100
5 @@ -24,7 +24,7 @@
6 VERSION = 1
7 PATCHLEVEL = 1
8 SUBLEVEL = 5
9 -EXTRAVERSION =
10 +EXTRAVERSION = -IFX-LXDB
11 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
12 VERSION_FILE = $(obj)include/version_autogenerated.h
13
14 @@ -44,6 +44,25 @@
15 # Deal with colliding definitions from tcsh etc.
16 VENDOR=
17
18 +# Default algorithm form compressing u-boot.bin
19 +ifndef COMPRESS
20 +COMPRESS=none
21 +COMPRESS_FILE=$(obj)u-boot.img
22 +else
23 +ifeq ($(COMPRESS),lzma)
24 +COMPRESS_FILE=$(obj)u-boot.limg
25 +endif
26 +ifeq ($(COMPRESS),bz2)
27 +COMPRESS_FILE=$(obj)u-boot.bzimg
28 +endif
29 +ifeq ($(COMPRESS),gzip)
30 +COMPRESS_FILE=$(obj)u-boot.zimg
31 +endif
32 +ifeq ($(COMPRESS),none)
33 +COMPRESS_FILE=$(obj)u-boot.img
34 +endif
35 +endif
36 +
37 #########################################################################
38 #
39 # U-boot build supports producing a object files to the separate external
40 @@ -164,6 +183,11 @@
41 # U-Boot objects....order is important (i.e. start must be first)
42
43 OBJS = cpu/$(CPU)/start.o
44 +OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o
45 +
46 +cpu/$(CPU)/start_bootstrap.S: cpu/$(CPU)/start.S
47 + ln -s start.S cpu/$(CPU)/start_bootstrap.S
48 +
49 ifeq ($(CPU),i386)
50 OBJS += cpu/$(CPU)/start16.o
51 OBJS += cpu/$(CPU)/reset.o
52 @@ -183,6 +207,7 @@
53 endif
54
55 OBJS := $(addprefix $(obj),$(OBJS))
56 +OBJS_BOOTSTRAP := $(addprefix $(obj),$(OBJS_BOOTSTRAP))
57
58 LIBS = lib_generic/libgeneric.a
59 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
60 @@ -206,15 +231,24 @@
61 LIBS += $(BOARDLIBS)
62
63 LIBS := $(addprefix $(obj),$(LIBS))
64 +
65 +LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a
66 +LIBS_BOOTSTRAP+= board/$(BOARDDIR)/lib$(BOARD).a
67 +#LIBS_BOOTSTRAP+= board/ifx/libifx.a
68 +LIBS_BOOTSTRAP+= cpu/$(CPU)/lib$(CPU).a
69 +
70 +LIBS_BOOTSTRAP := $(addprefix $(obj),$(LIBS_BOOTSTRAP))
71 +
72 .PHONY : $(LIBS)
73 +.PHONY : $(obj)lib_bootstrap/libbootstrap.a
74
75 # Add GCC lib
76 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
77
78 # The "tools" are needed early, so put this first
79 # Don't include stuff already done in $(LIBS)
80 + #examples
81 SUBDIRS = tools \
82 - examples \
83 post \
84 post/cpu
85 .PHONY : $(SUBDIRS)
86 @@ -226,14 +260,75 @@
87
88 __OBJS := $(subst $(obj),,$(OBJS))
89 __LIBS := $(subst $(obj),,$(LIBS))
90 +__LIBS_BOOTSTRAP := $(subst $(obj),,$(LIBS_BOOTSTRAP))
91 +
92 +#__HEAD_OBJS := $(subst $(obj),,$(HEAD_OBJS))
93 +#__HEAD_LIBS := $(subst $(obj),,$(HEAD_LIBS))
94
95 #########################################################################
96 #########################################################################
97
98 ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND)
99 +#IFX_ALL = $(obj)u-boot.ifx $(obj)head.srec $(obj)head.bin $(obj)head $(obj)head.map $(COMPRESS_FILE) $(obj)u-boot.srec
100 +IFX_ALL = $(obj)u-boot.srec $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin $(obj)System_bootstrap.map
101 +IFX_BOOTSTRAP = $(obj)bootstrap.bin
102
103 all: $(ALL)
104
105 +ifx_all: $(IFX_ALL)
106 +
107 +ifx_bootstrap: $(IFX_BOOTSTRAP)
108 +
109 +$(obj)u-boot.ifx: $(obj)bootstrap.bin $(obj)u-boot.lzimg
110 + @cat $(obj)bootstrap.bin > $(obj)u-boot.ifx
111 + @cat $(obj)u-boot.lzimg >> $(obj)u-boot.ifx
112 +
113 +$(obj)u-boot.lzimg: $(obj)u-boot.bin $(obj)System.map
114 + @lzma e $(obj)u-boot.bin $(obj)u-boot.lzma
115 + $(obj)tools/mkimage -A mips -T firmware -C lzma \
116 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
117 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
118 + -n 'u-boot image' -d $(obj)u-boot.lzma $@
119 +
120 +$(obj)ld_uboot.img: $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)bootstrap.bin
121 + @ cp -f $(obj)u-boot.ifx $(obj)u-boot.bin
122 + @ ./mkbootimg.incaip2 $(obj)ld_uboot.img < ld_uboot.conf
123 +
124 +$(obj)u-boot.zimg: $(obj)u-boot.bin $(obj)System.map
125 + gzip $(obj)u-boot.bin
126 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C gzip \
127 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
128 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
129 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
130 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
131 + -d u-boot.gz $@
132 +
133 +$(obj)u-boot.bzimg: $(obj)u-boot.bin $(obj)System.map
134 + bzip $(obj)u-boot.bin
135 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C bzip2 \
136 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
137 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
138 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
139 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
140 + -d u-boot.bz2 $@
141 +
142 +$(obj)u-boot.limg: $(obj)u-boot.bin $(obj)System.map
143 + @lzma e $(obj)u-boot.bin $(obj)u-boot.lzma
144 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C lzma \
145 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
146 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
147 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
148 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
149 + -d u-boot.lzma $@
150 +
151 +$(obj)u-boot.img: $(obj)u-boot.bin $(obj)System.map
152 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
153 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
154 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
155 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
156 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
157 + -d u-boot.bin $@
158 +
159 $(obj)u-boot.hex: $(obj)u-boot
160 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
161
162 @@ -243,28 +338,33 @@
163 $(obj)u-boot.bin: $(obj)u-boot
164 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
165
166 -$(obj)u-boot.img: $(obj)u-boot.bin
167 - ./tools/mkimage -A $(ARCH) -T firmware -C none \
168 - -a $(TEXT_BASE) -e 0 \
169 - -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
170 - sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
171 - -d $< $@
172 -
173 $(obj)u-boot.dis: $(obj)u-boot
174 $(OBJDUMP) -d $< > $@
175
176 -$(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
177 +$(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
178 UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
179 cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
180 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
181 -Map u-boot.map -o u-boot
182
183 +$(obj)bootstrap.bin: $(obj)bootstrap
184 + $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
185 +
186 +$(obj)bootstrap : depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LDSCRIPT_BOOTSTRAP)
187 + UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
188 + $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
189 + --start-group $(__LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \
190 + -Map bootstrap.map -o bootstrap
191 +
192 $(OBJS):
193 $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
194
195 $(LIBS):
196 $(MAKE) -C $(dir $(subst $(obj),,$@))
197
198 +$(obj)lib_bootstrap/libbootstrap.a:
199 + $(MAKE) -C $(dir $(subst $(obj),,$@))
200 +
201 $(SUBDIRS):
202 $(MAKE) -C $@ all
203
204 @@ -310,7 +410,12 @@
205 $(obj)System.map: $(obj)u-boot
206 @$(NM) $< | \
207 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
208 - sort > $(obj)System.map
209 + sort > $@
210 +
211 +$(obj)System_bootstrap.map: $(obj)bootstrap
212 + @$(NM) $< | \
213 + grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
214 + sort > $@
215
216 #########################################################################
217 else
218 @@ -2032,7 +2137,20 @@
219 # MIPS
220 #========================================================================
221 #########################################################################
222 -## MIPS32 4Kc
223 +## Infineon MIPS generic u-boot config
224 +#########################################################################
225 +danube_config: unconfig
226 + @$(MKCONFIG) $(@:_config=) mips mips danube ifx danube
227 +
228 +amazon_config: unconfig
229 + @$(MKCONFIG) $(@:_config=) mips mips amazon
230 +
231 +
232 +incaip2_config: unconfig
233 + @$(MKCONFIG) $(@:_config=) mips mips incaip2
234 +
235 +#########################################################################
236 +## MIPS32 4kc
237 #########################################################################
238
239 xtract_incaip = $(subst _100MHz,,$(subst _133MHz,,$(subst _150MHz,,$(subst _config,,$1))))
240 @@ -2254,7 +2372,7 @@
241 | xargs -0 rm -f
242 rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS $(obj)include/version_autogenerated.h
243 rm -fr $(obj)*.*~
244 - rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
245 + rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL) $(IFX_ALL)
246 rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c
247 rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
248 rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
249 Index: u-boot-1.1.5/common/cmd_bootm.c
250 ===================================================================
251 --- u-boot-1.1.5.orig/common/cmd_bootm.c 2006-10-20 17:54:33.000000000 +0200
252 +++ u-boot-1.1.5/common/cmd_bootm.c 2009-11-09 16:35:03.000000000 +0100
253 @@ -31,6 +31,7 @@
254 #include <malloc.h>
255 #include <zlib.h>
256 #include <bzlib.h>
257 +#include <LzmaWrapper.h>
258 #include <environment.h>
259 #include <asm/byteorder.h>
260
261 @@ -79,6 +80,8 @@
262 # define CHUNKSZ (64 * 1024)
263 #endif
264
265 +#ifndef CFG_HEAD_CODE
266 +
267 int gunzip (void *, int, unsigned char *, unsigned long *);
268
269 static void *zalloc(void *, unsigned, unsigned);
270 @@ -341,6 +344,7 @@
271 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
272 }
273 break;
274 +#ifndef CONFIG_REMOVE_GZIP
275 case IH_COMP_GZIP:
276 printf (" Uncompressing %s ... ", name);
277 if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
278 @@ -350,6 +354,7 @@
279 do_reset (cmdtp, flag, argc, argv);
280 }
281 break;
282 +#endif /* CONFIG_REMOVE_GZIP */
283 #ifdef CONFIG_BZIP2
284 case IH_COMP_BZIP2:
285 printf (" Uncompressing %s ... ", name);
286 @@ -369,6 +374,18 @@
287 }
288 break;
289 #endif /* CONFIG_BZIP2 */
290 +#ifdef CONFIG_LZMA
291 + case IH_COMP_LZMA:
292 + printf (" Uncompressing %s ... ", name);
293 + i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &unc_len);
294 + if (i != LZMA_RESULT_OK) {
295 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
296 + SHOW_BOOT_PROGRESS (-6);
297 + udelay(100000);
298 + do_reset (cmdtp, flag, argc, argv);
299 + }
300 + break;
301 +#endif /* CONFIG_LZMA */
302 default:
303 if (iflag)
304 enable_interrupts();
305 @@ -1176,6 +1193,8 @@
306 );
307 #endif /* CFG_CMD_IMLS */
308
309 +#endif /* ! CFG_HEAD_CODE */
310 +
311 void
312 print_image_hdr (image_header_t *hdr)
313 {
314 @@ -1270,12 +1289,15 @@
315 case IH_COMP_NONE: comp = "uncompressed"; break;
316 case IH_COMP_GZIP: comp = "gzip compressed"; break;
317 case IH_COMP_BZIP2: comp = "bzip2 compressed"; break;
318 + case IH_COMP_LZMA: comp = "lzma compressed"; break;
319 default: comp = "unknown compression"; break;
320 }
321
322 printf ("%s %s %s (%s)", arch, os, type, comp);
323 }
324
325 +#ifndef CFG_HEAD_CODE
326 +
327 #define ZALLOC_ALIGNMENT 16
328
329 static void *zalloc(void *x, unsigned items, unsigned size)
330 @@ -1427,3 +1449,5 @@
331 }
332
333 #endif /* CONFIG_LYNXKDI */
334 +
335 +#endif /* ! CFG_HEAD_CODE */
336 Index: u-boot-1.1.5/common/cmd_flash.c
337 ===================================================================
338 --- u-boot-1.1.5.orig/common/cmd_flash.c 2006-10-20 17:54:33.000000000 +0200
339 +++ u-boot-1.1.5/common/cmd_flash.c 2009-11-09 16:35:03.000000000 +0100
340 @@ -196,9 +196,17 @@
341 }
342
343 static int
344 -flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
345 - int *s_first, int *s_last,
346 - int *s_count )
347 +flash_fill_sect_ranges(
348 + ulong *addr_first_sect_start,
349 + ulong addr_first,
350 + ulong *addr_last_sect_end,
351 + ulong addr_last,
352 + int *s_first,
353 + int *s_last,
354 + int *bPartialStart,
355 + int *bPartialEnd,
356 + int *s_count,
357 + unsigned int bPartialErase)
358 {
359 flash_info_t *info;
360 ulong bank;
361 @@ -211,9 +219,7 @@
362 s_last [bank] = -1; /* last sector to erase */
363 }
364
365 - for (bank=0,info=&flash_info[0];
366 - (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
367 - ++bank, ++info) {
368 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last); ++bank, ++info) {
369 ulong b_end;
370 int sect;
371 short s_end;
372 @@ -225,7 +231,6 @@
373 b_end = info->start[0] + info->size - 1; /* bank end addr */
374 s_end = info->sector_count - 1; /* last sector */
375
376 -
377 for (sect=0; sect < info->sector_count; ++sect) {
378 ulong end; /* last address in current sect */
379
380 @@ -238,11 +243,21 @@
381
382 if (addr_first == info->start[sect]) {
383 s_first[bank] = sect;
384 + } else if (addr_first > info->start[sect] && addr_first <= end && bPartialErase) {
385 + *addr_first_sect_start = info->start[sect];
386 + s_first[bank] = sect;
387 + *bPartialStart = 1;
388 }
389 +
390 if (addr_last == end) {
391 s_last[bank] = sect;
392 + } else if (addr_last >= info->start[sect] && addr_last < end && bPartialErase) {
393 + *addr_last_sect_end = end;
394 + s_last[bank] = sect;
395 + *bPartialEnd = 1;
396 }
397 }
398 +
399 if (s_first[bank] >= 0) {
400 if (s_last[bank] < 0) {
401 if (addr_last > b_end) {
402 @@ -316,6 +331,8 @@
403 struct part_info *part;
404 u8 dev_type, dev_num, pnum;
405 #endif
406 + unsigned int bPartialErase = 0;
407 +
408 int rcode = 0;
409
410 if (argc < 2) {
411 @@ -369,7 +386,7 @@
412 }
413 #endif
414
415 - if (argc != 3) {
416 + if (argc != 4) {
417 printf ("Usage:\n%s\n", cmdtp->usage);
418 return 1;
419 }
420 @@ -397,11 +414,117 @@
421 return 1;
422 }
423
424 - rcode = flash_sect_erase(addr_first, addr_last);
425 + printf ("Erase Flash from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
426 + if(argc == 4) {
427 + bPartialErase = simple_strtoul(argv[3], NULL, 10);
428 + }
429 +
430 + rcode = flash_sect_erase(addr_first, addr_last, bPartialErase);
431 return rcode;
432 }
433
434 -int flash_sect_erase (ulong addr_first, ulong addr_last)
435 +int flerase_Partial(
436 + ulong addr_first_sect_start,
437 + ulong addr_first,
438 + ulong addr_last_sect_end,
439 + ulong addr_last,
440 + flash_info_t *info,
441 + int first_sect,
442 + int last_sect,
443 + int bFirstPartial,
444 + int bLastPartial) {
445 + unsigned int firstMemLen = 0;
446 + unsigned int lastMemLen = 0;
447 + unsigned int sectMemLen = 0;
448 + uchar *pSavedFirstMem = NULL;
449 + uchar *pSavedLastMem = NULL;
450 + uchar *pSavedSectMem = NULL;
451 + int bSectPartial = 0;
452 + int rt_code = 0;
453 +
454 + debug("%s ... 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%p, %d, %d, %d, %d\n", __FUNCTION__, addr_first_sect_start, addr_first, addr_last_sect_end, addr_last, info, first_sect, last_sect, bFirstPartial, bLastPartial);
455 +
456 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
457 + {
458 + ulong b_end = info->start[0] + info->size - 1;
459 + ulong end = (first_sect == (info->sector_count - 1)) ? b_end : info->start[first_sect + 1] - 1;
460 + sectMemLen = end - info->start[first_sect] + 1;
461 + pSavedSectMem = (uchar *)calloc(sectMemLen, sizeof(char));
462 + if (pSavedSectMem == NULL)
463 + {
464 + debug("calloc %u FAILED\n", sectMemLen);
465 + rt_code = 1;
466 + goto ret;
467 + }
468 + memset(pSavedSectMem, 0xff, sectMemLen);
469 + bSectPartial = 1;
470 + memcpy(pSavedSectMem, (uchar *)addr_first_sect_start, addr_first - addr_first_sect_start);
471 + memcpy(pSavedSectMem + (addr_last - info->start[first_sect]) + 1, addr_last + 1, end - addr_last);
472 + }
473 + else
474 + {
475 + if (bFirstPartial){
476 + firstMemLen = addr_first - addr_first_sect_start + 1;
477 + pSavedFirstMem = (uchar *)calloc(firstMemLen,sizeof(char));
478 + memcpy(pSavedFirstMem,(uchar *)addr_first_sect_start,firstMemLen - 1);
479 + }
480 + if (bLastPartial){
481 + lastMemLen = addr_last_sect_end - addr_last + 1;
482 + pSavedLastMem = (uchar *)calloc(lastMemLen,sizeof(char));
483 + memcpy(pSavedLastMem,(uchar *)addr_last + 1,lastMemLen - 1);
484 + }
485 + }
486 +
487 + if (bFirstPartial){
488 + if(flash_erase (info, first_sect, first_sect)) {
489 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, first_sect);
490 + rt_code = 1;
491 + goto ret;
492 + }
493 + debug("%s ... erase sector %d done!\n", __FUNCTION__, first_sect);
494 + }
495 +
496 + if (bLastPartial && first_sect != last_sect){
497 + if(flash_erase (info, last_sect, last_sect)) {
498 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, last_sect);
499 + rt_code = 1;
500 + goto ret;
501 + }
502 + debug("%s ... erase sector %d done!\n", __FUNCTION__, last_sect);
503 + }
504 +
505 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
506 + {
507 + flash_write(pSavedSectMem, (uchar *)addr_first_sect_start, sectMemLen);
508 + debug("flash_write from 0x%08x with len %u\n", addr_first_sect_start, sectMemLen);
509 + }
510 + else
511 + {
512 + if (bFirstPartial){
513 + if(flash_write(pSavedFirstMem,(uchar *)addr_first_sect_start,firstMemLen - 1)) {
514 + printf("%s ... Couldn't write at 0x%08lx length %d\n", __FUNCTION__, addr_first_sect_start,firstMemLen - 1);
515 + rt_code = 1;
516 + goto ret;
517 + }
518 + }
519 + if (bLastPartial){
520 + if(flash_write(pSavedLastMem,(uchar *)addr_last + 1,lastMemLen - 1)) {
521 + printf("%s ... Couldn't write at 0x%08lx length %d\n", __FUNCTION__, addr_last, lastMemLen - 1);
522 + rt_code = 1;
523 + }
524 + }
525 + }
526 +ret:
527 + if (bFirstPartial)
528 + free(pSavedFirstMem);
529 + if (bLastPartial)
530 + free(pSavedLastMem);
531 + if (bSectPartial)
532 + free(pSavedSectMem);
533 + return rt_code;
534 +}
535 +
536 +int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase)
537 {
538 flash_info_t *info;
539 ulong bank;
540 @@ -413,27 +536,66 @@
541 int erased = 0;
542 int planned;
543 int rcode = 0;
544 -
545 - rcode = flash_fill_sect_ranges (addr_first, addr_last,
546 - s_first, s_last, &planned );
547 + int bPartialStart = 0; // Start sector has to be erased partially
548 + int bPartialEnd = 0; // End sector has to be erased partially
549 + ulong addr_first_sect_start = 0;// Sector start address of location addr_start
550 + ulong addr_last_sect_end = 0; // Sector end address of location addr_last
551 +
552 + rcode = flash_fill_sect_ranges (
553 + &addr_first_sect_start,
554 + addr_first,
555 + &addr_last_sect_end,
556 + addr_last,
557 + s_first,
558 + s_last,
559 + &bPartialStart,
560 + &bPartialEnd,
561 + &planned,
562 + bPartialErase );
563
564 if (planned && (rcode == 0)) {
565 - for (bank=0,info=&flash_info[0];
566 - (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
567 - ++bank, ++info) {
568 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0); ++bank, ++info) {
569 + ulong b_end = info->start[0] + info->size - 1; /* bank end addr */
570 if (s_first[bank]>=0) {
571 - erased += s_last[bank] - s_first[bank] + 1;
572 - debug ("Erase Flash from 0x%08lx to 0x%08lx "
573 - "in Bank # %ld ",
574 - info->start[s_first[bank]],
575 - (s_last[bank] == info->sector_count) ?
576 - info->start[0] + info->size - 1:
577 - info->start[s_last[bank]+1] - 1,
578 - bank+1);
579 - rcode = flash_erase (info, s_first[bank], s_last[bank]);
580 + if(bPartialErase) {
581 + rcode = flerase_Partial(
582 + addr_first_sect_start,
583 + addr_first,
584 + addr_last_sect_end,
585 + addr_last,
586 + info,
587 + s_first[bank],
588 + s_last[bank],
589 + bPartialStart,
590 + bPartialEnd);
591 + }
592 +
593 + //Erase full sectores
594 + if (bPartialStart)
595 + s_first[bank] += 1;
596 + if (bPartialEnd)
597 + s_last[bank] -= 1;
598 + if (s_last[bank] >= s_first[bank]) {
599 + erased += s_last[bank] - s_first[bank] + 1;
600 + debug ("Erase Flash from 0x%08lx to 0x%08lx in Bank # %ld ",
601 + info->start[s_first[bank]],
602 + (s_last[bank] == info->sector_count) ?
603 + info->start[0] + info->size - 1:
604 + info->start[s_last[bank]+1] - 1,
605 + bank + 1);
606 + rcode = flash_erase (info, s_first[bank], s_last[bank]);
607 + }
608 }
609 }
610 - printf ("Erased %d sectors\n", erased);
611 +
612 + if (erased && !bPartialErase) {
613 + printf ("Erased %d sectors\n", erased);
614 + } else if (bPartialErase){
615 + printf ("Partial erased from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
616 + } else {
617 + printf ("Error: start and/or end address not on sector boundary\n");
618 + rcode = 1;
619 + }
620 } else if (rcode == 0) {
621 puts ("Error: start and/or end address"
622 " not on sector boundary\n");
623 @@ -629,8 +791,22 @@
624 int protected, i;
625 int planned;
626 int rcode;
627 -
628 - rcode = flash_fill_sect_ranges( addr_first, addr_last, s_first, s_last, &planned );
629 + int bPartialStart = 0; // Start sector has to be erased partially
630 + int bPartialEnd = 0; // End sector has to be erased partially
631 + ulong addr_first_sect_start = 0;// Sector start address of location addr_start
632 + ulong addr_last_sect_end = 0; // Sector end address of location addr_last
633 +
634 + rcode = flash_fill_sect_ranges (
635 + &addr_first_sect_start,
636 + addr_first,
637 + &addr_last_sect_end,
638 + addr_last,
639 + s_first,
640 + s_last,
641 + &bPartialStart,
642 + &bPartialEnd,
643 + &planned,
644 + 1 );
645
646 protected = 0;
647
648 @@ -690,7 +866,7 @@
649 );
650
651 U_BOOT_CMD(
652 - erase, 3, 1, do_flerase,
653 + erase, 4, 1, do_flerase,
654 "erase - erase FLASH memory\n",
655 "start end\n"
656 " - erase FLASH from addr 'start' to addr 'end'\n"
657 Index: u-boot-1.1.5/common/cmd_nvedit.c
658 ===================================================================
659 --- u-boot-1.1.5.orig/common/cmd_nvedit.c 2006-10-20 17:54:33.000000000 +0200
660 +++ u-boot-1.1.5/common/cmd_nvedit.c 2009-11-09 16:35:03.000000000 +0100
661 @@ -540,8 +540,19 @@
662 extern char * env_name_spec;
663
664 printf ("Saving Environment to %s...\n", env_name_spec);
665 -
666 +#if 1
667 + if(saveenv() == 0) {
668 +#ifdef UBOOT_ENV_COPY
669 + saveenv_copy();
670 +#else
671 + ;
672 +#endif //UBOOT_ENV_COPY
673 + } else
674 + return 1;
675 + return 0;
676 +#else
677 return (saveenv() ? 1 : 0);
678 +#endif
679 }
680
681
682 Index: u-boot-1.1.5/common/console.c
683 ===================================================================
684 --- u-boot-1.1.5.orig/common/console.c 2006-10-20 17:54:33.000000000 +0200
685 +++ u-boot-1.1.5/common/console.c 2009-11-09 16:35:03.000000000 +0100
686 @@ -324,7 +324,7 @@
687 #endif
688
689 /** U-Boot INIT FUNCTIONS *************************************************/
690 -
691 +#ifndef CFG_HEAD_CODE
692 int console_assign (int file, char *devname)
693 {
694 int flag, i;
695 @@ -357,7 +357,7 @@
696
697 return -1;
698 }
699 -
700 +#endif //CFG_HEAD_CODE
701 /* Called before relocation - use serial functions */
702 int console_init_f (void)
703 {
704 @@ -392,6 +392,7 @@
705 }
706 #endif /* CFG_CONSOLE_IS_IN_ENV || CONFIG_SPLASH_SCREEN */
707
708 +#ifndef CFG_HEAD_CODE
709 #ifdef CFG_CONSOLE_IS_IN_ENV
710 /* Called after the relocation - use desired console functions */
711 int console_init_r (void)
712 @@ -570,3 +571,4 @@
713 }
714
715 #endif /* CFG_CONSOLE_IS_IN_ENV */
716 +#endif //CFG_HEAD_CODE
717 Index: u-boot-1.1.5/common/devices.c
718 ===================================================================
719 --- u-boot-1.1.5.orig/common/devices.c 2006-10-20 17:54:33.000000000 +0200
720 +++ u-boot-1.1.5/common/devices.c 2009-11-09 16:35:03.000000000 +0100
721 @@ -39,6 +39,7 @@
722 list_t devlist = 0;
723 device_t *stdio_devices[] = { NULL, NULL, NULL };
724 char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
725 +#ifndef CFG_HEAD_CODE
726
727 #if defined(CONFIG_SPLASH_SCREEN) && !defined(CFG_DEVICE_NULLDEV)
728 #define CFG_DEVICE_NULLDEV 1
729 @@ -214,3 +215,5 @@
730
731 return 0;
732 }
733 +#endif //CFG_HEAD_CODE
734 +
735 Index: u-boot-1.1.5/common/env_common.c
736 ===================================================================
737 --- u-boot-1.1.5.orig/common/env_common.c 2006-10-20 17:54:33.000000000 +0200
738 +++ u-boot-1.1.5/common/env_common.c 2009-11-09 16:35:03.000000000 +0100
739 @@ -219,7 +219,9 @@
740 * We must allocate a buffer for the environment
741 */
742 env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
743 - DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
744 + if(!env_ptr)
745 + DEBUGF ("malloc env_ptr error!!\n");
746 + DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__, __LINE__, env_ptr);
747 #endif
748
749 /*
750 @@ -227,6 +229,10 @@
751 */
752 env_get_char = env_get_char_memory;
753
754 + //leejack
755 + DEBUGF ("%s[%d] gd->env_valid=%d\n", __FUNCTION__, __LINE__, gd->env_valid);
756 + DEBUGF ("%s[%d] CFG_ENV_SIZE=%d\n", __FUNCTION__, __LINE__, CFG_ENV_SIZE);
757 +
758 if (gd->env_valid == 0) {
759 #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */
760 puts ("Using default environment\n\n");
761 @@ -242,18 +248,17 @@
762 }
763
764 memset (env_ptr, 0, sizeof(env_t));
765 - memcpy (env_ptr->data,
766 - default_environment,
767 - sizeof(default_environment));
768 + memcpy (env_ptr->data, default_environment, sizeof(default_environment));
769 +
770 #ifdef CFG_REDUNDAND_ENVIRONMENT
771 env_ptr->flags = 0xFF;
772 #endif
773 env_crc_update ();
774 gd->env_valid = 1;
775 - }
776 - else {
777 + } else {
778 env_relocate_spec ();
779 }
780 +
781 gd->env_addr = (ulong)&(env_ptr->data);
782
783 #ifdef CONFIG_AMIGAONEG3SE
784 Index: u-boot-1.1.5/common/env_flash.c
785 ===================================================================
786 --- u-boot-1.1.5.orig/common/env_flash.c 2006-10-20 17:54:33.000000000 +0200
787 +++ u-boot-1.1.5/common/env_flash.c 2009-11-09 16:35:03.000000000 +0100
788 @@ -66,7 +66,6 @@
789 #endif
790
791 #else /* ! ENV_IS_EMBEDDED */
792 -
793 env_t *env_ptr = (env_t *)CFG_ENV_ADDR;
794 #ifdef CMD_SAVEENV
795 static env_t *flash_addr = (env_t *)CFG_ENV_ADDR;
796 @@ -201,6 +200,7 @@
797 debug (" %08lX ... %08lX ...",
798 (ulong)&(flash_addr_new->data),
799 sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
800 +
801 if ((rc = flash_write((char *)env_ptr->data,
802 (ulong)&(flash_addr_new->data),
803 sizeof(env_ptr->data))) ||
804 @@ -256,7 +256,6 @@
805 #endif /* CMD_SAVEENV */
806
807 #else /* ! CFG_ENV_ADDR_REDUND */
808 -
809 int env_init(void)
810 {
811 #ifdef CONFIG_OMAP2420H4
812 @@ -280,6 +279,52 @@
813
814 #ifdef CMD_SAVEENV
815
816 +#ifdef UBOOT_ENV_COPY
817 +int saveenv_copy(void) {
818 + uchar *env_buffer = (char *)env_ptr;
819 + char *kernel_addr;
820 + char *rootfs_addr;
821 + char *rootfs_size;
822 + ulong start_addr,end_addr,rootfs_end_addr;
823 + ulong flash_start;
824 +
825 + kernel_addr = getenv("f_kernel_addr");
826 + end_addr = simple_strtoul(kernel_addr,NULL,16) - 1;
827 + start_addr = end_addr - CFG_ENV_SIZE - sizeof(UBOOTCONFIG_COPY_HEADER) + 1;
828 +
829 + rootfs_addr = getenv("f_rootfs_addr");
830 + rootfs_size = getenv("f_rootfs_size");
831 + rootfs_end_addr = simple_strtoul(rootfs_addr,NULL,16) + simple_strtoul(rootfs_size,NULL,16);
832 +
833 + if(rootfs_end_addr >= start_addr)
834 + {
835 + printf("Can not copy the environment at 0x%08lx as no space left.\nf_kernel_addr = 0x%08lx while rootfs_end_addr = 0x%08lx\n",start_addr,end_addr,rootfs_end_addr);
836 + return 1;
837 + }
838 +
839 + debug ("Protect off %08lX ... %08lX\n", (ulong)rootfs_end_addr, end_addr);
840 + if (flash_sect_protect (0, rootfs_end_addr, end_addr))
841 + return 1;
842 +
843 + //delete the old environment copy, if found
844 + flash_start = rootfs_end_addr;
845 + while(flash_start + sizeof(UBOOTCONFIG_COPY_HEADER) + ENV_SIZE < end_addr)
846 + {
847 + if(strncmp((char *)flash_start,UBOOTCONFIG_COPY_HEADER,sizeof(UBOOTCONFIG_COPY_HEADER)) == 0)
848 + {
849 + flash_sect_erase(flash_start,flash_start + sizeof(UBOOTCONFIG_COPY_HEADER),1);
850 + }
851 + flash_start += 1;
852 + }
853 + flash_sect_erase(start_addr,end_addr,1);
854 + flash_write(UBOOTCONFIG_COPY_HEADER,start_addr,sizeof(UBOOTCONFIG_COPY_HEADER));
855 + flash_write(env_buffer,start_addr + sizeof(UBOOTCONFIG_COPY_HEADER), CFG_ENV_SIZE);
856 + flash_sect_protect (1, rootfs_end_addr, end_addr);
857 + printf("saved copy of the env at 0x%08lx\n",start_addr);
858 + return 0;
859 +}
860 +#endif //UBOOT_ENV_COPY
861 +
862 int saveenv(void)
863 {
864 int len, rc;
865 @@ -331,7 +376,7 @@
866 return 1;
867
868 puts ("Erasing Flash...");
869 - if (flash_sect_erase (flash_sect_addr, end_addr))
870 + if (flash_sect_erase (flash_sect_addr, end_addr, 1))
871 return 1;
872
873 puts ("Writing to Flash... ");
874 Index: u-boot-1.1.5/config.mk
875 ===================================================================
876 --- u-boot-1.1.5.orig/config.mk 2006-10-20 17:54:33.000000000 +0200
877 +++ u-boot-1.1.5/config.mk 2009-11-09 16:35:03.000000000 +0100
878 @@ -127,10 +127,15 @@
879 OBJDUMP = $(CROSS_COMPILE)objdump
880 RANLIB = $(CROSS_COMPILE)RANLIB
881
882 +ifneq (,$(findstring s,$(MAKEFLAGS)))
883 +ARFLAGS = cr
884 +else
885 ARFLAGS = crv
886 +endif
887 RELFLAGS= $(PLATFORM_RELFLAGS)
888 DBGFLAGS= -g # -DDEBUG
889 OPTFLAGS= -Os #-fomit-frame-pointer
890 +OWRT_FLAGS?=
891 ifndef LDSCRIPT
892 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
893 ifeq ($(CONFIG_NAND_U_BOOT),y)
894 @@ -139,12 +144,15 @@
895 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
896 endif
897 endif
898 +
899 +LDSCRIPT_BOOTSTRAP := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds
900 +
901 OBJCFLAGS += --gap-fill=0xff
902
903 gccincdir := $(shell $(CC) -print-file-name=include)
904
905 -CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
906 - -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
907 +CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) $(OWRT_FLAGS) \
908 + -D__KERNEL__ -DUBOOT_RAM_TEXT_BASE=$(UBOOT_RAM_TEXT_BASE) \
909
910 ifneq ($(OBJTREE),$(SRCTREE))
911 CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include
912 @@ -180,7 +188,8 @@
913
914 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
915
916 -LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
917 +LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(UBOOT_RAM_TEXT_BASE) $(PLATFORM_LDFLAGS)
918 +LDFLAGS_BOOTSTRAP += -Bstatic -T $(LDSCRIPT_BOOTSTRAP) -Ttext $(BOOTSTRAP_TEXT_BASE) $(PLATFORM_LDFLAGS)
919
920 # Location of a usable BFD library, where we define "usable" as
921 # "built for ${HOST}, supports ${TARGET}". Sensible values are
922 @@ -214,12 +223,19 @@
923 export CONFIG_SHELL HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE \
924 AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP \
925 MAKE
926 -export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
927 +export UBOOT_RAM_TEXT_BASE BOOTSTRAP_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
928
929 #########################################################################
930
931 ifndef REMOTE_BUILD
932
933 +%_bootstrap.s: %_bootstrap.S
934 + $(CPP) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -o $@ $<
935 +%_bootstrap.o: %_bootstrap.S
936 + $(CC) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $<
937 +%_bootstrap.o: %_bootstrap.c
938 + $(CC) $(CFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $<
939 +
940 %.s: %.S
941 $(CPP) $(AFLAGS) -o $@ $<
942 %.o: %.S
943 @@ -229,12 +245,20 @@
944
945 else
946
947 +$(obj)%_bootstrap.s: %_bootstrap.S
948 + $(CPP) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -o $@ $<
949 +$(obj)%_bootstrap.o: %_bootstrap.S
950 + $(CC) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $<
951 +$(obj)%_bootstrap.o: %_bootstrap.c
952 + $(CC) $(CFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $<
953 +
954 $(obj)%.s: %.S
955 $(CPP) $(AFLAGS) -o $@ $<
956 $(obj)%.o: %.S
957 $(CC) $(AFLAGS) -c -o $@ $<
958 $(obj)%.o: %.c
959 $(CC) $(CFLAGS) -c -o $@ $<
960 +
961 endif
962
963 #########################################################################
964 Index: u-boot-1.1.5/drivers/Makefile
965 ===================================================================
966 --- u-boot-1.1.5.orig/drivers/Makefile 2006-10-20 17:54:33.000000000 +0200
967 +++ u-boot-1.1.5/drivers/Makefile 2009-11-09 16:35:03.000000000 +0100
968 @@ -50,7 +50,7 @@
969 videomodes.o w83c553f.o \
970 ks8695eth.o \
971 pxa_pcmcia.o mpc8xx_pcmcia.o tqm8xx_pcmcia.o \
972 - rpx_pcmcia.o
973 + rpx_pcmcia.o ifx_sw.o
974
975 SRCS := $(COBJS:.o=.c)
976 OBJS := $(addprefix $(obj),$(COBJS))
977 Index: u-boot-1.1.5/include/asm-mips/mipsregs.h
978 ===================================================================
979 --- u-boot-1.1.5.orig/include/asm-mips/mipsregs.h 2006-10-20 17:54:33.000000000 +0200
980 +++ u-boot-1.1.5/include/asm-mips/mipsregs.h 2009-11-09 16:35:03.000000000 +0100
981 @@ -48,6 +48,7 @@
982 #define CP0_CAUSE $13
983 #define CP0_EPC $14
984 #define CP0_PRID $15
985 +#define CP0_EBASE $15,1
986 #define CP0_CONFIG $16
987 #define CP0_LLADDR $17
988 #define CP0_WATCHLO $18
989 @@ -330,11 +331,32 @@
990 # define KSU_USER 0x00000010
991 # define KSU_SUPERVISOR 0x00000008
992 # define KSU_KERNEL 0x00000000
993 +#ifdef CONFIG_DANUBE /* MIPS 24KE */
994 +/* bits 5 & 6 & 7: reserved */
995 +/* bits 8~15: IM0~7 */
996 +/* bits 16: reserved */
997 +#define ST0_CEE 0x00020000
998 +/* bits 18: always 0 */
999 +#define ST0_NMI 0x00080000
1000 +#define ST0_SR 0x00100000
1001 +#define ST0_TS 0x00200000
1002 +#define ST0_BEV 0x00400000
1003 +/* bits 23: reserved */
1004 +#define ST0_MX 0x01000000
1005 +#define ST0_RE 0x02000000
1006 +#define ST0_FR 0x04000000
1007 +#define ST0_RP 0x08000000
1008 +#define ST0_CU0 0x10000000
1009 +#define ST0_CU1 0x20000000
1010 +#define ST0_CU2 0x40000000
1011 +#define ST0_CU3 0x80000000
1012 +#else
1013 #define ST0_UX 0x00000020
1014 #define ST0_SX 0x00000040
1015 #define ST0_KX 0x00000080
1016 #define ST0_DE 0x00010000
1017 #define ST0_CE 0x00020000
1018 +#endif
1019
1020 /*
1021 * Bitfields in the R[23]000 cp0 status register.
1022 @@ -471,6 +493,14 @@
1023 #define CAUSEF_BD (1 << 31)
1024
1025 /*
1026 + * Bits in the coprocessor 0 EBase register
1027 + */
1028 +#define EBASEB_CPUNUM 0
1029 +#define EBASEF_CPUNUM (0x3ff << EBASEB_CPUNUM)
1030 +#define EBASEB_EXPBASE 12
1031 +#define EBASEF_EXPBASE (0x3ffff << EBASEB_EXPBASE)
1032 +
1033 +/*
1034 * Bits in the coprozessor 0 config register.
1035 */
1036 #define CONF_CM_CACHABLE_NO_WA 0
1037 @@ -544,4 +574,10 @@
1038 #define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
1039 #define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
1040
1041 +/*
1042 + * Bits in ErrCtl register
1043 + */
1044 +#define ECCB_WST 29
1045 +#define ECCF_WST (0x1 << ECCB_WST)
1046 +
1047 #endif /* _ASM_MIPSREGS_H */
1048 Index: u-boot-1.1.5/include/cmd_confdefs.h
1049 ===================================================================
1050 --- u-boot-1.1.5.orig/include/cmd_confdefs.h 2006-10-20 17:54:33.000000000 +0200
1051 +++ u-boot-1.1.5/include/cmd_confdefs.h 2009-11-09 16:35:03.000000000 +0100
1052 @@ -94,6 +94,7 @@
1053 #define CFG_CMD_EXT2 0x1000000000000000ULL /* EXT2 Support */
1054 #define CFG_CMD_SNTP 0x2000000000000000ULL /* SNTP support */
1055 #define CFG_CMD_DISPLAY 0x4000000000000000ULL /* Display support */
1056 +#define CFG_CMD_DHRYSTONE 0x8000000000000000ULL /* Dhrystone benchmark support */
1057
1058 #define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFULL /* ALL commands */
1059
1060 @@ -141,6 +142,7 @@
1061 CFG_CMD_SPI | \
1062 CFG_CMD_UNIVERSE | \
1063 CFG_CMD_USB | \
1064 + CFG_CMD_DHRYSTONE | \
1065 CFG_CMD_VFD )
1066
1067 /* Default configuration
1068 Index: u-boot-1.1.5/include/config.h
1069 ===================================================================
1070 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1071 +++ u-boot-1.1.5/include/config.h 2009-11-09 16:35:03.000000000 +0100
1072 @@ -0,0 +1,2 @@
1073 +/* Automatically generated - do not edit */
1074 +#include <configs/danube.h>
1075 Index: u-boot-1.1.5/include/config.mk
1076 ===================================================================
1077 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1078 +++ u-boot-1.1.5/include/config.mk 2009-11-09 16:35:03.000000000 +0100
1079 @@ -0,0 +1,5 @@
1080 +ARCH = mips
1081 +CPU = mips
1082 +BOARD = danube
1083 +VENDOR = ifx
1084 +SOC = danube
1085 Index: u-boot-1.1.5/include/flash.h
1086 ===================================================================
1087 --- u-boot-1.1.5.orig/include/flash.h 2006-10-20 17:54:33.000000000 +0200
1088 +++ u-boot-1.1.5/include/flash.h 2009-11-09 16:36:11.000000000 +0100
1089 @@ -79,7 +79,7 @@
1090 extern unsigned long flash_init (void);
1091 extern void flash_print_info (flash_info_t *);
1092 extern int flash_erase (flash_info_t *, int, int);
1093 -extern int flash_sect_erase (ulong addr_first, ulong addr_last);
1094 +extern int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase);
1095 extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
1096
1097 /* common/flash.c */
1098 @@ -131,7 +131,9 @@
1099 #define MT2_MANUFACT 0x002C002C /* alternate MICRON manufacturer ID*/
1100 #define EXCEL_MANUFACT 0x004A004A /* Excel Semiconductor */
1101
1102 - /* Micron Technologies (INTEL compat.) */
1103 +#define EON_ID_EN29LV320B 0x22f9
1104 +#define FLASH_29LV320B 0xE0
1105 +/* Micron Technologies (INTEL compat.) */
1106 #define MT_ID_28F400_T 0x44704470 /* 28F400B3 ID ( 4 M, top boot sector) */
1107 #define MT_ID_28F400_B 0x44714471 /* 28F400B3 ID ( 4 M, bottom boot sect) */
1108
1109 @@ -299,6 +301,10 @@
1110 #define TOSH_ID_FVT160 0xC2 /* TC58FVT160 ID (16 M, top ) */
1111 #define TOSH_ID_FVB160 0x43 /* TC58FVT160 ID (16 M, bottom ) */
1112
1113 +#define MX_ID_29LV320AB 0x22A822A8 /* MXIC MX29LV320AB ID (32 M, bottom ) joelin */
1114 +#define MX_ID_29LV160BB 0x22492249 /* MXIC MX29LV160BB ID (16 M, bottom ) joelin */
1115 +#define MX_ID_29LV640BB 0x22cb22cb /* MXIC MX29LV640BB ID (64 M, bottom ) joelin */
1116 +
1117 /*-----------------------------------------------------------------------
1118 * Internal FLASH identification codes
1119 *
1120 @@ -422,6 +428,10 @@
1121 #define FLASH_S29GL064M 0x00F0 /* Spansion S29GL064M-R6 */
1122 #define FLASH_S29GL128N 0x00F1 /* Spansion S29GL128N */
1123
1124 +#define FLASH_29LV320AB 0x00B0 /* MXIC MX29LV320AB( 32M = 4M x 16 ) joelin 10/07/2004*/
1125 +#define FLASH_29LV160BB 0x00B1 /* MXIC MX29LV160BB( 16M = 2M x 16 ) joelin 11/22/2004*/
1126 +#define FLASH_29LV640BB 0x00B2 /* MXIC MX29LV640BB( 64M = 8M x 16 ) liupeng*/
1127 +
1128 #define FLASH_UNKNOWN 0xFFFF /* unknown flash type */
1129
1130
1131 Index: u-boot-1.1.5/include/image.h
1132 ===================================================================
1133 --- u-boot-1.1.5.orig/include/image.h 2006-10-20 17:54:33.000000000 +0200
1134 +++ u-boot-1.1.5/include/image.h 2009-11-09 16:35:03.000000000 +0100
1135 @@ -132,6 +132,7 @@
1136 #define IH_COMP_NONE 0 /* No Compression Used */
1137 #define IH_COMP_GZIP 1 /* gzip Compression Used */
1138 #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
1139 +#define IH_COMP_LZMA 3 /* lzma Compression Used */
1140
1141 #define IH_MAGIC 0x27051956 /* Image Magic Number */
1142 #define IH_NMLEN 32 /* Image Name Length */
1143 Index: u-boot-1.1.5/include/syscall.h
1144 ===================================================================
1145 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1146 +++ u-boot-1.1.5/include/syscall.h 2009-11-09 16:35:03.000000000 +0100
1147 @@ -0,0 +1,42 @@
1148 +#ifndef __MON_SYS_CALL_H__
1149 +#define __MON_SYS_CALL_H__
1150 +
1151 +#ifndef __ASSEMBLY__
1152 +
1153 +#include <common.h>
1154 +
1155 +/* These are declarations of system calls available in C code */
1156 +int mon_getc(void);
1157 +int mon_tstc(void);
1158 +void mon_putc(const char);
1159 +void mon_puts(const char*);
1160 +void mon_printf(const char* fmt, ...);
1161 +void mon_install_hdlr(int, interrupt_handler_t*, void*);
1162 +void mon_free_hdlr(int);
1163 +void *mon_malloc(size_t);
1164 +void mon_free(void*);
1165 +void mon_udelay(unsigned long);
1166 +unsigned long mon_get_timer(unsigned long);
1167 +
1168 +#endif /* ifndef __ASSEMBLY__ */
1169 +
1170 +#define NR_SYSCALLS 11 /* number of syscalls */
1171 +
1172 +
1173 +/*
1174 + * Make sure these functions are in the same order as they
1175 + * appear in the "examples/syscall.S" file !!!
1176 + */
1177 +#define SYSCALL_GETC 0
1178 +#define SYSCALL_TSTC 1
1179 +#define SYSCALL_PUTC 2
1180 +#define SYSCALL_PUTS 3
1181 +#define SYSCALL_PRINTF 4
1182 +#define SYSCALL_INSTALL_HDLR 5
1183 +#define SYSCALL_FREE_HDLR 6
1184 +#define SYSCALL_MALLOC 7
1185 +#define SYSCALL_FREE 8
1186 +#define SYSCALL_UDELAY 9
1187 +#define SYSCALL_GET_TIMER 10
1188 +
1189 +#endif
1190 Index: u-boot-1.1.5/ld_uboot.conf
1191 ===================================================================
1192 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1193 +++ u-boot-1.1.5/ld_uboot.conf 2009-11-09 16:35:03.000000000 +0100
1194 @@ -0,0 +1,8 @@
1195 +TAG_DWNLD()
1196 +{
1197 + 0xA0B00000 "u-boot.bin" /* Download u-boot image */
1198 +};
1199 +TAG_START()
1200 +{
1201 + 0xA0B00000
1202 +}; /* Start u-boot image */
1203 Index: u-boot-1.1.5/lib_generic/Makefile
1204 ===================================================================
1205 --- u-boot-1.1.5.orig/lib_generic/Makefile 2006-10-20 17:54:33.000000000 +0200
1206 +++ u-boot-1.1.5/lib_generic/Makefile 2009-11-09 16:35:03.000000000 +0100
1207 @@ -28,7 +28,7 @@
1208 COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \
1209 bzlib_randtable.o bzlib_huffman.o \
1210 crc32.o ctype.o display_options.o ldiv.o \
1211 - string.o vsprintf.o zlib.o
1212 + string.o vsprintf.o zlib.o LzmaDecode.o LzmaWrapper.o
1213
1214 SRCS := $(COBJS:.o=.c)
1215 OBJS := $(addprefix $(obj),$(COBJS))
1216 Index: u-boot-1.1.5/lib_mips/board.c
1217 ===================================================================
1218 --- u-boot-1.1.5.orig/lib_mips/board.c 2006-10-20 17:54:33.000000000 +0200
1219 +++ u-boot-1.1.5/lib_mips/board.c 2009-11-09 16:35:03.000000000 +0100
1220 @@ -29,9 +29,30 @@
1221 #include <net.h>
1222 #include <environment.h>
1223
1224 +#ifdef CFG_BOOTSTRAP_CODE
1225 +//#include <asm/danube.h>
1226 +#undef CONFIG_MICROBZIP2
1227 +
1228 +#ifdef CONFIG_BZIP2
1229 +#include <bzlib.h>
1230 +#endif
1231 +
1232 +#ifdef CONFIG_MICROBZIP2
1233 +#include <micro_bzlib.h>
1234 +#endif
1235 +
1236 +#ifdef CONFIG_LZMA
1237 +#include <LzmaWrapper.h>
1238 +#endif
1239 +#endif //CFG_BOOTSTRAP_CODE
1240 +
1241 DECLARE_GLOBAL_DATA_PTR;
1242
1243 -#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
1244 +#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < BOOTSTRAP_CFG_MONITOR_BASE) || \
1245 + (CFG_ENV_ADDR >= (BOOTSTRAP_CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
1246 + defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_BOOTSTRAP_CODE)
1247 +#define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
1248 +#elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
1249 (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
1250 defined(CFG_ENV_IS_IN_NVRAM)
1251 #define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
1252 @@ -39,21 +60,24 @@
1253 #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
1254 #endif
1255
1256 -#undef DEBUG
1257 -
1258 extern int timer_init(void);
1259 -
1260 extern int incaip_set_cpuclk(void);
1261
1262 +#ifdef CFG_BOOTSTRAP_CODE
1263 +extern ulong uboot_end_data_bootstrap;
1264 +extern ulong uboot_end_bootstrap;
1265 +#else //CFG_BOOTSTRAP_CODE
1266 extern ulong uboot_end_data;
1267 extern ulong uboot_end;
1268 +#endif //CFG_BOOTSTRAP_CODE
1269
1270 ulong monitor_flash_len;
1271
1272 -const char version_string[] =
1273 - U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
1274 +const char version_string[] = U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
1275
1276 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1277 static char *failed = "*** failed ***\n";
1278 +#endif
1279
1280 /*
1281 * Begin and End of memory area for malloc(), and current "brk"
1282 @@ -62,14 +86,15 @@
1283 static ulong mem_malloc_end;
1284 static ulong mem_malloc_brk;
1285
1286 -
1287 /*
1288 * The Malloc area is immediately below the monitor copy in DRAM
1289 */
1290 -static void mem_malloc_init (void)
1291 -{
1292 +#ifdef CFG_BOOTSTRAP_CODE
1293 +static void mem_malloc_init (ulong dest_addr) {
1294 +#else //CFG_BOOTSTRAP_CODE
1295 +static void mem_malloc_init (void) {
1296 ulong dest_addr = CFG_MONITOR_BASE + gd->reloc_off;
1297 -
1298 +#endif //CFG_BOOTSTRAP_CODE
1299 mem_malloc_end = dest_addr;
1300 mem_malloc_start = dest_addr - TOTAL_MALLOC_LEN;
1301 mem_malloc_brk = mem_malloc_start;
1302 @@ -79,6 +104,25 @@
1303 mem_malloc_end - mem_malloc_start);
1304 }
1305
1306 +#ifdef CFG_BOOTSTRAP_CODE
1307 +void *malloc(unsigned int size) {
1308 + if(size < (mem_malloc_end - mem_malloc_start)) {
1309 + mem_malloc_start += size;
1310 + debug ("malloc : size required = 0x%08lx and pointer = 0x%08lx\n",size,mem_malloc_start - size);
1311 + return (void *)(mem_malloc_start - size);
1312 + }
1313 + return NULL;
1314 +}
1315 +
1316 +void *realloc(void *src,unsigned int size) {
1317 + return NULL;
1318 +}
1319 +
1320 +void free(void *src) {
1321 + return;
1322 +}
1323 +#endif //CFG_BOOTSTRAP_CODE
1324 +
1325 void *sbrk (ptrdiff_t increment)
1326 {
1327 ulong old = mem_malloc_brk;
1328 @@ -99,42 +143,58 @@
1329 #else
1330 int board_type = 0; /* use dummy arg */
1331 #endif
1332 - puts ("DRAM: ");
1333
1334 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1335 +#ifdef CONFIG_USE_DDR_RAM
1336 + puts ("DDR-DRAM: ");
1337 +#else
1338 + puts ("DRAM: ");
1339 +#endif
1340 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1341 if ((gd->ram_size = initdram (board_type)) > 0) {
1342 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1343 print_size (gd->ram_size, "\n");
1344 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1345 return (0);
1346 }
1347 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1348 puts (failed);
1349 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1350 return (1);
1351 }
1352
1353 +#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF)
1354 static int display_banner(void)
1355 {
1356 -
1357 printf ("\n\n%s\n\n", version_string);
1358 return (0);
1359 }
1360 +#endif
1361
1362 +#ifndef CFG_BOOTSTRAP_CODE
1363 static void display_flash_config(ulong size)
1364 {
1365 puts ("Flash: ");
1366 print_size (size, "\n");
1367 }
1368 +#endif //CFG_BOOTSTRAP_CODE
1369
1370 -
1371 +#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF)
1372 static int init_baudrate (void)
1373 {
1374 +#ifndef CFG_BOOTSTRAP_CODE
1375 char tmp[64]; /* long enough for environment variables */
1376 int i = getenv_r ("baudrate", tmp, sizeof (tmp));
1377
1378 gd->baudrate = (i > 0)
1379 ? (int) simple_strtoul (tmp, NULL, 10)
1380 : CONFIG_BAUDRATE;
1381 -
1382 +#else //CFG_BOOTSTRAP_CODE
1383 + gd->baudrate = CONFIG_BAUDRATE;
1384 +#endif //CFG_BOOTSTRAP_CODE
1385 return (0);
1386 }
1387 -
1388 +#endif
1389
1390 /*
1391 * Breath some life into the board...
1392 @@ -159,27 +219,49 @@
1393 typedef int (init_fnc_t) (void);
1394
1395 init_fnc_t *init_sequence[] = {
1396 +#ifdef CFG_BOOTSTRAP_CODE
1397 + //fuse_prg,
1398 + //timer_init,
1399 + //env_init, /* initialize environment */
1400 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1401 + init_baudrate, /* initialze baudrate settings */
1402 + serial_init, /* serial communications setup */
1403 + console_init_f,
1404 + display_banner, /* say that we are here */
1405 + checkboard,
1406 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1407 + init_func_ram,
1408 + NULL,
1409 +#else /********** CFG_BOOTSTRAP_CODE **********/
1410 timer_init,
1411 - env_init, /* initialize environment */
1412 -#ifdef CONFIG_INCA_IP
1413 - incaip_set_cpuclk, /* set cpu clock according to environment variable */
1414 -#endif
1415 init_baudrate, /* initialze baudrate settings */
1416 serial_init, /* serial communications setup */
1417 console_init_f,
1418 display_banner, /* say that we are here */
1419 checkboard,
1420 init_func_ram,
1421 + env_init, /* initialize environment */
1422 NULL,
1423 +#endif //CFG_BOOTSTRAP_CODE
1424 };
1425
1426 +#ifdef CFG_BOOTSTRAP_CODE
1427 +extern void bootstrap_relocate_code(ulong addr_sp, gd_t *id, ulong addr);
1428
1429 +void bootstrap_board_init_f(ulong bootflag)
1430 +#else
1431 void board_init_f(ulong bootflag)
1432 +#endif
1433 {
1434 gd_t gd_data, *id;
1435 bd_t *bd;
1436 init_fnc_t **init_fnc_ptr;
1437 - ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE;
1438 +#ifdef CFG_BOOTSTRAP_CODE
1439 + ulong addr, addr_sp, len = (ulong)&uboot_end_bootstrap - BOOTSTRAP_CFG_MONITOR_BASE;
1440 + ulong lzmaImageaddr = 0;
1441 +#else //CFG_BOOTSTRAP_CODE
1442 + ulong addr, addr_sp, len = CFG_MONITOR_LEN;
1443 +#endif //CFG_BOOTSTRAP_CODE
1444 ulong *s;
1445 #ifdef CONFIG_PURPLE
1446 void copy_code (ulong);
1447 @@ -219,13 +301,12 @@
1448 addr -= len;
1449 addr &= ~(16 * 1024 - 1);
1450
1451 - debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
1452 + debug ("Reserving %d Bytes for U-Boot at: %08lx\n", len, addr);
1453
1454 /* Reserve memory for malloc() arena.
1455 */
1456 addr_sp = addr - TOTAL_MALLOC_LEN;
1457 - debug ("Reserving %dk for malloc() at: %08lx\n",
1458 - TOTAL_MALLOC_LEN >> 10, addr_sp);
1459 + debug ("Reserving %d Bytes for malloc() at: %08lx\n", TOTAL_MALLOC_LEN, addr_sp);
1460
1461 /*
1462 * (permanently) allocate a Board Info struct
1463 @@ -234,20 +315,17 @@
1464 addr_sp -= sizeof(bd_t);
1465 bd = (bd_t *)addr_sp;
1466 gd->bd = bd;
1467 - debug ("Reserving %d Bytes for Board Info at: %08lx\n",
1468 - sizeof(bd_t), addr_sp);
1469 + debug ("Reserving %d Bytes for Board Info at: %08lx\n", sizeof(bd_t), addr_sp);
1470
1471 addr_sp -= sizeof(gd_t);
1472 id = (gd_t *)addr_sp;
1473 - debug ("Reserving %d Bytes for Global Data at: %08lx\n",
1474 - sizeof (gd_t), addr_sp);
1475 + debug ("Reserving %d Bytes for Global Data at: %08lx\n", sizeof (gd_t), addr_sp);
1476
1477 /* Reserve memory for boot params.
1478 */
1479 addr_sp -= CFG_BOOTPARAMS_LEN;
1480 bd->bi_boot_params = addr_sp;
1481 - debug ("Reserving %dk for boot params() at: %08lx\n",
1482 - CFG_BOOTPARAMS_LEN >> 10, addr_sp);
1483 + debug ("Reserving %dk for boot params() at: %08lx\n", CFG_BOOTPARAMS_LEN >> 10, addr_sp);
1484
1485 /*
1486 * Finally, we set up a new (bigger) stack.
1487 @@ -279,7 +357,16 @@
1488 copy_code(addr);
1489 #endif
1490
1491 +#ifdef CFG_BOOTSTRAP_CODE
1492 + lzmaImageaddr = (ulong)&uboot_end_data_bootstrap;
1493 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1494 + puts("\n BOOTSTRAP: relocate_code start");
1495 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1496 + bootstrap_relocate_code (addr_sp, id, addr);
1497 +#else //CFG_BOOTSTRAP_CODE
1498 + puts("\n relocate_code start");
1499 relocate_code (addr_sp, id, addr);
1500 +#endif //CFG_BOOTSTRAP_CODE
1501
1502 /* NOTREACHED - relocate_code() does not return */
1503 }
1504 @@ -292,7 +379,110 @@
1505 *
1506 ************************************************************************
1507 */
1508 +#ifdef CFG_BOOTSTRAP_CODE
1509 +void bootstrap_board_init_r (gd_t *id, ulong dest_addr) {
1510 + int i;
1511 + ulong addr;
1512 + ulong data, len, checksum;
1513 + ulong *len_ptr;
1514 + image_header_t header;
1515 + image_header_t *hdr = &header;
1516 + unsigned int destLen;
1517 + int (*fn)(void);
1518 +
1519 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1520 + puts("\n BOOTSTRAP: relocate_code finish.\n");
1521 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1522 +
1523 + /* initialize malloc() area */
1524 + mem_malloc_init(dest_addr);
1525 +
1526 + addr = (char *)(BOOTSTRAP_CFG_MONITOR_BASE + ((ulong)&uboot_end_data_bootstrap - dest_addr));
1527 + memmove (&header, (char *)addr, sizeof(image_header_t));
1528 +
1529 + if (ntohl(hdr->ih_magic) != IH_MAGIC) {
1530 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1531 + printf ("Bad Magic Number at address 0x%08lx\n",addr);
1532 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1533 + return;
1534 + }
1535
1536 + data = (ulong)&header;
1537 + len = sizeof(image_header_t);
1538 +
1539 + checksum = ntohl(hdr->ih_hcrc);
1540 + hdr->ih_hcrc = 0;
1541 + if (crc32 (0, (unsigned char *)data, len) != checksum) {
1542 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1543 + printf ("Bad Header Checksum\n");
1544 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1545 + return;
1546 + }
1547 +
1548 + data = addr + sizeof(image_header_t);
1549 + len = ntohl(hdr->ih_size);
1550 + len_ptr = (ulong *)data;
1551 +
1552 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1553 + debug ("Disabling all the interrupts\n");
1554 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1555 + disable_interrupts();
1556 +
1557 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1558 + debug (" Uncompressing UBoot Image ... \n" );
1559 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1560 + /*
1561 + * If we've got less than 4 MB of malloc() space,
1562 + * use slower decompression algorithm which requires
1563 + * at most 2300 KB of memory.
1564 + */
1565 + destLen = 0x0;
1566 +
1567 +#ifdef CONFIG_BZIP2
1568 + i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1569 + 0x400000, (char *)data, len,
1570 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1571 + if (i != BZ_OK) {
1572 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1573 + printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1574 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1575 + return;
1576 + }
1577 +#elif CONFIG_MICROBZIP2
1578 + i = micro_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1579 + &destLen, (char *)data, len,
1580 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1581 + if (i != RETVAL_OK) {
1582 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1583 + printf ("MICRO_BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1584 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1585 + return;
1586 + }
1587 +#elif CONFIG_LZMA
1588 + i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &destLen);
1589 + if (i != LZMA_RESULT_OK) {
1590 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1591 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
1592 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1593 + return;
1594 + }
1595 +#else
1596 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1597 + printf ("NONE Compressing u-boot body!!\n");
1598 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1599 + memmove ((void *)ntohl(hdr->ih_load), (uchar *)data, len);
1600 + destLen = len;
1601 +#endif
1602 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1603 + debug (" Uncompression completed successfully with destLen %d.\n ",destLen );
1604 + debug ("Head: Jumping to u-boot in the ram at 0x%08lx\n", CFG_MONITOR_BASE);
1605 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1606 +
1607 + fn = ntohl(hdr->ih_load);
1608 + (*fn)();
1609 + hang ();
1610 +}
1611 +#else //CFG_BOOTSTRAP_CODE
1612 void board_init_r (gd_t *id, ulong dest_addr)
1613 {
1614 cmd_tbl_t *cmdtp;
1615 @@ -305,6 +495,8 @@
1616 bd_t *bd;
1617 int i;
1618
1619 + puts("\n relocate_code finish.\n");
1620 +
1621 gd = id;
1622 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
1623
1624 @@ -321,12 +513,10 @@
1625 ulong addr;
1626
1627 addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
1628 -#if 0
1629 - printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
1630 - cmdtp->name, (ulong) (cmdtp->cmd), addr);
1631 -#endif
1632 - cmdtp->cmd =
1633 - (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
1634 +
1635 + debug ("Command \"%s\": 0x%08lx => 0x%08lx\n", cmdtp->name, (ulong) (cmdtp->cmd), addr);
1636 +
1637 + cmdtp->cmd = (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
1638
1639 addr = (ulong)(cmdtp->name) + gd->reloc_off;
1640 cmdtp->name = (char *)addr;
1641 @@ -363,7 +553,13 @@
1642 /* initialize malloc() area */
1643 mem_malloc_init();
1644 malloc_bin_reloc();
1645 +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
1646 + nand_init(); /* go init the NAND */
1647 +#endif
1648
1649 +#ifdef CONFIG_SPI
1650 + spi_init_f(); /* go init the SPI flash */
1651 +#endif
1652 /* relocate environment function pointers etc. */
1653 env_relocate();
1654
1655 @@ -424,9 +620,12 @@
1656
1657 /* NOTREACHED - no way out of command loop except booting */
1658 }
1659 +#endif //CFG_BOOTSTRAP_CODE
1660
1661 void hang (void)
1662 {
1663 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1664 puts ("### ERROR ### Please RESET the board ###\n");
1665 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1666 for (;;);
1667 }
1668 Index: u-boot-1.1.5/lib_mips/time.c
1669 ===================================================================
1670 --- u-boot-1.1.5.orig/lib_mips/time.c 2006-10-20 17:54:33.000000000 +0200
1671 +++ u-boot-1.1.5/lib_mips/time.c 2009-11-09 16:35:03.000000000 +0100
1672 @@ -80,6 +80,19 @@
1673 /*NOP*/;
1674 }
1675
1676 +#ifndef CFG_BOOTSTRAP_CODE
1677 +void mdelay (unsigned long msec)
1678 +{
1679 + int i,j;
1680 + for(i=0;i<msec;i++)
1681 + {
1682 + udelay(1000);
1683 +
1684 + }
1685 +
1686 +}
1687 +#endif
1688 +
1689 /*
1690 * This function is derived from PowerPC code (read timebase as long long).
1691 * On MIPS it just returns the timer value.
1692 Index: u-boot-1.1.5/net/eth.c
1693 ===================================================================
1694 --- u-boot-1.1.5.orig/net/eth.c 2006-10-20 17:54:33.000000000 +0200
1695 +++ u-boot-1.1.5/net/eth.c 2009-11-09 16:35:03.000000000 +0100
1696 @@ -25,6 +25,9 @@
1697 #include <command.h>
1698 #include <net.h>
1699 #include <miiphy.h>
1700 +#if defined(CONFIG_IFX_MIPS)
1701 +# include "ifx_eth.c"
1702 +#endif
1703
1704 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
1705
1706 @@ -54,6 +57,9 @@
1707 extern int skge_initialize(bd_t*);
1708 extern int tsec_initialize(bd_t*, int, char *);
1709 extern int npe_initialize(bd_t *);
1710 +#if defined(CONFIG_IFX_MIPS)
1711 + IFX_ETH_INITIALIZE_EXTERN
1712 +#endif
1713
1714 static struct eth_device *eth_devices, *eth_current;
1715
1716 @@ -235,7 +241,9 @@
1717 #if defined(CONFIG_RTL8169)
1718 rtl8169_initialize(bis);
1719 #endif
1720 -
1721 +#if defined(CONFIG_IFX_MIPS)
1722 + IFX_ETH_INITIALIZE(bis)
1723 +#endif
1724 if (!eth_devices) {
1725 puts ("No ethernet found.\n");
1726 } else {
1727 Index: u-boot-1.1.5/tools/mkimage.c
1728 ===================================================================
1729 --- u-boot-1.1.5.orig/tools/mkimage.c 2006-10-20 17:54:33.000000000 +0200
1730 +++ u-boot-1.1.5/tools/mkimage.c 2009-11-09 16:35:03.000000000 +0100
1731 @@ -28,6 +28,7 @@
1732 #ifndef __WIN32__
1733 #include <netinet/in.h> /* for host / network byte order conversions */
1734 #endif
1735 +#include <sys/types.h>
1736 #include <sys/mman.h>
1737 #include <sys/stat.h>
1738 #include <time.h>
1739 @@ -138,6 +139,7 @@
1740 { IH_COMP_NONE, "none", "uncompressed", },
1741 { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", },
1742 { IH_COMP_GZIP, "gzip", "gzip compressed", },
1743 + { IH_COMP_LZMA, "lzma", "lzma compressed", },
1744 { -1, "", "", },
1745 };
1746
1747 @@ -445,7 +447,7 @@
1748 }
1749
1750 /* We're a bit of paranoid */
1751 -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
1752 +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
1753 (void) fdatasync (ifd);
1754 #else
1755 (void) fsync (ifd);
1756 @@ -495,7 +497,7 @@
1757 (void) munmap((void *)ptr, sbuf.st_size);
1758
1759 /* We're a bit of paranoid */
1760 -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
1761 +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
1762 (void) fdatasync (ifd);
1763 #else
1764 (void) fsync (ifd);
1765 Index: u-boot-1.1.5/cpu/mips/cache.S
1766 ===================================================================
1767 --- u-boot-1.1.5.orig/cpu/mips/cache.S 2006-10-20 17:54:33.000000000 +0200
1768 +++ u-boot-1.1.5/cpu/mips/cache.S 2009-11-09 16:35:03.000000000 +0100
1769 @@ -29,7 +29,9 @@
1770 #include <asm/mipsregs.h>
1771 #include <asm/addrspace.h>
1772 #include <asm/cacheops.h>
1773 -
1774 +#if defined(CONFIG_IFX_MIPS)
1775 +# include "danube/ifx_cache.S"
1776 +#endif
1777
1778 /* 16KB is the maximum size of instruction and data caches on
1779 * MIPS 4K.
1780 @@ -155,6 +157,9 @@
1781 */
1782
1783 mtc0 zero, CP0_TAGLO
1784 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_INVALID_TAG)
1785 + IFX_CACHE_EXTRA_INVALID_TAG
1786 +#endif
1787
1788 /*
1789 * The caches are probably in an indeterminate state,
1790 @@ -171,6 +176,9 @@
1791 move a1, a2
1792 icacheopn(a0,a1,a2,a3,121,(Index_Store_Tag_I,Fill))
1793
1794 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_OPERATION)
1795 + IFX_CACHE_EXTRA_OPERATION
1796 +#else
1797 /* To support Orion/R4600, we initialise the data cache in 3 passes.
1798 */
1799
1800 @@ -200,6 +208,7 @@
1801 move a3, t5 # dcacheLineSize
1802 move a1, a2
1803 icacheop(a0,a1,a2,a3,Index_Store_Tag_D)
1804 +#endif
1805
1806 j ra
1807 .end mips_cache_reset
1808 Index: u-boot-1.1.5/cpu/mips/config.mk
1809 ===================================================================
1810 --- u-boot-1.1.5.orig/cpu/mips/config.mk 2006-10-20 17:54:33.000000000 +0200
1811 +++ u-boot-1.1.5/cpu/mips/config.mk 2009-11-09 16:35:03.000000000 +0100
1812 @@ -20,20 +20,26 @@
1813 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1814 # MA 02111-1307 USA
1815 #
1816 -v=$(shell \
1817 -$(CROSS_COMPILE)as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
1818 -MIPSFLAGS=$(shell \
1819 -if [ "$v" -lt "14" ]; then \
1820 - echo "-mcpu=4kc"; \
1821 -else \
1822 - echo "-march=4kc -mtune=4kc"; \
1823 -fi)
1824
1825 +ifndef PLATFORM_CPU
1826 +PLATFORM_CPU = mips32
1827 +endif
1828 +
1829 +MIPSFLAGS +=$(call cc-option,-march=$(PLATFORM_CPU) -mtune=$(PLATFORM_CPU),-mcpu=$(PLATFORM_CPU))
1830 +
1831 +ifeq ($(CROSS_COMPILE_UCLIBC),1)
1832 +ifneq (,$(findstring mipsel,$(CROSS_COMIPLE)))
1833 +ENDIANNESS = -el
1834 +else
1835 +ENDIANNESS = -eb
1836 +endif
1837 +else
1838 ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
1839 ENDIANNESS = -EL
1840 else
1841 ENDIANNESS = -EB
1842 endif
1843 +endif
1844
1845 MIPSFLAGS += $(ENDIANNESS) -mabicalls
1846
1847 Index: u-boot-1.1.5/cpu/mips/cpu.c
1848 ===================================================================
1849 --- u-boot-1.1.5.orig/cpu/mips/cpu.c 2006-10-20 17:54:33.000000000 +0200
1850 +++ u-boot-1.1.5/cpu/mips/cpu.c 2009-11-09 16:35:03.000000000 +0100
1851 @@ -23,7 +23,12 @@
1852
1853 #include <common.h>
1854 #include <command.h>
1855 -#include <asm/inca-ip.h>
1856 +#if defined(CONFIG_INCA_IP)
1857 +# include <asm/inca-ip.h>
1858 +#elif defined(CONFIG_IFX_MIPS)
1859 +# include <asm/danube.h>
1860 +# include "danube/ifx_cpu.c"
1861 +#endif
1862 #include <asm/mipsregs.h>
1863
1864 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1865 @@ -34,6 +39,8 @@
1866 void (*f)(void) = (void *) 0xbfc00000;
1867
1868 f();
1869 +#elif defined(CONFIG_IFX_MIPS)
1870 + IFX_CPU_RESET;
1871 #endif
1872 fprintf(stderr, "*** reset failed ***\n");
1873 return 0;
1874 Index: u-boot-1.1.5/cpu/mips/incaip_clock.c
1875 ===================================================================
1876 --- u-boot-1.1.5.orig/cpu/mips/incaip_clock.c 2006-10-20 17:54:33.000000000 +0200
1877 +++ u-boot-1.1.5/cpu/mips/incaip_clock.c 2009-11-09 16:35:03.000000000 +0100
1878 @@ -22,8 +22,9 @@
1879 */
1880
1881 #include <common.h>
1882 -#include <asm/inca-ip.h>
1883
1884 +#ifdef CONFIG_INCA_IP
1885 +#include <asm/inca-ip.h>
1886
1887 /*******************************************************************************
1888 *
1889 @@ -114,3 +115,5 @@
1890
1891 return 0;
1892 }
1893 +
1894 +#endif /* CONFIG_INCA_IP */
1895 Index: u-boot-1.1.5/cpu/mips/start.S
1896 ===================================================================
1897 --- u-boot-1.1.5.orig/cpu/mips/start.S 2006-10-20 17:54:33.000000000 +0200
1898 +++ u-boot-1.1.5/cpu/mips/start.S 2009-11-09 16:35:03.000000000 +0100
1899 @@ -27,7 +27,9 @@
1900 #include <version.h>
1901 #include <asm/regdef.h>
1902 #include <asm/mipsregs.h>
1903 -
1904 +#if defined(CONFIG_IFX_MIPS)
1905 +# include "danube/ifx_start.S"
1906 +#endif
1907
1908 #define RVECENT(f,n) \
1909 b f; nop
1910 @@ -36,15 +38,24 @@
1911 li k0,bev
1912
1913 .set noreorder
1914 -
1915 +#ifdef CFG_BOOTSTRAP_CODE
1916 + .globl _start_bootstrap
1917 +#else
1918 .globl _start
1919 +#endif
1920 .text
1921 +#ifdef CFG_BOOTSTRAP_CODE
1922 +_start_bootstrap:
1923 +#else
1924 _start:
1925 +#endif
1926 RVECENT(reset,0) /* U-boot entry point */
1927 RVECENT(reset,1) /* software reboot */
1928 -#if defined(CONFIG_INCA_IP)
1929 +#if defined(CONFIG_INCA_IP) || defined(CONFIG_INCA_IP2)
1930 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1931 .word 0x00000000 /* phase of the flash */
1932 +#elif defined(CONFIG_IFX_MIPS) && defined(IFX_EBU_BOOTCFG_DWORD)
1933 + IFX_EBU_BOOTCFG_DWORD
1934 #elif defined(CONFIG_PURPLE)
1935 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1936 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1937 @@ -181,6 +192,9 @@
1938 * 128 * 8 == 1024 == 0x400
1939 * so this is address R_VEC+0x400 == 0xbfc00400
1940 */
1941 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_MORE_RESERVED_VECTORS)
1942 + IFX_MORE_RESERVED_VECTORS
1943 +#else
1944 #ifdef CONFIG_PURPLE
1945 /* 0xbfc00400 */
1946 .word 0xdc870000
1947 @@ -205,8 +219,12 @@
1948 .word 0x00000000
1949 .word 0x00000000
1950 #endif /* CONFIG_PURPLE */
1951 +#endif /* CONFIG_IFX_MIPS */
1952 .align 4
1953 reset:
1954 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_RESET_PRECHECK)
1955 + IFX_RESET_PRECHECK
1956 +#endif
1957
1958 /* Clear watch registers.
1959 */
1960 @@ -226,6 +244,10 @@
1961 /* CAUSE register */
1962 mtc0 zero, CP0_CAUSE
1963
1964 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU_EXTRA_INIT)
1965 + IFX_CPU_EXTRA_INIT
1966 +#endif
1967 +
1968 /* Init Timer */
1969 mtc0 zero, CP0_COUNT
1970 mtc0 zero, CP0_COMPARE
1971 @@ -252,12 +274,26 @@
1972 nop
1973 #endif
1974
1975 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_SKIP_LOWLEVEL_INIT)
1976 + IFX_SKIP_LOWLEVEL_INIT
1977 +#endif
1978 +#ifdef CFG_BOOTSTRAP_CODE
1979 /* Initialize any external memory.
1980 */
1981 la t9, lowlevel_init
1982 jalr t9
1983 nop
1984 +#endif
1985 +lowlevel_init_done:
1986 +
1987 + beq s0, zero, init_cache_0
1988 + nop
1989 +
1990 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_CPU1_INIT)
1991 + IFX_CPU1_INIT
1992 +#endif
1993
1994 +init_cache_0:
1995 /* Initialize caches...
1996 */
1997 la t9, mips_cache_reset
1998 @@ -266,7 +302,11 @@
1999
2000 /* ... and enable them.
2001 */
2002 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_OPER_MODE)
2003 + IFX_CACHE_OPER_MODE
2004 +#else
2005 li t0, CONF_CM_CACHABLE_NONCOHERENT
2006 +#endif
2007 mtc0 t0, CP0_CONFIG
2008
2009
2010 @@ -280,13 +320,38 @@
2011 li t0, CFG_SDRAM_BASE + CFG_INIT_SP_OFFSET
2012 la sp, 0(t0)
2013
2014 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_BOOT_CLEAR)
2015 + IFX_BOOT_CLEAR
2016 +#endif
2017 +
2018 +#ifdef CFG_BOOTSTRAP_CODE
2019 + la t9, bootstrap_board_init_f
2020 +#else
2021 la t9, board_init_f
2022 +#endif
2023 j t9
2024 nop
2025
2026 +#ifdef CFG_BOOTSTRAP_CODE
2027 +/*
2028 + * void jump_unconditional (addr)
2029 + * This function simply jumps to the location pointed by a0.
2030 + * a0 = target_location
2031 + *
2032 + */
2033 + .globl jump_unconditional
2034 + .ent jump_unconditional
2035 +jump_unconditional:
2036 + move t9, a0
2037 + j t9
2038 + nop
2039 + .end jump_unconditional
2040 +
2041 +#endif
2042
2043 /*
2044 * void relocate_code (addr_sp, gd, addr_moni)
2045 + * void bootstrap_relocate_code (addr_sp, gd, addr_moni)
2046 *
2047 * This "function" does not return, instead it continues in RAM
2048 * after relocating the monitor code.
2049 @@ -295,12 +360,22 @@
2050 * a1 = gd
2051 * a2 = destination address
2052 */
2053 +#ifdef CFG_BOOTSTRAP_CODE
2054 + .globl bootstrap_relocate_code
2055 + .ent bootstrap_relocate_code
2056 +bootstrap_relocate_code:
2057 +#else
2058 .globl relocate_code
2059 .ent relocate_code
2060 relocate_code:
2061 +#endif
2062 move sp, a0 /* Set new stack pointer */
2063
2064 +#ifdef CFG_BOOTSTRAP_CODE
2065 + li t0, BOOTSTRAP_CFG_MONITOR_BASE
2066 +#else
2067 li t0, CFG_MONITOR_BASE
2068 +#endif
2069 la t3, in_ram
2070 lw t2, -12(t3) /* t2 <-- uboot_end_data */
2071 move t1, a2
2072 @@ -311,7 +386,11 @@
2073 * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
2074 */
2075 move t6, gp
2076 +#ifdef CFG_BOOTSTRAP_CODE
2077 + sub gp, BOOTSTRAP_CFG_MONITOR_BASE
2078 +#else
2079 sub gp, CFG_MONITOR_BASE
2080 +#endif
2081 add gp, a2 /* gp now adjusted */
2082 sub t6, gp, t6 /* t6 <-- relocation offset */
2083
2084 @@ -337,12 +416,21 @@
2085
2086 /* Jump to where we've relocated ourselves.
2087 */
2088 +#ifdef CFG_BOOTSTRAP_CODE
2089 + addi t0, a2, in_ram - _start_bootstrap
2090 +#else
2091 addi t0, a2, in_ram - _start
2092 +#endif
2093 j t0
2094 nop
2095
2096 +#ifdef CFG_BOOTSTRAP_CODE
2097 + .word uboot_end_data_bootstrap
2098 + .word uboot_end_bootstrap
2099 +#else
2100 .word uboot_end_data
2101 .word uboot_end
2102 +#endif
2103 .word num_got_entries
2104
2105 in_ram:
2106 @@ -374,12 +462,19 @@
2107 sw zero, 0(t1) /* delay slot */
2108
2109 move a0, a1
2110 +#ifdef CFG_BOOTSTRAP_CODE
2111 + la t9, bootstrap_board_init_r
2112 +#else
2113 la t9, board_init_r
2114 +#endif
2115 j t9
2116 move a1, a2 /* delay slot */
2117
2118 +#ifdef CFG_BOOTSTRAP_CODE
2119 + .end bootstrap_relocate_code
2120 +#else
2121 .end relocate_code
2122 -
2123 +#endif
2124
2125 /* Exception handlers.
2126 */
2127 @@ -388,3 +483,20 @@
2128
2129 romExcHandle:
2130 b romExcHandle
2131 +
2132 +romEjtagHandle:
2133 +#ifdef CFG_BOOTSTRAP_CODE
2134 + deret
2135 + nop
2136 +#endif /* CFG_BOOTSTRAP_CODE */
2137 +1:
2138 + b 1b
2139 +
2140 + /* Additional handlers.
2141 + */
2142 +#if defined(CONFIG_IFX_MIPS)
2143 +#if defined(IFX_MIPS_HANDLER_1)
2144 +ifx_mips_handler_1:
2145 + IFX_MIPS_HANDLER_1
2146 +#endif
2147 +#endif
2148 Index: u-boot-1.1.5/tools/Makefile
2149 ===================================================================
2150 --- u-boot-1.1.5.orig/tools/Makefile 2006-10-20 17:54:33.000000000 +0200
2151 +++ u-boot-1.1.5/tools/Makefile 2009-11-09 16:35:03.000000000 +0100
2152 @@ -21,7 +21,7 @@
2153 # MA 02111-1307 USA
2154 #
2155
2156 -BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
2157 +BIN_FILES = mkimage$(SFX)
2158
2159 OBJ_LINKS = environment.o crc32.o
2160 OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o