8 +EXTRAVERSION = -IFX-LXDB
9 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
10 VERSION_FILE = $(obj)include/version_autogenerated.h
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
49 # load other configuration
51 #########################################################################
52 # U-Boot objects....order is important (i.e. start must be first)
54 -OBJS = cpu/$(CPU)/start.o
55 +OBJS = cpu/$(CPU)/$(BOARDDIR)/start.o
56 +OBJS_BOOTSTRAP = cpu/$(CPU)/$(BOARDDIR)/start_bootstrap.o
59 OBJS += cpu/$(CPU)/start16.o
60 OBJS += cpu/$(CPU)/reset.o
63 LIBS = lib_generic/libgeneric.a
64 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
65 -LIBS += cpu/$(CPU)/lib$(CPU).a
66 +LIBS += cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a
68 LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
70 -LIBS += lib_$(ARCH)/lib$(ARCH).a
71 +LIBS += lib_$(ARCH)/$(BOARDIR)/lib$(ARCH).a
72 LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
73 fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a
78 LIBS += drivers/libdrivers.a
79 -LIBS += drivers/nand/libnand.a
80 -LIBS += drivers/nand_legacy/libnand_legacy.a
81 +#LIBS += drivers/nand_$(BOARDDIR)/libnand.a
82 +#LIBS += drivers/nand_legacy/libnand_legacy.a
83 LIBS += drivers/sk98lin/libsk98lin.a
84 LIBS += post/libpost.a post/cpu/libcpu.a
85 LIBS += common/libcommon.a
88 LIBS := $(addprefix $(obj),$(LIBS))
91 +LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a
92 +LIBS_BOOTSTRAP+= board/$(BOARDDIR)/lib$(BOARD).a
93 +#LIBS_BOOTSTRAP+= board/ifx/libifx.a
94 +LIBS_BOOTSTRAP+= cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a
96 +#HEAD_OBJS = cpu/$(CPU)/$(BOARDDIR)/start.o lib_$(ARCH)/board.o
98 +#HEAD_LIBS = board/$(BOARDDIR)/lib$(BOARD).a
99 +#HEAD_LIBS += cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a
100 +#HEAD_LIBS += lib_$(ARCH)/lib$(ARCH).a
101 +#HEAD_LIBS += lib_generic/libgeneric.a
102 +#HEAD_LIBS += common/console.o
103 +#HEAD_LIBS += common/devices.o
104 +#HEAD_LIBS += common/cmd_bootm.o
106 +#.PHONY : $(LIBS) $(HEAD_LIBS)
108 +.PHONY : $(LIBS_BOOTSTRAP)
111 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
113 # The "tools" are needed early, so put this first
114 # Don't include stuff already done in $(LIBS)
122 +# HEAD_SUBDIRS = tools
123 +#HEAD_SUBDIRS = lib_generic \
125 +# board/$(BOARDDIR) \
128 +#.PHONY : $(HEAD_SUBDIRS)
130 ifeq ($(CONFIG_NAND_U_BOOT),y)
132 U_BOOT_NAND = $(obj)u-boot-nand.bin
133 @@ -227,13 +280,76 @@
134 __OBJS := $(subst $(obj),,$(OBJS))
135 __LIBS := $(subst $(obj),,$(LIBS))
137 +#__HEAD_OBJS := $(subst $(obj),,$(HEAD_OBJS))
138 +#__HEAD_LIBS := $(subst $(obj),,$(HEAD_LIBS))
140 #########################################################################
141 #########################################################################
143 ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND)
144 +#IFX_ALL = $(obj)u-boot.ifx $(obj)head.srec $(obj)head.bin $(obj)head $(obj)head.map $(COMPRESS_FILE) $(obj)u-boot.srec
145 +IFX_ALL = $(obj)u-boot.srec $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin
152 +$(obj)u-boot.ifx: $(obj)System.map $(obj)bootstrap.bin $(obj)u-boot.lzimg
153 + @cat $(obj)bootstrap.bin > $(obj)u-boot.ifx
154 + @cat $(obj)u-boot.lzimg >> $(obj)u-boot.ifx
156 +$(obj)u-boot.lzimg: $(obj)u-boot.bin System.map
157 +# @lzma -f -z --best -v $(obj)u-boot.bin
158 + @lzma e $(obj)u-boot.bin $(obj)u-boot.bin.lzma
159 + @./tools/mkimage -A mips -T firmware -C lzma \
160 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
161 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
162 + -n 'u-boot image' -d $(obj)u-boot.bin.lzma $@
164 +$(obj)ld_uboot.img: $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin
165 + @ cp -f $(obj)u-boot.ifx $(obj)u-boot.bin
166 + @ ./mkbootimg.incaip2 $(obj)ld_uboot.img < ld_uboot.conf
171 +$(obj)u-boot.zimg: $(obj)u-boot.bin $(obj)System.map
172 + gzip $(obj)u-boot.bin
173 + ./tools/mkimage -A $(ARCH) -T firmware -C gzip \
174 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
175 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
176 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
177 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
180 +$(obj)u-boot.bzimg: $(obj)u-boot.bin $(obj)System.map
181 + bzip $(obj)u-boot.bin
182 + ./tools/mkimage -A $(ARCH) -T firmware -C bzip2 \
183 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
184 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
185 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
186 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
189 +$(obj)u-boot.limg: $(obj)u-boot.bin $(obj)System.map
190 +# @lzma -f -z --best -v $(obj)u-boot.bin
191 + @lzma e $(obj)u-boot.bin $(obj)u-boot.bin.lzma
192 + ./tools/mkimage -A $(ARCH) -T firmware -C lzma \
193 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
194 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
195 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
196 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
197 + -d u-boot.bin.lzma $@
199 +$(obj)u-boot.img: $(obj)u-boot.bin $(obj)System.map
200 + ./tools/mkimage -A $(ARCH) -T firmware -C none \
201 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
202 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
203 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
204 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
207 $(obj)u-boot.hex: $(obj)u-boot
208 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
210 @@ -243,28 +359,36 @@
211 $(obj)u-boot.bin: $(obj)u-boot
212 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
214 -$(obj)u-boot.img: $(obj)u-boot.bin
215 - ./tools/mkimage -A $(ARCH) -T firmware -C none \
216 - -a $(TEXT_BASE) -e 0 \
217 - -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
218 - sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
221 $(obj)u-boot.dis: $(obj)u-boot
222 $(OBJDUMP) -d $< > $@
224 -$(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
225 +$(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
226 UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
227 cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
228 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
229 -Map u-boot.map -o u-boot
233 +$(obj)bootstrap.bin: $(obj)bootstrap
234 + $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
236 +$(obj)bootstrap : depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LDSCRIPT_BOOTSTRAP)
237 + UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
238 + $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
239 + --start-group $(LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \
240 + -Map bootstrap.map -o bootstrap
243 - $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
244 + $(MAKE) -C cpu/$(CPU)/$(BOARDDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@))
247 $(MAKE) -C $(dir $(subst $(obj),,$@))
251 + $(MAKE) -C `dirname $@`
256 @@ -295,14 +419,14 @@
259 ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) include \
260 - lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
261 + lib_generic board/$(BOARDDIR) cpu/$(CPU)/$(BOARDDIR) lib_$(ARCH) \
262 fs/cramfs fs/fat fs/fdos fs/jffs2 \
263 net disk rtc dtt drivers drivers/sk98lin common \
264 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
267 etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) include \
268 - lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
269 + lib_generic board/$(BOARDDIR) cpu/$(CPU)/$(BOARDDIR) lib_$(ARCH) \
270 fs/cramfs fs/fat fs/fdos fs/jffs2 \
271 net disk rtc dtt drivers drivers/sk98lin common \
272 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
273 @@ -2032,7 +2156,20 @@
275 #========================================================================
276 #########################################################################
278 +## Infineon MIPS generic u-boot config
279 +#########################################################################
280 +danube_config: unconfig
281 + @$(MKCONFIG) $(@:_config=) mips mips danube
283 +amazon_config: unconfig
284 + @$(MKCONFIG) $(@:_config=) mips mips amazon
287 +incaip2_config: unconfig
288 + @$(MKCONFIG) $(@:_config=) mips mips incaip2
290 +#########################################################################
292 #########################################################################
294 xtract_incaip = $(subst _100MHz,,$(subst _133MHz,,$(subst _150MHz,,$(subst _config,,$1))))
295 @@ -2246,6 +2383,8 @@
296 rm -f $(obj)include/bmp_logo.h
297 find nand_spl -lname "*" -print | xargs rm -f
298 rm -f nand_spl/u-boot-spl nand_spl/u-boot-spl.map
299 + rm -f lib_bootstrap/*.o
300 + rm -f lib_bootstrap/*.a
303 find $(OBJTREE) -type f \( -name .depend \
304 @@ -2254,7 +2393,7 @@
306 rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS $(obj)include/version_autogenerated.h
308 - rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
309 + rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL) $(IFX_ALL)
310 rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c
311 rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
312 rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
314 +++ b/build_danube.sh
317 +IFX_CONFIG_FLASH_SIZE=8
318 +IFX_CONFIG_MEMORY_SIZE=30
319 +CONFIG_RAM_TEXT_BASE=0xA0400000
323 +# cp -f include/flash_$1.h \
325 +# cp -f include/net_$1.h \
327 +# cp -f include/asm-mips/cacheops_$1.h \
328 +# include/asm-mips/cacheops.h
329 +# cp -f include/asm-mips/mipsregs_$1.h \
330 +# include/asm-mips/mipsregs.h
332 +#prepare_headers "danube"
334 +UBOOT_CFLAGS="-DCONFIG_IFX_MIPS -DCONFIG_LZMA -DIFX_CONFIG_MEMORY_SIZE=${IFX_CONFIG_MEMORY_SIZE} -DIFX_CONFIG_FLASH_SIZE=${IFX_CONFIG_FLASH_SIZE}"
338 +make CROSS_COMPILE="mips-linux-uclibc-" CROSS_COMPILE_UCLIBC=1 COMPRESS=${UBOOT_COMPRESS} PLATFORM_CPU=mips32r2 IFX_CFLAGS="${UBOOT_CFLAGS}" UBOOT_RAM_TEXT_BASE=${CONFIG_RAM_TEXT_BASE} CPU_TYPE=${IFX_CONFIG_CPU} danube_config distclean
340 +CROSS_COMPILE="mips-linux-uclibc-" CROSS_COMPILE_UCLIBC=1 COMPRESS=${UBOOT_COMPRESS} PLATFORM_CPU=mips32r2 IFX_CFLAGS="${UBOOT_CFLAGS}" make UBOOT_RAM_TEXT_BASE=${CONFIG_RAM_TEXT_BASE} CPU_TYPE=${IFX_CONFIG_CPU} danube_config
341 + echo -n > .config_ok
343 +CROSS_COMPILE="mips-linux-uclibc-" CROSS_COMPILE_UCLIBC=1 COMPRESS=${UBOOT_COMPRESS} PLATFORM_CPU=mips32r2 IFX_CFLAGS="${UBOOT_CFLAGS}" make UBOOT_RAM_TEXT_BASE=${CONFIG_RAM_TEXT_BASE} BOOTSTRAP_PRINTF_STATUS=$2 CPU_TYPE=${IFX_CONFIG_CPU} ifx_all
344 --- a/common/Makefile
345 +++ b/common/Makefile
347 env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
348 env_nvram.o env_nowhere.o \
350 - flash.o fpga.o ft_build.o \
351 + flash_$(BOARD).o fpga.o ft_build.o \
352 hush.o kgdb.o lcd.o lists.o lynxkdi.o \
353 memsize.o miiphybb.o miiphyutil.o \
354 s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
359 -$(LIB): $(obj).depend $(OBJS)
361 $(AR) $(ARFLAGS) $@ $(OBJS)
363 $(obj)environment.o: $(src)environment.c $(obj)../tools/envcrc
364 --- a/common/cmd_bootm.c
365 +++ b/common/cmd_bootm.c
370 +#include <LzmaWrapper.h>
371 #include <environment.h>
372 #include <asm/byteorder.h>
375 # define CHUNKSZ (64 * 1024)
378 +#ifndef CFG_HEAD_CODE
380 int gunzip (void *, int, unsigned char *, unsigned long *);
382 static void *zalloc(void *, unsigned, unsigned);
384 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
387 +#ifndef CONFIG_REMOVE_GZIP
389 printf (" Uncompressing %s ... ", name);
390 if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
392 do_reset (cmdtp, flag, argc, argv);
395 +#endif /* CONFIG_REMOVE_GZIP */
398 printf (" Uncompressing %s ... ", name);
402 #endif /* CONFIG_BZIP2 */
405 + printf (" Uncompressing %s ... ", name);
406 + i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &unc_len);
407 + if (i != LZMA_RESULT_OK) {
408 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
409 + SHOW_BOOT_PROGRESS (-6);
411 + do_reset (cmdtp, flag, argc, argv);
414 +#endif /* CONFIG_LZMA */
418 @@ -1176,6 +1193,8 @@
420 #endif /* CFG_CMD_IMLS */
422 +#endif /* ! CFG_HEAD_CODE */
425 print_image_hdr (image_header_t *hdr)
427 @@ -1270,12 +1289,15 @@
428 case IH_COMP_NONE: comp = "uncompressed"; break;
429 case IH_COMP_GZIP: comp = "gzip compressed"; break;
430 case IH_COMP_BZIP2: comp = "bzip2 compressed"; break;
431 + case IH_COMP_LZMA: comp = "lzma compressed"; break;
432 default: comp = "unknown compression"; break;
435 printf ("%s %s %s (%s)", arch, os, type, comp);
438 +#ifndef CFG_HEAD_CODE
440 #define ZALLOC_ALIGNMENT 16
442 static void *zalloc(void *x, unsigned items, unsigned size)
443 @@ -1427,3 +1449,5 @@
446 #endif /* CONFIG_LYNXKDI */
448 +#endif /* ! CFG_HEAD_CODE */
449 --- a/common/cmd_flash.c
450 +++ b/common/cmd_flash.c
455 -flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
456 - int *s_first, int *s_last,
458 +flash_fill_sect_ranges(
459 + ulong *addr_first_sect_start,
461 + ulong *addr_last_sect_end,
465 + int *bPartialStart,
468 + unsigned int bPartialErase)
473 s_last [bank] = -1; /* last sector to erase */
476 - for (bank=0,info=&flash_info[0];
477 - (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
479 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last); ++bank, ++info) {
484 b_end = info->start[0] + info->size - 1; /* bank end addr */
485 s_end = info->sector_count - 1; /* last sector */
488 for (sect=0; sect < info->sector_count; ++sect) {
489 ulong end; /* last address in current sect */
491 @@ -238,11 +243,21 @@
493 if (addr_first == info->start[sect]) {
494 s_first[bank] = sect;
495 + } else if (addr_first > info->start[sect] && addr_first <= end && bPartialErase) {
496 + *addr_first_sect_start = info->start[sect];
497 + s_first[bank] = sect;
498 + *bPartialStart = 1;
501 if (addr_last == end) {
503 + } else if (addr_last >= info->start[sect] && addr_last < end && bPartialErase) {
504 + *addr_last_sect_end = end;
505 + s_last[bank] = sect;
510 if (s_first[bank] >= 0) {
511 if (s_last[bank] < 0) {
512 if (addr_last > b_end) {
514 struct part_info *part;
515 u8 dev_type, dev_num, pnum;
517 + unsigned int bPartialErase = 0;
530 printf ("Usage:\n%s\n", cmdtp->usage);
533 @@ -397,11 +414,117 @@
537 - rcode = flash_sect_erase(addr_first, addr_last);
538 + printf ("Erase Flash from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
540 + bPartialErase = simple_strtoul(argv[3], NULL, 10);
543 + rcode = flash_sect_erase(addr_first, addr_last, bPartialErase);
547 -int flash_sect_erase (ulong addr_first, ulong addr_last)
548 +int flerase_Partial(
549 + ulong addr_first_sect_start,
551 + ulong addr_last_sect_end,
553 + flash_info_t *info,
557 + int bLastPartial) {
558 + unsigned int firstMemLen = 0;
559 + unsigned int lastMemLen = 0;
560 + unsigned int sectMemLen = 0;
561 + uchar *pSavedFirstMem = NULL;
562 + uchar *pSavedLastMem = NULL;
563 + uchar *pSavedSectMem = NULL;
564 + int bSectPartial = 0;
567 + 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);
569 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
571 + ulong b_end = info->start[0] + info->size - 1;
572 + ulong end = (first_sect == (info->sector_count - 1)) ? b_end : info->start[first_sect + 1] - 1;
573 + sectMemLen = end - info->start[first_sect] + 1;
574 + pSavedSectMem = (uchar *)calloc(sectMemLen, sizeof(char));
575 + if (pSavedSectMem == NULL)
577 + debug("calloc %u FAILED\n", sectMemLen);
581 + memset(pSavedSectMem, 0xff, sectMemLen);
583 + memcpy(pSavedSectMem, (uchar *)addr_first_sect_start, addr_first - addr_first_sect_start);
584 + memcpy(pSavedSectMem + (addr_last - info->start[first_sect]) + 1, addr_last + 1, end - addr_last);
588 + if (bFirstPartial){
589 + firstMemLen = addr_first - addr_first_sect_start + 1;
590 + pSavedFirstMem = (uchar *)calloc(firstMemLen,sizeof(char));
591 + memcpy(pSavedFirstMem,(uchar *)addr_first_sect_start,firstMemLen - 1);
594 + lastMemLen = addr_last_sect_end - addr_last + 1;
595 + pSavedLastMem = (uchar *)calloc(lastMemLen,sizeof(char));
596 + memcpy(pSavedLastMem,(uchar *)addr_last + 1,lastMemLen - 1);
600 + if (bFirstPartial){
601 + if(flash_erase (info, first_sect, first_sect)) {
602 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, first_sect);
606 + debug("%s ... erase sector %d done!\n", __FUNCTION__, first_sect);
609 + if (bLastPartial && first_sect != last_sect){
610 + if(flash_erase (info, last_sect, last_sect)) {
611 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, last_sect);
615 + debug("%s ... erase sector %d done!\n", __FUNCTION__, last_sect);
618 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
620 + flash_write(pSavedSectMem, (uchar *)addr_first_sect_start, sectMemLen);
621 + debug("flash_write from 0x%08x with len %u\n", addr_first_sect_start, sectMemLen);
625 + if (bFirstPartial){
626 + if(flash_write(pSavedFirstMem,(uchar *)addr_first_sect_start,firstMemLen - 1)) {
627 + printf("%s ... Couldn't write at 0x%08lx length %d\n", __FUNCTION__, addr_first_sect_start,firstMemLen - 1);
633 + if(flash_write(pSavedLastMem,(uchar *)addr_last + 1,lastMemLen - 1)) {
634 + printf("%s ... Couldn't write at 0x%08lx length %d\n", __FUNCTION__, addr_last, lastMemLen - 1);
641 + free(pSavedFirstMem);
643 + free(pSavedLastMem);
645 + free(pSavedSectMem);
649 +int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase)
653 @@ -413,27 +536,66 @@
658 - rcode = flash_fill_sect_ranges (addr_first, addr_last,
659 - s_first, s_last, &planned );
660 + int bPartialStart = 0; // Start sector has to be erased partially
661 + int bPartialEnd = 0; // End sector has to be erased partially
662 + ulong addr_first_sect_start = 0;// Sector start address of location addr_start
663 + ulong addr_last_sect_end = 0; // Sector end address of location addr_last
665 + rcode = flash_fill_sect_ranges (
666 + &addr_first_sect_start,
668 + &addr_last_sect_end,
677 if (planned && (rcode == 0)) {
678 - for (bank=0,info=&flash_info[0];
679 - (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
681 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0); ++bank, ++info) {
682 + ulong b_end = info->start[0] + info->size - 1; /* bank end addr */
683 if (s_first[bank]>=0) {
684 - erased += s_last[bank] - s_first[bank] + 1;
685 - debug ("Erase Flash from 0x%08lx to 0x%08lx "
687 - info->start[s_first[bank]],
688 - (s_last[bank] == info->sector_count) ?
689 - info->start[0] + info->size - 1:
690 - info->start[s_last[bank]+1] - 1,
692 - rcode = flash_erase (info, s_first[bank], s_last[bank]);
693 + if(bPartialErase) {
694 + rcode = flerase_Partial(
695 + addr_first_sect_start,
697 + addr_last_sect_end,
706 + //Erase full sectores
708 + s_first[bank] += 1;
711 + if (s_last[bank] >= s_first[bank]) {
712 + erased += s_last[bank] - s_first[bank] + 1;
713 + debug ("Erase Flash from 0x%08lx to 0x%08lx in Bank # %ld ",
714 + info->start[s_first[bank]],
715 + (s_last[bank] == info->sector_count) ?
716 + info->start[0] + info->size - 1:
717 + info->start[s_last[bank]+1] - 1,
719 + rcode = flash_erase (info, s_first[bank], s_last[bank]);
723 - printf ("Erased %d sectors\n", erased);
725 + if (erased && !bPartialErase) {
726 + printf ("Erased %d sectors\n", erased);
727 + } else if (bPartialErase){
728 + printf ("Partial erased from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
730 + printf ("Error: start and/or end address not on sector boundary\n");
733 } else if (rcode == 0) {
734 puts ("Error: start and/or end address"
735 " not on sector boundary\n");
741 - rcode = flash_fill_sect_ranges( addr_first, addr_last, s_first, s_last, &planned );
742 + int bPartialStart = 0; // Start sector has to be erased partially
743 + int bPartialEnd = 0; // End sector has to be erased partially
744 + ulong addr_first_sect_start = 0;// Sector start address of location addr_start
745 + ulong addr_last_sect_end = 0; // Sector end address of location addr_last
747 + rcode = flash_fill_sect_ranges (
748 + &addr_first_sect_start,
750 + &addr_last_sect_end,
765 - erase, 3, 1, do_flerase,
766 + erase, 4, 1, do_flerase,
767 "erase - erase FLASH memory\n",
769 " - erase FLASH from addr 'start' to addr 'end'\n"
770 --- a/common/cmd_nvedit.c
771 +++ b/common/cmd_nvedit.c
773 extern char * env_name_spec;
775 printf ("Saving Environment to %s...\n", env_name_spec);
778 + if(saveenv() == 0) {
779 +#ifdef UBOOT_ENV_COPY
783 +#endif //UBOOT_ENV_COPY
788 return (saveenv() ? 1 : 0);
793 --- a/common/console.c
794 +++ b/common/console.c
798 /** U-Boot INIT FUNCTIONS *************************************************/
800 +#ifndef CFG_HEAD_CODE
801 int console_assign (int file, char *devname)
809 +#endif //CFG_HEAD_CODE
810 /* Called before relocation - use serial functions */
811 int console_init_f (void)
815 #endif /* CFG_CONSOLE_IS_IN_ENV || CONFIG_SPLASH_SCREEN */
817 +#ifndef CFG_HEAD_CODE
818 #ifdef CFG_CONSOLE_IS_IN_ENV
819 /* Called after the relocation - use desired console functions */
820 int console_init_r (void)
824 #endif /* CFG_CONSOLE_IS_IN_ENV */
825 +#endif //CFG_HEAD_CODE
826 --- a/common/devices.c
827 +++ b/common/devices.c
830 device_t *stdio_devices[] = { NULL, NULL, NULL };
831 char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
832 +#ifndef CFG_HEAD_CODE
834 #if defined(CONFIG_SPLASH_SCREEN) && !defined(CFG_DEVICE_NULLDEV)
835 #define CFG_DEVICE_NULLDEV 1
840 +#endif //CFG_HEAD_CODE
842 --- a/common/env_common.c
843 +++ b/common/env_common.c
845 * We must allocate a buffer for the environment
847 env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
848 - DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
850 + DEBUGF ("malloc env_ptr error!!\n");
851 + DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__, __LINE__, env_ptr);
857 env_get_char = env_get_char_memory;
860 + DEBUGF ("%s[%d] gd->env_valid=%d\n", __FUNCTION__, __LINE__, gd->env_valid);
861 + DEBUGF ("%s[%d] CFG_ENV_SIZE=%d\n", __FUNCTION__, __LINE__, CFG_ENV_SIZE);
863 if (gd->env_valid == 0) {
864 #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */
865 puts ("Using default environment\n\n");
866 @@ -242,18 +248,17 @@
869 memset (env_ptr, 0, sizeof(env_t));
870 - memcpy (env_ptr->data,
871 - default_environment,
872 - sizeof(default_environment));
873 + memcpy (env_ptr->data, default_environment, sizeof(default_environment));
875 #ifdef CFG_REDUNDAND_ENVIRONMENT
876 env_ptr->flags = 0xFF;
883 env_relocate_spec ();
886 gd->env_addr = (ulong)&(env_ptr->data);
888 #ifdef CONFIG_AMIGAONEG3SE
889 --- a/common/env_flash.c
890 +++ b/common/env_flash.c
894 #else /* ! ENV_IS_EMBEDDED */
896 env_t *env_ptr = (env_t *)CFG_ENV_ADDR;
898 static env_t *flash_addr = (env_t *)CFG_ENV_ADDR;
900 debug (" %08lX ... %08lX ...",
901 (ulong)&(flash_addr_new->data),
902 sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
904 if ((rc = flash_write((char *)env_ptr->data,
905 (ulong)&(flash_addr_new->data),
906 sizeof(env_ptr->data))) ||
908 #endif /* CMD_SAVEENV */
910 #else /* ! CFG_ENV_ADDR_REDUND */
914 #ifdef CONFIG_OMAP2420H4
919 +#ifdef UBOOT_ENV_COPY
920 +int saveenv_copy(void) {
921 + uchar *env_buffer = (char *)env_ptr;
925 + ulong start_addr,end_addr,rootfs_end_addr;
928 + kernel_addr = getenv("f_kernel_addr");
929 + end_addr = simple_strtoul(kernel_addr,NULL,16) - 1;
930 + start_addr = end_addr - CFG_ENV_SIZE - sizeof(UBOOTCONFIG_COPY_HEADER) + 1;
932 + rootfs_addr = getenv("f_rootfs_addr");
933 + rootfs_size = getenv("f_rootfs_size");
934 + rootfs_end_addr = simple_strtoul(rootfs_addr,NULL,16) + simple_strtoul(rootfs_size,NULL,16);
936 + if(rootfs_end_addr >= start_addr)
938 + 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);
942 + debug ("Protect off %08lX ... %08lX\n", (ulong)rootfs_end_addr, end_addr);
943 + if (flash_sect_protect (0, rootfs_end_addr, end_addr))
946 + //delete the old environment copy, if found
947 + flash_start = rootfs_end_addr;
948 + while(flash_start + sizeof(UBOOTCONFIG_COPY_HEADER) + ENV_SIZE < end_addr)
950 + if(strncmp((char *)flash_start,UBOOTCONFIG_COPY_HEADER,sizeof(UBOOTCONFIG_COPY_HEADER)) == 0)
952 + flash_sect_erase(flash_start,flash_start + sizeof(UBOOTCONFIG_COPY_HEADER),1);
956 + flash_sect_erase(start_addr,end_addr,1);
957 + flash_write(UBOOTCONFIG_COPY_HEADER,start_addr,sizeof(UBOOTCONFIG_COPY_HEADER));
958 + flash_write(env_buffer,start_addr + sizeof(UBOOTCONFIG_COPY_HEADER), CFG_ENV_SIZE);
959 + flash_sect_protect (1, rootfs_end_addr, end_addr);
960 + printf("saved copy of the env at 0x%08lx\n",start_addr);
963 +#endif //UBOOT_ENV_COPY
967 +#define debug printf
970 ulong flash_sect_addr;
974 puts ("Erasing Flash...");
975 - if (flash_sect_erase (flash_sect_addr, end_addr))
976 + if (flash_sect_erase (flash_sect_addr, end_addr, 1))
979 puts ("Writing to Flash... ");
982 @@ -3167,9 +3167,11 @@
986 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
988 initialize_context(&ctx);
990 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
991 if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset((uchar *)";$&|", 0);
993 rcode = parse_stream(&temp, &ctx, inp, '\n');
994 @@ -3180,9 +3182,12 @@
998 +printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1000 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1002 if (rcode != 1 && ctx.old_flag == 0) {
1003 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1004 done_word(&temp, &ctx);
1005 done_pipe(&ctx,PIPE_SEQ);
1007 @@ -3202,6 +3207,7 @@
1011 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1013 if (ctx.old_flag != 0) {
1015 @@ -3215,6 +3221,7 @@
1018 free_pipe_list(ctx.list_head,0);
1019 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1022 } while (rcode != -1 && !(flag & FLAG_EXIT_FROM_LOOP)); /* loop on syntax errors, return on EOF */
1023 @@ -3235,9 +3242,12 @@
1027 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1030 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1031 if (!(p = strchr(s, '\n')) || *++p) {
1032 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1033 p = xmalloc(strlen(s) + 2);
1036 @@ -3247,6 +3257,7 @@
1040 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1041 setup_string_in_str(&input, s);
1042 return parse_stream_outer(&input, flag);
1047 sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rules
1050 -sinclude $(TOPDIR)/cpu/$(CPU)/config.mk # include CPU specific rules
1051 +sinclude $(TOPDIR)/cpu/$(CPU)/$(BOARD)/config.mk # include CPU specific rules
1054 sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include SoC specific rules
1057 RELFLAGS= $(PLATFORM_RELFLAGS)
1058 DBGFLAGS= -g # -DDEBUG
1059 -OPTFLAGS= -Os #-fomit-frame-pointer
1061 +#-O2 #-fomit-frame-pointer
1063 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
1064 ifeq ($(CONFIG_NAND_U_BOOT),y)
1065 @@ -139,12 +140,15 @@
1066 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
1070 +LDSCRIPT_BOOTSTRAP := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds
1072 OBJCFLAGS += --gap-fill=0xff
1074 gccincdir := $(shell $(CC) -print-file-name=include)
1076 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
1077 - -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
1078 + -D__KERNEL__ -DUBOOT_RAM_TEXT_BASE=$(UBOOT_RAM_TEXT_BASE) \
1080 ifneq ($(OBJTREE),$(SRCTREE))
1081 CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include
1082 @@ -180,7 +184,10 @@
1084 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
1086 -LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
1087 +LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(UBOOT_RAM_TEXT_BASE) $(PLATFORM_LDFLAGS)
1088 +LDFLAGS_BOOTSTRAP += -Bstatic -T $(LDSCRIPT_BOOTSTRAP) -Ttext $(BOOTSTRAP_TEXT_BASE) $(PLATFORM_LDFLAGS)
1090 +#HEAD_LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(HEAD_FLASH_TEXT_BASE) $(PLATFORM_LDFLAGS)
1092 # Location of a usable BFD library, where we define "usable" as
1093 # "built for ${HOST}, supports ${TARGET}". Sensible values are
1094 @@ -211,10 +218,17 @@
1096 #########################################################################
1098 +AFLAGS := $(AFLAGS) $(IFX_CFLAGS)
1099 +CFLAGS := $(CFLAGS) $(IFX_CFLAGS)
1100 +CPPFLAGS := $(CPPFLAGS) $(IFX_CFLAGS)
1102 +#########################################################################
1104 export CONFIG_SHELL HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE \
1105 AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP \
1107 -export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
1108 +#export UBOOT_RAM_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
1109 +export UBOOT_RAM_TEXT_BASE BOOTSTRAP_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
1111 #########################################################################
1113 --- a/drivers/Makefile
1114 +++ b/drivers/Makefile
1116 videomodes.o w83c553f.o \
1118 pxa_pcmcia.o mpc8xx_pcmcia.o tqm8xx_pcmcia.o \
1120 + rpx_pcmcia.o ifx_sw.o
1122 SRCS := $(COBJS:.o=.c)
1123 OBJS := $(addprefix $(obj),$(COBJS))
1127 -$(LIB): $(obj).depend $(OBJS)
1129 $(AR) $(ARFLAGS) $@ $(OBJS)
1131 #########################################################################
1132 --- a/include/asm-mips/mipsregs.h
1133 +++ b/include/asm-mips/mipsregs.h
1135 #define CP0_CAUSE $13
1137 #define CP0_PRID $15
1138 +#define CP0_EBASE $15,1
1139 #define CP0_CONFIG $16
1140 #define CP0_LLADDR $17
1141 #define CP0_WATCHLO $18
1142 @@ -330,11 +331,32 @@
1143 # define KSU_USER 0x00000010
1144 # define KSU_SUPERVISOR 0x00000008
1145 # define KSU_KERNEL 0x00000000
1146 +#ifdef CONFIG_DANUBE /* MIPS 24KE */
1147 +/* bits 5 & 6 & 7: reserved */
1148 +/* bits 8~15: IM0~7 */
1149 +/* bits 16: reserved */
1150 +#define ST0_CEE 0x00020000
1151 +/* bits 18: always 0 */
1152 +#define ST0_NMI 0x00080000
1153 +#define ST0_SR 0x00100000
1154 +#define ST0_TS 0x00200000
1155 +#define ST0_BEV 0x00400000
1156 +/* bits 23: reserved */
1157 +#define ST0_MX 0x01000000
1158 +#define ST0_RE 0x02000000
1159 +#define ST0_FR 0x04000000
1160 +#define ST0_RP 0x08000000
1161 +#define ST0_CU0 0x10000000
1162 +#define ST0_CU1 0x20000000
1163 +#define ST0_CU2 0x40000000
1164 +#define ST0_CU3 0x80000000
1166 #define ST0_UX 0x00000020
1167 #define ST0_SX 0x00000040
1168 #define ST0_KX 0x00000080
1169 #define ST0_DE 0x00010000
1170 #define ST0_CE 0x00020000
1174 * Bitfields in the R[23]000 cp0 status register.
1175 @@ -471,6 +493,14 @@
1176 #define CAUSEF_BD (1 << 31)
1179 + * Bits in the coprocessor 0 EBase register
1181 +#define EBASEB_CPUNUM 0
1182 +#define EBASEF_CPUNUM (0x3ff << EBASEB_CPUNUM)
1183 +#define EBASEB_EXPBASE 12
1184 +#define EBASEF_EXPBASE (0x3ffff << EBASEB_EXPBASE)
1187 * Bits in the coprozessor 0 config register.
1189 #define CONF_CM_CACHABLE_NO_WA 0
1190 @@ -544,4 +574,10 @@
1191 #define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
1192 #define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
1195 + * Bits in ErrCtl register
1197 +#define ECCB_WST 29
1198 +#define ECCF_WST (0x1 << ECCB_WST)
1200 #endif /* _ASM_MIPSREGS_H */
1201 --- a/include/cmd_confdefs.h
1202 +++ b/include/cmd_confdefs.h
1204 #define CFG_CMD_EXT2 0x1000000000000000ULL /* EXT2 Support */
1205 #define CFG_CMD_SNTP 0x2000000000000000ULL /* SNTP support */
1206 #define CFG_CMD_DISPLAY 0x4000000000000000ULL /* Display support */
1207 +#define CFG_CMD_DHRYSTONE 0x8000000000000000ULL /* Dhrystone benchmark support */
1209 #define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFULL /* ALL commands */
1213 CFG_CMD_UNIVERSE | \
1215 + CFG_CMD_DHRYSTONE | \
1218 /* Default configuration
1220 +++ b/include/config.h
1222 +/* Automatically generated - do not edit */
1223 +#include <configs/danube.h>
1225 +++ b/include/config.mk
1230 --- a/include/flash.h
1231 +++ b/include/flash.h
1233 extern unsigned long flash_init (void);
1234 extern void flash_print_info (flash_info_t *);
1235 extern int flash_erase (flash_info_t *, int, int);
1236 -extern int flash_sect_erase (ulong addr_first, ulong addr_last);
1237 +extern int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase);
1238 extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
1240 /* common/flash.c */
1241 @@ -299,6 +299,10 @@
1242 #define TOSH_ID_FVT160 0xC2 /* TC58FVT160 ID (16 M, top ) */
1243 #define TOSH_ID_FVB160 0x43 /* TC58FVT160 ID (16 M, bottom ) */
1245 +#define MX_ID_29LV320AB 0x22A822A8 /* MXIC MX29LV320AB ID (32 M, bottom ) joelin */
1246 +#define MX_ID_29LV160BB 0x22492249 /* MXIC MX29LV160BB ID (16 M, bottom ) joelin */
1247 +#define MX_ID_29LV640BB 0x22cb22cb /* MXIC MX29LV640BB ID (64 M, bottom ) joelin */
1249 /*-----------------------------------------------------------------------
1250 * Internal FLASH identification codes
1252 @@ -422,6 +426,10 @@
1253 #define FLASH_S29GL064M 0x00F0 /* Spansion S29GL064M-R6 */
1254 #define FLASH_S29GL128N 0x00F1 /* Spansion S29GL128N */
1256 +#define FLASH_29LV320AB 0x00B0 /* MXIC MX29LV320AB( 32M = 4M x 16 ) joelin 10/07/2004*/
1257 +#define FLASH_29LV160BB 0x00B1 /* MXIC MX29LV160BB( 16M = 2M x 16 ) joelin 11/22/2004*/
1258 +#define FLASH_29LV640BB 0x00B2 /* MXIC MX29LV640BB( 64M = 8M x 16 ) liupeng*/
1260 #define FLASH_UNKNOWN 0xFFFF /* unknown flash type */
1263 --- a/include/image.h
1264 +++ b/include/image.h
1266 #define IH_COMP_NONE 0 /* No Compression Used */
1267 #define IH_COMP_GZIP 1 /* gzip Compression Used */
1268 #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
1269 +#define IH_COMP_LZMA 3 /* lzma Compression Used */
1271 #define IH_MAGIC 0x27051956 /* Image Magic Number */
1272 #define IH_NMLEN 32 /* Image Name Length */
1274 +++ b/include/syscall.h
1276 +#ifndef __MON_SYS_CALL_H__
1277 +#define __MON_SYS_CALL_H__
1279 +#ifndef __ASSEMBLY__
1281 +#include <common.h>
1283 +/* These are declarations of system calls available in C code */
1284 +int mon_getc(void);
1285 +int mon_tstc(void);
1286 +void mon_putc(const char);
1287 +void mon_puts(const char*);
1288 +void mon_printf(const char* fmt, ...);
1289 +void mon_install_hdlr(int, interrupt_handler_t*, void*);
1290 +void mon_free_hdlr(int);
1291 +void *mon_malloc(size_t);
1292 +void mon_free(void*);
1293 +void mon_udelay(unsigned long);
1294 +unsigned long mon_get_timer(unsigned long);
1296 +#endif /* ifndef __ASSEMBLY__ */
1298 +#define NR_SYSCALLS 11 /* number of syscalls */
1302 + * Make sure these functions are in the same order as they
1303 + * appear in the "examples/syscall.S" file !!!
1305 +#define SYSCALL_GETC 0
1306 +#define SYSCALL_TSTC 1
1307 +#define SYSCALL_PUTC 2
1308 +#define SYSCALL_PUTS 3
1309 +#define SYSCALL_PRINTF 4
1310 +#define SYSCALL_INSTALL_HDLR 5
1311 +#define SYSCALL_FREE_HDLR 6
1312 +#define SYSCALL_MALLOC 7
1313 +#define SYSCALL_FREE 8
1314 +#define SYSCALL_UDELAY 9
1315 +#define SYSCALL_GET_TIMER 10
1319 +++ b/include/version_autogenerated.h
1321 +#define U_BOOT_VERSION "U-Boot 1.1.5-IFX-LXDB-g71af1545"
1327 + 0xA0B00000 "u-boot.bin" /* Download u-boot image */
1332 +}; /* Start u-boot image */
1333 --- a/lib_generic/Makefile
1334 +++ b/lib_generic/Makefile
1336 COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \
1337 bzlib_randtable.o bzlib_huffman.o \
1338 crc32.o ctype.o display_options.o ldiv.o \
1339 - string.o vsprintf.o zlib.o
1340 + string.o vsprintf.o zlib.o LzmaDecode.o LzmaWrapper.o
1342 SRCS := $(COBJS:.o=.c)
1343 OBJS := $(addprefix $(obj),$(COBJS))
1344 --- a/lib_mips/board.c
1345 +++ b/lib_mips/board.c
1348 #include <environment.h>
1350 +#ifdef CFG_HEAD_CODE
1351 +#undef CONFIG_MICROBZIP2
1353 +#ifdef CONFIG_BZIP2
1357 +#ifdef CONFIG_MICROBZIP2
1358 +#include <micro_bzlib.h>
1362 +#include <LzmaWrapper.h>
1367 +#endif //CFG_HEAD_CODE
1369 DECLARE_GLOBAL_DATA_PTR;
1371 #if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
1373 #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
1378 extern int timer_init(void);
1380 extern int incaip_set_cpuclk(void);
1382 mem_malloc_end - mem_malloc_start);
1385 +#ifdef CFG_HEAD_CODE
1386 +void *malloc(unsigned int size) {
1387 + if(size < (mem_malloc_end - mem_malloc_start)) {
1388 + mem_malloc_start += size;
1389 + //printf("malloc : size required = 0x%08lx and pointer = 0x%08lx\n",size,mem_malloc_start - size);
1390 + return (void *)(mem_malloc_start - size);
1395 +void *realloc(void *src,unsigned int size) {
1399 +void free(void *src) {
1402 +#endif //CFG_HEAD_CODE
1404 void *sbrk (ptrdiff_t increment)
1406 ulong old = mem_malloc_brk;
1409 int board_type = 0; /* use dummy arg */
1411 +#ifdef CONFIG_USE_DDR_RAM
1412 + puts ("DDR-DRAM: ");
1417 if ((gd->ram_size = initdram (board_type)) > 0) {
1418 print_size (gd->ram_size, "\n");
1419 @@ -116,26 +156,29 @@
1423 +#ifndef CFG_HEAD_CODE
1424 static void display_flash_config(ulong size)
1427 print_size (size, "\n");
1432 static int init_baudrate (void)
1434 +#ifndef CFG_HEAD_CODE
1435 char tmp[64]; /* long enough for environment variables */
1436 int i = getenv_r ("baudrate", tmp, sizeof (tmp));
1438 gd->baudrate = (i > 0)
1439 ? (int) simple_strtoul (tmp, NULL, 10)
1442 +#else //CFG_HEAD_CODE
1443 + gd->baudrate = CONFIG_BAUDRATE;
1444 +#endif //CFG_HEAD_CODE
1450 * Breath some life into the board...
1454 init_fnc_t *init_sequence[] = {
1456 +#ifndef CFG_HEAD_CODE
1457 env_init, /* initialize environment */
1458 +#endif //CFG_HEAD_CODE
1459 #ifdef CONFIG_INCA_IP
1460 incaip_set_cpuclk, /* set cpu clock according to environment variable */
1462 @@ -179,7 +224,11 @@
1465 init_fnc_t **init_fnc_ptr;
1466 +#ifdef CFG_HEAD_CODE
1467 + ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_HEAD_BASE;
1468 +#else //CFG_HEAD_CODE
1469 ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE;
1470 +#endif //CFG_HEAD_CODE
1472 #ifdef CONFIG_PURPLE
1473 void copy_code (ulong);
1475 #ifdef CONFIG_PURPLE
1480 + puts("\n relocate_code start");
1481 relocate_code (addr_sp, id, addr);
1483 /* NOTREACHED - relocate_code() does not return */
1484 @@ -292,7 +342,93 @@
1486 ************************************************************************
1488 +#ifdef CFG_HEAD_CODE
1490 +extern void print_image_hdr (image_header_t *hdr);
1491 +extern void jump_unconditional (ulong addr);
1493 +void board_init_r (gd_t *id, ulong dest_addr) {
1496 + ulong data, len, checksum;
1498 + image_header_t header;
1499 + image_header_t *hdr = &header;
1500 + unsigned int destLen;
1502 + puts("\n relocate code finish.\n");
1504 + /* initialize malloc() area */
1505 + mem_malloc_init();
1507 + addr = CFG_HEAD_BASE + CFG_UBOOT_OFFSET;
1508 + memmove (&header, (char *)addr, sizeof(image_header_t));
1510 + if (ntohl(hdr->ih_magic) != IH_MAGIC) {
1511 + printf ("Bad Magic Number at address 0x%08lx\n",addr);
1515 + data = (ulong)&header;
1516 + len = sizeof(image_header_t);
1518 + checksum = ntohl(hdr->ih_hcrc);
1520 + if (crc32 (0, (char *)data, len) != checksum) {
1521 + printf ("Bad Header Checksum\n");
1525 + print_image_hdr (hdr);
1527 + data = addr + sizeof(image_header_t);
1528 + len = ntohl(hdr->ih_size);
1529 + len_ptr = (ulong *)data;
1531 + debug ("Disabling all the interrupts\n");
1532 + disable_interrupts();
1534 + debug (" Uncompressing UBoot Image ... \n" );
1536 + * If we've got less than 4 MB of malloc() space,
1537 + * use slower decompression algorithm which requires
1538 + * at most 2300 KB of memory.
1542 +#ifdef CONFIG_BZIP2
1543 + i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1544 + 0x400000, (char *)data, len,
1545 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1547 + printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1550 +#elif CONFIG_MICROBZIP2
1551 + i = micro_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1552 + &destLen, (char *)data, len,
1553 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1554 + if (i != RETVAL_OK) {
1555 + printf ("MICRO_BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1559 + i = lzma_inflate ((char *)data, len, (char*)ntohl(hdr->ih_load), &destLen);
1560 + if (i != LZMA_RESULT_OK) {
1561 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
1565 + printf ("NONE Compressing u-boot body!!\n");
1566 + memmove ((void *)ntohl(hdr->ih_load), (uchar *)data, len);
1569 + debug (" Uncompression completed successfully with destLen %d.\n ",destLen );
1570 + debug ("Head: Jumping to u-boot in the ram at 0x%08lx\n", CFG_MONITOR_BASE);
1572 + jump_unconditional(CFG_MONITOR_BASE);
1574 +#else //CFG_HEAD_CODE
1575 void board_init_r (gd_t *id, ulong dest_addr)
1582 + puts("\n relocate code finish.\n");
1585 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
1587 @@ -321,10 +459,10 @@
1590 addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
1592 - printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
1594 + debug ("Command \"%s\": 0x%08lx => 0x%08lx\n",
1595 cmdtp->name, (ulong) (cmdtp->cmd), addr);
1599 (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
1603 /* NOTREACHED - no way out of command loop except booting */
1605 +#endif //CFG_HEAD_CODE
1610 +++ b/lib_mips/head.h
1613 +//#define CFG_HEAD_LEN 0x00006000
1614 +#define CFG_UBOOT_OFFSET CFG_HEAD_LEN
1615 --- a/lib_mips/time.c
1616 +++ b/lib_mips/time.c
1621 +void mdelay (unsigned long msec)
1624 + for(i=0;i<msec;i++)
1633 * This function is derived from PowerPC code (read timebase as long long).
1634 * On MIPS it just returns the timer value.
1638 #include <command.h>
1641 +#if defined(CONFIG_IFX_MIPS)
1642 +# include "ifx_eth.c"
1645 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
1648 extern int skge_initialize(bd_t*);
1649 extern int tsec_initialize(bd_t*, int, char *);
1650 extern int npe_initialize(bd_t *);
1651 +#if defined(CONFIG_IFX_MIPS)
1652 + IFX_ETH_INITIALIZE_EXTERN
1655 static struct eth_device *eth_devices, *eth_current;
1658 #if defined(CONFIG_RTL8169)
1659 rtl8169_initialize(bis);
1662 +#if defined(CONFIG_IFX_MIPS)
1663 + IFX_ETH_INITIALIZE(bis)
1666 puts ("No ethernet found.\n");
1668 --- a/tools/Makefile
1669 +++ b/tools/Makefile
1672 BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
1674 -OBJ_LINKS = environment.o crc32.o
1675 +OBJ_LINKS = environment_$(BOARDDIR).o crc32_$(BOARDDIR).o
1676 OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o
1680 CPPFLAGS = -idirafter $(SRCTREE)/include \
1681 -idirafter $(OBJTREE)/include2 \
1682 -idirafter $(OBJTREE)/include \
1683 - -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
1684 + -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC $(IFX_CFLAGS)
1685 CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O
1686 AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS)
1688 @@ -126,14 +126,14 @@
1690 all: $(obj).depend $(BINS) $(LOGO_H) subdirs
1692 -$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32.o $(obj)environment.o
1693 +$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32_$(BOARDDIR).o $(obj)environment_$(BOARDDIR).o
1694 $(CC) $(CFLAGS) -o $@ $^
1696 $(obj)img2srec$(SFX): $(obj)img2srec.o
1697 $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
1700 -$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o
1701 +$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32_$(BOARDDIR).o
1702 $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
1706 $(obj)envcrc.o: $(src)envcrc.c
1707 $(CC) -g $(CFLAGS) -c -o $@ $<
1709 -$(obj)crc32.o: $(obj)crc32.c
1710 +$(obj)crc32_$(BOARDDIR).o: $(obj)crc32_$(BOARDDIR).c
1711 $(CC) -g $(CFLAGS) -c -o $@ $<
1713 $(obj)mkimage.o: $(src)mkimage.c
1714 @@ -192,16 +192,16 @@
1718 -$(obj)environment.c:
1719 - @rm -f $(obj)environment.c
1720 - ln -s $(src)../common/environment.c $(obj)environment.c
1721 +$(obj)environment_$(BOARDDIR).c:
1722 + @rm -f $(obj)environment_$(BOARDDIR).c
1723 + ln -s $(src)../common/environment_$(BOARDDIR).c $(obj)environment_$(BOARDDIR).c
1725 -$(obj)environment.o: $(obj)environment.c
1726 +$(obj)environment_$(BOARDDIR).o: $(obj)environment_$(BOARDDIR).c
1727 $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
1730 - @rm -f $(obj)crc32.c
1731 - ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
1732 +$(obj)crc32_$(BOARDDIR).c:
1733 + @rm -f $(obj)crc32_$(BOARDDIR).c
1734 + ln -s $(src)../lib_generic/crc32_$(BOARDDIR).c $(obj)crc32_$(BOARDDIR).c
1736 $(LOGO_H): $(obj)bmp_logo $(LOGO_BMP)
1737 $(obj)./bmp_logo $(LOGO_BMP) >$@
1738 --- a/tools/mkimage.c
1739 +++ b/tools/mkimage.c
1742 #include <netinet/in.h> /* for host / network byte order conversions */
1744 +#include <sys/types.h>
1745 #include <sys/mman.h>
1746 #include <sys/stat.h>
1749 { IH_COMP_NONE, "none", "uncompressed", },
1750 { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", },
1751 { IH_COMP_GZIP, "gzip", "gzip compressed", },
1752 + { IH_COMP_LZMA, "lzma", "lzma compressed", },
1759 /* We're a bit of paranoid */
1760 -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
1761 +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
1762 (void) fdatasync (ifd);
1766 (void) munmap((void *)ptr, sbuf.st_size);
1768 /* We're a bit of paranoid */
1769 -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
1770 +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
1771 (void) fdatasync (ifd);