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-10-04 23:06:03.000000000 +0200
10 +EXTRAVERSION = -IFX-LXDB
11 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
12 VERSION_FILE = $(obj)include/version_autogenerated.h
15 # Deal with colliding definitions from tcsh etc.
18 +# Default algorithm form compressing u-boot.bin
21 +COMPRESS_FILE=$(obj)u-boot.img
23 +ifeq ($(COMPRESS),lzma)
24 +COMPRESS_FILE=$(obj)u-boot.limg
26 +ifeq ($(COMPRESS),bz2)
27 +COMPRESS_FILE=$(obj)u-boot.bzimg
29 +ifeq ($(COMPRESS),gzip)
30 +COMPRESS_FILE=$(obj)u-boot.zimg
32 +ifeq ($(COMPRESS),none)
33 +COMPRESS_FILE=$(obj)u-boot.img
37 #########################################################################
39 # U-boot build supports producing a object files to the separate external
41 # U-Boot objects....order is important (i.e. start must be first)
43 OBJS = cpu/$(CPU)/start.o
44 +OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o
46 +cpu/$(CPU)/start_bootstrap.S: cpu/$(CPU)/start.S
47 + ln -s start.S cpu/$(CPU)/start_bootstrap.S
50 OBJS += cpu/$(CPU)/start16.o
51 OBJS += cpu/$(CPU)/reset.o
55 OBJS := $(addprefix $(obj),$(OBJS))
56 +OBJS_BOOTSTRAP := $(addprefix $(obj),$(OBJS_BOOTSTRAP))
58 LIBS = lib_generic/libgeneric.a
59 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
63 LIBS := $(addprefix $(obj),$(LIBS))
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
70 +LIBS_BOOTSTRAP := $(addprefix $(obj),$(LIBS_BOOTSTRAP))
73 +.PHONY : $(obj)lib_bootstrap/libbootstrap.a
76 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
78 # The "tools" are needed early, so put this first
79 # Don't include stuff already done in $(LIBS)
88 __OBJS := $(subst $(obj),,$(OBJS))
89 __LIBS := $(subst $(obj),,$(LIBS))
90 +__LIBS_BOOTSTRAP := $(subst $(obj),,$(LIBS_BOOTSTRAP))
92 +#__HEAD_OBJS := $(subst $(obj),,$(HEAD_OBJS))
93 +#__HEAD_LIBS := $(subst $(obj),,$(HEAD_LIBS))
95 #########################################################################
96 #########################################################################
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
107 +ifx_bootstrap: $(IFX_BOOTSTRAP)
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
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 $@
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
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"/') \
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"/') \
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"/') \
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"/') \
159 $(obj)u-boot.hex: $(obj)u-boot
160 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
162 @@ -243,28 +338,33 @@
163 $(obj)u-boot.bin: $(obj)u-boot
164 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
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"/') \
173 $(obj)u-boot.dis: $(obj)u-boot
174 $(OBJDUMP) -d $< > $@
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
183 +$(obj)bootstrap.bin: $(obj)bootstrap
184 + $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
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
193 $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
196 $(MAKE) -C $(dir $(subst $(obj),,$@))
198 +$(obj)lib_bootstrap/libbootstrap.a:
199 + $(MAKE) -C $(dir $(subst $(obj),,$@))
205 $(obj)System.map: $(obj)u-boot
207 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
208 - sort > $(obj)System.map
211 +$(obj)System_bootstrap.map: $(obj)bootstrap
213 + grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
216 #########################################################################
218 @@ -2032,7 +2137,20 @@
220 #========================================================================
221 #########################################################################
223 +## Infineon MIPS generic u-boot config
224 +#########################################################################
225 +danube_config: unconfig
226 + @$(MKCONFIG) $(@:_config=) mips mips danube ifx danube
228 +amazon_config: unconfig
229 + @$(MKCONFIG) $(@:_config=) mips mips amazon
232 +incaip2_config: unconfig
233 + @$(MKCONFIG) $(@:_config=) mips mips incaip2
235 +#########################################################################
237 #########################################################################
239 xtract_incaip = $(subst _100MHz,,$(subst _133MHz,,$(subst _150MHz,,$(subst _config,,$1))))
240 @@ -2254,7 +2372,7 @@
242 rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS $(obj)include/version_autogenerated.h
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-10-04 23:06:03.000000000 +0200
257 +#include <LzmaWrapper.h>
258 #include <environment.h>
259 #include <asm/byteorder.h>
262 # define CHUNKSZ (64 * 1024)
265 +#ifndef CFG_HEAD_CODE
267 int gunzip (void *, int, unsigned char *, unsigned long *);
269 static void *zalloc(void *, unsigned, unsigned);
271 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
274 +#ifndef CONFIG_REMOVE_GZIP
276 printf (" Uncompressing %s ... ", name);
277 if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
279 do_reset (cmdtp, flag, argc, argv);
282 +#endif /* CONFIG_REMOVE_GZIP */
285 printf (" Uncompressing %s ... ", name);
289 #endif /* CONFIG_BZIP2 */
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);
298 + do_reset (cmdtp, flag, argc, argv);
301 +#endif /* CONFIG_LZMA */
305 @@ -1176,6 +1193,8 @@
307 #endif /* CFG_CMD_IMLS */
309 +#endif /* ! CFG_HEAD_CODE */
312 print_image_hdr (image_header_t *hdr)
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;
322 printf ("%s %s %s (%s)", arch, os, type, comp);
325 +#ifndef CFG_HEAD_CODE
327 #define ZALLOC_ALIGNMENT 16
329 static void *zalloc(void *x, unsigned items, unsigned size)
330 @@ -1427,3 +1449,5 @@
333 #endif /* CONFIG_LYNXKDI */
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-10-04 23:06:03.000000000 +0200
344 -flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
345 - int *s_first, int *s_last,
347 +flash_fill_sect_ranges(
348 + ulong *addr_first_sect_start,
350 + ulong *addr_last_sect_end,
354 + int *bPartialStart,
357 + unsigned int bPartialErase)
362 s_last [bank] = -1; /* last sector to erase */
365 - for (bank=0,info=&flash_info[0];
366 - (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
368 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last); ++bank, ++info) {
373 b_end = info->start[0] + info->size - 1; /* bank end addr */
374 s_end = info->sector_count - 1; /* last sector */
377 for (sect=0; sect < info->sector_count; ++sect) {
378 ulong end; /* last address in current sect */
380 @@ -238,11 +243,21 @@
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;
390 if (addr_last == end) {
392 + } else if (addr_last >= info->start[sect] && addr_last < end && bPartialErase) {
393 + *addr_last_sect_end = end;
394 + s_last[bank] = sect;
399 if (s_first[bank] >= 0) {
400 if (s_last[bank] < 0) {
401 if (addr_last > b_end) {
403 struct part_info *part;
404 u8 dev_type, dev_num, pnum;
406 + unsigned int bPartialErase = 0;
417 printf ("Usage:\n%s\n", cmdtp->usage);
420 @@ -397,11 +414,117 @@
424 - rcode = flash_sect_erase(addr_first, addr_last);
425 + printf ("Erase Flash from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
427 + bPartialErase = simple_strtoul(argv[3], NULL, 10);
430 + rcode = flash_sect_erase(addr_first, addr_last, bPartialErase);
434 -int flash_sect_erase (ulong addr_first, ulong addr_last)
435 +int flerase_Partial(
436 + ulong addr_first_sect_start,
438 + ulong addr_last_sect_end,
440 + flash_info_t *info,
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;
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);
456 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
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)
464 + debug("calloc %u FAILED\n", sectMemLen);
468 + memset(pSavedSectMem, 0xff, sectMemLen);
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);
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);
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);
487 + if (bFirstPartial){
488 + if(flash_erase (info, first_sect, first_sect)) {
489 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, first_sect);
493 + debug("%s ... erase sector %d done!\n", __FUNCTION__, first_sect);
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);
502 + debug("%s ... erase sector %d done!\n", __FUNCTION__, last_sect);
505 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
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);
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);
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);
528 + free(pSavedFirstMem);
530 + free(pSavedLastMem);
532 + free(pSavedSectMem);
536 +int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase)
540 @@ -413,27 +536,66 @@
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
552 + rcode = flash_fill_sect_ranges (
553 + &addr_first_sect_start,
555 + &addr_last_sect_end,
564 if (planned && (rcode == 0)) {
565 - for (bank=0,info=&flash_info[0];
566 - (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
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 "
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,
579 - rcode = flash_erase (info, s_first[bank], s_last[bank]);
580 + if(bPartialErase) {
581 + rcode = flerase_Partial(
582 + addr_first_sect_start,
584 + addr_last_sect_end,
593 + //Erase full sectores
595 + s_first[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,
606 + rcode = flash_erase (info, s_first[bank], s_last[bank]);
610 - printf ("Erased %d sectors\n", erased);
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);
617 + printf ("Error: start and/or end address not on sector boundary\n");
620 } else if (rcode == 0) {
621 puts ("Error: start and/or end address"
622 " not on sector boundary\n");
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
634 + rcode = flash_fill_sect_ranges (
635 + &addr_first_sect_start,
637 + &addr_last_sect_end,
652 - erase, 3, 1, do_flerase,
653 + erase, 4, 1, do_flerase,
654 "erase - erase FLASH memory\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-10-04 23:06:03.000000000 +0200
662 extern char * env_name_spec;
664 printf ("Saving Environment to %s...\n", env_name_spec);
667 + if(saveenv() == 0) {
668 +#ifdef UBOOT_ENV_COPY
672 +#endif //UBOOT_ENV_COPY
677 return (saveenv() ? 1 : 0);
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-10-04 23:06:03.000000000 +0200
689 /** U-Boot INIT FUNCTIONS *************************************************/
691 +#ifndef CFG_HEAD_CODE
692 int console_assign (int file, char *devname)
700 +#endif //CFG_HEAD_CODE
701 /* Called before relocation - use serial functions */
702 int console_init_f (void)
706 #endif /* CFG_CONSOLE_IS_IN_ENV || CONFIG_SPLASH_SCREEN */
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)
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-10-04 23:06:03.000000000 +0200
723 device_t *stdio_devices[] = { NULL, NULL, NULL };
724 char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
725 +#ifndef CFG_HEAD_CODE
727 #if defined(CONFIG_SPLASH_SCREEN) && !defined(CFG_DEVICE_NULLDEV)
728 #define CFG_DEVICE_NULLDEV 1
733 +#endif //CFG_HEAD_CODE
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-10-04 23:06:03.000000000 +0200
740 * We must allocate a buffer for the environment
742 env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
743 - DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
745 + DEBUGF ("malloc env_ptr error!!\n");
746 + DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__, __LINE__, env_ptr);
752 env_get_char = env_get_char_memory;
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);
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 @@
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));
770 #ifdef CFG_REDUNDAND_ENVIRONMENT
771 env_ptr->flags = 0xFF;
778 env_relocate_spec ();
781 gd->env_addr = (ulong)&(env_ptr->data);
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-10-04 23:06:03.000000000 +0200
791 #else /* ! ENV_IS_EMBEDDED */
793 env_t *env_ptr = (env_t *)CFG_ENV_ADDR;
795 static env_t *flash_addr = (env_t *)CFG_ENV_ADDR;
797 debug (" %08lX ... %08lX ...",
798 (ulong)&(flash_addr_new->data),
799 sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
801 if ((rc = flash_write((char *)env_ptr->data,
802 (ulong)&(flash_addr_new->data),
803 sizeof(env_ptr->data))) ||
805 #endif /* CMD_SAVEENV */
807 #else /* ! CFG_ENV_ADDR_REDUND */
811 #ifdef CONFIG_OMAP2420H4
816 +#ifdef UBOOT_ENV_COPY
817 +int saveenv_copy(void) {
818 + uchar *env_buffer = (char *)env_ptr;
822 + ulong start_addr,end_addr,rootfs_end_addr;
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;
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);
833 + if(rootfs_end_addr >= start_addr)
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);
839 + debug ("Protect off %08lX ... %08lX\n", (ulong)rootfs_end_addr, end_addr);
840 + if (flash_sect_protect (0, rootfs_end_addr, end_addr))
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)
847 + if(strncmp((char *)flash_start,UBOOTCONFIG_COPY_HEADER,sizeof(UBOOTCONFIG_COPY_HEADER)) == 0)
849 + flash_sect_erase(flash_start,flash_start + sizeof(UBOOTCONFIG_COPY_HEADER),1);
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);
860 +#endif //UBOOT_ENV_COPY
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))
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-10-04 23:32:51.000000000 +0200
878 @@ -127,10 +127,15 @@
879 OBJDUMP = $(CROSS_COMPILE)objdump
880 RANLIB = $(CROSS_COMPILE)RANLIB
882 +ifneq (,$(findstring s,$(MAKEFLAGS)))
887 RELFLAGS= $(PLATFORM_RELFLAGS)
888 DBGFLAGS= -g # -DDEBUG
889 OPTFLAGS= -Os #-fomit-frame-pointer
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
899 +LDSCRIPT_BOOTSTRAP := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds
901 OBJCFLAGS += --gap-fill=0xff
903 gccincdir := $(shell $(CC) -print-file-name=include)
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) \
910 ifneq ($(OBJTREE),$(SRCTREE))
911 CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include
914 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
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)
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 \
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
929 #########################################################################
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 $@ $<
941 $(CPP) $(AFLAGS) -o $@ $<
943 @@ -229,12 +245,20 @@
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 $@ $<
955 $(CPP) $(AFLAGS) -o $@ $<
957 $(CC) $(AFLAGS) -c -o $@ $<
959 $(CC) $(CFLAGS) -c -o $@ $<
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-10-04 23:06:03.000000000 +0200
969 videomodes.o w83c553f.o \
971 pxa_pcmcia.o mpc8xx_pcmcia.o tqm8xx_pcmcia.o \
973 + rpx_pcmcia.o ifx_sw.o
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-10-04 23:06:03.000000000 +0200
982 #define CP0_CAUSE $13
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
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
1021 * Bitfields in the R[23]000 cp0 status register.
1022 @@ -471,6 +493,14 @@
1023 #define CAUSEF_BD (1 << 31)
1026 + * Bits in the coprocessor 0 EBase register
1028 +#define EBASEB_CPUNUM 0
1029 +#define EBASEF_CPUNUM (0x3ff << EBASEB_CPUNUM)
1030 +#define EBASEB_EXPBASE 12
1031 +#define EBASEF_EXPBASE (0x3ffff << EBASEB_EXPBASE)
1034 * Bits in the coprozessor 0 config register.
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 */
1042 + * Bits in ErrCtl register
1044 +#define ECCB_WST 29
1045 +#define ECCF_WST (0x1 << ECCB_WST)
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-10-04 23:06:03.000000000 +0200
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 */
1058 #define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFULL /* ALL commands */
1062 CFG_CMD_UNIVERSE | \
1064 + CFG_CMD_DHRYSTONE | \
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-10-04 23:06:04.000000000 +0200
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-10-04 23:06:04.000000000 +0200
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-10-04 23:06:03.000000000 +0200
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);
1097 /* common/flash.c */
1098 @@ -299,6 +299,10 @@
1099 #define TOSH_ID_FVT160 0xC2 /* TC58FVT160 ID (16 M, top ) */
1100 #define TOSH_ID_FVB160 0x43 /* TC58FVT160 ID (16 M, bottom ) */
1102 +#define MX_ID_29LV320AB 0x22A822A8 /* MXIC MX29LV320AB ID (32 M, bottom ) joelin */
1103 +#define MX_ID_29LV160BB 0x22492249 /* MXIC MX29LV160BB ID (16 M, bottom ) joelin */
1104 +#define MX_ID_29LV640BB 0x22cb22cb /* MXIC MX29LV640BB ID (64 M, bottom ) joelin */
1106 /*-----------------------------------------------------------------------
1107 * Internal FLASH identification codes
1109 @@ -422,6 +426,10 @@
1110 #define FLASH_S29GL064M 0x00F0 /* Spansion S29GL064M-R6 */
1111 #define FLASH_S29GL128N 0x00F1 /* Spansion S29GL128N */
1113 +#define FLASH_29LV320AB 0x00B0 /* MXIC MX29LV320AB( 32M = 4M x 16 ) joelin 10/07/2004*/
1114 +#define FLASH_29LV160BB 0x00B1 /* MXIC MX29LV160BB( 16M = 2M x 16 ) joelin 11/22/2004*/
1115 +#define FLASH_29LV640BB 0x00B2 /* MXIC MX29LV640BB( 64M = 8M x 16 ) liupeng*/
1117 #define FLASH_UNKNOWN 0xFFFF /* unknown flash type */
1120 Index: u-boot-1.1.5/include/image.h
1121 ===================================================================
1122 --- u-boot-1.1.5.orig/include/image.h 2006-10-20 17:54:33.000000000 +0200
1123 +++ u-boot-1.1.5/include/image.h 2009-10-04 23:06:03.000000000 +0200
1125 #define IH_COMP_NONE 0 /* No Compression Used */
1126 #define IH_COMP_GZIP 1 /* gzip Compression Used */
1127 #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
1128 +#define IH_COMP_LZMA 3 /* lzma Compression Used */
1130 #define IH_MAGIC 0x27051956 /* Image Magic Number */
1131 #define IH_NMLEN 32 /* Image Name Length */
1132 Index: u-boot-1.1.5/include/syscall.h
1133 ===================================================================
1134 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1135 +++ u-boot-1.1.5/include/syscall.h 2009-10-04 23:06:03.000000000 +0200
1137 +#ifndef __MON_SYS_CALL_H__
1138 +#define __MON_SYS_CALL_H__
1140 +#ifndef __ASSEMBLY__
1142 +#include <common.h>
1144 +/* These are declarations of system calls available in C code */
1145 +int mon_getc(void);
1146 +int mon_tstc(void);
1147 +void mon_putc(const char);
1148 +void mon_puts(const char*);
1149 +void mon_printf(const char* fmt, ...);
1150 +void mon_install_hdlr(int, interrupt_handler_t*, void*);
1151 +void mon_free_hdlr(int);
1152 +void *mon_malloc(size_t);
1153 +void mon_free(void*);
1154 +void mon_udelay(unsigned long);
1155 +unsigned long mon_get_timer(unsigned long);
1157 +#endif /* ifndef __ASSEMBLY__ */
1159 +#define NR_SYSCALLS 11 /* number of syscalls */
1163 + * Make sure these functions are in the same order as they
1164 + * appear in the "examples/syscall.S" file !!!
1166 +#define SYSCALL_GETC 0
1167 +#define SYSCALL_TSTC 1
1168 +#define SYSCALL_PUTC 2
1169 +#define SYSCALL_PUTS 3
1170 +#define SYSCALL_PRINTF 4
1171 +#define SYSCALL_INSTALL_HDLR 5
1172 +#define SYSCALL_FREE_HDLR 6
1173 +#define SYSCALL_MALLOC 7
1174 +#define SYSCALL_FREE 8
1175 +#define SYSCALL_UDELAY 9
1176 +#define SYSCALL_GET_TIMER 10
1179 Index: u-boot-1.1.5/ld_uboot.conf
1180 ===================================================================
1181 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1182 +++ u-boot-1.1.5/ld_uboot.conf 2009-10-04 23:06:03.000000000 +0200
1186 + 0xA0B00000 "u-boot.bin" /* Download u-boot image */
1191 +}; /* Start u-boot image */
1192 Index: u-boot-1.1.5/lib_generic/Makefile
1193 ===================================================================
1194 --- u-boot-1.1.5.orig/lib_generic/Makefile 2006-10-20 17:54:33.000000000 +0200
1195 +++ u-boot-1.1.5/lib_generic/Makefile 2009-10-04 23:06:03.000000000 +0200
1197 COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \
1198 bzlib_randtable.o bzlib_huffman.o \
1199 crc32.o ctype.o display_options.o ldiv.o \
1200 - string.o vsprintf.o zlib.o
1201 + string.o vsprintf.o zlib.o LzmaDecode.o LzmaWrapper.o
1203 SRCS := $(COBJS:.o=.c)
1204 OBJS := $(addprefix $(obj),$(COBJS))
1205 Index: u-boot-1.1.5/lib_mips/board.c
1206 ===================================================================
1207 --- u-boot-1.1.5.orig/lib_mips/board.c 2006-10-20 17:54:33.000000000 +0200
1208 +++ u-boot-1.1.5/lib_mips/board.c 2009-10-04 23:06:03.000000000 +0200
1211 #include <environment.h>
1213 +#ifdef CFG_BOOTSTRAP_CODE
1214 +//#include <asm/danube.h>
1215 +#undef CONFIG_MICROBZIP2
1217 +#ifdef CONFIG_BZIP2
1221 +#ifdef CONFIG_MICROBZIP2
1222 +#include <micro_bzlib.h>
1226 +#include <LzmaWrapper.h>
1228 +#endif //CFG_BOOTSTRAP_CODE
1230 DECLARE_GLOBAL_DATA_PTR;
1232 -#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
1233 +#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < BOOTSTRAP_CFG_MONITOR_BASE) || \
1234 + (CFG_ENV_ADDR >= (BOOTSTRAP_CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
1235 + defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_BOOTSTRAP_CODE)
1236 +#define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
1237 +#elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
1238 (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
1239 defined(CFG_ENV_IS_IN_NVRAM)
1240 #define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
1242 #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
1247 extern int timer_init(void);
1249 extern int incaip_set_cpuclk(void);
1251 +#ifdef CFG_BOOTSTRAP_CODE
1252 +extern ulong uboot_end_data_bootstrap;
1253 +extern ulong uboot_end_bootstrap;
1254 +#else //CFG_BOOTSTRAP_CODE
1255 extern ulong uboot_end_data;
1256 extern ulong uboot_end;
1257 +#endif //CFG_BOOTSTRAP_CODE
1259 ulong monitor_flash_len;
1261 -const char version_string[] =
1262 - U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
1263 +const char version_string[] = U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
1265 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1266 static char *failed = "*** failed ***\n";
1270 * Begin and End of memory area for malloc(), and current "brk"
1272 static ulong mem_malloc_end;
1273 static ulong mem_malloc_brk;
1277 * The Malloc area is immediately below the monitor copy in DRAM
1279 -static void mem_malloc_init (void)
1281 +#ifdef CFG_BOOTSTRAP_CODE
1282 +static void mem_malloc_init (ulong dest_addr) {
1283 +#else //CFG_BOOTSTRAP_CODE
1284 +static void mem_malloc_init (void) {
1285 ulong dest_addr = CFG_MONITOR_BASE + gd->reloc_off;
1287 +#endif //CFG_BOOTSTRAP_CODE
1288 mem_malloc_end = dest_addr;
1289 mem_malloc_start = dest_addr - TOTAL_MALLOC_LEN;
1290 mem_malloc_brk = mem_malloc_start;
1292 mem_malloc_end - mem_malloc_start);
1295 +#ifdef CFG_BOOTSTRAP_CODE
1296 +void *malloc(unsigned int size) {
1297 + if(size < (mem_malloc_end - mem_malloc_start)) {
1298 + mem_malloc_start += size;
1299 + debug ("malloc : size required = 0x%08lx and pointer = 0x%08lx\n",size,mem_malloc_start - size);
1300 + return (void *)(mem_malloc_start - size);
1305 +void *realloc(void *src,unsigned int size) {
1309 +void free(void *src) {
1312 +#endif //CFG_BOOTSTRAP_CODE
1314 void *sbrk (ptrdiff_t increment)
1316 ulong old = mem_malloc_brk;
1317 @@ -99,42 +143,58 @@
1319 int board_type = 0; /* use dummy arg */
1323 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1324 +#ifdef CONFIG_USE_DDR_RAM
1325 + puts ("DDR-DRAM: ");
1329 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1330 if ((gd->ram_size = initdram (board_type)) > 0) {
1331 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1332 print_size (gd->ram_size, "\n");
1333 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1336 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1338 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1342 +#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF)
1343 static int display_banner(void)
1346 printf ("\n\n%s\n\n", version_string);
1351 +#ifndef CFG_BOOTSTRAP_CODE
1352 static void display_flash_config(ulong size)
1355 print_size (size, "\n");
1357 +#endif //CFG_BOOTSTRAP_CODE
1360 +#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF)
1361 static int init_baudrate (void)
1363 +#ifndef CFG_BOOTSTRAP_CODE
1364 char tmp[64]; /* long enough for environment variables */
1365 int i = getenv_r ("baudrate", tmp, sizeof (tmp));
1367 gd->baudrate = (i > 0)
1368 ? (int) simple_strtoul (tmp, NULL, 10)
1371 +#else //CFG_BOOTSTRAP_CODE
1372 + gd->baudrate = CONFIG_BAUDRATE;
1373 +#endif //CFG_BOOTSTRAP_CODE
1380 * Breath some life into the board...
1381 @@ -159,27 +219,49 @@
1382 typedef int (init_fnc_t) (void);
1384 init_fnc_t *init_sequence[] = {
1385 +#ifdef CFG_BOOTSTRAP_CODE
1388 + //env_init, /* initialize environment */
1389 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1390 + init_baudrate, /* initialze baudrate settings */
1391 + serial_init, /* serial communications setup */
1393 + display_banner, /* say that we are here */
1395 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1398 +#else /********** CFG_BOOTSTRAP_CODE **********/
1400 - env_init, /* initialize environment */
1401 -#ifdef CONFIG_INCA_IP
1402 - incaip_set_cpuclk, /* set cpu clock according to environment variable */
1404 init_baudrate, /* initialze baudrate settings */
1405 serial_init, /* serial communications setup */
1407 display_banner, /* say that we are here */
1410 + env_init, /* initialize environment */
1412 +#endif //CFG_BOOTSTRAP_CODE
1415 +#ifdef CFG_BOOTSTRAP_CODE
1416 +extern void bootstrap_relocate_code(ulong addr_sp, gd_t *id, ulong addr);
1418 +void bootstrap_board_init_f(ulong bootflag)
1420 void board_init_f(ulong bootflag)
1425 init_fnc_t **init_fnc_ptr;
1426 - ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE;
1427 +#ifdef CFG_BOOTSTRAP_CODE
1428 + ulong addr, addr_sp, len = (ulong)&uboot_end_bootstrap - BOOTSTRAP_CFG_MONITOR_BASE;
1429 + ulong lzmaImageaddr = 0;
1430 +#else //CFG_BOOTSTRAP_CODE
1431 + ulong addr, addr_sp, len = CFG_MONITOR_LEN;
1432 +#endif //CFG_BOOTSTRAP_CODE
1434 #ifdef CONFIG_PURPLE
1435 void copy_code (ulong);
1436 @@ -219,13 +301,12 @@
1438 addr &= ~(16 * 1024 - 1);
1440 - debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
1441 + debug ("Reserving %d Bytes for U-Boot at: %08lx\n", len, addr);
1443 /* Reserve memory for malloc() arena.
1445 addr_sp = addr - TOTAL_MALLOC_LEN;
1446 - debug ("Reserving %dk for malloc() at: %08lx\n",
1447 - TOTAL_MALLOC_LEN >> 10, addr_sp);
1448 + debug ("Reserving %d Bytes for malloc() at: %08lx\n", TOTAL_MALLOC_LEN, addr_sp);
1451 * (permanently) allocate a Board Info struct
1452 @@ -234,20 +315,17 @@
1453 addr_sp -= sizeof(bd_t);
1454 bd = (bd_t *)addr_sp;
1456 - debug ("Reserving %d Bytes for Board Info at: %08lx\n",
1457 - sizeof(bd_t), addr_sp);
1458 + debug ("Reserving %d Bytes for Board Info at: %08lx\n", sizeof(bd_t), addr_sp);
1460 addr_sp -= sizeof(gd_t);
1461 id = (gd_t *)addr_sp;
1462 - debug ("Reserving %d Bytes for Global Data at: %08lx\n",
1463 - sizeof (gd_t), addr_sp);
1464 + debug ("Reserving %d Bytes for Global Data at: %08lx\n", sizeof (gd_t), addr_sp);
1466 /* Reserve memory for boot params.
1468 addr_sp -= CFG_BOOTPARAMS_LEN;
1469 bd->bi_boot_params = addr_sp;
1470 - debug ("Reserving %dk for boot params() at: %08lx\n",
1471 - CFG_BOOTPARAMS_LEN >> 10, addr_sp);
1472 + debug ("Reserving %dk for boot params() at: %08lx\n", CFG_BOOTPARAMS_LEN >> 10, addr_sp);
1475 * Finally, we set up a new (bigger) stack.
1476 @@ -279,7 +357,16 @@
1480 +#ifdef CFG_BOOTSTRAP_CODE
1481 + lzmaImageaddr = (ulong)&uboot_end_data_bootstrap;
1482 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1483 + puts("\n BOOTSTRAP: relocate_code start");
1484 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1485 + bootstrap_relocate_code (addr_sp, id, addr);
1486 +#else //CFG_BOOTSTRAP_CODE
1487 + puts("\n relocate_code start");
1488 relocate_code (addr_sp, id, addr);
1489 +#endif //CFG_BOOTSTRAP_CODE
1491 /* NOTREACHED - relocate_code() does not return */
1493 @@ -292,7 +379,110 @@
1495 ************************************************************************
1497 +#ifdef CFG_BOOTSTRAP_CODE
1498 +void bootstrap_board_init_r (gd_t *id, ulong dest_addr) {
1501 + ulong data, len, checksum;
1503 + image_header_t header;
1504 + image_header_t *hdr = &header;
1505 + unsigned int destLen;
1508 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1509 + puts("\n BOOTSTRAP: relocate_code finish.\n");
1510 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1512 + /* initialize malloc() area */
1513 + mem_malloc_init(dest_addr);
1515 + addr = (char *)(BOOTSTRAP_CFG_MONITOR_BASE + ((ulong)&uboot_end_data_bootstrap - dest_addr));
1516 + memmove (&header, (char *)addr, sizeof(image_header_t));
1518 + if (ntohl(hdr->ih_magic) != IH_MAGIC) {
1519 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1520 + printf ("Bad Magic Number at address 0x%08lx\n",addr);
1521 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1525 + data = (ulong)&header;
1526 + len = sizeof(image_header_t);
1528 + checksum = ntohl(hdr->ih_hcrc);
1530 + if (crc32 (0, (unsigned char *)data, len) != checksum) {
1531 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1532 + printf ("Bad Header Checksum\n");
1533 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1537 + data = addr + sizeof(image_header_t);
1538 + len = ntohl(hdr->ih_size);
1539 + len_ptr = (ulong *)data;
1541 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1542 + debug ("Disabling all the interrupts\n");
1543 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1544 + disable_interrupts();
1546 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1547 + debug (" Uncompressing UBoot Image ... \n" );
1548 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1550 + * If we've got less than 4 MB of malloc() space,
1551 + * use slower decompression algorithm which requires
1552 + * at most 2300 KB of memory.
1556 +#ifdef CONFIG_BZIP2
1557 + i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1558 + 0x400000, (char *)data, len,
1559 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1561 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1562 + printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1563 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1566 +#elif CONFIG_MICROBZIP2
1567 + i = micro_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1568 + &destLen, (char *)data, len,
1569 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1570 + if (i != RETVAL_OK) {
1571 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1572 + printf ("MICRO_BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1573 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1577 + i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &destLen);
1578 + if (i != LZMA_RESULT_OK) {
1579 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1580 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
1581 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1585 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1586 + printf ("NONE Compressing u-boot body!!\n");
1587 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1588 + memmove ((void *)ntohl(hdr->ih_load), (uchar *)data, len);
1591 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1592 + debug (" Uncompression completed successfully with destLen %d.\n ",destLen );
1593 + debug ("Head: Jumping to u-boot in the ram at 0x%08lx\n", CFG_MONITOR_BASE);
1594 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1596 + fn = ntohl(hdr->ih_load);
1600 +#else //CFG_BOOTSTRAP_CODE
1601 void board_init_r (gd_t *id, ulong dest_addr)
1608 + puts("\n relocate_code finish.\n");
1611 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
1613 @@ -321,12 +513,10 @@
1616 addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
1618 - printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
1619 - cmdtp->name, (ulong) (cmdtp->cmd), addr);
1622 - (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
1624 + debug ("Command \"%s\": 0x%08lx => 0x%08lx\n", cmdtp->name, (ulong) (cmdtp->cmd), addr);
1626 + cmdtp->cmd = (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
1628 addr = (ulong)(cmdtp->name) + gd->reloc_off;
1629 cmdtp->name = (char *)addr;
1630 @@ -363,7 +553,13 @@
1631 /* initialize malloc() area */
1634 +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
1635 + nand_init(); /* go init the NAND */
1639 + spi_init_f(); /* go init the SPI flash */
1641 /* relocate environment function pointers etc. */
1644 @@ -424,9 +620,12 @@
1646 /* NOTREACHED - no way out of command loop except booting */
1648 +#endif //CFG_BOOTSTRAP_CODE
1652 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1653 puts ("### ERROR ### Please RESET the board ###\n");
1654 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1657 Index: u-boot-1.1.5/lib_mips/time.c
1658 ===================================================================
1659 --- u-boot-1.1.5.orig/lib_mips/time.c 2006-10-20 17:54:33.000000000 +0200
1660 +++ u-boot-1.1.5/lib_mips/time.c 2009-10-04 23:06:03.000000000 +0200
1665 +#ifndef CFG_BOOTSTRAP_CODE
1666 +void mdelay (unsigned long msec)
1669 + for(i=0;i<msec;i++)
1679 * This function is derived from PowerPC code (read timebase as long long).
1680 * On MIPS it just returns the timer value.
1681 Index: u-boot-1.1.5/net/eth.c
1682 ===================================================================
1683 --- u-boot-1.1.5.orig/net/eth.c 2006-10-20 17:54:33.000000000 +0200
1684 +++ u-boot-1.1.5/net/eth.c 2009-10-04 23:06:03.000000000 +0200
1686 #include <command.h>
1689 +#if defined(CONFIG_IFX_MIPS)
1690 +# include "ifx_eth.c"
1693 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
1696 extern int skge_initialize(bd_t*);
1697 extern int tsec_initialize(bd_t*, int, char *);
1698 extern int npe_initialize(bd_t *);
1699 +#if defined(CONFIG_IFX_MIPS)
1700 + IFX_ETH_INITIALIZE_EXTERN
1703 static struct eth_device *eth_devices, *eth_current;
1706 #if defined(CONFIG_RTL8169)
1707 rtl8169_initialize(bis);
1710 +#if defined(CONFIG_IFX_MIPS)
1711 + IFX_ETH_INITIALIZE(bis)
1714 puts ("No ethernet found.\n");
1716 Index: u-boot-1.1.5/tools/mkimage.c
1717 ===================================================================
1718 --- u-boot-1.1.5.orig/tools/mkimage.c 2006-10-20 17:54:33.000000000 +0200
1719 +++ u-boot-1.1.5/tools/mkimage.c 2009-10-04 23:06:03.000000000 +0200
1722 #include <netinet/in.h> /* for host / network byte order conversions */
1724 +#include <sys/types.h>
1725 #include <sys/mman.h>
1726 #include <sys/stat.h>
1729 { IH_COMP_NONE, "none", "uncompressed", },
1730 { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", },
1731 { IH_COMP_GZIP, "gzip", "gzip compressed", },
1732 + { IH_COMP_LZMA, "lzma", "lzma compressed", },
1739 /* We're a bit of paranoid */
1740 -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
1741 +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
1742 (void) fdatasync (ifd);
1746 (void) munmap((void *)ptr, sbuf.st_size);
1748 /* We're a bit of paranoid */
1749 -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
1750 +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
1751 (void) fdatasync (ifd);
1754 Index: u-boot-1.1.5/cpu/mips/cache.S
1755 ===================================================================
1756 --- u-boot-1.1.5.orig/cpu/mips/cache.S 2006-10-20 17:54:33.000000000 +0200
1757 +++ u-boot-1.1.5/cpu/mips/cache.S 2009-10-04 23:06:03.000000000 +0200
1759 #include <asm/mipsregs.h>
1760 #include <asm/addrspace.h>
1761 #include <asm/cacheops.h>
1763 +#if defined(CONFIG_IFX_MIPS)
1764 +# include "danube/ifx_cache.S"
1767 /* 16KB is the maximum size of instruction and data caches on
1772 mtc0 zero, CP0_TAGLO
1773 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_INVALID_TAG)
1774 + IFX_CACHE_EXTRA_INVALID_TAG
1778 * The caches are probably in an indeterminate state,
1781 icacheopn(a0,a1,a2,a3,121,(Index_Store_Tag_I,Fill))
1783 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_OPERATION)
1784 + IFX_CACHE_EXTRA_OPERATION
1786 /* To support Orion/R4600, we initialise the data cache in 3 passes.
1790 move a3, t5 # dcacheLineSize
1792 icacheop(a0,a1,a2,a3,Index_Store_Tag_D)
1796 .end mips_cache_reset
1797 Index: u-boot-1.1.5/cpu/mips/config.mk
1798 ===================================================================
1799 --- u-boot-1.1.5.orig/cpu/mips/config.mk 2006-10-20 17:54:33.000000000 +0200
1800 +++ u-boot-1.1.5/cpu/mips/config.mk 2009-10-04 23:06:03.000000000 +0200
1802 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1806 -$(CROSS_COMPILE)as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
1807 -MIPSFLAGS=$(shell \
1808 -if [ "$v" -lt "14" ]; then \
1809 - echo "-mcpu=4kc"; \
1811 - echo "-march=4kc -mtune=4kc"; \
1814 +ifndef PLATFORM_CPU
1815 +PLATFORM_CPU = mips32
1818 +MIPSFLAGS +=$(call cc-option,-march=$(PLATFORM_CPU) -mtune=$(PLATFORM_CPU),-mcpu=$(PLATFORM_CPU))
1820 +ifeq ($(CROSS_COMPILE_UCLIBC),1)
1821 +ifneq (,$(findstring mipsel,$(CROSS_COMIPLE)))
1827 ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
1834 MIPSFLAGS += $(ENDIANNESS) -mabicalls
1836 Index: u-boot-1.1.5/cpu/mips/cpu.c
1837 ===================================================================
1838 --- u-boot-1.1.5.orig/cpu/mips/cpu.c 2006-10-20 17:54:33.000000000 +0200
1839 +++ u-boot-1.1.5/cpu/mips/cpu.c 2009-10-04 23:06:03.000000000 +0200
1843 #include <command.h>
1844 -#include <asm/inca-ip.h>
1845 +#if defined(CONFIG_INCA_IP)
1846 +# include <asm/inca-ip.h>
1847 +#elif defined(CONFIG_IFX_MIPS)
1848 +# include <asm/danube.h>
1849 +# include "danube/ifx_cpu.c"
1851 #include <asm/mipsregs.h>
1853 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1855 void (*f)(void) = (void *) 0xbfc00000;
1858 +#elif defined(CONFIG_IFX_MIPS)
1861 fprintf(stderr, "*** reset failed ***\n");
1863 Index: u-boot-1.1.5/cpu/mips/incaip_clock.c
1864 ===================================================================
1865 --- u-boot-1.1.5.orig/cpu/mips/incaip_clock.c 2006-10-20 17:54:33.000000000 +0200
1866 +++ u-boot-1.1.5/cpu/mips/incaip_clock.c 2009-10-04 23:06:03.000000000 +0200
1871 -#include <asm/inca-ip.h>
1873 +#ifdef CONFIG_INCA_IP
1874 +#include <asm/inca-ip.h>
1876 /*******************************************************************************
1883 +#endif /* CONFIG_INCA_IP */
1884 Index: u-boot-1.1.5/cpu/mips/start.S
1885 ===================================================================
1886 --- u-boot-1.1.5.orig/cpu/mips/start.S 2006-10-20 17:54:33.000000000 +0200
1887 +++ u-boot-1.1.5/cpu/mips/start.S 2009-10-04 23:06:03.000000000 +0200
1889 #include <version.h>
1890 #include <asm/regdef.h>
1891 #include <asm/mipsregs.h>
1893 +#if defined(CONFIG_IFX_MIPS)
1894 +# include "danube/ifx_start.S"
1897 #define RVECENT(f,n) \
1904 +#ifdef CFG_BOOTSTRAP_CODE
1905 + .globl _start_bootstrap
1910 +#ifdef CFG_BOOTSTRAP_CODE
1915 RVECENT(reset,0) /* U-boot entry point */
1916 RVECENT(reset,1) /* software reboot */
1917 -#if defined(CONFIG_INCA_IP)
1918 +#if defined(CONFIG_INCA_IP) || defined(CONFIG_INCA_IP2)
1919 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1920 .word 0x00000000 /* phase of the flash */
1921 +#elif defined(CONFIG_IFX_MIPS) && defined(IFX_EBU_BOOTCFG_DWORD)
1922 + IFX_EBU_BOOTCFG_DWORD
1923 #elif defined(CONFIG_PURPLE)
1924 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1925 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1927 * 128 * 8 == 1024 == 0x400
1928 * so this is address R_VEC+0x400 == 0xbfc00400
1930 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_MORE_RESERVED_VECTORS)
1931 + IFX_MORE_RESERVED_VECTORS
1933 #ifdef CONFIG_PURPLE
1936 @@ -205,8 +219,12 @@
1939 #endif /* CONFIG_PURPLE */
1940 +#endif /* CONFIG_IFX_MIPS */
1943 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_RESET_PRECHECK)
1944 + IFX_RESET_PRECHECK
1947 /* Clear watch registers.
1949 @@ -226,6 +244,10 @@
1950 /* CAUSE register */
1951 mtc0 zero, CP0_CAUSE
1953 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU_EXTRA_INIT)
1954 + IFX_CPU_EXTRA_INIT
1958 mtc0 zero, CP0_COUNT
1959 mtc0 zero, CP0_COMPARE
1960 @@ -252,12 +274,26 @@
1964 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_SKIP_LOWLEVEL_INIT)
1965 + IFX_SKIP_LOWLEVEL_INIT
1967 +#ifdef CFG_BOOTSTRAP_CODE
1968 /* Initialize any external memory.
1970 la t9, lowlevel_init
1974 +lowlevel_init_done:
1976 + beq s0, zero, init_cache_0
1979 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_CPU1_INIT)
1984 /* Initialize caches...
1986 la t9, mips_cache_reset
1987 @@ -266,7 +302,11 @@
1989 /* ... and enable them.
1991 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_OPER_MODE)
1992 + IFX_CACHE_OPER_MODE
1994 li t0, CONF_CM_CACHABLE_NONCOHERENT
1999 @@ -280,13 +320,38 @@
2000 li t0, CFG_SDRAM_BASE + CFG_INIT_SP_OFFSET
2003 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_BOOT_CLEAR)
2007 +#ifdef CFG_BOOTSTRAP_CODE
2008 + la t9, bootstrap_board_init_f
2015 +#ifdef CFG_BOOTSTRAP_CODE
2017 + * void jump_unconditional (addr)
2018 + * This function simply jumps to the location pointed by a0.
2019 + * a0 = target_location
2022 + .globl jump_unconditional
2023 + .ent jump_unconditional
2024 +jump_unconditional:
2028 + .end jump_unconditional
2033 * void relocate_code (addr_sp, gd, addr_moni)
2034 + * void bootstrap_relocate_code (addr_sp, gd, addr_moni)
2036 * This "function" does not return, instead it continues in RAM
2037 * after relocating the monitor code.
2038 @@ -295,12 +360,22 @@
2040 * a2 = destination address
2042 +#ifdef CFG_BOOTSTRAP_CODE
2043 + .globl bootstrap_relocate_code
2044 + .ent bootstrap_relocate_code
2045 +bootstrap_relocate_code:
2047 .globl relocate_code
2051 move sp, a0 /* Set new stack pointer */
2053 +#ifdef CFG_BOOTSTRAP_CODE
2054 + li t0, BOOTSTRAP_CFG_MONITOR_BASE
2056 li t0, CFG_MONITOR_BASE
2059 lw t2, -12(t3) /* t2 <-- uboot_end_data */
2061 @@ -311,7 +386,11 @@
2062 * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
2065 +#ifdef CFG_BOOTSTRAP_CODE
2066 + sub gp, BOOTSTRAP_CFG_MONITOR_BASE
2068 sub gp, CFG_MONITOR_BASE
2070 add gp, a2 /* gp now adjusted */
2071 sub t6, gp, t6 /* t6 <-- relocation offset */
2073 @@ -337,12 +416,21 @@
2075 /* Jump to where we've relocated ourselves.
2077 +#ifdef CFG_BOOTSTRAP_CODE
2078 + addi t0, a2, in_ram - _start_bootstrap
2080 addi t0, a2, in_ram - _start
2085 +#ifdef CFG_BOOTSTRAP_CODE
2086 + .word uboot_end_data_bootstrap
2087 + .word uboot_end_bootstrap
2089 .word uboot_end_data
2092 .word num_got_entries
2095 @@ -374,12 +462,19 @@
2096 sw zero, 0(t1) /* delay slot */
2099 +#ifdef CFG_BOOTSTRAP_CODE
2100 + la t9, bootstrap_board_init_r
2105 move a1, a2 /* delay slot */
2107 +#ifdef CFG_BOOTSTRAP_CODE
2108 + .end bootstrap_relocate_code
2114 /* Exception handlers.
2116 @@ -388,3 +483,20 @@
2122 +#ifdef CFG_BOOTSTRAP_CODE
2125 +#endif /* CFG_BOOTSTRAP_CODE */
2129 + /* Additional handlers.
2131 +#if defined(CONFIG_IFX_MIPS)
2132 +#if defined(IFX_MIPS_HANDLER_1)
2133 +ifx_mips_handler_1:
2134 + IFX_MIPS_HANDLER_1
2137 Index: u-boot-1.1.5/tools/Makefile
2138 ===================================================================
2139 --- u-boot-1.1.5.orig/tools/Makefile 2006-10-20 17:54:33.000000000 +0200
2140 +++ u-boot-1.1.5/tools/Makefile 2009-10-04 23:06:03.000000000 +0200
2145 -BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
2146 +BIN_FILES = mkimage$(SFX)
2148 OBJ_LINKS = environment.o crc32.o
2149 OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o