100-ifx.patch 62 KB

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