8 +EXTRAVERSION = -IFX-LXDB
9 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
10 VERSION_FILE = $(obj)include/version_autogenerated.h
12 @@ -44,6 +44,25 @@ export HOSTARCH HOSTOS
13 # Deal with colliding definitions from tcsh etc.
16 +# Default algorithm form compressing u-boot.bin
19 +COMPRESS_FILE=$(obj)u-boot.img
21 +ifeq ($(COMPRESS),lzma)
22 +COMPRESS_FILE=$(obj)u-boot.limg
24 +ifeq ($(COMPRESS),bz2)
25 +COMPRESS_FILE=$(obj)u-boot.bzimg
27 +ifeq ($(COMPRESS),gzip)
28 +COMPRESS_FILE=$(obj)u-boot.zimg
30 +ifeq ($(COMPRESS),none)
31 +COMPRESS_FILE=$(obj)u-boot.img
35 #########################################################################
37 # U-boot build supports producing a object files to the separate external
38 @@ -164,6 +183,11 @@ include $(TOPDIR)/config.mk
39 # U-Boot objects....order is important (i.e. start must be first)
41 OBJS = cpu/$(CPU)/start.o
42 +OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o
44 +cpu/$(CPU)/start_bootstrap.S: cpu/$(CPU)/start.S
45 + ln -s start.S cpu/$(CPU)/start_bootstrap.S
48 OBJS += cpu/$(CPU)/start16.o
49 OBJS += cpu/$(CPU)/reset.o
50 @@ -183,6 +207,7 @@ OBJS += cpu/$(CPU)/cplbhdlr.o cpu/$(CPU)
53 OBJS := $(addprefix $(obj),$(OBJS))
54 +OBJS_BOOTSTRAP := $(addprefix $(obj),$(OBJS_BOOTSTRAP))
56 LIBS = lib_generic/libgeneric.a
57 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
58 @@ -206,15 +231,24 @@ LIBS += common/libcommon.a
61 LIBS := $(addprefix $(obj),$(LIBS))
63 +LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a
64 +LIBS_BOOTSTRAP+= board/$(BOARDDIR)/lib$(BOARD).a
65 +#LIBS_BOOTSTRAP+= board/ifx/libifx.a
66 +LIBS_BOOTSTRAP+= cpu/$(CPU)/lib$(CPU).a
68 +LIBS_BOOTSTRAP := $(addprefix $(obj),$(LIBS_BOOTSTRAP))
71 +.PHONY : $(obj)lib_bootstrap/libbootstrap.a
74 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
76 # The "tools" are needed early, so put this first
77 # Don't include stuff already done in $(LIBS)
84 @@ -226,14 +260,75 @@ endif
86 __OBJS := $(subst $(obj),,$(OBJS))
87 __LIBS := $(subst $(obj),,$(LIBS))
88 +__LIBS_BOOTSTRAP := $(subst $(obj),,$(LIBS_BOOTSTRAP))
90 +#__HEAD_OBJS := $(subst $(obj),,$(HEAD_OBJS))
91 +#__HEAD_LIBS := $(subst $(obj),,$(HEAD_LIBS))
93 #########################################################################
94 #########################################################################
96 ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND)
97 +#IFX_ALL = $(obj)u-boot.ifx $(obj)head.srec $(obj)head.bin $(obj)head $(obj)head.map $(COMPRESS_FILE) $(obj)u-boot.srec
98 +IFX_ALL = $(obj)u-boot.srec $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin $(obj)System_bootstrap.map
99 +IFX_BOOTSTRAP = $(obj)bootstrap.bin
105 +ifx_bootstrap: $(IFX_BOOTSTRAP)
107 +$(obj)u-boot.ifx: $(obj)bootstrap.bin $(obj)u-boot.lzimg
108 + @cat $(obj)bootstrap.bin > $(obj)u-boot.ifx
109 + @cat $(obj)u-boot.lzimg >> $(obj)u-boot.ifx
111 +$(obj)u-boot.lzimg: $(obj)u-boot.bin $(obj)System.map
112 + @lzma e $(obj)u-boot.bin $(obj)u-boot.lzma
113 + $(obj)tools/mkimage -A mips -T firmware -C lzma \
114 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
115 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
116 + -n 'u-boot image' -d $(obj)u-boot.lzma $@
118 +$(obj)ld_uboot.img: $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)bootstrap.bin
119 + @ cp -f $(obj)u-boot.ifx $(obj)u-boot.bin
120 + @ ./mkbootimg.incaip2 $(obj)ld_uboot.img < ld_uboot.conf
122 +$(obj)u-boot.zimg: $(obj)u-boot.bin $(obj)System.map
123 + gzip $(obj)u-boot.bin
124 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C gzip \
125 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
126 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
127 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
128 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
131 +$(obj)u-boot.bzimg: $(obj)u-boot.bin $(obj)System.map
132 + bzip $(obj)u-boot.bin
133 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C bzip2 \
134 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
135 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
136 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
137 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
140 +$(obj)u-boot.limg: $(obj)u-boot.bin $(obj)System.map
141 + @lzma e $(obj)u-boot.bin $(obj)u-boot.lzma
142 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C lzma \
143 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
144 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
145 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
146 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
149 +$(obj)u-boot.img: $(obj)u-boot.bin $(obj)System.map
150 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
151 + -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
152 + -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \
153 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
154 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
157 $(obj)u-boot.hex: $(obj)u-boot
158 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
160 @@ -243,28 +338,33 @@ $(obj)u-boot.srec: $(obj)u-boot
161 $(obj)u-boot.bin: $(obj)u-boot
162 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
164 -$(obj)u-boot.img: $(obj)u-boot.bin
165 - ./tools/mkimage -A $(ARCH) -T firmware -C none \
166 - -a $(TEXT_BASE) -e 0 \
167 - -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
168 - sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
171 $(obj)u-boot.dis: $(obj)u-boot
172 $(OBJDUMP) -d $< > $@
174 -$(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
175 +$(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
176 UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
177 cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
178 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
179 -Map u-boot.map -o u-boot
181 +$(obj)bootstrap.bin: $(obj)bootstrap
182 + $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
184 +$(obj)bootstrap : depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LDSCRIPT_BOOTSTRAP)
185 + UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
186 + $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
187 + --start-group $(__LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \
188 + -Map bootstrap.map -o bootstrap
191 $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
194 $(MAKE) -C $(dir $(subst $(obj),,$@))
196 +$(obj)lib_bootstrap/libbootstrap.a:
197 + $(MAKE) -C $(dir $(subst $(obj),,$@))
202 @@ -310,7 +410,12 @@ etags:
203 $(obj)System.map: $(obj)u-boot
205 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
206 - sort > $(obj)System.map
209 +$(obj)System_bootstrap.map: $(obj)bootstrap
211 + grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
214 #########################################################################
216 @@ -2032,7 +2137,20 @@ sc520_spunk_rel_config : unconfig
218 #========================================================================
219 #########################################################################
221 +## Infineon MIPS generic u-boot config
222 +#########################################################################
223 +danube_config: unconfig
224 + @$(MKCONFIG) $(@:_config=) mips mips danube ifx danube
226 +amazon_config: unconfig
227 + @$(MKCONFIG) $(@:_config=) mips mips amazon
230 +incaip2_config: unconfig
231 + @$(MKCONFIG) $(@:_config=) mips mips incaip2
233 +#########################################################################
235 #########################################################################
237 xtract_incaip = $(subst _100MHz,,$(subst _133MHz,,$(subst _150MHz,,$(subst _config,,$1))))
238 @@ -2254,7 +2372,7 @@ clobber: clean
240 rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS $(obj)include/version_autogenerated.h
242 - rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
243 + rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL) $(IFX_ALL)
244 rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c
245 rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
246 rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
247 --- a/common/cmd_bootm.c
248 +++ b/common/cmd_bootm.c
253 +#include <LzmaWrapper.h>
254 #include <environment.h>
255 #include <asm/byteorder.h>
257 @@ -79,6 +80,8 @@ DECLARE_GLOBAL_DATA_PTR;
258 # define CHUNKSZ (64 * 1024)
261 +#ifndef CFG_HEAD_CODE
263 int gunzip (void *, int, unsigned char *, unsigned long *);
265 static void *zalloc(void *, unsigned, unsigned);
266 @@ -341,6 +344,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
267 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
270 +#ifndef CONFIG_REMOVE_GZIP
272 printf (" Uncompressing %s ... ", name);
273 if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
274 @@ -350,6 +354,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
275 do_reset (cmdtp, flag, argc, argv);
278 +#endif /* CONFIG_REMOVE_GZIP */
281 printf (" Uncompressing %s ... ", name);
282 @@ -369,6 +374,18 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
285 #endif /* CONFIG_BZIP2 */
288 + printf (" Uncompressing %s ... ", name);
289 + i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &unc_len);
290 + if (i != LZMA_RESULT_OK) {
291 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
292 + SHOW_BOOT_PROGRESS (-6);
294 + do_reset (cmdtp, flag, argc, argv);
297 +#endif /* CONFIG_LZMA */
301 @@ -1176,6 +1193,8 @@ U_BOOT_CMD(
303 #endif /* CFG_CMD_IMLS */
305 +#endif /* ! CFG_HEAD_CODE */
308 print_image_hdr (image_header_t *hdr)
310 @@ -1270,12 +1289,15 @@ print_type (image_header_t *hdr)
311 case IH_COMP_NONE: comp = "uncompressed"; break;
312 case IH_COMP_GZIP: comp = "gzip compressed"; break;
313 case IH_COMP_BZIP2: comp = "bzip2 compressed"; break;
314 + case IH_COMP_LZMA: comp = "lzma compressed"; break;
315 default: comp = "unknown compression"; break;
318 printf ("%s %s %s (%s)", arch, os, type, comp);
321 +#ifndef CFG_HEAD_CODE
323 #define ZALLOC_ALIGNMENT 16
325 static void *zalloc(void *x, unsigned items, unsigned size)
326 @@ -1427,3 +1449,5 @@ do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int
329 #endif /* CONFIG_LYNXKDI */
331 +#endif /* ! CFG_HEAD_CODE */
332 --- a/common/cmd_flash.c
333 +++ b/common/cmd_flash.c
334 @@ -196,9 +196,17 @@ addr_spec(char *arg1, char *arg2, ulong
338 -flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
339 - int *s_first, int *s_last,
341 +flash_fill_sect_ranges(
342 + ulong *addr_first_sect_start,
344 + ulong *addr_last_sect_end,
348 + int *bPartialStart,
351 + unsigned int bPartialErase)
355 @@ -211,9 +219,7 @@ flash_fill_sect_ranges (ulong addr_first
356 s_last [bank] = -1; /* last sector to erase */
359 - for (bank=0,info=&flash_info[0];
360 - (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
362 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last); ++bank, ++info) {
366 @@ -225,7 +231,6 @@ flash_fill_sect_ranges (ulong addr_first
367 b_end = info->start[0] + info->size - 1; /* bank end addr */
368 s_end = info->sector_count - 1; /* last sector */
371 for (sect=0; sect < info->sector_count; ++sect) {
372 ulong end; /* last address in current sect */
374 @@ -238,11 +243,21 @@ flash_fill_sect_ranges (ulong addr_first
376 if (addr_first == info->start[sect]) {
377 s_first[bank] = sect;
378 + } else if (addr_first > info->start[sect] && addr_first <= end && bPartialErase) {
379 + *addr_first_sect_start = info->start[sect];
380 + s_first[bank] = sect;
381 + *bPartialStart = 1;
384 if (addr_last == end) {
386 + } else if (addr_last >= info->start[sect] && addr_last < end && bPartialErase) {
387 + *addr_last_sect_end = end;
388 + s_last[bank] = sect;
393 if (s_first[bank] >= 0) {
394 if (s_last[bank] < 0) {
395 if (addr_last > b_end) {
396 @@ -316,6 +331,8 @@ int do_flerase (cmd_tbl_t *cmdtp, int fl
397 struct part_info *part;
398 u8 dev_type, dev_num, pnum;
400 + unsigned int bPartialErase = 0;
405 @@ -369,7 +386,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int fl
411 printf ("Usage:\n%s\n", cmdtp->usage);
414 @@ -397,11 +414,117 @@ int do_flerase (cmd_tbl_t *cmdtp, int fl
418 - rcode = flash_sect_erase(addr_first, addr_last);
419 + printf ("Erase Flash from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
421 + bPartialErase = simple_strtoul(argv[3], NULL, 10);
424 + rcode = flash_sect_erase(addr_first, addr_last, bPartialErase);
428 -int flash_sect_erase (ulong addr_first, ulong addr_last)
429 +int flerase_Partial(
430 + ulong addr_first_sect_start,
432 + ulong addr_last_sect_end,
434 + flash_info_t *info,
438 + int bLastPartial) {
439 + unsigned int firstMemLen = 0;
440 + unsigned int lastMemLen = 0;
441 + unsigned int sectMemLen = 0;
442 + uchar *pSavedFirstMem = NULL;
443 + uchar *pSavedLastMem = NULL;
444 + uchar *pSavedSectMem = NULL;
445 + int bSectPartial = 0;
448 + 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);
450 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
452 + ulong b_end = info->start[0] + info->size - 1;
453 + ulong end = (first_sect == (info->sector_count - 1)) ? b_end : info->start[first_sect + 1] - 1;
454 + sectMemLen = end - info->start[first_sect] + 1;
455 + pSavedSectMem = (uchar *)calloc(sectMemLen, sizeof(char));
456 + if (pSavedSectMem == NULL)
458 + debug("calloc %u FAILED\n", sectMemLen);
462 + memset(pSavedSectMem, 0xff, sectMemLen);
464 + memcpy(pSavedSectMem, (uchar *)addr_first_sect_start, addr_first - addr_first_sect_start);
465 + memcpy(pSavedSectMem + (addr_last - info->start[first_sect]) + 1, addr_last + 1, end - addr_last);
469 + if (bFirstPartial){
470 + firstMemLen = addr_first - addr_first_sect_start + 1;
471 + pSavedFirstMem = (uchar *)calloc(firstMemLen,sizeof(char));
472 + memcpy(pSavedFirstMem,(uchar *)addr_first_sect_start,firstMemLen - 1);
475 + lastMemLen = addr_last_sect_end - addr_last + 1;
476 + pSavedLastMem = (uchar *)calloc(lastMemLen,sizeof(char));
477 + memcpy(pSavedLastMem,(uchar *)addr_last + 1,lastMemLen - 1);
481 + if (bFirstPartial){
482 + if(flash_erase (info, first_sect, first_sect)) {
483 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, first_sect);
487 + debug("%s ... erase sector %d done!\n", __FUNCTION__, first_sect);
490 + if (bLastPartial && first_sect != last_sect){
491 + if(flash_erase (info, last_sect, last_sect)) {
492 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, last_sect);
496 + debug("%s ... erase sector %d done!\n", __FUNCTION__, last_sect);
499 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
501 + flash_write(pSavedSectMem, (uchar *)addr_first_sect_start, sectMemLen);
502 + debug("flash_write from 0x%08x with len %u\n", addr_first_sect_start, sectMemLen);
506 + if (bFirstPartial){
507 + if(flash_write(pSavedFirstMem,(uchar *)addr_first_sect_start,firstMemLen - 1)) {
508 + printf("%s ... Couldn't write at 0x%08lx length %d\n", __FUNCTION__, addr_first_sect_start,firstMemLen - 1);
514 + if(flash_write(pSavedLastMem,(uchar *)addr_last + 1,lastMemLen - 1)) {
515 + printf("%s ... Couldn't write at 0x%08lx length %d\n", __FUNCTION__, addr_last, lastMemLen - 1);
522 + free(pSavedFirstMem);
524 + free(pSavedLastMem);
526 + free(pSavedSectMem);
530 +int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase)
534 @@ -413,27 +536,66 @@ int flash_sect_erase (ulong addr_first,
539 - rcode = flash_fill_sect_ranges (addr_first, addr_last,
540 - s_first, s_last, &planned );
541 + int bPartialStart = 0; // Start sector has to be erased partially
542 + int bPartialEnd = 0; // End sector has to be erased partially
543 + ulong addr_first_sect_start = 0;// Sector start address of location addr_start
544 + ulong addr_last_sect_end = 0; // Sector end address of location addr_last
546 + rcode = flash_fill_sect_ranges (
547 + &addr_first_sect_start,
549 + &addr_last_sect_end,
558 if (planned && (rcode == 0)) {
559 - for (bank=0,info=&flash_info[0];
560 - (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
562 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0); ++bank, ++info) {
563 + ulong b_end = info->start[0] + info->size - 1; /* bank end addr */
564 if (s_first[bank]>=0) {
565 - erased += s_last[bank] - s_first[bank] + 1;
566 - debug ("Erase Flash from 0x%08lx to 0x%08lx "
568 - info->start[s_first[bank]],
569 - (s_last[bank] == info->sector_count) ?
570 - info->start[0] + info->size - 1:
571 - info->start[s_last[bank]+1] - 1,
573 - rcode = flash_erase (info, s_first[bank], s_last[bank]);
574 + if(bPartialErase) {
575 + rcode = flerase_Partial(
576 + addr_first_sect_start,
578 + addr_last_sect_end,
587 + //Erase full sectores
589 + s_first[bank] += 1;
592 + if (s_last[bank] >= s_first[bank]) {
593 + erased += s_last[bank] - s_first[bank] + 1;
594 + debug ("Erase Flash from 0x%08lx to 0x%08lx in Bank # %ld ",
595 + info->start[s_first[bank]],
596 + (s_last[bank] == info->sector_count) ?
597 + info->start[0] + info->size - 1:
598 + info->start[s_last[bank]+1] - 1,
600 + rcode = flash_erase (info, s_first[bank], s_last[bank]);
604 - printf ("Erased %d sectors\n", erased);
606 + if (erased && !bPartialErase) {
607 + printf ("Erased %d sectors\n", erased);
608 + } else if (bPartialErase){
609 + printf ("Partial erased from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
611 + printf ("Error: start and/or end address not on sector boundary\n");
614 } else if (rcode == 0) {
615 puts ("Error: start and/or end address"
616 " not on sector boundary\n");
617 @@ -629,8 +791,22 @@ int flash_sect_protect (int p, ulong add
622 - rcode = flash_fill_sect_ranges( addr_first, addr_last, s_first, s_last, &planned );
623 + int bPartialStart = 0; // Start sector has to be erased partially
624 + int bPartialEnd = 0; // End sector has to be erased partially
625 + ulong addr_first_sect_start = 0;// Sector start address of location addr_start
626 + ulong addr_last_sect_end = 0; // Sector end address of location addr_last
628 + rcode = flash_fill_sect_ranges (
629 + &addr_first_sect_start,
631 + &addr_last_sect_end,
642 @@ -690,7 +866,7 @@ U_BOOT_CMD(
646 - erase, 3, 1, do_flerase,
647 + erase, 4, 1, do_flerase,
648 "erase - erase FLASH memory\n",
650 " - erase FLASH from addr 'start' to addr 'end'\n"
651 --- a/common/cmd_nvedit.c
652 +++ b/common/cmd_nvedit.c
653 @@ -540,8 +540,19 @@ int do_saveenv (cmd_tbl_t *cmdtp, int fl
654 extern char * env_name_spec;
656 printf ("Saving Environment to %s...\n", env_name_spec);
659 + if(saveenv() == 0) {
660 +#ifdef UBOOT_ENV_COPY
664 +#endif //UBOOT_ENV_COPY
669 return (saveenv() ? 1 : 0);
674 --- a/common/console.c
675 +++ b/common/console.c
676 @@ -324,7 +324,7 @@ inline void dbg(const char *fmt, ...)
679 /** U-Boot INIT FUNCTIONS *************************************************/
681 +#ifndef CFG_HEAD_CODE
682 int console_assign (int file, char *devname)
685 @@ -357,7 +357,7 @@ int console_assign (int file, char *devn
690 +#endif //CFG_HEAD_CODE
691 /* Called before relocation - use serial functions */
692 int console_init_f (void)
694 @@ -392,6 +392,7 @@ device_t *search_device (int flags, char
696 #endif /* CFG_CONSOLE_IS_IN_ENV || CONFIG_SPLASH_SCREEN */
698 +#ifndef CFG_HEAD_CODE
699 #ifdef CFG_CONSOLE_IS_IN_ENV
700 /* Called after the relocation - use desired console functions */
701 int console_init_r (void)
702 @@ -570,3 +571,4 @@ int console_init_r (void)
705 #endif /* CFG_CONSOLE_IS_IN_ENV */
706 +#endif //CFG_HEAD_CODE
707 --- a/common/devices.c
708 +++ b/common/devices.c
709 @@ -39,6 +39,7 @@ DECLARE_GLOBAL_DATA_PTR;
711 device_t *stdio_devices[] = { NULL, NULL, NULL };
712 char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
713 +#ifndef CFG_HEAD_CODE
715 #if defined(CONFIG_SPLASH_SCREEN) && !defined(CFG_DEVICE_NULLDEV)
716 #define CFG_DEVICE_NULLDEV 1
717 @@ -214,3 +215,5 @@ int devices_done (void)
721 +#endif //CFG_HEAD_CODE
723 --- a/common/env_common.c
724 +++ b/common/env_common.c
725 @@ -219,7 +219,9 @@ void env_relocate (void)
726 * We must allocate a buffer for the environment
728 env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
729 - DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
731 + DEBUGF ("malloc env_ptr error!!\n");
732 + DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__, __LINE__, env_ptr);
736 @@ -227,6 +229,10 @@ void env_relocate (void)
738 env_get_char = env_get_char_memory;
741 + DEBUGF ("%s[%d] gd->env_valid=%d\n", __FUNCTION__, __LINE__, gd->env_valid);
742 + DEBUGF ("%s[%d] CFG_ENV_SIZE=%d\n", __FUNCTION__, __LINE__, CFG_ENV_SIZE);
744 if (gd->env_valid == 0) {
745 #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */
746 puts ("Using default environment\n\n");
747 @@ -242,18 +248,17 @@ void env_relocate (void)
750 memset (env_ptr, 0, sizeof(env_t));
751 - memcpy (env_ptr->data,
752 - default_environment,
753 - sizeof(default_environment));
754 + memcpy (env_ptr->data, default_environment, sizeof(default_environment));
756 #ifdef CFG_REDUNDAND_ENVIRONMENT
757 env_ptr->flags = 0xFF;
764 env_relocate_spec ();
767 gd->env_addr = (ulong)&(env_ptr->data);
769 #ifdef CONFIG_AMIGAONEG3SE
770 --- a/common/env_flash.c
771 +++ b/common/env_flash.c
772 @@ -66,7 +66,6 @@ static env_t *flash_addr = (env_t *)CFG_
775 #else /* ! ENV_IS_EMBEDDED */
777 env_t *env_ptr = (env_t *)CFG_ENV_ADDR;
779 static env_t *flash_addr = (env_t *)CFG_ENV_ADDR;
780 @@ -201,6 +200,7 @@ int saveenv(void)
781 debug (" %08lX ... %08lX ...",
782 (ulong)&(flash_addr_new->data),
783 sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
785 if ((rc = flash_write((char *)env_ptr->data,
786 (ulong)&(flash_addr_new->data),
787 sizeof(env_ptr->data))) ||
788 @@ -256,7 +256,6 @@ Done:
789 #endif /* CMD_SAVEENV */
791 #else /* ! CFG_ENV_ADDR_REDUND */
795 #ifdef CONFIG_OMAP2420H4
796 @@ -280,6 +279,52 @@ bad_flash:
800 +#ifdef UBOOT_ENV_COPY
801 +int saveenv_copy(void) {
802 + uchar *env_buffer = (char *)env_ptr;
806 + ulong start_addr,end_addr,rootfs_end_addr;
809 + kernel_addr = getenv("f_kernel_addr");
810 + end_addr = simple_strtoul(kernel_addr,NULL,16) - 1;
811 + start_addr = end_addr - CFG_ENV_SIZE - sizeof(UBOOTCONFIG_COPY_HEADER) + 1;
813 + rootfs_addr = getenv("f_rootfs_addr");
814 + rootfs_size = getenv("f_rootfs_size");
815 + rootfs_end_addr = simple_strtoul(rootfs_addr,NULL,16) + simple_strtoul(rootfs_size,NULL,16);
817 + if(rootfs_end_addr >= start_addr)
819 + 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);
823 + debug ("Protect off %08lX ... %08lX\n", (ulong)rootfs_end_addr, end_addr);
824 + if (flash_sect_protect (0, rootfs_end_addr, end_addr))
827 + //delete the old environment copy, if found
828 + flash_start = rootfs_end_addr;
829 + while(flash_start + sizeof(UBOOTCONFIG_COPY_HEADER) + ENV_SIZE < end_addr)
831 + if(strncmp((char *)flash_start,UBOOTCONFIG_COPY_HEADER,sizeof(UBOOTCONFIG_COPY_HEADER)) == 0)
833 + flash_sect_erase(flash_start,flash_start + sizeof(UBOOTCONFIG_COPY_HEADER),1);
837 + flash_sect_erase(start_addr,end_addr,1);
838 + flash_write(UBOOTCONFIG_COPY_HEADER,start_addr,sizeof(UBOOTCONFIG_COPY_HEADER));
839 + flash_write(env_buffer,start_addr + sizeof(UBOOTCONFIG_COPY_HEADER), CFG_ENV_SIZE);
840 + flash_sect_protect (1, rootfs_end_addr, end_addr);
841 + printf("saved copy of the env at 0x%08lx\n",start_addr);
844 +#endif //UBOOT_ENV_COPY
849 @@ -331,7 +376,7 @@ int saveenv(void)
852 puts ("Erasing Flash...");
853 - if (flash_sect_erase (flash_sect_addr, end_addr))
854 + if (flash_sect_erase (flash_sect_addr, end_addr, 1))
857 puts ("Writing to Flash... ");
860 @@ -127,10 +127,15 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
861 OBJDUMP = $(CROSS_COMPILE)objdump
862 RANLIB = $(CROSS_COMPILE)RANLIB
864 +ifneq (,$(findstring s,$(MAKEFLAGS)))
869 RELFLAGS= $(PLATFORM_RELFLAGS)
870 DBGFLAGS= -g # -DDEBUG
871 OPTFLAGS= -Os #-fomit-frame-pointer
874 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
875 ifeq ($(CONFIG_NAND_U_BOOT),y)
876 @@ -139,12 +144,15 @@ else
877 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
881 +LDSCRIPT_BOOTSTRAP := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds
883 OBJCFLAGS += --gap-fill=0xff
885 gccincdir := $(shell $(CC) -print-file-name=include)
887 -CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
888 - -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
889 +CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) $(OWRT_FLAGS) \
890 + -D__KERNEL__ -DUBOOT_RAM_TEXT_BASE=$(UBOOT_RAM_TEXT_BASE) \
892 ifneq ($(OBJTREE),$(SRCTREE))
893 CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include
894 @@ -180,7 +188,8 @@ endif
896 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
898 -LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
899 +LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(UBOOT_RAM_TEXT_BASE) $(PLATFORM_LDFLAGS)
900 +LDFLAGS_BOOTSTRAP += -Bstatic -T $(LDSCRIPT_BOOTSTRAP) -Ttext $(BOOTSTRAP_TEXT_BASE) $(PLATFORM_LDFLAGS)
902 # Location of a usable BFD library, where we define "usable" as
903 # "built for ${HOST}, supports ${TARGET}". Sensible values are
904 @@ -214,12 +223,19 @@ endif
905 export CONFIG_SHELL HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE \
906 AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP \
908 -export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
909 +export UBOOT_RAM_TEXT_BASE BOOTSTRAP_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
911 #########################################################################
915 +%_bootstrap.s: %_bootstrap.S
916 + $(CPP) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -o $@ $<
917 +%_bootstrap.o: %_bootstrap.S
918 + $(CC) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $<
919 +%_bootstrap.o: %_bootstrap.c
920 + $(CC) $(CFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $<
923 $(CPP) $(AFLAGS) -o $@ $<
925 @@ -229,12 +245,20 @@ ifndef REMOTE_BUILD
929 +$(obj)%_bootstrap.s: %_bootstrap.S
930 + $(CPP) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -o $@ $<
931 +$(obj)%_bootstrap.o: %_bootstrap.S
932 + $(CC) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $<
933 +$(obj)%_bootstrap.o: %_bootstrap.c
934 + $(CC) $(CFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $<
937 $(CPP) $(AFLAGS) -o $@ $<
939 $(CC) $(AFLAGS) -c -o $@ $<
941 $(CC) $(CFLAGS) -c -o $@ $<
945 #########################################################################
946 --- a/drivers/Makefile
947 +++ b/drivers/Makefile
948 @@ -50,7 +50,7 @@ COBJS = 3c589.o 5701rls.o ali512x.o \
949 videomodes.o w83c553f.o \
951 pxa_pcmcia.o mpc8xx_pcmcia.o tqm8xx_pcmcia.o \
953 + rpx_pcmcia.o ifx_sw.o
955 SRCS := $(COBJS:.o=.c)
956 OBJS := $(addprefix $(obj),$(COBJS))
957 --- a/include/asm-mips/mipsregs.h
958 +++ b/include/asm-mips/mipsregs.h
960 #define CP0_CAUSE $13
963 +#define CP0_EBASE $15,1
964 #define CP0_CONFIG $16
965 #define CP0_LLADDR $17
966 #define CP0_WATCHLO $18
967 @@ -330,11 +331,32 @@ __BUILD_SET_CP0(config,CP0_CONFIG)
968 # define KSU_USER 0x00000010
969 # define KSU_SUPERVISOR 0x00000008
970 # define KSU_KERNEL 0x00000000
971 +#ifdef CONFIG_DANUBE /* MIPS 24KE */
972 +/* bits 5 & 6 & 7: reserved */
973 +/* bits 8~15: IM0~7 */
974 +/* bits 16: reserved */
975 +#define ST0_CEE 0x00020000
976 +/* bits 18: always 0 */
977 +#define ST0_NMI 0x00080000
978 +#define ST0_SR 0x00100000
979 +#define ST0_TS 0x00200000
980 +#define ST0_BEV 0x00400000
981 +/* bits 23: reserved */
982 +#define ST0_MX 0x01000000
983 +#define ST0_RE 0x02000000
984 +#define ST0_FR 0x04000000
985 +#define ST0_RP 0x08000000
986 +#define ST0_CU0 0x10000000
987 +#define ST0_CU1 0x20000000
988 +#define ST0_CU2 0x40000000
989 +#define ST0_CU3 0x80000000
991 #define ST0_UX 0x00000020
992 #define ST0_SX 0x00000040
993 #define ST0_KX 0x00000080
994 #define ST0_DE 0x00010000
995 #define ST0_CE 0x00020000
999 * Bitfields in the R[23]000 cp0 status register.
1000 @@ -471,6 +493,14 @@ __BUILD_SET_CP0(config,CP0_CONFIG)
1001 #define CAUSEF_BD (1 << 31)
1004 + * Bits in the coprocessor 0 EBase register
1006 +#define EBASEB_CPUNUM 0
1007 +#define EBASEF_CPUNUM (0x3ff << EBASEB_CPUNUM)
1008 +#define EBASEB_EXPBASE 12
1009 +#define EBASEF_EXPBASE (0x3ffff << EBASEB_EXPBASE)
1012 * Bits in the coprozessor 0 config register.
1014 #define CONF_CM_CACHABLE_NO_WA 0
1015 @@ -544,4 +574,10 @@ __BUILD_SET_CP0(config,CP0_CONFIG)
1016 #define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
1017 #define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
1020 + * Bits in ErrCtl register
1022 +#define ECCB_WST 29
1023 +#define ECCF_WST (0x1 << ECCB_WST)
1025 #endif /* _ASM_MIPSREGS_H */
1026 --- a/include/cmd_confdefs.h
1027 +++ b/include/cmd_confdefs.h
1029 #define CFG_CMD_EXT2 0x1000000000000000ULL /* EXT2 Support */
1030 #define CFG_CMD_SNTP 0x2000000000000000ULL /* SNTP support */
1031 #define CFG_CMD_DISPLAY 0x4000000000000000ULL /* Display support */
1032 +#define CFG_CMD_DHRYSTONE 0x8000000000000000ULL /* Dhrystone benchmark support */
1034 #define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFULL /* ALL commands */
1038 CFG_CMD_UNIVERSE | \
1040 + CFG_CMD_DHRYSTONE | \
1043 /* Default configuration
1045 +++ b/include/config.h
1047 +/* Automatically generated - do not edit */
1048 +#include <configs/danube.h>
1050 +++ b/include/config.mk
1057 --- a/include/flash.h
1058 +++ b/include/flash.h
1059 @@ -79,7 +79,7 @@ typedef struct {
1060 extern unsigned long flash_init (void);
1061 extern void flash_print_info (flash_info_t *);
1062 extern int flash_erase (flash_info_t *, int, int);
1063 -extern int flash_sect_erase (ulong addr_first, ulong addr_last);
1064 +extern int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase);
1065 extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
1067 /* common/flash.c */
1068 @@ -131,7 +131,9 @@ extern void flash_read_factory_serial(fl
1069 #define MT2_MANUFACT 0x002C002C /* alternate MICRON manufacturer ID*/
1070 #define EXCEL_MANUFACT 0x004A004A /* Excel Semiconductor */
1072 - /* Micron Technologies (INTEL compat.) */
1073 +#define EON_ID_EN29LV320B 0x22f9
1074 +#define FLASH_29LV320B 0xE0
1075 +/* Micron Technologies (INTEL compat.) */
1076 #define MT_ID_28F400_T 0x44704470 /* 28F400B3 ID ( 4 M, top boot sector) */
1077 #define MT_ID_28F400_B 0x44714471 /* 28F400B3 ID ( 4 M, bottom boot sect) */
1079 @@ -299,6 +301,10 @@ extern void flash_read_factory_serial(fl
1080 #define TOSH_ID_FVT160 0xC2 /* TC58FVT160 ID (16 M, top ) */
1081 #define TOSH_ID_FVB160 0x43 /* TC58FVT160 ID (16 M, bottom ) */
1083 +#define MX_ID_29LV320AB 0x22A822A8 /* MXIC MX29LV320AB ID (32 M, bottom ) joelin */
1084 +#define MX_ID_29LV160BB 0x22492249 /* MXIC MX29LV160BB ID (16 M, bottom ) joelin */
1085 +#define MX_ID_29LV640BB 0x22cb22cb /* MXIC MX29LV640BB ID (64 M, bottom ) joelin */
1087 /*-----------------------------------------------------------------------
1088 * Internal FLASH identification codes
1090 @@ -422,6 +428,10 @@ extern void flash_read_factory_serial(fl
1091 #define FLASH_S29GL064M 0x00F0 /* Spansion S29GL064M-R6 */
1092 #define FLASH_S29GL128N 0x00F1 /* Spansion S29GL128N */
1094 +#define FLASH_29LV320AB 0x00B0 /* MXIC MX29LV320AB( 32M = 4M x 16 ) joelin 10/07/2004*/
1095 +#define FLASH_29LV160BB 0x00B1 /* MXIC MX29LV160BB( 16M = 2M x 16 ) joelin 11/22/2004*/
1096 +#define FLASH_29LV640BB 0x00B2 /* MXIC MX29LV640BB( 64M = 8M x 16 ) liupeng*/
1098 #define FLASH_UNKNOWN 0xFFFF /* unknown flash type */
1101 --- a/include/image.h
1102 +++ b/include/image.h
1104 #define IH_COMP_NONE 0 /* No Compression Used */
1105 #define IH_COMP_GZIP 1 /* gzip Compression Used */
1106 #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
1107 +#define IH_COMP_LZMA 3 /* lzma Compression Used */
1109 #define IH_MAGIC 0x27051956 /* Image Magic Number */
1110 #define IH_NMLEN 32 /* Image Name Length */
1112 +++ b/include/syscall.h
1114 +#ifndef __MON_SYS_CALL_H__
1115 +#define __MON_SYS_CALL_H__
1117 +#ifndef __ASSEMBLY__
1119 +#include <common.h>
1121 +/* These are declarations of system calls available in C code */
1122 +int mon_getc(void);
1123 +int mon_tstc(void);
1124 +void mon_putc(const char);
1125 +void mon_puts(const char*);
1126 +void mon_printf(const char* fmt, ...);
1127 +void mon_install_hdlr(int, interrupt_handler_t*, void*);
1128 +void mon_free_hdlr(int);
1129 +void *mon_malloc(size_t);
1130 +void mon_free(void*);
1131 +void mon_udelay(unsigned long);
1132 +unsigned long mon_get_timer(unsigned long);
1134 +#endif /* ifndef __ASSEMBLY__ */
1136 +#define NR_SYSCALLS 11 /* number of syscalls */
1140 + * Make sure these functions are in the same order as they
1141 + * appear in the "examples/syscall.S" file !!!
1143 +#define SYSCALL_GETC 0
1144 +#define SYSCALL_TSTC 1
1145 +#define SYSCALL_PUTC 2
1146 +#define SYSCALL_PUTS 3
1147 +#define SYSCALL_PRINTF 4
1148 +#define SYSCALL_INSTALL_HDLR 5
1149 +#define SYSCALL_FREE_HDLR 6
1150 +#define SYSCALL_MALLOC 7
1151 +#define SYSCALL_FREE 8
1152 +#define SYSCALL_UDELAY 9
1153 +#define SYSCALL_GET_TIMER 10
1161 + 0xA0B00000 "u-boot.bin" /* Download u-boot image */
1166 +}; /* Start u-boot image */
1167 --- a/lib_generic/Makefile
1168 +++ b/lib_generic/Makefile
1169 @@ -28,7 +28,7 @@ LIB = $(obj)libgeneric.a
1170 COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \
1171 bzlib_randtable.o bzlib_huffman.o \
1172 crc32.o ctype.o display_options.o ldiv.o \
1173 - string.o vsprintf.o zlib.o
1174 + string.o vsprintf.o zlib.o LzmaDecode.o LzmaWrapper.o
1176 SRCS := $(COBJS:.o=.c)
1177 OBJS := $(addprefix $(obj),$(COBJS))
1178 --- a/lib_mips/board.c
1179 +++ b/lib_mips/board.c
1182 #include <environment.h>
1184 +#ifdef CFG_BOOTSTRAP_CODE
1185 +//#include <asm/danube.h>
1186 +#undef CONFIG_MICROBZIP2
1188 +#ifdef CONFIG_BZIP2
1192 +#ifdef CONFIG_MICROBZIP2
1193 +#include <micro_bzlib.h>
1197 +#include <LzmaWrapper.h>
1199 +#endif //CFG_BOOTSTRAP_CODE
1201 DECLARE_GLOBAL_DATA_PTR;
1203 -#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
1204 +#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < BOOTSTRAP_CFG_MONITOR_BASE) || \
1205 + (CFG_ENV_ADDR >= (BOOTSTRAP_CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
1206 + defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_BOOTSTRAP_CODE)
1207 +#define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
1208 +#elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
1209 (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
1210 defined(CFG_ENV_IS_IN_NVRAM)
1211 #define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
1212 @@ -39,21 +60,24 @@ DECLARE_GLOBAL_DATA_PTR;
1213 #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
1218 extern int timer_init(void);
1220 extern int incaip_set_cpuclk(void);
1222 +#ifdef CFG_BOOTSTRAP_CODE
1223 +extern ulong uboot_end_data_bootstrap;
1224 +extern ulong uboot_end_bootstrap;
1225 +#else //CFG_BOOTSTRAP_CODE
1226 extern ulong uboot_end_data;
1227 extern ulong uboot_end;
1228 +#endif //CFG_BOOTSTRAP_CODE
1230 ulong monitor_flash_len;
1232 -const char version_string[] =
1233 - U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
1234 +const char version_string[] = U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
1236 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1237 static char *failed = "*** failed ***\n";
1241 * Begin and End of memory area for malloc(), and current "brk"
1242 @@ -62,14 +86,15 @@ static ulong mem_malloc_start;
1243 static ulong mem_malloc_end;
1244 static ulong mem_malloc_brk;
1248 * The Malloc area is immediately below the monitor copy in DRAM
1250 -static void mem_malloc_init (void)
1252 +#ifdef CFG_BOOTSTRAP_CODE
1253 +static void mem_malloc_init (ulong dest_addr) {
1254 +#else //CFG_BOOTSTRAP_CODE
1255 +static void mem_malloc_init (void) {
1256 ulong dest_addr = CFG_MONITOR_BASE + gd->reloc_off;
1258 +#endif //CFG_BOOTSTRAP_CODE
1259 mem_malloc_end = dest_addr;
1260 mem_malloc_start = dest_addr - TOTAL_MALLOC_LEN;
1261 mem_malloc_brk = mem_malloc_start;
1262 @@ -79,6 +104,25 @@ static void mem_malloc_init (void)
1263 mem_malloc_end - mem_malloc_start);
1266 +#ifdef CFG_BOOTSTRAP_CODE
1267 +void *malloc(unsigned int size) {
1268 + if(size < (mem_malloc_end - mem_malloc_start)) {
1269 + mem_malloc_start += size;
1270 + debug ("malloc : size required = 0x%08lx and pointer = 0x%08lx\n",size,mem_malloc_start - size);
1271 + return (void *)(mem_malloc_start - size);
1276 +void *realloc(void *src,unsigned int size) {
1280 +void free(void *src) {
1283 +#endif //CFG_BOOTSTRAP_CODE
1285 void *sbrk (ptrdiff_t increment)
1287 ulong old = mem_malloc_brk;
1288 @@ -99,42 +143,58 @@ static int init_func_ram (void)
1290 int board_type = 0; /* use dummy arg */
1294 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1295 +#ifdef CONFIG_USE_DDR_RAM
1296 + puts ("DDR-DRAM: ");
1300 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1301 if ((gd->ram_size = initdram (board_type)) > 0) {
1302 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1303 print_size (gd->ram_size, "\n");
1304 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1307 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1309 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1313 +#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF)
1314 static int display_banner(void)
1317 printf ("\n\n%s\n\n", version_string);
1322 +#ifndef CFG_BOOTSTRAP_CODE
1323 static void display_flash_config(ulong size)
1326 print_size (size, "\n");
1328 +#endif //CFG_BOOTSTRAP_CODE
1331 +#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF)
1332 static int init_baudrate (void)
1334 +#ifndef CFG_BOOTSTRAP_CODE
1335 char tmp[64]; /* long enough for environment variables */
1336 int i = getenv_r ("baudrate", tmp, sizeof (tmp));
1338 gd->baudrate = (i > 0)
1339 ? (int) simple_strtoul (tmp, NULL, 10)
1342 +#else //CFG_BOOTSTRAP_CODE
1343 + gd->baudrate = CONFIG_BAUDRATE;
1344 +#endif //CFG_BOOTSTRAP_CODE
1351 * Breath some life into the board...
1352 @@ -159,27 +219,49 @@ static int init_baudrate (void)
1353 typedef int (init_fnc_t) (void);
1355 init_fnc_t *init_sequence[] = {
1356 +#ifdef CFG_BOOTSTRAP_CODE
1359 + //env_init, /* initialize environment */
1360 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1361 + init_baudrate, /* initialze baudrate settings */
1362 + serial_init, /* serial communications setup */
1364 + display_banner, /* say that we are here */
1366 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1369 +#else /********** CFG_BOOTSTRAP_CODE **********/
1371 - env_init, /* initialize environment */
1372 -#ifdef CONFIG_INCA_IP
1373 - incaip_set_cpuclk, /* set cpu clock according to environment variable */
1375 init_baudrate, /* initialze baudrate settings */
1376 serial_init, /* serial communications setup */
1378 display_banner, /* say that we are here */
1381 + env_init, /* initialize environment */
1383 +#endif //CFG_BOOTSTRAP_CODE
1386 +#ifdef CFG_BOOTSTRAP_CODE
1387 +extern void bootstrap_relocate_code(ulong addr_sp, gd_t *id, ulong addr);
1389 +void bootstrap_board_init_f(ulong bootflag)
1391 void board_init_f(ulong bootflag)
1396 init_fnc_t **init_fnc_ptr;
1397 - ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE;
1398 +#ifdef CFG_BOOTSTRAP_CODE
1399 + ulong addr, addr_sp, len = (ulong)&uboot_end_bootstrap - BOOTSTRAP_CFG_MONITOR_BASE;
1400 + ulong lzmaImageaddr = 0;
1401 +#else //CFG_BOOTSTRAP_CODE
1402 + ulong addr, addr_sp, len = CFG_MONITOR_LEN;
1403 +#endif //CFG_BOOTSTRAP_CODE
1405 #ifdef CONFIG_PURPLE
1406 void copy_code (ulong);
1407 @@ -219,13 +301,12 @@ void board_init_f(ulong bootflag)
1409 addr &= ~(16 * 1024 - 1);
1411 - debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
1412 + debug ("Reserving %d Bytes for U-Boot at: %08lx\n", len, addr);
1414 /* Reserve memory for malloc() arena.
1416 addr_sp = addr - TOTAL_MALLOC_LEN;
1417 - debug ("Reserving %dk for malloc() at: %08lx\n",
1418 - TOTAL_MALLOC_LEN >> 10, addr_sp);
1419 + debug ("Reserving %d Bytes for malloc() at: %08lx\n", TOTAL_MALLOC_LEN, addr_sp);
1422 * (permanently) allocate a Board Info struct
1423 @@ -234,20 +315,17 @@ void board_init_f(ulong bootflag)
1424 addr_sp -= sizeof(bd_t);
1425 bd = (bd_t *)addr_sp;
1427 - debug ("Reserving %d Bytes for Board Info at: %08lx\n",
1428 - sizeof(bd_t), addr_sp);
1429 + debug ("Reserving %d Bytes for Board Info at: %08lx\n", sizeof(bd_t), addr_sp);
1431 addr_sp -= sizeof(gd_t);
1432 id = (gd_t *)addr_sp;
1433 - debug ("Reserving %d Bytes for Global Data at: %08lx\n",
1434 - sizeof (gd_t), addr_sp);
1435 + debug ("Reserving %d Bytes for Global Data at: %08lx\n", sizeof (gd_t), addr_sp);
1437 /* Reserve memory for boot params.
1439 addr_sp -= CFG_BOOTPARAMS_LEN;
1440 bd->bi_boot_params = addr_sp;
1441 - debug ("Reserving %dk for boot params() at: %08lx\n",
1442 - CFG_BOOTPARAMS_LEN >> 10, addr_sp);
1443 + debug ("Reserving %dk for boot params() at: %08lx\n", CFG_BOOTPARAMS_LEN >> 10, addr_sp);
1446 * Finally, we set up a new (bigger) stack.
1447 @@ -279,7 +357,16 @@ void board_init_f(ulong bootflag)
1451 +#ifdef CFG_BOOTSTRAP_CODE
1452 + lzmaImageaddr = (ulong)&uboot_end_data_bootstrap;
1453 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1454 + puts("\n BOOTSTRAP: relocate_code start");
1455 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1456 + bootstrap_relocate_code (addr_sp, id, addr);
1457 +#else //CFG_BOOTSTRAP_CODE
1458 + puts("\n relocate_code start");
1459 relocate_code (addr_sp, id, addr);
1460 +#endif //CFG_BOOTSTRAP_CODE
1462 /* NOTREACHED - relocate_code() does not return */
1464 @@ -292,7 +379,110 @@ void board_init_f(ulong bootflag)
1466 ************************************************************************
1468 +#ifdef CFG_BOOTSTRAP_CODE
1469 +void bootstrap_board_init_r (gd_t *id, ulong dest_addr) {
1472 + ulong data, len, checksum;
1474 + image_header_t header;
1475 + image_header_t *hdr = &header;
1476 + unsigned int destLen;
1479 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1480 + puts("\n BOOTSTRAP: relocate_code finish.\n");
1481 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1483 + /* initialize malloc() area */
1484 + mem_malloc_init(dest_addr);
1486 + addr = (char *)(BOOTSTRAP_CFG_MONITOR_BASE + ((ulong)&uboot_end_data_bootstrap - dest_addr));
1487 + memmove (&header, (char *)addr, sizeof(image_header_t));
1489 + if (ntohl(hdr->ih_magic) != IH_MAGIC) {
1490 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1491 + printf ("Bad Magic Number at address 0x%08lx\n",addr);
1492 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1496 + data = (ulong)&header;
1497 + len = sizeof(image_header_t);
1499 + checksum = ntohl(hdr->ih_hcrc);
1501 + if (crc32 (0, (unsigned char *)data, len) != checksum) {
1502 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1503 + printf ("Bad Header Checksum\n");
1504 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1508 + data = addr + sizeof(image_header_t);
1509 + len = ntohl(hdr->ih_size);
1510 + len_ptr = (ulong *)data;
1512 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1513 + debug ("Disabling all the interrupts\n");
1514 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1515 + disable_interrupts();
1517 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1518 + debug (" Uncompressing UBoot Image ... \n" );
1519 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1521 + * If we've got less than 4 MB of malloc() space,
1522 + * use slower decompression algorithm which requires
1523 + * at most 2300 KB of memory.
1527 +#ifdef CONFIG_BZIP2
1528 + i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1529 + 0x400000, (char *)data, len,
1530 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1532 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1533 + printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1534 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1537 +#elif CONFIG_MICROBZIP2
1538 + i = micro_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1539 + &destLen, (char *)data, len,
1540 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1541 + if (i != RETVAL_OK) {
1542 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1543 + printf ("MICRO_BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1544 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1548 + i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &destLen);
1549 + if (i != LZMA_RESULT_OK) {
1550 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1551 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
1552 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1556 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1557 + printf ("NONE Compressing u-boot body!!\n");
1558 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1559 + memmove ((void *)ntohl(hdr->ih_load), (uchar *)data, len);
1562 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1563 + debug (" Uncompression completed successfully with destLen %d.\n ",destLen );
1564 + debug ("Head: Jumping to u-boot in the ram at 0x%08lx\n", CFG_MONITOR_BASE);
1565 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1567 + fn = ntohl(hdr->ih_load);
1571 +#else //CFG_BOOTSTRAP_CODE
1572 void board_init_r (gd_t *id, ulong dest_addr)
1575 @@ -305,6 +495,8 @@ void board_init_r (gd_t *id, ulong dest_
1579 + puts("\n relocate_code finish.\n");
1582 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
1584 @@ -321,12 +513,10 @@ void board_init_r (gd_t *id, ulong dest_
1587 addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
1589 - printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
1590 - cmdtp->name, (ulong) (cmdtp->cmd), addr);
1593 - (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
1595 + debug ("Command \"%s\": 0x%08lx => 0x%08lx\n", cmdtp->name, (ulong) (cmdtp->cmd), addr);
1597 + cmdtp->cmd = (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
1599 addr = (ulong)(cmdtp->name) + gd->reloc_off;
1600 cmdtp->name = (char *)addr;
1601 @@ -363,7 +553,13 @@ void board_init_r (gd_t *id, ulong dest_
1602 /* initialize malloc() area */
1605 +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
1606 + nand_init(); /* go init the NAND */
1610 + spi_init_f(); /* go init the SPI flash */
1612 /* relocate environment function pointers etc. */
1615 @@ -424,9 +620,12 @@ void board_init_r (gd_t *id, ulong dest_
1617 /* NOTREACHED - no way out of command loop except booting */
1619 +#endif //CFG_BOOTSTRAP_CODE
1623 +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
1624 puts ("### ERROR ### Please RESET the board ###\n");
1625 +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
1628 --- a/lib_mips/time.c
1629 +++ b/lib_mips/time.c
1630 @@ -80,6 +80,19 @@ void udelay (unsigned long usec)
1634 +#ifndef CFG_BOOTSTRAP_CODE
1635 +void mdelay (unsigned long msec)
1638 + for(i=0;i<msec;i++)
1648 * This function is derived from PowerPC code (read timebase as long long).
1649 * On MIPS it just returns the timer value.
1653 #include <command.h>
1656 +#if defined(CONFIG_IFX_MIPS)
1657 +# include "ifx_eth.c"
1660 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
1662 @@ -54,6 +57,9 @@ extern int scc_initialize(bd_t*);
1663 extern int skge_initialize(bd_t*);
1664 extern int tsec_initialize(bd_t*, int, char *);
1665 extern int npe_initialize(bd_t *);
1666 +#if defined(CONFIG_IFX_MIPS)
1667 + IFX_ETH_INITIALIZE_EXTERN
1670 static struct eth_device *eth_devices, *eth_current;
1672 @@ -235,7 +241,9 @@ int eth_initialize(bd_t *bis)
1673 #if defined(CONFIG_RTL8169)
1674 rtl8169_initialize(bis);
1677 +#if defined(CONFIG_IFX_MIPS)
1678 + IFX_ETH_INITIALIZE(bis)
1681 puts ("No ethernet found.\n");
1683 --- a/tools/mkimage.c
1684 +++ b/tools/mkimage.c
1687 #include <netinet/in.h> /* for host / network byte order conversions */
1689 +#include <sys/types.h>
1690 #include <sys/mman.h>
1691 #include <sys/stat.h>
1693 @@ -138,6 +139,7 @@ table_entry_t comp_name[] = {
1694 { IH_COMP_NONE, "none", "uncompressed", },
1695 { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", },
1696 { IH_COMP_GZIP, "gzip", "gzip compressed", },
1697 + { IH_COMP_LZMA, "lzma", "lzma compressed", },
1701 @@ -445,7 +447,7 @@ NXTARG: ;
1704 /* We're a bit of paranoid */
1705 -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
1706 +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
1707 (void) fdatasync (ifd);
1710 @@ -495,7 +497,7 @@ NXTARG: ;
1711 (void) munmap((void *)ptr, sbuf.st_size);
1713 /* We're a bit of paranoid */
1714 -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
1715 +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
1716 (void) fdatasync (ifd);
1719 --- a/cpu/mips/cache.S
1720 +++ b/cpu/mips/cache.S
1722 #include <asm/mipsregs.h>
1723 #include <asm/addrspace.h>
1724 #include <asm/cacheops.h>
1726 +#if defined(CONFIG_IFX_MIPS)
1727 +# include "danube/ifx_cache.S"
1730 /* 16KB is the maximum size of instruction and data caches on
1732 @@ -155,6 +157,9 @@ mips_cache_reset:
1735 mtc0 zero, CP0_TAGLO
1736 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_INVALID_TAG)
1737 + IFX_CACHE_EXTRA_INVALID_TAG
1741 * The caches are probably in an indeterminate state,
1742 @@ -171,6 +176,9 @@ mips_cache_reset:
1744 icacheopn(a0,a1,a2,a3,121,(Index_Store_Tag_I,Fill))
1746 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_OPERATION)
1747 + IFX_CACHE_EXTRA_OPERATION
1749 /* To support Orion/R4600, we initialise the data cache in 3 passes.
1752 @@ -200,6 +208,7 @@ mips_cache_reset:
1753 move a3, t5 # dcacheLineSize
1755 icacheop(a0,a1,a2,a3,Index_Store_Tag_D)
1759 .end mips_cache_reset
1760 --- a/cpu/mips/config.mk
1761 +++ b/cpu/mips/config.mk
1763 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1767 -$(CROSS_COMPILE)as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
1768 -MIPSFLAGS=$(shell \
1769 -if [ "$v" -lt "14" ]; then \
1770 - echo "-mcpu=4kc"; \
1772 - echo "-march=4kc -mtune=4kc"; \
1775 +ifndef PLATFORM_CPU
1776 +PLATFORM_CPU = mips32
1779 +MIPSFLAGS +=$(call cc-option,-march=$(PLATFORM_CPU) -mtune=$(PLATFORM_CPU),-mcpu=$(PLATFORM_CPU))
1781 +ifeq ($(CROSS_COMPILE_UCLIBC),1)
1782 +ifneq (,$(findstring mipsel,$(CROSS_COMIPLE)))
1788 ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
1795 MIPSFLAGS += $(ENDIANNESS) -mabicalls
1797 --- a/cpu/mips/cpu.c
1798 +++ b/cpu/mips/cpu.c
1802 #include <command.h>
1803 -#include <asm/inca-ip.h>
1804 +#if defined(CONFIG_INCA_IP)
1805 +# include <asm/inca-ip.h>
1806 +#elif defined(CONFIG_IFX_MIPS)
1807 +# include <asm/danube.h>
1808 +# include "danube/ifx_cpu.c"
1810 #include <asm/mipsregs.h>
1812 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1813 @@ -34,6 +39,8 @@ int do_reset(cmd_tbl_t *cmdtp, int flag,
1814 void (*f)(void) = (void *) 0xbfc00000;
1817 +#elif defined(CONFIG_IFX_MIPS)
1820 fprintf(stderr, "*** reset failed ***\n");
1822 --- a/cpu/mips/incaip_clock.c
1823 +++ b/cpu/mips/incaip_clock.c
1828 -#include <asm/inca-ip.h>
1830 +#ifdef CONFIG_INCA_IP
1831 +#include <asm/inca-ip.h>
1833 /*******************************************************************************
1835 @@ -114,3 +115,5 @@ int incaip_set_cpuclk (void)
1840 +#endif /* CONFIG_INCA_IP */
1841 --- a/cpu/mips/start.S
1842 +++ b/cpu/mips/start.S
1844 #include <version.h>
1845 #include <asm/regdef.h>
1846 #include <asm/mipsregs.h>
1848 +#if defined(CONFIG_IFX_MIPS)
1849 +# include "danube/ifx_start.S"
1852 #define RVECENT(f,n) \
1859 +#ifdef CFG_BOOTSTRAP_CODE
1860 + .globl _start_bootstrap
1865 +#ifdef CFG_BOOTSTRAP_CODE
1870 RVECENT(reset,0) /* U-boot entry point */
1871 RVECENT(reset,1) /* software reboot */
1872 -#if defined(CONFIG_INCA_IP)
1873 +#if defined(CONFIG_INCA_IP) || defined(CONFIG_INCA_IP2)
1874 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1875 .word 0x00000000 /* phase of the flash */
1876 +#elif defined(CONFIG_IFX_MIPS) && defined(IFX_EBU_BOOTCFG_DWORD)
1877 + IFX_EBU_BOOTCFG_DWORD
1878 #elif defined(CONFIG_PURPLE)
1879 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1880 .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
1881 @@ -181,6 +192,9 @@ _start:
1882 * 128 * 8 == 1024 == 0x400
1883 * so this is address R_VEC+0x400 == 0xbfc00400
1885 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_MORE_RESERVED_VECTORS)
1886 + IFX_MORE_RESERVED_VECTORS
1888 #ifdef CONFIG_PURPLE
1891 @@ -205,8 +219,12 @@ _start:
1894 #endif /* CONFIG_PURPLE */
1895 +#endif /* CONFIG_IFX_MIPS */
1898 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_RESET_PRECHECK)
1899 + IFX_RESET_PRECHECK
1902 /* Clear watch registers.
1904 @@ -226,6 +244,10 @@ reset:
1905 /* CAUSE register */
1906 mtc0 zero, CP0_CAUSE
1908 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU_EXTRA_INIT)
1909 + IFX_CPU_EXTRA_INIT
1913 mtc0 zero, CP0_COUNT
1914 mtc0 zero, CP0_COMPARE
1915 @@ -252,12 +274,26 @@ reset:
1919 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_SKIP_LOWLEVEL_INIT)
1920 + IFX_SKIP_LOWLEVEL_INIT
1922 +#ifdef CFG_BOOTSTRAP_CODE
1923 /* Initialize any external memory.
1925 la t9, lowlevel_init
1929 +lowlevel_init_done:
1931 + beq s0, zero, init_cache_0
1934 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_CPU1_INIT)
1939 /* Initialize caches...
1941 la t9, mips_cache_reset
1942 @@ -266,7 +302,11 @@ reset:
1944 /* ... and enable them.
1946 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_OPER_MODE)
1947 + IFX_CACHE_OPER_MODE
1949 li t0, CONF_CM_CACHABLE_NONCOHERENT
1954 @@ -280,13 +320,38 @@ reset:
1955 li t0, CFG_SDRAM_BASE + CFG_INIT_SP_OFFSET
1958 +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_BOOT_CLEAR)
1962 +#ifdef CFG_BOOTSTRAP_CODE
1963 + la t9, bootstrap_board_init_f
1970 +#ifdef CFG_BOOTSTRAP_CODE
1972 + * void jump_unconditional (addr)
1973 + * This function simply jumps to the location pointed by a0.
1974 + * a0 = target_location
1977 + .globl jump_unconditional
1978 + .ent jump_unconditional
1979 +jump_unconditional:
1983 + .end jump_unconditional
1988 * void relocate_code (addr_sp, gd, addr_moni)
1989 + * void bootstrap_relocate_code (addr_sp, gd, addr_moni)
1991 * This "function" does not return, instead it continues in RAM
1992 * after relocating the monitor code.
1993 @@ -295,12 +360,22 @@ reset:
1995 * a2 = destination address
1997 +#ifdef CFG_BOOTSTRAP_CODE
1998 + .globl bootstrap_relocate_code
1999 + .ent bootstrap_relocate_code
2000 +bootstrap_relocate_code:
2002 .globl relocate_code
2006 move sp, a0 /* Set new stack pointer */
2008 +#ifdef CFG_BOOTSTRAP_CODE
2009 + li t0, BOOTSTRAP_CFG_MONITOR_BASE
2011 li t0, CFG_MONITOR_BASE
2014 lw t2, -12(t3) /* t2 <-- uboot_end_data */
2016 @@ -311,7 +386,11 @@ relocate_code:
2017 * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
2020 +#ifdef CFG_BOOTSTRAP_CODE
2021 + sub gp, BOOTSTRAP_CFG_MONITOR_BASE
2023 sub gp, CFG_MONITOR_BASE
2025 add gp, a2 /* gp now adjusted */
2026 sub t6, gp, t6 /* t6 <-- relocation offset */
2028 @@ -337,12 +416,21 @@ relocate_code:
2030 /* Jump to where we've relocated ourselves.
2032 +#ifdef CFG_BOOTSTRAP_CODE
2033 + addi t0, a2, in_ram - _start_bootstrap
2035 addi t0, a2, in_ram - _start
2040 +#ifdef CFG_BOOTSTRAP_CODE
2041 + .word uboot_end_data_bootstrap
2042 + .word uboot_end_bootstrap
2044 .word uboot_end_data
2047 .word num_got_entries
2050 @@ -374,12 +462,19 @@ in_ram:
2051 sw zero, 0(t1) /* delay slot */
2054 +#ifdef CFG_BOOTSTRAP_CODE
2055 + la t9, bootstrap_board_init_r
2060 move a1, a2 /* delay slot */
2062 +#ifdef CFG_BOOTSTRAP_CODE
2063 + .end bootstrap_relocate_code
2069 /* Exception handlers.
2071 @@ -388,3 +483,20 @@ romReserved:
2077 +#ifdef CFG_BOOTSTRAP_CODE
2080 +#endif /* CFG_BOOTSTRAP_CODE */
2084 + /* Additional handlers.
2086 +#if defined(CONFIG_IFX_MIPS)
2087 +#if defined(IFX_MIPS_HANDLER_1)
2088 +ifx_mips_handler_1:
2089 + IFX_MIPS_HANDLER_1
2092 --- a/tools/Makefile
2093 +++ b/tools/Makefile
2098 -BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
2099 +BIN_FILES = mkimage$(SFX)
2101 OBJ_LINKS = environment.o crc32.o
2102 OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o