100-ifx.patch 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149
  1. Index: u-boot-1.1.5/Makefile
  2. ===================================================================
  3. --- u-boot-1.1.5.orig/Makefile 2006-10-20 17:54:33.000000000 +0200
  4. +++ u-boot-1.1.5/Makefile 2009-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:32:51.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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-10-04 23:06:04.000000000 +0200
  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-10-04 23:06:04.000000000 +0200
  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-10-04 23:06:03.000000000 +0200
  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. @@ -299,6 +299,10 @@
  1016. #define TOSH_ID_FVT160 0xC2 /* TC58FVT160 ID (16 M, top ) */
  1017. #define TOSH_ID_FVB160 0x43 /* TC58FVT160 ID (16 M, bottom ) */
  1018. +#define MX_ID_29LV320AB 0x22A822A8 /* MXIC MX29LV320AB ID (32 M, bottom ) joelin */
  1019. +#define MX_ID_29LV160BB 0x22492249 /* MXIC MX29LV160BB ID (16 M, bottom ) joelin */
  1020. +#define MX_ID_29LV640BB 0x22cb22cb /* MXIC MX29LV640BB ID (64 M, bottom ) joelin */
  1021. +
  1022. /*-----------------------------------------------------------------------
  1023. * Internal FLASH identification codes
  1024. *
  1025. @@ -422,6 +426,10 @@
  1026. #define FLASH_S29GL064M 0x00F0 /* Spansion S29GL064M-R6 */
  1027. #define FLASH_S29GL128N 0x00F1 /* Spansion S29GL128N */
  1028. +#define FLASH_29LV320AB 0x00B0 /* MXIC MX29LV320AB( 32M = 4M x 16 ) joelin 10/07/2004*/
  1029. +#define FLASH_29LV160BB 0x00B1 /* MXIC MX29LV160BB( 16M = 2M x 16 ) joelin 11/22/2004*/
  1030. +#define FLASH_29LV640BB 0x00B2 /* MXIC MX29LV640BB( 64M = 8M x 16 ) liupeng*/
  1031. +
  1032. #define FLASH_UNKNOWN 0xFFFF /* unknown flash type */
  1033. Index: u-boot-1.1.5/include/image.h
  1034. ===================================================================
  1035. --- u-boot-1.1.5.orig/include/image.h 2006-10-20 17:54:33.000000000 +0200
  1036. +++ u-boot-1.1.5/include/image.h 2009-10-04 23:06:03.000000000 +0200
  1037. @@ -132,6 +132,7 @@
  1038. #define IH_COMP_NONE 0 /* No Compression Used */
  1039. #define IH_COMP_GZIP 1 /* gzip Compression Used */
  1040. #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
  1041. +#define IH_COMP_LZMA 3 /* lzma Compression Used */
  1042. #define IH_MAGIC 0x27051956 /* Image Magic Number */
  1043. #define IH_NMLEN 32 /* Image Name Length */
  1044. Index: u-boot-1.1.5/include/syscall.h
  1045. ===================================================================
  1046. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  1047. +++ u-boot-1.1.5/include/syscall.h 2009-10-04 23:06:03.000000000 +0200
  1048. @@ -0,0 +1,42 @@
  1049. +#ifndef __MON_SYS_CALL_H__
  1050. +#define __MON_SYS_CALL_H__
  1051. +
  1052. +#ifndef __ASSEMBLY__
  1053. +
  1054. +#include <common.h>
  1055. +
  1056. +/* These are declarations of system calls available in C code */
  1057. +int mon_getc(void);
  1058. +int mon_tstc(void);
  1059. +void mon_putc(const char);
  1060. +void mon_puts(const char*);
  1061. +void mon_printf(const char* fmt, ...);
  1062. +void mon_install_hdlr(int, interrupt_handler_t*, void*);
  1063. +void mon_free_hdlr(int);
  1064. +void *mon_malloc(size_t);
  1065. +void mon_free(void*);
  1066. +void mon_udelay(unsigned long);
  1067. +unsigned long mon_get_timer(unsigned long);
  1068. +
  1069. +#endif /* ifndef __ASSEMBLY__ */
  1070. +
  1071. +#define NR_SYSCALLS 11 /* number of syscalls */
  1072. +
  1073. +
  1074. +/*
  1075. + * Make sure these functions are in the same order as they
  1076. + * appear in the "examples/syscall.S" file !!!
  1077. + */
  1078. +#define SYSCALL_GETC 0
  1079. +#define SYSCALL_TSTC 1
  1080. +#define SYSCALL_PUTC 2
  1081. +#define SYSCALL_PUTS 3
  1082. +#define SYSCALL_PRINTF 4
  1083. +#define SYSCALL_INSTALL_HDLR 5
  1084. +#define SYSCALL_FREE_HDLR 6
  1085. +#define SYSCALL_MALLOC 7
  1086. +#define SYSCALL_FREE 8
  1087. +#define SYSCALL_UDELAY 9
  1088. +#define SYSCALL_GET_TIMER 10
  1089. +
  1090. +#endif
  1091. Index: u-boot-1.1.5/ld_uboot.conf
  1092. ===================================================================
  1093. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  1094. +++ u-boot-1.1.5/ld_uboot.conf 2009-10-04 23:06:03.000000000 +0200
  1095. @@ -0,0 +1,8 @@
  1096. +TAG_DWNLD()
  1097. +{
  1098. + 0xA0B00000 "u-boot.bin" /* Download u-boot image */
  1099. +};
  1100. +TAG_START()
  1101. +{
  1102. + 0xA0B00000
  1103. +}; /* Start u-boot image */
  1104. Index: u-boot-1.1.5/lib_generic/Makefile
  1105. ===================================================================
  1106. --- u-boot-1.1.5.orig/lib_generic/Makefile 2006-10-20 17:54:33.000000000 +0200
  1107. +++ u-boot-1.1.5/lib_generic/Makefile 2009-10-04 23:06:03.000000000 +0200
  1108. @@ -28,7 +28,7 @@
  1109. COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \
  1110. bzlib_randtable.o bzlib_huffman.o \
  1111. crc32.o ctype.o display_options.o ldiv.o \
  1112. - string.o vsprintf.o zlib.o
  1113. + string.o vsprintf.o zlib.o LzmaDecode.o LzmaWrapper.o
  1114. SRCS := $(COBJS:.o=.c)
  1115. OBJS := $(addprefix $(obj),$(COBJS))
  1116. Index: u-boot-1.1.5/lib_mips/board.c
  1117. ===================================================================
  1118. --- u-boot-1.1.5.orig/lib_mips/board.c 2006-10-20 17:54:33.000000000 +0200
  1119. +++ u-boot-1.1.5/lib_mips/board.c 2009-10-04 23:06:03.000000000 +0200
  1120. @@ -29,9 +29,30 @@
  1121. #include <net.h>
  1122. #include <environment.h>
  1123. +#ifdef CFG_BOOTSTRAP_CODE
  1124. +//#include <asm/danube.h>
  1125. +#undef CONFIG_MICROBZIP2
  1126. +
  1127. +#ifdef CONFIG_BZIP2
  1128. +#include <bzlib.h>
  1129. +#endif
  1130. +
  1131. +#ifdef CONFIG_MICROBZIP2
  1132. +#include <micro_bzlib.h>
  1133. +#endif
  1134. +
  1135. +#ifdef CONFIG_LZMA
  1136. +#include <LzmaWrapper.h>
  1137. +#endif
  1138. +#endif //CFG_BOOTSTRAP_CODE
  1139. +
  1140. DECLARE_GLOBAL_DATA_PTR;
  1141. -#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
  1142. +#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < BOOTSTRAP_CFG_MONITOR_BASE) || \
  1143. + (CFG_ENV_ADDR >= (BOOTSTRAP_CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
  1144. + defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_BOOTSTRAP_CODE)
  1145. +#define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
  1146. +#elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
  1147. (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
  1148. defined(CFG_ENV_IS_IN_NVRAM)
  1149. #define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
  1150. @@ -39,21 +60,24 @@
  1151. #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
  1152. #endif
  1153. -#undef DEBUG
  1154. -
  1155. extern int timer_init(void);
  1156. -
  1157. extern int incaip_set_cpuclk(void);
  1158. +#ifdef CFG_BOOTSTRAP_CODE
  1159. +extern ulong uboot_end_data_bootstrap;
  1160. +extern ulong uboot_end_bootstrap;
  1161. +#else //CFG_BOOTSTRAP_CODE
  1162. extern ulong uboot_end_data;
  1163. extern ulong uboot_end;
  1164. +#endif //CFG_BOOTSTRAP_CODE
  1165. ulong monitor_flash_len;
  1166. -const char version_string[] =
  1167. - U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
  1168. +const char version_string[] = U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
  1169. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1170. static char *failed = "*** failed ***\n";
  1171. +#endif
  1172. /*
  1173. * Begin and End of memory area for malloc(), and current "brk"
  1174. @@ -62,14 +86,15 @@
  1175. static ulong mem_malloc_end;
  1176. static ulong mem_malloc_brk;
  1177. -
  1178. /*
  1179. * The Malloc area is immediately below the monitor copy in DRAM
  1180. */
  1181. -static void mem_malloc_init (void)
  1182. -{
  1183. +#ifdef CFG_BOOTSTRAP_CODE
  1184. +static void mem_malloc_init (ulong dest_addr) {
  1185. +#else //CFG_BOOTSTRAP_CODE
  1186. +static void mem_malloc_init (void) {
  1187. ulong dest_addr = CFG_MONITOR_BASE + gd->reloc_off;
  1188. -
  1189. +#endif //CFG_BOOTSTRAP_CODE
  1190. mem_malloc_end = dest_addr;
  1191. mem_malloc_start = dest_addr - TOTAL_MALLOC_LEN;
  1192. mem_malloc_brk = mem_malloc_start;
  1193. @@ -79,6 +104,25 @@
  1194. mem_malloc_end - mem_malloc_start);
  1195. }
  1196. +#ifdef CFG_BOOTSTRAP_CODE
  1197. +void *malloc(unsigned int size) {
  1198. + if(size < (mem_malloc_end - mem_malloc_start)) {
  1199. + mem_malloc_start += size;
  1200. + debug ("malloc : size required = 0x%08lx and pointer = 0x%08lx\n",size,mem_malloc_start - size);
  1201. + return (void *)(mem_malloc_start - size);
  1202. + }
  1203. + return NULL;
  1204. +}
  1205. +
  1206. +void *realloc(void *src,unsigned int size) {
  1207. + return NULL;
  1208. +}
  1209. +
  1210. +void free(void *src) {
  1211. + return;
  1212. +}
  1213. +#endif //CFG_BOOTSTRAP_CODE
  1214. +
  1215. void *sbrk (ptrdiff_t increment)
  1216. {
  1217. ulong old = mem_malloc_brk;
  1218. @@ -99,42 +143,58 @@
  1219. #else
  1220. int board_type = 0; /* use dummy arg */
  1221. #endif
  1222. - puts ("DRAM: ");
  1223. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1224. +#ifdef CONFIG_USE_DDR_RAM
  1225. + puts ("DDR-DRAM: ");
  1226. +#else
  1227. + puts ("DRAM: ");
  1228. +#endif
  1229. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1230. if ((gd->ram_size = initdram (board_type)) > 0) {
  1231. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1232. print_size (gd->ram_size, "\n");
  1233. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1234. return (0);
  1235. }
  1236. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1237. puts (failed);
  1238. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1239. return (1);
  1240. }
  1241. +#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF)
  1242. static int display_banner(void)
  1243. {
  1244. -
  1245. printf ("\n\n%s\n\n", version_string);
  1246. return (0);
  1247. }
  1248. +#endif
  1249. +#ifndef CFG_BOOTSTRAP_CODE
  1250. static void display_flash_config(ulong size)
  1251. {
  1252. puts ("Flash: ");
  1253. print_size (size, "\n");
  1254. }
  1255. +#endif //CFG_BOOTSTRAP_CODE
  1256. -
  1257. +#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF)
  1258. static int init_baudrate (void)
  1259. {
  1260. +#ifndef CFG_BOOTSTRAP_CODE
  1261. char tmp[64]; /* long enough for environment variables */
  1262. int i = getenv_r ("baudrate", tmp, sizeof (tmp));
  1263. gd->baudrate = (i > 0)
  1264. ? (int) simple_strtoul (tmp, NULL, 10)
  1265. : CONFIG_BAUDRATE;
  1266. -
  1267. +#else //CFG_BOOTSTRAP_CODE
  1268. + gd->baudrate = CONFIG_BAUDRATE;
  1269. +#endif //CFG_BOOTSTRAP_CODE
  1270. return (0);
  1271. }
  1272. -
  1273. +#endif
  1274. /*
  1275. * Breath some life into the board...
  1276. @@ -159,27 +219,49 @@
  1277. typedef int (init_fnc_t) (void);
  1278. init_fnc_t *init_sequence[] = {
  1279. +#ifdef CFG_BOOTSTRAP_CODE
  1280. + //fuse_prg,
  1281. + //timer_init,
  1282. + //env_init, /* initialize environment */
  1283. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1284. + init_baudrate, /* initialze baudrate settings */
  1285. + serial_init, /* serial communications setup */
  1286. + console_init_f,
  1287. + display_banner, /* say that we are here */
  1288. + checkboard,
  1289. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1290. + init_func_ram,
  1291. + NULL,
  1292. +#else /********** CFG_BOOTSTRAP_CODE **********/
  1293. timer_init,
  1294. - env_init, /* initialize environment */
  1295. -#ifdef CONFIG_INCA_IP
  1296. - incaip_set_cpuclk, /* set cpu clock according to environment variable */
  1297. -#endif
  1298. init_baudrate, /* initialze baudrate settings */
  1299. serial_init, /* serial communications setup */
  1300. console_init_f,
  1301. display_banner, /* say that we are here */
  1302. checkboard,
  1303. init_func_ram,
  1304. + env_init, /* initialize environment */
  1305. NULL,
  1306. +#endif //CFG_BOOTSTRAP_CODE
  1307. };
  1308. +#ifdef CFG_BOOTSTRAP_CODE
  1309. +extern void bootstrap_relocate_code(ulong addr_sp, gd_t *id, ulong addr);
  1310. +void bootstrap_board_init_f(ulong bootflag)
  1311. +#else
  1312. void board_init_f(ulong bootflag)
  1313. +#endif
  1314. {
  1315. gd_t gd_data, *id;
  1316. bd_t *bd;
  1317. init_fnc_t **init_fnc_ptr;
  1318. - ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE;
  1319. +#ifdef CFG_BOOTSTRAP_CODE
  1320. + ulong addr, addr_sp, len = (ulong)&uboot_end_bootstrap - BOOTSTRAP_CFG_MONITOR_BASE;
  1321. + ulong lzmaImageaddr = 0;
  1322. +#else //CFG_BOOTSTRAP_CODE
  1323. + ulong addr, addr_sp, len = CFG_MONITOR_LEN;
  1324. +#endif //CFG_BOOTSTRAP_CODE
  1325. ulong *s;
  1326. #ifdef CONFIG_PURPLE
  1327. void copy_code (ulong);
  1328. @@ -219,13 +301,12 @@
  1329. addr -= len;
  1330. addr &= ~(16 * 1024 - 1);
  1331. - debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
  1332. + debug ("Reserving %d Bytes for U-Boot at: %08lx\n", len, addr);
  1333. /* Reserve memory for malloc() arena.
  1334. */
  1335. addr_sp = addr - TOTAL_MALLOC_LEN;
  1336. - debug ("Reserving %dk for malloc() at: %08lx\n",
  1337. - TOTAL_MALLOC_LEN >> 10, addr_sp);
  1338. + debug ("Reserving %d Bytes for malloc() at: %08lx\n", TOTAL_MALLOC_LEN, addr_sp);
  1339. /*
  1340. * (permanently) allocate a Board Info struct
  1341. @@ -234,20 +315,17 @@
  1342. addr_sp -= sizeof(bd_t);
  1343. bd = (bd_t *)addr_sp;
  1344. gd->bd = bd;
  1345. - debug ("Reserving %d Bytes for Board Info at: %08lx\n",
  1346. - sizeof(bd_t), addr_sp);
  1347. + debug ("Reserving %d Bytes for Board Info at: %08lx\n", sizeof(bd_t), addr_sp);
  1348. addr_sp -= sizeof(gd_t);
  1349. id = (gd_t *)addr_sp;
  1350. - debug ("Reserving %d Bytes for Global Data at: %08lx\n",
  1351. - sizeof (gd_t), addr_sp);
  1352. + debug ("Reserving %d Bytes for Global Data at: %08lx\n", sizeof (gd_t), addr_sp);
  1353. /* Reserve memory for boot params.
  1354. */
  1355. addr_sp -= CFG_BOOTPARAMS_LEN;
  1356. bd->bi_boot_params = addr_sp;
  1357. - debug ("Reserving %dk for boot params() at: %08lx\n",
  1358. - CFG_BOOTPARAMS_LEN >> 10, addr_sp);
  1359. + debug ("Reserving %dk for boot params() at: %08lx\n", CFG_BOOTPARAMS_LEN >> 10, addr_sp);
  1360. /*
  1361. * Finally, we set up a new (bigger) stack.
  1362. @@ -279,7 +357,16 @@
  1363. copy_code(addr);
  1364. #endif
  1365. +#ifdef CFG_BOOTSTRAP_CODE
  1366. + lzmaImageaddr = (ulong)&uboot_end_data_bootstrap;
  1367. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1368. + puts("\n BOOTSTRAP: relocate_code start");
  1369. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1370. + bootstrap_relocate_code (addr_sp, id, addr);
  1371. +#else //CFG_BOOTSTRAP_CODE
  1372. + puts("\n relocate_code start");
  1373. relocate_code (addr_sp, id, addr);
  1374. +#endif //CFG_BOOTSTRAP_CODE
  1375. /* NOTREACHED - relocate_code() does not return */
  1376. }
  1377. @@ -292,7 +379,110 @@
  1378. *
  1379. ************************************************************************
  1380. */
  1381. +#ifdef CFG_BOOTSTRAP_CODE
  1382. +void bootstrap_board_init_r (gd_t *id, ulong dest_addr) {
  1383. + int i;
  1384. + ulong addr;
  1385. + ulong data, len, checksum;
  1386. + ulong *len_ptr;
  1387. + image_header_t header;
  1388. + image_header_t *hdr = &header;
  1389. + unsigned int destLen;
  1390. + int (*fn)(void);
  1391. +
  1392. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1393. + puts("\n BOOTSTRAP: relocate_code finish.\n");
  1394. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1395. +
  1396. + /* initialize malloc() area */
  1397. + mem_malloc_init(dest_addr);
  1398. +
  1399. + addr = (char *)(BOOTSTRAP_CFG_MONITOR_BASE + ((ulong)&uboot_end_data_bootstrap - dest_addr));
  1400. + memmove (&header, (char *)addr, sizeof(image_header_t));
  1401. +
  1402. + if (ntohl(hdr->ih_magic) != IH_MAGIC) {
  1403. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1404. + printf ("Bad Magic Number at address 0x%08lx\n",addr);
  1405. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1406. + return;
  1407. + }
  1408. + data = (ulong)&header;
  1409. + len = sizeof(image_header_t);
  1410. +
  1411. + checksum = ntohl(hdr->ih_hcrc);
  1412. + hdr->ih_hcrc = 0;
  1413. + if (crc32 (0, (unsigned char *)data, len) != checksum) {
  1414. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1415. + printf ("Bad Header Checksum\n");
  1416. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1417. + return;
  1418. + }
  1419. +
  1420. + data = addr + sizeof(image_header_t);
  1421. + len = ntohl(hdr->ih_size);
  1422. + len_ptr = (ulong *)data;
  1423. +
  1424. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1425. + debug ("Disabling all the interrupts\n");
  1426. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1427. + disable_interrupts();
  1428. +
  1429. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1430. + debug (" Uncompressing UBoot Image ... \n" );
  1431. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1432. + /*
  1433. + * If we've got less than 4 MB of malloc() space,
  1434. + * use slower decompression algorithm which requires
  1435. + * at most 2300 KB of memory.
  1436. + */
  1437. + destLen = 0x0;
  1438. +
  1439. +#ifdef CONFIG_BZIP2
  1440. + i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
  1441. + 0x400000, (char *)data, len,
  1442. + CFG_MALLOC_LEN < (4096 * 1024), 0);
  1443. + if (i != BZ_OK) {
  1444. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1445. + printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
  1446. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1447. + return;
  1448. + }
  1449. +#elif CONFIG_MICROBZIP2
  1450. + i = micro_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
  1451. + &destLen, (char *)data, len,
  1452. + CFG_MALLOC_LEN < (4096 * 1024), 0);
  1453. + if (i != RETVAL_OK) {
  1454. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1455. + printf ("MICRO_BUNZIP2 ERROR %d - must RESET board to recover\n", i);
  1456. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1457. + return;
  1458. + }
  1459. +#elif CONFIG_LZMA
  1460. + i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &destLen);
  1461. + if (i != LZMA_RESULT_OK) {
  1462. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1463. + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
  1464. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1465. + return;
  1466. + }
  1467. +#else
  1468. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1469. + printf ("NONE Compressing u-boot body!!\n");
  1470. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1471. + memmove ((void *)ntohl(hdr->ih_load), (uchar *)data, len);
  1472. + destLen = len;
  1473. +#endif
  1474. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1475. + debug (" Uncompression completed successfully with destLen %d.\n ",destLen );
  1476. + debug ("Head: Jumping to u-boot in the ram at 0x%08lx\n", CFG_MONITOR_BASE);
  1477. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1478. +
  1479. + fn = ntohl(hdr->ih_load);
  1480. + (*fn)();
  1481. + hang ();
  1482. +}
  1483. +#else //CFG_BOOTSTRAP_CODE
  1484. void board_init_r (gd_t *id, ulong dest_addr)
  1485. {
  1486. cmd_tbl_t *cmdtp;
  1487. @@ -305,6 +495,8 @@
  1488. bd_t *bd;
  1489. int i;
  1490. + puts("\n relocate_code finish.\n");
  1491. +
  1492. gd = id;
  1493. gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
  1494. @@ -321,12 +513,10 @@
  1495. ulong addr;
  1496. addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
  1497. -#if 0
  1498. - printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
  1499. - cmdtp->name, (ulong) (cmdtp->cmd), addr);
  1500. -#endif
  1501. - cmdtp->cmd =
  1502. - (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
  1503. +
  1504. + debug ("Command \"%s\": 0x%08lx => 0x%08lx\n", cmdtp->name, (ulong) (cmdtp->cmd), addr);
  1505. +
  1506. + cmdtp->cmd = (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
  1507. addr = (ulong)(cmdtp->name) + gd->reloc_off;
  1508. cmdtp->name = (char *)addr;
  1509. @@ -363,7 +553,13 @@
  1510. /* initialize malloc() area */
  1511. mem_malloc_init();
  1512. malloc_bin_reloc();
  1513. +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
  1514. + nand_init(); /* go init the NAND */
  1515. +#endif
  1516. +#ifdef CONFIG_SPI
  1517. + spi_init_f(); /* go init the SPI flash */
  1518. +#endif
  1519. /* relocate environment function pointers etc. */
  1520. env_relocate();
  1521. @@ -424,9 +620,12 @@
  1522. /* NOTREACHED - no way out of command loop except booting */
  1523. }
  1524. +#endif //CFG_BOOTSTRAP_CODE
  1525. void hang (void)
  1526. {
  1527. +#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1528. puts ("### ERROR ### Please RESET the board ###\n");
  1529. +#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF
  1530. for (;;);
  1531. }
  1532. Index: u-boot-1.1.5/lib_mips/time.c
  1533. ===================================================================
  1534. --- u-boot-1.1.5.orig/lib_mips/time.c 2006-10-20 17:54:33.000000000 +0200
  1535. +++ u-boot-1.1.5/lib_mips/time.c 2009-10-04 23:06:03.000000000 +0200
  1536. @@ -80,6 +80,19 @@
  1537. /*NOP*/;
  1538. }
  1539. +#ifndef CFG_BOOTSTRAP_CODE
  1540. +void mdelay (unsigned long msec)
  1541. +{
  1542. + int i,j;
  1543. + for(i=0;i<msec;i++)
  1544. + {
  1545. + udelay(1000);
  1546. +
  1547. + }
  1548. +
  1549. +}
  1550. +#endif
  1551. +
  1552. /*
  1553. * This function is derived from PowerPC code (read timebase as long long).
  1554. * On MIPS it just returns the timer value.
  1555. Index: u-boot-1.1.5/net/eth.c
  1556. ===================================================================
  1557. --- u-boot-1.1.5.orig/net/eth.c 2006-10-20 17:54:33.000000000 +0200
  1558. +++ u-boot-1.1.5/net/eth.c 2009-10-04 23:06:03.000000000 +0200
  1559. @@ -25,6 +25,9 @@
  1560. #include <command.h>
  1561. #include <net.h>
  1562. #include <miiphy.h>
  1563. +#if defined(CONFIG_IFX_MIPS)
  1564. +# include "ifx_eth.c"
  1565. +#endif
  1566. #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
  1567. @@ -54,6 +57,9 @@
  1568. extern int skge_initialize(bd_t*);
  1569. extern int tsec_initialize(bd_t*, int, char *);
  1570. extern int npe_initialize(bd_t *);
  1571. +#if defined(CONFIG_IFX_MIPS)
  1572. + IFX_ETH_INITIALIZE_EXTERN
  1573. +#endif
  1574. static struct eth_device *eth_devices, *eth_current;
  1575. @@ -235,7 +241,9 @@
  1576. #if defined(CONFIG_RTL8169)
  1577. rtl8169_initialize(bis);
  1578. #endif
  1579. -
  1580. +#if defined(CONFIG_IFX_MIPS)
  1581. + IFX_ETH_INITIALIZE(bis)
  1582. +#endif
  1583. if (!eth_devices) {
  1584. puts ("No ethernet found.\n");
  1585. } else {
  1586. Index: u-boot-1.1.5/tools/mkimage.c
  1587. ===================================================================
  1588. --- u-boot-1.1.5.orig/tools/mkimage.c 2006-10-20 17:54:33.000000000 +0200
  1589. +++ u-boot-1.1.5/tools/mkimage.c 2009-10-04 23:06:03.000000000 +0200
  1590. @@ -28,6 +28,7 @@
  1591. #ifndef __WIN32__
  1592. #include <netinet/in.h> /* for host / network byte order conversions */
  1593. #endif
  1594. +#include <sys/types.h>
  1595. #include <sys/mman.h>
  1596. #include <sys/stat.h>
  1597. #include <time.h>
  1598. @@ -138,6 +139,7 @@
  1599. { IH_COMP_NONE, "none", "uncompressed", },
  1600. { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", },
  1601. { IH_COMP_GZIP, "gzip", "gzip compressed", },
  1602. + { IH_COMP_LZMA, "lzma", "lzma compressed", },
  1603. { -1, "", "", },
  1604. };
  1605. @@ -445,7 +447,7 @@
  1606. }
  1607. /* We're a bit of paranoid */
  1608. -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
  1609. +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
  1610. (void) fdatasync (ifd);
  1611. #else
  1612. (void) fsync (ifd);
  1613. @@ -495,7 +497,7 @@
  1614. (void) munmap((void *)ptr, sbuf.st_size);
  1615. /* We're a bit of paranoid */
  1616. -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
  1617. +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__)
  1618. (void) fdatasync (ifd);
  1619. #else
  1620. (void) fsync (ifd);
  1621. Index: u-boot-1.1.5/cpu/mips/cache.S
  1622. ===================================================================
  1623. --- u-boot-1.1.5.orig/cpu/mips/cache.S 2006-10-20 17:54:33.000000000 +0200
  1624. +++ u-boot-1.1.5/cpu/mips/cache.S 2009-10-04 23:06:03.000000000 +0200
  1625. @@ -29,7 +29,9 @@
  1626. #include <asm/mipsregs.h>
  1627. #include <asm/addrspace.h>
  1628. #include <asm/cacheops.h>
  1629. -
  1630. +#if defined(CONFIG_IFX_MIPS)
  1631. +# include "danube/ifx_cache.S"
  1632. +#endif
  1633. /* 16KB is the maximum size of instruction and data caches on
  1634. * MIPS 4K.
  1635. @@ -155,6 +157,9 @@
  1636. */
  1637. mtc0 zero, CP0_TAGLO
  1638. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_INVALID_TAG)
  1639. + IFX_CACHE_EXTRA_INVALID_TAG
  1640. +#endif
  1641. /*
  1642. * The caches are probably in an indeterminate state,
  1643. @@ -171,6 +176,9 @@
  1644. move a1, a2
  1645. icacheopn(a0,a1,a2,a3,121,(Index_Store_Tag_I,Fill))
  1646. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_OPERATION)
  1647. + IFX_CACHE_EXTRA_OPERATION
  1648. +#else
  1649. /* To support Orion/R4600, we initialise the data cache in 3 passes.
  1650. */
  1651. @@ -200,6 +208,7 @@
  1652. move a3, t5 # dcacheLineSize
  1653. move a1, a2
  1654. icacheop(a0,a1,a2,a3,Index_Store_Tag_D)
  1655. +#endif
  1656. j ra
  1657. .end mips_cache_reset
  1658. Index: u-boot-1.1.5/cpu/mips/config.mk
  1659. ===================================================================
  1660. --- u-boot-1.1.5.orig/cpu/mips/config.mk 2006-10-20 17:54:33.000000000 +0200
  1661. +++ u-boot-1.1.5/cpu/mips/config.mk 2009-10-04 23:06:03.000000000 +0200
  1662. @@ -20,20 +20,26 @@
  1663. # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  1664. # MA 02111-1307 USA
  1665. #
  1666. -v=$(shell \
  1667. -$(CROSS_COMPILE)as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
  1668. -MIPSFLAGS=$(shell \
  1669. -if [ "$v" -lt "14" ]; then \
  1670. - echo "-mcpu=4kc"; \
  1671. -else \
  1672. - echo "-march=4kc -mtune=4kc"; \
  1673. -fi)
  1674. +ifndef PLATFORM_CPU
  1675. +PLATFORM_CPU = mips32
  1676. +endif
  1677. +
  1678. +MIPSFLAGS +=$(call cc-option,-march=$(PLATFORM_CPU) -mtune=$(PLATFORM_CPU),-mcpu=$(PLATFORM_CPU))
  1679. +
  1680. +ifeq ($(CROSS_COMPILE_UCLIBC),1)
  1681. +ifneq (,$(findstring mipsel,$(CROSS_COMIPLE)))
  1682. +ENDIANNESS = -el
  1683. +else
  1684. +ENDIANNESS = -eb
  1685. +endif
  1686. +else
  1687. ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
  1688. ENDIANNESS = -EL
  1689. else
  1690. ENDIANNESS = -EB
  1691. endif
  1692. +endif
  1693. MIPSFLAGS += $(ENDIANNESS) -mabicalls
  1694. Index: u-boot-1.1.5/cpu/mips/cpu.c
  1695. ===================================================================
  1696. --- u-boot-1.1.5.orig/cpu/mips/cpu.c 2006-10-20 17:54:33.000000000 +0200
  1697. +++ u-boot-1.1.5/cpu/mips/cpu.c 2009-10-04 23:06:03.000000000 +0200
  1698. @@ -23,7 +23,12 @@
  1699. #include <common.h>
  1700. #include <command.h>
  1701. -#include <asm/inca-ip.h>
  1702. +#if defined(CONFIG_INCA_IP)
  1703. +# include <asm/inca-ip.h>
  1704. +#elif defined(CONFIG_IFX_MIPS)
  1705. +# include <asm/danube.h>
  1706. +# include "danube/ifx_cpu.c"
  1707. +#endif
  1708. #include <asm/mipsregs.h>
  1709. int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  1710. @@ -34,6 +39,8 @@
  1711. void (*f)(void) = (void *) 0xbfc00000;
  1712. f();
  1713. +#elif defined(CONFIG_IFX_MIPS)
  1714. + IFX_CPU_RESET;
  1715. #endif
  1716. fprintf(stderr, "*** reset failed ***\n");
  1717. return 0;
  1718. Index: u-boot-1.1.5/cpu/mips/incaip_clock.c
  1719. ===================================================================
  1720. --- u-boot-1.1.5.orig/cpu/mips/incaip_clock.c 2006-10-20 17:54:33.000000000 +0200
  1721. +++ u-boot-1.1.5/cpu/mips/incaip_clock.c 2009-10-04 23:06:03.000000000 +0200
  1722. @@ -22,8 +22,9 @@
  1723. */
  1724. #include <common.h>
  1725. -#include <asm/inca-ip.h>
  1726. +#ifdef CONFIG_INCA_IP
  1727. +#include <asm/inca-ip.h>
  1728. /*******************************************************************************
  1729. *
  1730. @@ -114,3 +115,5 @@
  1731. return 0;
  1732. }
  1733. +
  1734. +#endif /* CONFIG_INCA_IP */
  1735. Index: u-boot-1.1.5/cpu/mips/start.S
  1736. ===================================================================
  1737. --- u-boot-1.1.5.orig/cpu/mips/start.S 2006-10-20 17:54:33.000000000 +0200
  1738. +++ u-boot-1.1.5/cpu/mips/start.S 2009-10-04 23:06:03.000000000 +0200
  1739. @@ -27,7 +27,9 @@
  1740. #include <version.h>
  1741. #include <asm/regdef.h>
  1742. #include <asm/mipsregs.h>
  1743. -
  1744. +#if defined(CONFIG_IFX_MIPS)
  1745. +# include "danube/ifx_start.S"
  1746. +#endif
  1747. #define RVECENT(f,n) \
  1748. b f; nop
  1749. @@ -36,15 +38,24 @@
  1750. li k0,bev
  1751. .set noreorder
  1752. -
  1753. +#ifdef CFG_BOOTSTRAP_CODE
  1754. + .globl _start_bootstrap
  1755. +#else
  1756. .globl _start
  1757. +#endif
  1758. .text
  1759. +#ifdef CFG_BOOTSTRAP_CODE
  1760. +_start_bootstrap:
  1761. +#else
  1762. _start:
  1763. +#endif
  1764. RVECENT(reset,0) /* U-boot entry point */
  1765. RVECENT(reset,1) /* software reboot */
  1766. -#if defined(CONFIG_INCA_IP)
  1767. +#if defined(CONFIG_INCA_IP) || defined(CONFIG_INCA_IP2)
  1768. .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
  1769. .word 0x00000000 /* phase of the flash */
  1770. +#elif defined(CONFIG_IFX_MIPS) && defined(IFX_EBU_BOOTCFG_DWORD)
  1771. + IFX_EBU_BOOTCFG_DWORD
  1772. #elif defined(CONFIG_PURPLE)
  1773. .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
  1774. .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
  1775. @@ -181,6 +192,9 @@
  1776. * 128 * 8 == 1024 == 0x400
  1777. * so this is address R_VEC+0x400 == 0xbfc00400
  1778. */
  1779. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_MORE_RESERVED_VECTORS)
  1780. + IFX_MORE_RESERVED_VECTORS
  1781. +#else
  1782. #ifdef CONFIG_PURPLE
  1783. /* 0xbfc00400 */
  1784. .word 0xdc870000
  1785. @@ -205,8 +219,12 @@
  1786. .word 0x00000000
  1787. .word 0x00000000
  1788. #endif /* CONFIG_PURPLE */
  1789. +#endif /* CONFIG_IFX_MIPS */
  1790. .align 4
  1791. reset:
  1792. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_RESET_PRECHECK)
  1793. + IFX_RESET_PRECHECK
  1794. +#endif
  1795. /* Clear watch registers.
  1796. */
  1797. @@ -226,6 +244,10 @@
  1798. /* CAUSE register */
  1799. mtc0 zero, CP0_CAUSE
  1800. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU_EXTRA_INIT)
  1801. + IFX_CPU_EXTRA_INIT
  1802. +#endif
  1803. +
  1804. /* Init Timer */
  1805. mtc0 zero, CP0_COUNT
  1806. mtc0 zero, CP0_COMPARE
  1807. @@ -252,12 +274,26 @@
  1808. nop
  1809. #endif
  1810. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_SKIP_LOWLEVEL_INIT)
  1811. + IFX_SKIP_LOWLEVEL_INIT
  1812. +#endif
  1813. +#ifdef CFG_BOOTSTRAP_CODE
  1814. /* Initialize any external memory.
  1815. */
  1816. la t9, lowlevel_init
  1817. jalr t9
  1818. nop
  1819. +#endif
  1820. +lowlevel_init_done:
  1821. +
  1822. + beq s0, zero, init_cache_0
  1823. + nop
  1824. +
  1825. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_CPU1_INIT)
  1826. + IFX_CPU1_INIT
  1827. +#endif
  1828. +init_cache_0:
  1829. /* Initialize caches...
  1830. */
  1831. la t9, mips_cache_reset
  1832. @@ -266,7 +302,11 @@
  1833. /* ... and enable them.
  1834. */
  1835. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_OPER_MODE)
  1836. + IFX_CACHE_OPER_MODE
  1837. +#else
  1838. li t0, CONF_CM_CACHABLE_NONCOHERENT
  1839. +#endif
  1840. mtc0 t0, CP0_CONFIG
  1841. @@ -280,13 +320,38 @@
  1842. li t0, CFG_SDRAM_BASE + CFG_INIT_SP_OFFSET
  1843. la sp, 0(t0)
  1844. +#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_BOOT_CLEAR)
  1845. + IFX_BOOT_CLEAR
  1846. +#endif
  1847. +
  1848. +#ifdef CFG_BOOTSTRAP_CODE
  1849. + la t9, bootstrap_board_init_f
  1850. +#else
  1851. la t9, board_init_f
  1852. +#endif
  1853. j t9
  1854. nop
  1855. +#ifdef CFG_BOOTSTRAP_CODE
  1856. +/*
  1857. + * void jump_unconditional (addr)
  1858. + * This function simply jumps to the location pointed by a0.
  1859. + * a0 = target_location
  1860. + *
  1861. + */
  1862. + .globl jump_unconditional
  1863. + .ent jump_unconditional
  1864. +jump_unconditional:
  1865. + move t9, a0
  1866. + j t9
  1867. + nop
  1868. + .end jump_unconditional
  1869. +
  1870. +#endif
  1871. /*
  1872. * void relocate_code (addr_sp, gd, addr_moni)
  1873. + * void bootstrap_relocate_code (addr_sp, gd, addr_moni)
  1874. *
  1875. * This "function" does not return, instead it continues in RAM
  1876. * after relocating the monitor code.
  1877. @@ -295,12 +360,22 @@
  1878. * a1 = gd
  1879. * a2 = destination address
  1880. */
  1881. +#ifdef CFG_BOOTSTRAP_CODE
  1882. + .globl bootstrap_relocate_code
  1883. + .ent bootstrap_relocate_code
  1884. +bootstrap_relocate_code:
  1885. +#else
  1886. .globl relocate_code
  1887. .ent relocate_code
  1888. relocate_code:
  1889. +#endif
  1890. move sp, a0 /* Set new stack pointer */
  1891. +#ifdef CFG_BOOTSTRAP_CODE
  1892. + li t0, BOOTSTRAP_CFG_MONITOR_BASE
  1893. +#else
  1894. li t0, CFG_MONITOR_BASE
  1895. +#endif
  1896. la t3, in_ram
  1897. lw t2, -12(t3) /* t2 <-- uboot_end_data */
  1898. move t1, a2
  1899. @@ -311,7 +386,11 @@
  1900. * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
  1901. */
  1902. move t6, gp
  1903. +#ifdef CFG_BOOTSTRAP_CODE
  1904. + sub gp, BOOTSTRAP_CFG_MONITOR_BASE
  1905. +#else
  1906. sub gp, CFG_MONITOR_BASE
  1907. +#endif
  1908. add gp, a2 /* gp now adjusted */
  1909. sub t6, gp, t6 /* t6 <-- relocation offset */
  1910. @@ -337,12 +416,21 @@
  1911. /* Jump to where we've relocated ourselves.
  1912. */
  1913. +#ifdef CFG_BOOTSTRAP_CODE
  1914. + addi t0, a2, in_ram - _start_bootstrap
  1915. +#else
  1916. addi t0, a2, in_ram - _start
  1917. +#endif
  1918. j t0
  1919. nop
  1920. +#ifdef CFG_BOOTSTRAP_CODE
  1921. + .word uboot_end_data_bootstrap
  1922. + .word uboot_end_bootstrap
  1923. +#else
  1924. .word uboot_end_data
  1925. .word uboot_end
  1926. +#endif
  1927. .word num_got_entries
  1928. in_ram:
  1929. @@ -374,12 +462,19 @@
  1930. sw zero, 0(t1) /* delay slot */
  1931. move a0, a1
  1932. +#ifdef CFG_BOOTSTRAP_CODE
  1933. + la t9, bootstrap_board_init_r
  1934. +#else
  1935. la t9, board_init_r
  1936. +#endif
  1937. j t9
  1938. move a1, a2 /* delay slot */
  1939. +#ifdef CFG_BOOTSTRAP_CODE
  1940. + .end bootstrap_relocate_code
  1941. +#else
  1942. .end relocate_code
  1943. -
  1944. +#endif
  1945. /* Exception handlers.
  1946. */
  1947. @@ -388,3 +483,20 @@
  1948. romExcHandle:
  1949. b romExcHandle
  1950. +
  1951. +romEjtagHandle:
  1952. +#ifdef CFG_BOOTSTRAP_CODE
  1953. + deret
  1954. + nop
  1955. +#endif /* CFG_BOOTSTRAP_CODE */
  1956. +1:
  1957. + b 1b
  1958. +
  1959. + /* Additional handlers.
  1960. + */
  1961. +#if defined(CONFIG_IFX_MIPS)
  1962. +#if defined(IFX_MIPS_HANDLER_1)
  1963. +ifx_mips_handler_1:
  1964. + IFX_MIPS_HANDLER_1
  1965. +#endif
  1966. +#endif
  1967. Index: u-boot-1.1.5/tools/Makefile
  1968. ===================================================================
  1969. --- u-boot-1.1.5.orig/tools/Makefile 2006-10-20 17:54:33.000000000 +0200
  1970. +++ u-boot-1.1.5/tools/Makefile 2009-10-04 23:06:03.000000000 +0200
  1971. @@ -21,7 +21,7 @@
  1972. # MA 02111-1307 USA
  1973. #
  1974. -BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
  1975. +BIN_FILES = mkimage$(SFX)
  1976. OBJ_LINKS = environment.o crc32.o
  1977. OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o