start.S 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151
  1. /*
  2. * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
  3. * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
  4. * Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de>
  5. * Copyright (C) 2007 Stefan Roese <sr@denx.de>, DENX Software Engineering
  6. * Copyright (c) 2008 Nuovation System Designs, LLC
  7. * Grant Erickson <gerickson@nuovations.com>
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. /*------------------------------------------------------------------------------+
  28. *
  29. * This source code has been made available to you by IBM on an AS-IS
  30. * basis. Anyone receiving this source is licensed under IBM
  31. * copyrights to use it in any way he or she deems fit, including
  32. * copying it, modifying it, compiling it, and redistributing it either
  33. * with or without modifications. No license under IBM patents or
  34. * patent applications is to be implied by the copyright license.
  35. *
  36. * Any user of this software should understand that IBM cannot provide
  37. * technical support for this software and will not be responsible for
  38. * any consequences resulting from the use of this software.
  39. *
  40. * Any person who transfers this source code or any derivative work
  41. * must include the IBM copyright notice, this paragraph, and the
  42. * preceding two paragraphs in the transferred software.
  43. *
  44. * COPYRIGHT I B M CORPORATION 1995
  45. * LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
  46. *-------------------------------------------------------------------------------
  47. */
  48. /* U-Boot - Startup Code for AMCC 4xx PowerPC based Embedded Boards
  49. *
  50. *
  51. * The processor starts at 0xfffffffc and the code is executed
  52. * from flash/rom.
  53. * in memory, but as long we don't jump around before relocating.
  54. * board_init lies at a quite high address and when the cpu has
  55. * jumped there, everything is ok.
  56. * This works because the cpu gives the FLASH (CS0) the whole
  57. * address space at startup, and board_init lies as a echo of
  58. * the flash somewhere up there in the memorymap.
  59. *
  60. * board_init will change CS0 to be positioned at the correct
  61. * address and (s)dram will be positioned at address 0
  62. */
  63. #include <config.h>
  64. #include <ppc4xx.h>
  65. #include <version.h>
  66. #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
  67. #include <ppc_asm.tmpl>
  68. #include <ppc_defs.h>
  69. #include <asm/cache.h>
  70. #include <asm/mmu.h>
  71. #include <asm/ppc4xx-isram.h>
  72. #ifndef CONFIG_IDENT_STRING
  73. #define CONFIG_IDENT_STRING ""
  74. #endif
  75. #ifdef CONFIG_SYS_INIT_DCACHE_CS
  76. # if (CONFIG_SYS_INIT_DCACHE_CS == 0)
  77. # define PBxAP pb0ap
  78. # define PBxCR pb0cr
  79. # if (defined(CONFIG_SYS_EBC_PB0AP) && defined(CONFIG_SYS_EBC_PB0CR))
  80. # define PBxAP_VAL CONFIG_SYS_EBC_PB0AP
  81. # define PBxCR_VAL CONFIG_SYS_EBC_PB0CR
  82. # endif
  83. # endif
  84. # if (CONFIG_SYS_INIT_DCACHE_CS == 1)
  85. # define PBxAP pb1ap
  86. # define PBxCR pb1cr
  87. # if (defined(CONFIG_SYS_EBC_PB1AP) && defined(CONFIG_SYS_EBC_PB1CR))
  88. # define PBxAP_VAL CONFIG_SYS_EBC_PB1AP
  89. # define PBxCR_VAL CONFIG_SYS_EBC_PB1CR
  90. # endif
  91. # endif
  92. # if (CONFIG_SYS_INIT_DCACHE_CS == 2)
  93. # define PBxAP pb2ap
  94. # define PBxCR pb2cr
  95. # if (defined(CONFIG_SYS_EBC_PB2AP) && defined(CONFIG_SYS_EBC_PB2CR))
  96. # define PBxAP_VAL CONFIG_SYS_EBC_PB2AP
  97. # define PBxCR_VAL CONFIG_SYS_EBC_PB2CR
  98. # endif
  99. # endif
  100. # if (CONFIG_SYS_INIT_DCACHE_CS == 3)
  101. # define PBxAP pb3ap
  102. # define PBxCR pb3cr
  103. # if (defined(CONFIG_SYS_EBC_PB3AP) && defined(CONFIG_SYS_EBC_PB3CR))
  104. # define PBxAP_VAL CONFIG_SYS_EBC_PB3AP
  105. # define PBxCR_VAL CONFIG_SYS_EBC_PB3CR
  106. # endif
  107. # endif
  108. # if (CONFIG_SYS_INIT_DCACHE_CS == 4)
  109. # define PBxAP pb4ap
  110. # define PBxCR pb4cr
  111. # if (defined(CONFIG_SYS_EBC_PB4AP) && defined(CONFIG_SYS_EBC_PB4CR))
  112. # define PBxAP_VAL CONFIG_SYS_EBC_PB4AP
  113. # define PBxCR_VAL CONFIG_SYS_EBC_PB4CR
  114. # endif
  115. # endif
  116. # if (CONFIG_SYS_INIT_DCACHE_CS == 5)
  117. # define PBxAP pb5ap
  118. # define PBxCR pb5cr
  119. # if (defined(CONFIG_SYS_EBC_PB5AP) && defined(CONFIG_SYS_EBC_PB5CR))
  120. # define PBxAP_VAL CONFIG_SYS_EBC_PB5AP
  121. # define PBxCR_VAL CONFIG_SYS_EBC_PB5CR
  122. # endif
  123. # endif
  124. # if (CONFIG_SYS_INIT_DCACHE_CS == 6)
  125. # define PBxAP pb6ap
  126. # define PBxCR pb6cr
  127. # if (defined(CONFIG_SYS_EBC_PB6AP) && defined(CONFIG_SYS_EBC_PB6CR))
  128. # define PBxAP_VAL CONFIG_SYS_EBC_PB6AP
  129. # define PBxCR_VAL CONFIG_SYS_EBC_PB6CR
  130. # endif
  131. # endif
  132. # if (CONFIG_SYS_INIT_DCACHE_CS == 7)
  133. # define PBxAP pb7ap
  134. # define PBxCR pb7cr
  135. # if (defined(CONFIG_SYS_EBC_PB7AP) && defined(CONFIG_SYS_EBC_PB7CR))
  136. # define PBxAP_VAL CONFIG_SYS_EBC_PB7AP
  137. # define PBxCR_VAL CONFIG_SYS_EBC_PB7CR
  138. # endif
  139. # endif
  140. # ifndef PBxAP_VAL
  141. # define PBxAP_VAL 0
  142. # endif
  143. # ifndef PBxCR_VAL
  144. # define PBxCR_VAL 0
  145. # endif
  146. /*
  147. * Memory Bank x (nothingness) initialization CONFIG_SYS_INIT_RAM_ADDR + 64 MiB
  148. * used as temporary stack pointer for the primordial stack
  149. */
  150. # ifndef CONFIG_SYS_INIT_DCACHE_PBxAR
  151. # define CONFIG_SYS_INIT_DCACHE_PBxAR (EBC_BXAP_BME_DISABLED | \
  152. EBC_BXAP_TWT_ENCODE(7) | \
  153. EBC_BXAP_BCE_DISABLE | \
  154. EBC_BXAP_BCT_2TRANS | \
  155. EBC_BXAP_CSN_ENCODE(0) | \
  156. EBC_BXAP_OEN_ENCODE(0) | \
  157. EBC_BXAP_WBN_ENCODE(0) | \
  158. EBC_BXAP_WBF_ENCODE(0) | \
  159. EBC_BXAP_TH_ENCODE(2) | \
  160. EBC_BXAP_RE_DISABLED | \
  161. EBC_BXAP_SOR_NONDELAYED | \
  162. EBC_BXAP_BEM_WRITEONLY | \
  163. EBC_BXAP_PEN_DISABLED)
  164. # endif /* CONFIG_SYS_INIT_DCACHE_PBxAR */
  165. # ifndef CONFIG_SYS_INIT_DCACHE_PBxCR
  166. # define CONFIG_SYS_INIT_DCACHE_PBxCR (EBC_BXCR_BAS_ENCODE(CONFIG_SYS_INIT_RAM_ADDR) | \
  167. EBC_BXCR_BS_64MB | \
  168. EBC_BXCR_BU_RW | \
  169. EBC_BXCR_BW_16BIT)
  170. # endif /* CONFIG_SYS_INIT_DCACHE_PBxCR */
  171. # ifndef CONFIG_SYS_INIT_RAM_PATTERN
  172. # define CONFIG_SYS_INIT_RAM_PATTERN 0xDEADDEAD
  173. # endif
  174. #endif /* CONFIG_SYS_INIT_DCACHE_CS */
  175. #if (defined(CONFIG_SYS_INIT_RAM_DCACHE) && (CONFIG_SYS_INIT_RAM_END > (4 << 10)))
  176. #error Only 4k of init-ram is supported - please adjust CONFIG_SYS_INIT_RAM_END!
  177. #endif
  178. /*
  179. * Unless otherwise overriden, enable two 128MB cachable instruction regions
  180. * at CONFIG_SYS_SDRAM_BASE and another 128MB cacheable instruction region covering
  181. * NOR flash at CONFIG_SYS_FLASH_BASE. Disable all cacheable data regions.
  182. */
  183. #if !defined(CONFIG_SYS_FLASH_BASE)
  184. /* If not already defined, set it to the "last" 128MByte region */
  185. # define CONFIG_SYS_FLASH_BASE 0xf8000000
  186. #endif
  187. #if !defined(CONFIG_SYS_ICACHE_SACR_VALUE)
  188. # define CONFIG_SYS_ICACHE_SACR_VALUE \
  189. (PPC_128MB_SACR_VALUE(CONFIG_SYS_SDRAM_BASE + ( 0 << 20)) | \
  190. PPC_128MB_SACR_VALUE(CONFIG_SYS_SDRAM_BASE + (128 << 20)) | \
  191. PPC_128MB_SACR_VALUE(CONFIG_SYS_FLASH_BASE))
  192. #endif /* !defined(CONFIG_SYS_ICACHE_SACR_VALUE) */
  193. #if !defined(CONFIG_SYS_DCACHE_SACR_VALUE)
  194. # define CONFIG_SYS_DCACHE_SACR_VALUE \
  195. (0x00000000)
  196. #endif /* !defined(CONFIG_SYS_DCACHE_SACR_VALUE) */
  197. #define function_prolog(func_name) .text; \
  198. .align 2; \
  199. .globl func_name; \
  200. func_name:
  201. #define function_epilog(func_name) .type func_name,@function; \
  202. .size func_name,.-func_name
  203. /* We don't want the MMU yet.
  204. */
  205. #undef MSR_KERNEL
  206. #define MSR_KERNEL ( MSR_ME ) /* Machine Check */
  207. .extern ext_bus_cntlr_init
  208. #ifdef CONFIG_NAND_U_BOOT
  209. .extern reconfig_tlb0
  210. #endif
  211. /*
  212. * Set up GOT: Global Offset Table
  213. *
  214. * Use r14 to access the GOT
  215. */
  216. #if !defined(CONFIG_NAND_SPL)
  217. START_GOT
  218. GOT_ENTRY(_GOT2_TABLE_)
  219. GOT_ENTRY(_FIXUP_TABLE_)
  220. GOT_ENTRY(_start)
  221. GOT_ENTRY(_start_of_vectors)
  222. GOT_ENTRY(_end_of_vectors)
  223. GOT_ENTRY(transfer_to_handler)
  224. GOT_ENTRY(__init_end)
  225. GOT_ENTRY(_end)
  226. GOT_ENTRY(__bss_start)
  227. END_GOT
  228. #endif /* CONFIG_NAND_SPL */
  229. #if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
  230. /*
  231. * NAND U-Boot image is started from offset 0
  232. */
  233. .text
  234. #if defined(CONFIG_440)
  235. bl reconfig_tlb0
  236. #endif
  237. GET_GOT
  238. bl cpu_init_f /* run low-level CPU init code (from Flash) */
  239. bl board_init_f
  240. #endif
  241. /*
  242. * 440 Startup -- on reset only the top 4k of the effective
  243. * address space is mapped in by an entry in the instruction
  244. * and data shadow TLB. The .bootpg section is located in the
  245. * top 4k & does only what's necessary to map in the the rest
  246. * of the boot rom. Once the boot rom is mapped in we can
  247. * proceed with normal startup.
  248. *
  249. * NOTE: CS0 only covers the top 2MB of the effective address
  250. * space after reset.
  251. */
  252. #if defined(CONFIG_440)
  253. #if !defined(CONFIG_NAND_SPL)
  254. .section .bootpg,"ax"
  255. #endif
  256. .globl _start_440
  257. /**************************************************************************/
  258. _start_440:
  259. /*--------------------------------------------------------------------+
  260. | 440EPX BUP Change - Hardware team request
  261. +--------------------------------------------------------------------*/
  262. #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
  263. sync
  264. nop
  265. nop
  266. #endif
  267. /*----------------------------------------------------------------+
  268. | Core bug fix. Clear the esr
  269. +-----------------------------------------------------------------*/
  270. li r0,0
  271. mtspr esr,r0
  272. /*----------------------------------------------------------------*/
  273. /* Clear and set up some registers. */
  274. /*----------------------------------------------------------------*/
  275. iccci r0,r0 /* NOTE: operands not used for 440 */
  276. dccci r0,r0 /* NOTE: operands not used for 440 */
  277. sync
  278. li r0,0
  279. mtspr srr0,r0
  280. mtspr srr1,r0
  281. mtspr csrr0,r0
  282. mtspr csrr1,r0
  283. /* NOTE: 440GX adds machine check status regs */
  284. #if defined(CONFIG_440) && !defined(CONFIG_440GP)
  285. mtspr mcsrr0,r0
  286. mtspr mcsrr1,r0
  287. mfspr r1,mcsr
  288. mtspr mcsr,r1
  289. #endif
  290. /*----------------------------------------------------------------*/
  291. /* CCR0 init */
  292. /*----------------------------------------------------------------*/
  293. /* Disable store gathering & broadcast, guarantee inst/data
  294. * cache block touch, force load/store alignment
  295. * (see errata 1.12: 440_33)
  296. */
  297. lis r1,0x0030 /* store gathering & broadcast disable */
  298. ori r1,r1,0x6000 /* cache touch */
  299. mtspr ccr0,r1
  300. /*----------------------------------------------------------------*/
  301. /* Initialize debug */
  302. /*----------------------------------------------------------------*/
  303. mfspr r1,dbcr0
  304. andis. r1, r1, 0x8000 /* test DBCR0[EDM] bit */
  305. bne skip_debug_init /* if set, don't clear debug register */
  306. mtspr dbcr0,r0
  307. mtspr dbcr1,r0
  308. mtspr dbcr2,r0
  309. mtspr iac1,r0
  310. mtspr iac2,r0
  311. mtspr iac3,r0
  312. mtspr dac1,r0
  313. mtspr dac2,r0
  314. mtspr dvc1,r0
  315. mtspr dvc2,r0
  316. mfspr r1,dbsr
  317. mtspr dbsr,r1 /* Clear all valid bits */
  318. skip_debug_init:
  319. #if defined (CONFIG_440SPE)
  320. /*----------------------------------------------------------------+
  321. | Initialize Core Configuration Reg1.
  322. | a. ICDPEI: Record even parity. Normal operation.
  323. | b. ICTPEI: Record even parity. Normal operation.
  324. | c. DCTPEI: Record even parity. Normal operation.
  325. | d. DCDPEI: Record even parity. Normal operation.
  326. | e. DCUPEI: Record even parity. Normal operation.
  327. | f. DCMPEI: Record even parity. Normal operation.
  328. | g. FCOM: Normal operation
  329. | h. MMUPEI: Record even parity. Normal operation.
  330. | i. FFF: Flush only as much data as necessary.
  331. | j. TCS: Timebase increments from CPU clock.
  332. +-----------------------------------------------------------------*/
  333. li r0,0
  334. mtspr ccr1, r0
  335. /*----------------------------------------------------------------+
  336. | Reset the timebase.
  337. | The previous write to CCR1 sets the timebase source.
  338. +-----------------------------------------------------------------*/
  339. mtspr tbl, r0
  340. mtspr tbu, r0
  341. #endif
  342. /*----------------------------------------------------------------*/
  343. /* Setup interrupt vectors */
  344. /*----------------------------------------------------------------*/
  345. mtspr ivpr,r0 /* Vectors start at 0x0000_0000 */
  346. li r1,0x0100
  347. mtspr ivor0,r1 /* Critical input */
  348. li r1,0x0200
  349. mtspr ivor1,r1 /* Machine check */
  350. li r1,0x0300
  351. mtspr ivor2,r1 /* Data storage */
  352. li r1,0x0400
  353. mtspr ivor3,r1 /* Instruction storage */
  354. li r1,0x0500
  355. mtspr ivor4,r1 /* External interrupt */
  356. li r1,0x0600
  357. mtspr ivor5,r1 /* Alignment */
  358. li r1,0x0700
  359. mtspr ivor6,r1 /* Program check */
  360. li r1,0x0800
  361. mtspr ivor7,r1 /* Floating point unavailable */
  362. li r1,0x0c00
  363. mtspr ivor8,r1 /* System call */
  364. li r1,0x0a00
  365. mtspr ivor9,r1 /* Auxiliary Processor unavailable */
  366. li r1,0x0900
  367. mtspr ivor10,r1 /* Decrementer */
  368. li r1,0x1300
  369. mtspr ivor13,r1 /* Data TLB error */
  370. li r1,0x1400
  371. mtspr ivor14,r1 /* Instr TLB error */
  372. li r1,0x2000
  373. mtspr ivor15,r1 /* Debug */
  374. /*----------------------------------------------------------------*/
  375. /* Configure cache regions */
  376. /*----------------------------------------------------------------*/
  377. mtspr inv0,r0
  378. mtspr inv1,r0
  379. mtspr inv2,r0
  380. mtspr inv3,r0
  381. mtspr dnv0,r0
  382. mtspr dnv1,r0
  383. mtspr dnv2,r0
  384. mtspr dnv3,r0
  385. mtspr itv0,r0
  386. mtspr itv1,r0
  387. mtspr itv2,r0
  388. mtspr itv3,r0
  389. mtspr dtv0,r0
  390. mtspr dtv1,r0
  391. mtspr dtv2,r0
  392. mtspr dtv3,r0
  393. /*----------------------------------------------------------------*/
  394. /* Cache victim limits */
  395. /*----------------------------------------------------------------*/
  396. /* floors 0, ceiling max to use the entire cache -- nothing locked
  397. */
  398. lis r1,0x0001
  399. ori r1,r1,0xf800
  400. mtspr ivlim,r1
  401. mtspr dvlim,r1
  402. /*----------------------------------------------------------------+
  403. |Initialize MMUCR[STID] = 0.
  404. +-----------------------------------------------------------------*/
  405. mfspr r0,mmucr
  406. addis r1,0,0xFFFF
  407. ori r1,r1,0xFF00
  408. and r0,r0,r1
  409. mtspr mmucr,r0
  410. /*----------------------------------------------------------------*/
  411. /* Clear all TLB entries -- TID = 0, TS = 0 */
  412. /*----------------------------------------------------------------*/
  413. addis r0,0,0x0000
  414. li r1,0x003f /* 64 TLB entries */
  415. mtctr r1
  416. rsttlb: tlbwe r0,r1,0x0000 /* Invalidate all entries (V=0)*/
  417. tlbwe r0,r1,0x0001
  418. tlbwe r0,r1,0x0002
  419. subi r1,r1,0x0001
  420. bdnz rsttlb
  421. /*----------------------------------------------------------------*/
  422. /* TLB entry setup -- step thru tlbtab */
  423. /*----------------------------------------------------------------*/
  424. #if defined(CONFIG_440SPE)
  425. /*----------------------------------------------------------------*/
  426. /* We have different TLB tables for revA and rev B of 440SPe */
  427. /*----------------------------------------------------------------*/
  428. mfspr r1, PVR
  429. lis r0,0x5342
  430. ori r0,r0,0x1891
  431. cmpw r7,r1,r0
  432. bne r7,..revA
  433. bl tlbtabB
  434. b ..goon
  435. ..revA:
  436. bl tlbtabA
  437. ..goon:
  438. #else
  439. bl tlbtab /* Get tlbtab pointer */
  440. #endif
  441. mr r5,r0
  442. li r1,0x003f /* 64 TLB entries max */
  443. mtctr r1
  444. li r4,0 /* TLB # */
  445. addi r5,r5,-4
  446. 1: lwzu r0,4(r5)
  447. cmpwi r0,0
  448. beq 2f /* 0 marks end */
  449. lwzu r1,4(r5)
  450. lwzu r2,4(r5)
  451. tlbwe r0,r4,0 /* TLB Word 0 */
  452. tlbwe r1,r4,1 /* TLB Word 1 */
  453. tlbwe r2,r4,2 /* TLB Word 2 */
  454. addi r4,r4,1 /* Next TLB */
  455. bdnz 1b
  456. /*----------------------------------------------------------------*/
  457. /* Continue from 'normal' start */
  458. /*----------------------------------------------------------------*/
  459. 2:
  460. bl 3f
  461. b _start
  462. 3: li r0,0
  463. mtspr srr1,r0 /* Keep things disabled for now */
  464. mflr r1
  465. mtspr srr0,r1
  466. rfi
  467. #endif /* CONFIG_440 */
  468. /*
  469. * r3 - 1st arg to board_init(): IMMP pointer
  470. * r4 - 2nd arg to board_init(): boot flag
  471. */
  472. #ifndef CONFIG_NAND_SPL
  473. .text
  474. .long 0x27051956 /* U-Boot Magic Number */
  475. .globl version_string
  476. version_string:
  477. .ascii U_BOOT_VERSION
  478. .ascii " (", __DATE__, " - ", __TIME__, ")"
  479. .ascii CONFIG_IDENT_STRING, "\0"
  480. . = EXC_OFF_SYS_RESET
  481. .globl _start_of_vectors
  482. _start_of_vectors:
  483. /* Critical input. */
  484. CRIT_EXCEPTION(0x100, CritcalInput, UnknownException)
  485. #ifdef CONFIG_440
  486. /* Machine check */
  487. MCK_EXCEPTION(0x200, MachineCheck, MachineCheckException)
  488. #else
  489. CRIT_EXCEPTION(0x200, MachineCheck, MachineCheckException)
  490. #endif /* CONFIG_440 */
  491. /* Data Storage exception. */
  492. STD_EXCEPTION(0x300, DataStorage, UnknownException)
  493. /* Instruction Storage exception. */
  494. STD_EXCEPTION(0x400, InstStorage, UnknownException)
  495. /* External Interrupt exception. */
  496. STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
  497. /* Alignment exception. */
  498. . = 0x600
  499. Alignment:
  500. EXCEPTION_PROLOG(SRR0, SRR1)
  501. mfspr r4,DAR
  502. stw r4,_DAR(r21)
  503. mfspr r5,DSISR
  504. stw r5,_DSISR(r21)
  505. addi r3,r1,STACK_FRAME_OVERHEAD
  506. li r20,MSR_KERNEL
  507. rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
  508. lwz r6,GOT(transfer_to_handler)
  509. mtlr r6
  510. blrl
  511. .L_Alignment:
  512. .long AlignmentException - _start + _START_OFFSET
  513. .long int_return - _start + _START_OFFSET
  514. /* Program check exception */
  515. . = 0x700
  516. ProgramCheck:
  517. EXCEPTION_PROLOG(SRR0, SRR1)
  518. addi r3,r1,STACK_FRAME_OVERHEAD
  519. li r20,MSR_KERNEL
  520. rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
  521. lwz r6,GOT(transfer_to_handler)
  522. mtlr r6
  523. blrl
  524. .L_ProgramCheck:
  525. .long ProgramCheckException - _start + _START_OFFSET
  526. .long int_return - _start + _START_OFFSET
  527. #ifdef CONFIG_440
  528. STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
  529. STD_EXCEPTION(0x900, Decrementer, DecrementerPITException)
  530. STD_EXCEPTION(0xa00, APU, UnknownException)
  531. #endif
  532. STD_EXCEPTION(0xc00, SystemCall, UnknownException)
  533. #ifdef CONFIG_440
  534. STD_EXCEPTION(0x1300, DataTLBError, UnknownException)
  535. STD_EXCEPTION(0x1400, InstructionTLBError, UnknownException)
  536. #else
  537. STD_EXCEPTION(0x1000, PIT, DecrementerPITException)
  538. STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
  539. STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
  540. #endif
  541. CRIT_EXCEPTION(0x2000, DebugBreakpoint, DebugException )
  542. .globl _end_of_vectors
  543. _end_of_vectors:
  544. . = _START_OFFSET
  545. #endif
  546. .globl _start
  547. _start:
  548. /*****************************************************************************/
  549. #if defined(CONFIG_440)
  550. /*----------------------------------------------------------------*/
  551. /* Clear and set up some registers. */
  552. /*----------------------------------------------------------------*/
  553. li r0,0x0000
  554. lis r1,0xffff
  555. mtspr dec,r0 /* prevent dec exceptions */
  556. mtspr tbl,r0 /* prevent fit & wdt exceptions */
  557. mtspr tbu,r0
  558. mtspr tsr,r1 /* clear all timer exception status */
  559. mtspr tcr,r0 /* disable all */
  560. mtspr esr,r0 /* clear exception syndrome register */
  561. mtxer r0 /* clear integer exception register */
  562. /*----------------------------------------------------------------*/
  563. /* Debug setup -- some (not very good) ice's need an event*/
  564. /* to establish control :-( Define CONFIG_SYS_INIT_DBCR to the dbsr */
  565. /* value you need in this case 0x8cff 0000 should do the trick */
  566. /*----------------------------------------------------------------*/
  567. #if defined(CONFIG_SYS_INIT_DBCR)
  568. lis r1,0xffff
  569. ori r1,r1,0xffff
  570. mtspr dbsr,r1 /* Clear all status bits */
  571. lis r0,CONFIG_SYS_INIT_DBCR@h
  572. ori r0,r0,CONFIG_SYS_INIT_DBCR@l
  573. mtspr dbcr0,r0
  574. isync
  575. #endif
  576. /*----------------------------------------------------------------*/
  577. /* Setup the internal SRAM */
  578. /*----------------------------------------------------------------*/
  579. li r0,0
  580. #ifdef CONFIG_SYS_INIT_RAM_DCACHE
  581. /* Clear Dcache to use as RAM */
  582. addis r3,r0,CONFIG_SYS_INIT_RAM_ADDR@h
  583. ori r3,r3,CONFIG_SYS_INIT_RAM_ADDR@l
  584. addis r4,r0,CONFIG_SYS_INIT_RAM_END@h
  585. ori r4,r4,CONFIG_SYS_INIT_RAM_END@l
  586. rlwinm. r5,r4,0,27,31
  587. rlwinm r5,r4,27,5,31
  588. beq ..d_ran
  589. addi r5,r5,0x0001
  590. ..d_ran:
  591. mtctr r5
  592. ..d_ag:
  593. dcbz r0,r3
  594. addi r3,r3,32
  595. bdnz ..d_ag
  596. /*
  597. * Lock the init-ram/stack in d-cache, so that other regions
  598. * may use d-cache as well
  599. * Note, that this current implementation locks exactly 4k
  600. * of d-cache, so please make sure that you don't define a
  601. * bigger init-ram area. Take a look at the lwmon5 440EPx
  602. * implementation as a reference.
  603. */
  604. msync
  605. isync
  606. /* 8. set TFLOOR/NFLOOR to 8 (-> 8*16*32 bytes locked -> 4k) */
  607. lis r1,0x0201
  608. ori r1,r1,0xf808
  609. mtspr dvlim,r1
  610. lis r1,0x0808
  611. ori r1,r1,0x0808
  612. mtspr dnv0,r1
  613. mtspr dnv1,r1
  614. mtspr dnv2,r1
  615. mtspr dnv3,r1
  616. mtspr dtv0,r1
  617. mtspr dtv1,r1
  618. mtspr dtv2,r1
  619. mtspr dtv3,r1
  620. msync
  621. isync
  622. #endif /* CONFIG_SYS_INIT_RAM_DCACHE */
  623. /* 440EP & 440GR are only 440er PPC's without internal SRAM */
  624. #if !defined(CONFIG_440EP) && !defined(CONFIG_440GR)
  625. /* not all PPC's have internal SRAM usable as L2-cache */
  626. #if defined(CONFIG_440GX) || \
  627. defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
  628. defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
  629. defined(CONFIG_460SX)
  630. mtdcr L2_CACHE_CFG,r0 /* Ensure L2 Cache is off */
  631. #endif
  632. lis r2,0x7fff
  633. ori r2,r2,0xffff
  634. mfdcr r1,ISRAM0_DPC
  635. and r1,r1,r2 /* Disable parity check */
  636. mtdcr ISRAM0_DPC,r1
  637. mfdcr r1,ISRAM0_PMEG
  638. and r1,r1,r2 /* Disable pwr mgmt */
  639. mtdcr ISRAM0_PMEG,r1
  640. lis r1,0x8000 /* BAS = 8000_0000 */
  641. #if defined(CONFIG_440GX) || defined(CONFIG_440SP)
  642. ori r1,r1,0x0980 /* first 64k */
  643. mtdcr ISRAM0_SB0CR,r1
  644. lis r1,0x8001
  645. ori r1,r1,0x0980 /* second 64k */
  646. mtdcr ISRAM0_SB1CR,r1
  647. lis r1, 0x8002
  648. ori r1,r1, 0x0980 /* third 64k */
  649. mtdcr ISRAM0_SB2CR,r1
  650. lis r1, 0x8003
  651. ori r1,r1, 0x0980 /* fourth 64k */
  652. mtdcr ISRAM0_SB3CR,r1
  653. #elif defined(CONFIG_440SPE)
  654. lis r1,0x0000 /* BAS = 0000_0000 */
  655. ori r1,r1,0x0984 /* first 64k */
  656. mtdcr ISRAM0_SB0CR,r1
  657. lis r1,0x0001
  658. ori r1,r1,0x0984 /* second 64k */
  659. mtdcr ISRAM0_SB1CR,r1
  660. lis r1, 0x0002
  661. ori r1,r1, 0x0984 /* third 64k */
  662. mtdcr ISRAM0_SB2CR,r1
  663. lis r1, 0x0003
  664. ori r1,r1, 0x0984 /* fourth 64k */
  665. mtdcr ISRAM0_SB3CR,r1
  666. #elif defined(CONFIG_460EX) || defined(CONFIG_460GT)
  667. lis r1,0x4000 /* BAS = 8000_0000 */
  668. ori r1,r1,0x4580 /* 16k */
  669. mtdcr ISRAM0_SB0CR,r1
  670. #elif defined(CONFIG_460SX)
  671. lis r1,0x0000 /* BAS = 0000_0000 */
  672. ori r1,r1,0x0B84 /* first 128k */
  673. mtdcr ISRAM0_SB0CR,r1
  674. lis r1,0x0001
  675. ori r1,r1,0x0B84 /* second 128k */
  676. mtdcr ISRAM0_SB1CR,r1
  677. lis r1, 0x0002
  678. ori r1,r1, 0x0B84 /* third 128k */
  679. mtdcr ISRAM0_SB2CR,r1
  680. lis r1, 0x0003
  681. ori r1,r1, 0x0B84 /* fourth 128k */
  682. mtdcr ISRAM0_SB3CR,r1
  683. #elif defined(CONFIG_440GP)
  684. ori r1,r1,0x0380 /* 8k rw */
  685. mtdcr ISRAM0_SB0CR,r1
  686. mtdcr ISRAM0_SB1CR,r0 /* Disable bank 1 */
  687. #endif
  688. #endif /* #if !defined(CONFIG_440EP) && !defined(CONFIG_440GR) */
  689. /*----------------------------------------------------------------*/
  690. /* Setup the stack in internal SRAM */
  691. /*----------------------------------------------------------------*/
  692. lis r1,CONFIG_SYS_INIT_RAM_ADDR@h
  693. ori r1,r1,CONFIG_SYS_INIT_SP_OFFSET@l
  694. li r0,0
  695. stwu r0,-4(r1)
  696. stwu r0,-4(r1) /* Terminate call chain */
  697. stwu r1,-8(r1) /* Save back chain and move SP */
  698. lis r0,RESET_VECTOR@h /* Address of reset vector */
  699. ori r0,r0, RESET_VECTOR@l
  700. stwu r1,-8(r1) /* Save back chain and move SP */
  701. stw r0,+12(r1) /* Save return addr (underflow vect) */
  702. #ifdef CONFIG_NAND_SPL
  703. bl nand_boot_common /* will not return */
  704. #else
  705. GET_GOT
  706. bl cpu_init_f /* run low-level CPU init code (from Flash) */
  707. bl board_init_f
  708. #endif
  709. #endif /* CONFIG_440 */
  710. /*****************************************************************************/
  711. #ifdef CONFIG_IOP480
  712. /*----------------------------------------------------------------------- */
  713. /* Set up some machine state registers. */
  714. /*----------------------------------------------------------------------- */
  715. addi r0,r0,0x0000 /* initialize r0 to zero */
  716. mtspr esr,r0 /* clear Exception Syndrome Reg */
  717. mttcr r0 /* timer control register */
  718. mtexier r0 /* disable all interrupts */
  719. addis r4,r0,0xFFFF /* set r4 to 0xFFFFFFFF (status in the */
  720. ori r4,r4,0xFFFF /* dbsr is cleared by setting bits to 1) */
  721. mtdbsr r4 /* clear/reset the dbsr */
  722. mtexisr r4 /* clear all pending interrupts */
  723. addis r4,r0,0x8000
  724. mtexier r4 /* enable critical exceptions */
  725. addis r4,r0,0x0000 /* assume 403GCX - enable core clk */
  726. ori r4,r4,0x4020 /* dbling (no harm done on GA and GC */
  727. mtiocr r4 /* since bit not used) & DRC to latch */
  728. /* data bus on rising edge of CAS */
  729. /*----------------------------------------------------------------------- */
  730. /* Clear XER. */
  731. /*----------------------------------------------------------------------- */
  732. mtxer r0
  733. /*----------------------------------------------------------------------- */
  734. /* Invalidate i-cache and d-cache TAG arrays. */
  735. /*----------------------------------------------------------------------- */
  736. addi r3,0,1024 /* 1/4 of I-cache size, half of D-cache */
  737. addi r4,0,1024 /* 1/4 of I-cache */
  738. ..cloop:
  739. iccci 0,r3
  740. iccci r4,r3
  741. dccci 0,r3
  742. addic. r3,r3,-16 /* move back one cache line */
  743. bne ..cloop /* loop back to do rest until r3 = 0 */
  744. /* */
  745. /* initialize IOP480 so it can read 1 MB code area for SRAM spaces */
  746. /* this requires enabling MA[17..0], by default only MA[12..0] are enabled. */
  747. /* */
  748. /* first copy IOP480 register base address into r3 */
  749. addis r3,0,0x5000 /* IOP480 register base address hi */
  750. /* ori r3,r3,0x0000 / IOP480 register base address lo */
  751. #ifdef CONFIG_ADCIOP
  752. /* use r4 as the working variable */
  753. /* turn on CS3 (LOCCTL.7) */
  754. lwz r4,0x84(r3) /* LOCTL is at offset 0x84 */
  755. andi. r4,r4,0xff7f /* make bit 7 = 0 -- CS3 mode */
  756. stw r4,0x84(r3) /* LOCTL is at offset 0x84 */
  757. #endif
  758. #ifdef CONFIG_DASA_SIM
  759. /* use r4 as the working variable */
  760. /* turn on MA17 (LOCCTL.7) */
  761. lwz r4,0x84(r3) /* LOCTL is at offset 0x84 */
  762. ori r4,r4,0x80 /* make bit 7 = 1 -- MA17 mode */
  763. stw r4,0x84(r3) /* LOCTL is at offset 0x84 */
  764. #endif
  765. /* turn on MA16..13 (LCS0BRD.12 = 0) */
  766. lwz r4,0x100(r3) /* LCS0BRD is at offset 0x100 */
  767. andi. r4,r4,0xefff /* make bit 12 = 0 */
  768. stw r4,0x100(r3) /* LCS0BRD is at offset 0x100 */
  769. /* make sure above stores all comlete before going on */
  770. sync
  771. /* last thing, set local init status done bit (DEVINIT.31) */
  772. lwz r4,0x80(r3) /* DEVINIT is at offset 0x80 */
  773. oris r4,r4,0x8000 /* make bit 31 = 1 */
  774. stw r4,0x80(r3) /* DEVINIT is at offset 0x80 */
  775. /* clear all pending interrupts and disable all interrupts */
  776. li r4,-1 /* set p1 to 0xffffffff */
  777. stw r4,0x1b0(r3) /* clear all pending interrupts */
  778. stw r4,0x1b8(r3) /* clear all pending interrupts */
  779. li r4,0 /* set r4 to 0 */
  780. stw r4,0x1b4(r3) /* disable all interrupts */
  781. stw r4,0x1bc(r3) /* disable all interrupts */
  782. /* make sure above stores all comlete before going on */
  783. sync
  784. /* Set-up icache cacheability. */
  785. lis r1, CONFIG_SYS_ICACHE_SACR_VALUE@h
  786. ori r1, r1, CONFIG_SYS_ICACHE_SACR_VALUE@l
  787. mticcr r1
  788. isync
  789. /* Set-up dcache cacheability. */
  790. lis r1, CONFIG_SYS_DCACHE_SACR_VALUE@h
  791. ori r1, r1, CONFIG_SYS_DCACHE_SACR_VALUE@l
  792. mtdccr r1
  793. addis r1,r0,CONFIG_SYS_INIT_RAM_ADDR@h
  794. ori r1,r1,CONFIG_SYS_INIT_SP_OFFSET /* set up the stack to SDRAM */
  795. li r0, 0 /* Make room for stack frame header and */
  796. stwu r0, -4(r1) /* clear final stack frame so that */
  797. stwu r0, -4(r1) /* stack backtraces terminate cleanly */
  798. GET_GOT /* initialize GOT access */
  799. bl board_init_f /* run first part of init code (from Flash) */
  800. #endif /* CONFIG_IOP480 */
  801. /*****************************************************************************/
  802. #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
  803. defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
  804. defined(CONFIG_405EX) || defined(CONFIG_405)
  805. /*----------------------------------------------------------------------- */
  806. /* Clear and set up some registers. */
  807. /*----------------------------------------------------------------------- */
  808. addi r4,r0,0x0000
  809. #if !defined(CONFIG_405EX)
  810. mtspr sgr,r4
  811. #else
  812. /*
  813. * On 405EX, completely clearing the SGR leads to PPC hangup
  814. * upon PCIe configuration access. The PCIe memory regions
  815. * need to be guarded!
  816. */
  817. lis r3,0x0000
  818. ori r3,r3,0x7FFC
  819. mtspr sgr,r3
  820. #endif
  821. mtspr dcwr,r4
  822. mtesr r4 /* clear Exception Syndrome Reg */
  823. mttcr r4 /* clear Timer Control Reg */
  824. mtxer r4 /* clear Fixed-Point Exception Reg */
  825. mtevpr r4 /* clear Exception Vector Prefix Reg */
  826. addi r4,r0,(0xFFFF-0x10000) /* set r4 to 0xFFFFFFFF (status in the */
  827. /* dbsr is cleared by setting bits to 1) */
  828. mtdbsr r4 /* clear/reset the dbsr */
  829. /* Invalidate the i- and d-caches. */
  830. bl invalidate_icache
  831. bl invalidate_dcache
  832. /* Set-up icache cacheability. */
  833. lis r4, CONFIG_SYS_ICACHE_SACR_VALUE@h
  834. ori r4, r4, CONFIG_SYS_ICACHE_SACR_VALUE@l
  835. mticcr r4
  836. isync
  837. /* Set-up dcache cacheability. */
  838. lis r4, CONFIG_SYS_DCACHE_SACR_VALUE@h
  839. ori r4, r4, CONFIG_SYS_DCACHE_SACR_VALUE@l
  840. mtdccr r4
  841. #if !(defined(CONFIG_SYS_EBC_PB0AP) && defined(CONFIG_SYS_EBC_PB0CR))\
  842. && !defined (CONFIG_XILINX_405)
  843. /*----------------------------------------------------------------------- */
  844. /* Tune the speed and size for flash CS0 */
  845. /*----------------------------------------------------------------------- */
  846. bl ext_bus_cntlr_init
  847. #endif
  848. #if !(defined(CONFIG_SYS_INIT_DCACHE_CS) || defined(CONFIG_SYS_TEMP_STACK_OCM))
  849. /*
  850. * For boards that don't have OCM and can't use the data cache
  851. * for their primordial stack, setup stack here directly after the
  852. * SDRAM is initialized in ext_bus_cntlr_init.
  853. */
  854. lis r1, CONFIG_SYS_INIT_RAM_ADDR@h
  855. ori r1,r1,CONFIG_SYS_INIT_SP_OFFSET /* set up the stack in SDRAM */
  856. li r0, 0 /* Make room for stack frame header and */
  857. stwu r0, -4(r1) /* clear final stack frame so that */
  858. stwu r0, -4(r1) /* stack backtraces terminate cleanly */
  859. /*
  860. * Set up a dummy frame to store reset vector as return address.
  861. * this causes stack underflow to reset board.
  862. */
  863. stwu r1, -8(r1) /* Save back chain and move SP */
  864. lis r0, RESET_VECTOR@h /* Address of reset vector */
  865. ori r0, r0, RESET_VECTOR@l
  866. stwu r1, -8(r1) /* Save back chain and move SP */
  867. stw r0, +12(r1) /* Save return addr (underflow vect) */
  868. #endif /* !(CONFIG_SYS_INIT_DCACHE_CS || !CONFIG_SYS_TEM_STACK_OCM) */
  869. #if defined(CONFIG_405EP)
  870. /*----------------------------------------------------------------------- */
  871. /* DMA Status, clear to come up clean */
  872. /*----------------------------------------------------------------------- */
  873. addis r3,r0, 0xFFFF /* Clear all existing DMA status */
  874. ori r3,r3, 0xFFFF
  875. mtdcr dmasr, r3
  876. bl ppc405ep_init /* do ppc405ep specific init */
  877. #endif /* CONFIG_405EP */
  878. #if defined(CONFIG_SYS_OCM_DATA_ADDR) && defined(CONFIG_SYS_OCM_DATA_SIZE)
  879. #if defined(CONFIG_405EZ)
  880. /********************************************************************
  881. * Setup OCM - On Chip Memory - PPC405EZ uses OCM Controller V2
  882. *******************************************************************/
  883. /*
  884. * We can map the OCM on the PLB3, so map it at
  885. * CONFIG_SYS_OCM_DATA_ADDR + 0x8000
  886. */
  887. lis r3,CONFIG_SYS_OCM_DATA_ADDR@h /* OCM location */
  888. ori r3,r3,CONFIG_SYS_OCM_DATA_ADDR@l
  889. ori r3,r3,0x0270 /* 16K for Bank 1, R/W/Enable */
  890. mtdcr ocmplb3cr1,r3 /* Set PLB Access */
  891. ori r3,r3,0x4000 /* Add 0x4000 for bank 2 */
  892. mtdcr ocmplb3cr2,r3 /* Set PLB Access */
  893. isync
  894. lis r3,CONFIG_SYS_OCM_DATA_ADDR@h /* OCM location */
  895. ori r3,r3,CONFIG_SYS_OCM_DATA_ADDR@l
  896. ori r3,r3,0x0270 /* 16K for Bank 1, R/W/Enable */
  897. mtdcr ocmdscr1, r3 /* Set Data Side */
  898. mtdcr ocmiscr1, r3 /* Set Instruction Side */
  899. ori r3,r3,0x4000 /* Add 0x4000 for bank 2 */
  900. mtdcr ocmdscr2, r3 /* Set Data Side */
  901. mtdcr ocmiscr2, r3 /* Set Instruction Side */
  902. addis r3,0,0x0800 /* OCM Data Parity Disable - 1 Wait State */
  903. mtdcr ocmdsisdpc,r3
  904. isync
  905. #else /* CONFIG_405EZ */
  906. /********************************************************************
  907. * Setup OCM - On Chip Memory
  908. *******************************************************************/
  909. /* Setup OCM */
  910. lis r0, 0x7FFF
  911. ori r0, r0, 0xFFFF
  912. mfdcr r3, ocmiscntl /* get instr-side IRAM config */
  913. mfdcr r4, ocmdscntl /* get data-side IRAM config */
  914. and r3, r3, r0 /* disable data-side IRAM */
  915. and r4, r4, r0 /* disable data-side IRAM */
  916. mtdcr ocmiscntl, r3 /* set instr-side IRAM config */
  917. mtdcr ocmdscntl, r4 /* set data-side IRAM config */
  918. isync
  919. lis r3,CONFIG_SYS_OCM_DATA_ADDR@h /* OCM location */
  920. ori r3,r3,CONFIG_SYS_OCM_DATA_ADDR@l
  921. mtdcr ocmdsarc, r3
  922. addis r4, 0, 0xC000 /* OCM data area enabled */
  923. mtdcr ocmdscntl, r4
  924. isync
  925. #endif /* CONFIG_405EZ */
  926. #endif
  927. /*----------------------------------------------------------------------- */
  928. /* Setup temporary stack in DCACHE or OCM if needed for SDRAM SPD. */
  929. /*----------------------------------------------------------------------- */
  930. #ifdef CONFIG_SYS_INIT_DCACHE_CS
  931. li r4, PBxAP
  932. mtdcr ebccfga, r4
  933. lis r4, CONFIG_SYS_INIT_DCACHE_PBxAR@h
  934. ori r4, r4, CONFIG_SYS_INIT_DCACHE_PBxAR@l
  935. mtdcr ebccfgd, r4
  936. addi r4, 0, PBxCR
  937. mtdcr ebccfga, r4
  938. lis r4, CONFIG_SYS_INIT_DCACHE_PBxCR@h
  939. ori r4, r4, CONFIG_SYS_INIT_DCACHE_PBxCR@l
  940. mtdcr ebccfgd, r4
  941. /*
  942. * Enable the data cache for the 128MB storage access control region
  943. * at CONFIG_SYS_INIT_RAM_ADDR.
  944. */
  945. mfdccr r4
  946. oris r4, r4, PPC_128MB_SACR_VALUE(CONFIG_SYS_INIT_RAM_ADDR)@h
  947. ori r4, r4, PPC_128MB_SACR_VALUE(CONFIG_SYS_INIT_RAM_ADDR)@l
  948. mtdccr r4
  949. /*
  950. * Preallocate data cache lines to be used to avoid a subsequent
  951. * cache miss and an ensuing machine check exception when exceptions
  952. * are enabled.
  953. */
  954. li r0, 0
  955. lis r3, CONFIG_SYS_INIT_RAM_ADDR@h
  956. ori r3, r3, CONFIG_SYS_INIT_RAM_ADDR@l
  957. lis r4, CONFIG_SYS_INIT_RAM_END@h
  958. ori r4, r4, CONFIG_SYS_INIT_RAM_END@l
  959. /*
  960. * Convert the size, in bytes, to the number of cache lines/blocks
  961. * to preallocate.
  962. */
  963. clrlwi. r5, r4, (32 - L1_CACHE_SHIFT)
  964. srwi r5, r4, L1_CACHE_SHIFT
  965. beq ..load_counter
  966. addi r5, r5, 0x0001
  967. ..load_counter:
  968. mtctr r5
  969. /* Preallocate the computed number of cache blocks. */
  970. ..alloc_dcache_block:
  971. dcba r0, r3
  972. addi r3, r3, L1_CACHE_BYTES
  973. bdnz ..alloc_dcache_block
  974. sync
  975. /*
  976. * Load the initial stack pointer and data area and convert the size,
  977. * in bytes, to the number of words to initialize to a known value.
  978. */
  979. lis r1, CONFIG_SYS_INIT_RAM_ADDR@h
  980. ori r1, r1, CONFIG_SYS_INIT_SP_OFFSET@l
  981. lis r4, (CONFIG_SYS_INIT_RAM_END >> 2)@h
  982. ori r4, r4, (CONFIG_SYS_INIT_RAM_END >> 2)@l
  983. mtctr r4
  984. lis r2, CONFIG_SYS_INIT_RAM_ADDR@h
  985. ori r2, r2, CONFIG_SYS_INIT_RAM_END@l
  986. lis r4, CONFIG_SYS_INIT_RAM_PATTERN@h
  987. ori r4, r4, CONFIG_SYS_INIT_RAM_PATTERN@l
  988. ..stackloop:
  989. stwu r4, -4(r2)
  990. bdnz ..stackloop
  991. /*
  992. * Make room for stack frame header and clear final stack frame so
  993. * that stack backtraces terminate cleanly.
  994. */
  995. stwu r0, -4(r1)
  996. stwu r0, -4(r1)
  997. /*
  998. * Set up a dummy frame to store reset vector as return address.
  999. * this causes stack underflow to reset board.
  1000. */
  1001. stwu r1, -8(r1) /* Save back chain and move SP */
  1002. addis r0, 0, RESET_VECTOR@h /* Address of reset vector */
  1003. ori r0, r0, RESET_VECTOR@l
  1004. stwu r1, -8(r1) /* Save back chain and move SP */
  1005. stw r0, +12(r1) /* Save return addr (underflow vect) */
  1006. #elif defined(CONFIG_SYS_TEMP_STACK_OCM) && \
  1007. (defined(CONFIG_SYS_OCM_DATA_ADDR) && defined(CONFIG_SYS_OCM_DATA_SIZE))
  1008. /*
  1009. * Stack in OCM.
  1010. */
  1011. /* Set up Stack at top of OCM */
  1012. lis r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)@h
  1013. ori r1, r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)@l
  1014. /* Set up a zeroized stack frame so that backtrace works right */
  1015. li r0, 0
  1016. stwu r0, -4(r1)
  1017. stwu r0, -4(r1)
  1018. /*
  1019. * Set up a dummy frame to store reset vector as return address.
  1020. * this causes stack underflow to reset board.
  1021. */
  1022. stwu r1, -8(r1) /* Save back chain and move SP */
  1023. lis r0, RESET_VECTOR@h /* Address of reset vector */
  1024. ori r0, r0, RESET_VECTOR@l
  1025. stwu r1, -8(r1) /* Save back chain and move SP */
  1026. stw r0, +12(r1) /* Save return addr (underflow vect) */
  1027. #endif /* CONFIG_SYS_INIT_DCACHE_CS */
  1028. #ifdef CONFIG_NAND_SPL
  1029. bl nand_boot_common /* will not return */
  1030. #else
  1031. GET_GOT /* initialize GOT access */
  1032. bl cpu_init_f /* run low-level CPU init code (from Flash) */
  1033. /* NEVER RETURNS! */
  1034. bl board_init_f /* run first part of init code (from Flash) */
  1035. #endif /* CONFIG_NAND_SPL */
  1036. #endif /* CONFIG_405GP || CONFIG_405CR || CONFIG_405 || CONFIG_405EP */
  1037. /*----------------------------------------------------------------------- */
  1038. #ifndef CONFIG_NAND_SPL
  1039. /*
  1040. * This code finishes saving the registers to the exception frame
  1041. * and jumps to the appropriate handler for the exception.
  1042. * Register r21 is pointer into trap frame, r1 has new stack pointer.
  1043. */
  1044. .globl transfer_to_handler
  1045. transfer_to_handler:
  1046. stw r22,_NIP(r21)
  1047. lis r22,MSR_POW@h
  1048. andc r23,r23,r22
  1049. stw r23,_MSR(r21)
  1050. SAVE_GPR(7, r21)
  1051. SAVE_4GPRS(8, r21)
  1052. SAVE_8GPRS(12, r21)
  1053. SAVE_8GPRS(24, r21)
  1054. mflr r23
  1055. andi. r24,r23,0x3f00 /* get vector offset */
  1056. stw r24,TRAP(r21)
  1057. li r22,0
  1058. stw r22,RESULT(r21)
  1059. mtspr SPRG2,r22 /* r1 is now kernel sp */
  1060. lwz r24,0(r23) /* virtual address of handler */
  1061. lwz r23,4(r23) /* where to go when done */
  1062. mtspr SRR0,r24
  1063. mtspr SRR1,r20
  1064. mtlr r23
  1065. SYNC
  1066. rfi /* jump to handler, enable MMU */
  1067. int_return:
  1068. mfmsr r28 /* Disable interrupts */
  1069. li r4,0
  1070. ori r4,r4,MSR_EE
  1071. andc r28,r28,r4
  1072. SYNC /* Some chip revs need this... */
  1073. mtmsr r28
  1074. SYNC
  1075. lwz r2,_CTR(r1)
  1076. lwz r0,_LINK(r1)
  1077. mtctr r2
  1078. mtlr r0
  1079. lwz r2,_XER(r1)
  1080. lwz r0,_CCR(r1)
  1081. mtspr XER,r2
  1082. mtcrf 0xFF,r0
  1083. REST_10GPRS(3, r1)
  1084. REST_10GPRS(13, r1)
  1085. REST_8GPRS(23, r1)
  1086. REST_GPR(31, r1)
  1087. lwz r2,_NIP(r1) /* Restore environment */
  1088. lwz r0,_MSR(r1)
  1089. mtspr SRR0,r2
  1090. mtspr SRR1,r0
  1091. lwz r0,GPR0(r1)
  1092. lwz r2,GPR2(r1)
  1093. lwz r1,GPR1(r1)
  1094. SYNC
  1095. rfi
  1096. crit_return:
  1097. mfmsr r28 /* Disable interrupts */
  1098. li r4,0
  1099. ori r4,r4,MSR_EE
  1100. andc r28,r28,r4
  1101. SYNC /* Some chip revs need this... */
  1102. mtmsr r28
  1103. SYNC
  1104. lwz r2,_CTR(r1)
  1105. lwz r0,_LINK(r1)
  1106. mtctr r2
  1107. mtlr r0
  1108. lwz r2,_XER(r1)
  1109. lwz r0,_CCR(r1)
  1110. mtspr XER,r2
  1111. mtcrf 0xFF,r0
  1112. REST_10GPRS(3, r1)
  1113. REST_10GPRS(13, r1)
  1114. REST_8GPRS(23, r1)
  1115. REST_GPR(31, r1)
  1116. lwz r2,_NIP(r1) /* Restore environment */
  1117. lwz r0,_MSR(r1)
  1118. mtspr csrr0,r2
  1119. mtspr csrr1,r0
  1120. lwz r0,GPR0(r1)
  1121. lwz r2,GPR2(r1)
  1122. lwz r1,GPR1(r1)
  1123. SYNC
  1124. rfci
  1125. #ifdef CONFIG_440
  1126. mck_return:
  1127. mfmsr r28 /* Disable interrupts */
  1128. li r4,0
  1129. ori r4,r4,MSR_EE
  1130. andc r28,r28,r4
  1131. SYNC /* Some chip revs need this... */
  1132. mtmsr r28
  1133. SYNC
  1134. lwz r2,_CTR(r1)
  1135. lwz r0,_LINK(r1)
  1136. mtctr r2
  1137. mtlr r0
  1138. lwz r2,_XER(r1)
  1139. lwz r0,_CCR(r1)
  1140. mtspr XER,r2
  1141. mtcrf 0xFF,r0
  1142. REST_10GPRS(3, r1)
  1143. REST_10GPRS(13, r1)
  1144. REST_8GPRS(23, r1)
  1145. REST_GPR(31, r1)
  1146. lwz r2,_NIP(r1) /* Restore environment */
  1147. lwz r0,_MSR(r1)
  1148. mtspr mcsrr0,r2
  1149. mtspr mcsrr1,r0
  1150. lwz r0,GPR0(r1)
  1151. lwz r2,GPR2(r1)
  1152. lwz r1,GPR1(r1)
  1153. SYNC
  1154. rfmci
  1155. #endif /* CONFIG_440 */
  1156. .globl get_pvr
  1157. get_pvr:
  1158. mfspr r3, PVR
  1159. blr
  1160. /*------------------------------------------------------------------------------- */
  1161. /* Function: out16 */
  1162. /* Description: Output 16 bits */
  1163. /*------------------------------------------------------------------------------- */
  1164. .globl out16
  1165. out16:
  1166. sth r4,0x0000(r3)
  1167. blr
  1168. /*------------------------------------------------------------------------------- */
  1169. /* Function: out16r */
  1170. /* Description: Byte reverse and output 16 bits */
  1171. /*------------------------------------------------------------------------------- */
  1172. .globl out16r
  1173. out16r:
  1174. sthbrx r4,r0,r3
  1175. blr
  1176. /*------------------------------------------------------------------------------- */
  1177. /* Function: out32r */
  1178. /* Description: Byte reverse and output 32 bits */
  1179. /*------------------------------------------------------------------------------- */
  1180. .globl out32r
  1181. out32r:
  1182. stwbrx r4,r0,r3
  1183. blr
  1184. /*------------------------------------------------------------------------------- */
  1185. /* Function: in16 */
  1186. /* Description: Input 16 bits */
  1187. /*------------------------------------------------------------------------------- */
  1188. .globl in16
  1189. in16:
  1190. lhz r3,0x0000(r3)
  1191. blr
  1192. /*------------------------------------------------------------------------------- */
  1193. /* Function: in16r */
  1194. /* Description: Input 16 bits and byte reverse */
  1195. /*------------------------------------------------------------------------------- */
  1196. .globl in16r
  1197. in16r:
  1198. lhbrx r3,r0,r3
  1199. blr
  1200. /*------------------------------------------------------------------------------- */
  1201. /* Function: in32r */
  1202. /* Description: Input 32 bits and byte reverse */
  1203. /*------------------------------------------------------------------------------- */
  1204. .globl in32r
  1205. in32r:
  1206. lwbrx r3,r0,r3
  1207. blr
  1208. /*
  1209. * void relocate_code (addr_sp, gd, addr_moni)
  1210. *
  1211. * This "function" does not return, instead it continues in RAM
  1212. * after relocating the monitor code.
  1213. *
  1214. * r3 = Relocated stack pointer
  1215. * r4 = Relocated global data pointer
  1216. * r5 = Relocated text pointer
  1217. */
  1218. .globl relocate_code
  1219. relocate_code:
  1220. #if defined(CONFIG_4xx_DCACHE) || defined(CONFIG_SYS_INIT_DCACHE_CS)
  1221. /*
  1222. * We need to flush the initial global data (gd_t) before the dcache
  1223. * will be invalidated.
  1224. */
  1225. /* Save registers */
  1226. mr r9, r3
  1227. mr r10, r4
  1228. mr r11, r5
  1229. /* Flush initial global data range */
  1230. mr r3, r4
  1231. addi r4, r4, CONFIG_SYS_GBL_DATA_SIZE@l
  1232. bl flush_dcache_range
  1233. #if defined(CONFIG_SYS_INIT_DCACHE_CS)
  1234. /*
  1235. * Undo the earlier data cache set-up for the primordial stack and
  1236. * data area. First, invalidate the data cache and then disable data
  1237. * cacheability for that area. Finally, restore the EBC values, if
  1238. * any.
  1239. */
  1240. /* Invalidate the primordial stack and data area in cache */
  1241. lis r3, CONFIG_SYS_INIT_RAM_ADDR@h
  1242. ori r3, r3, CONFIG_SYS_INIT_RAM_ADDR@l
  1243. lis r4, CONFIG_SYS_INIT_RAM_END@h
  1244. ori r4, r4, CONFIG_SYS_INIT_RAM_END@l
  1245. add r4, r4, r3
  1246. bl invalidate_dcache_range
  1247. /* Disable cacheability for the region */
  1248. mfdccr r3
  1249. lis r4, ~PPC_128MB_SACR_VALUE(CONFIG_SYS_INIT_RAM_ADDR)@h
  1250. ori r4, r4, ~PPC_128MB_SACR_VALUE(CONFIG_SYS_INIT_RAM_ADDR)@l
  1251. and r3, r3, r4
  1252. mtdccr r3
  1253. /* Restore the EBC parameters */
  1254. li r3, PBxAP
  1255. mtdcr ebccfga, r3
  1256. lis r3, PBxAP_VAL@h
  1257. ori r3, r3, PBxAP_VAL@l
  1258. mtdcr ebccfgd, r3
  1259. li r3, PBxCR
  1260. mtdcr ebccfga, r3
  1261. lis r3, PBxCR_VAL@h
  1262. ori r3, r3, PBxCR_VAL@l
  1263. mtdcr ebccfgd, r3
  1264. #endif /* defined(CONFIG_SYS_INIT_DCACHE_CS) */
  1265. /* Restore registers */
  1266. mr r3, r9
  1267. mr r4, r10
  1268. mr r5, r11
  1269. #endif /* defined(CONFIG_4xx_DCACHE) || defined(CONFIG_SYS_INIT_DCACHE_CS) */
  1270. #ifdef CONFIG_SYS_INIT_RAM_DCACHE
  1271. /*
  1272. * Unlock the previously locked d-cache
  1273. */
  1274. msync
  1275. isync
  1276. /* set TFLOOR/NFLOOR to 0 again */
  1277. lis r6,0x0001
  1278. ori r6,r6,0xf800
  1279. mtspr dvlim,r6
  1280. lis r6,0x0000
  1281. ori r6,r6,0x0000
  1282. mtspr dnv0,r6
  1283. mtspr dnv1,r6
  1284. mtspr dnv2,r6
  1285. mtspr dnv3,r6
  1286. mtspr dtv0,r6
  1287. mtspr dtv1,r6
  1288. mtspr dtv2,r6
  1289. mtspr dtv3,r6
  1290. msync
  1291. isync
  1292. #endif /* CONFIG_SYS_INIT_RAM_DCACHE */
  1293. #if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
  1294. defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
  1295. defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
  1296. defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
  1297. defined(CONFIG_460SX)
  1298. /*
  1299. * On some 440er platforms the cache is enabled in the first TLB (Boot-CS)
  1300. * to speed up the boot process. Now this cache needs to be disabled.
  1301. */
  1302. iccci 0,0 /* Invalidate inst cache */
  1303. dccci 0,0 /* Invalidate data cache, now no longer our stack */
  1304. sync
  1305. isync
  1306. /* Clear all potential pending exceptions */
  1307. mfspr r1,mcsr
  1308. mtspr mcsr,r1
  1309. #ifdef CONFIG_SYS_TLB_FOR_BOOT_FLASH
  1310. addi r1,r0,CONFIG_SYS_TLB_FOR_BOOT_FLASH /* Use defined TLB */
  1311. #else
  1312. addi r1,r0,0x0000 /* Default TLB entry is #0 */
  1313. #endif /* CONFIG_SYS_TLB_FOR_BOOT_FLASH */
  1314. tlbre r0,r1,0x0002 /* Read contents */
  1315. ori r0,r0,0x0c00 /* Or in the inhibit, write through bit */
  1316. tlbwe r0,r1,0x0002 /* Save it out */
  1317. sync
  1318. isync
  1319. #endif /* defined(CONFIG_440EP) || ... || defined(CONFIG_460GT) */
  1320. mr r1, r3 /* Set new stack pointer */
  1321. mr r9, r4 /* Save copy of Init Data pointer */
  1322. mr r10, r5 /* Save copy of Destination Address */
  1323. mr r3, r5 /* Destination Address */
  1324. lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */
  1325. ori r4, r4, CONFIG_SYS_MONITOR_BASE@l
  1326. lwz r5, GOT(__init_end)
  1327. sub r5, r5, r4
  1328. li r6, L1_CACHE_BYTES /* Cache Line Size */
  1329. /*
  1330. * Fix GOT pointer:
  1331. *
  1332. * New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE) + Destination Address
  1333. *
  1334. * Offset:
  1335. */
  1336. sub r15, r10, r4
  1337. /* First our own GOT */
  1338. add r14, r14, r15
  1339. /* then the one used by the C code */
  1340. add r30, r30, r15
  1341. /*
  1342. * Now relocate code
  1343. */
  1344. cmplw cr1,r3,r4
  1345. addi r0,r5,3
  1346. srwi. r0,r0,2
  1347. beq cr1,4f /* In place copy is not necessary */
  1348. beq 7f /* Protect against 0 count */
  1349. mtctr r0
  1350. bge cr1,2f
  1351. la r8,-4(r4)
  1352. la r7,-4(r3)
  1353. 1: lwzu r0,4(r8)
  1354. stwu r0,4(r7)
  1355. bdnz 1b
  1356. b 4f
  1357. 2: slwi r0,r0,2
  1358. add r8,r4,r0
  1359. add r7,r3,r0
  1360. 3: lwzu r0,-4(r8)
  1361. stwu r0,-4(r7)
  1362. bdnz 3b
  1363. /*
  1364. * Now flush the cache: note that we must start from a cache aligned
  1365. * address. Otherwise we might miss one cache line.
  1366. */
  1367. 4: cmpwi r6,0
  1368. add r5,r3,r5
  1369. beq 7f /* Always flush prefetch queue in any case */
  1370. subi r0,r6,1
  1371. andc r3,r3,r0
  1372. mr r4,r3
  1373. 5: dcbst 0,r4
  1374. add r4,r4,r6
  1375. cmplw r4,r5
  1376. blt 5b
  1377. sync /* Wait for all dcbst to complete on bus */
  1378. mr r4,r3
  1379. 6: icbi 0,r4
  1380. add r4,r4,r6
  1381. cmplw r4,r5
  1382. blt 6b
  1383. 7: sync /* Wait for all icbi to complete on bus */
  1384. isync
  1385. /*
  1386. * We are done. Do not return, instead branch to second part of board
  1387. * initialization, now running from RAM.
  1388. */
  1389. addi r0, r10, in_ram - _start + _START_OFFSET
  1390. mtlr r0
  1391. blr /* NEVER RETURNS! */
  1392. in_ram:
  1393. /*
  1394. * Relocation Function, r14 point to got2+0x8000
  1395. *
  1396. * Adjust got2 pointers, no need to check for 0, this code
  1397. * already puts a few entries in the table.
  1398. */
  1399. li r0,__got2_entries@sectoff@l
  1400. la r3,GOT(_GOT2_TABLE_)
  1401. lwz r11,GOT(_GOT2_TABLE_)
  1402. mtctr r0
  1403. sub r11,r3,r11
  1404. addi r3,r3,-4
  1405. 1: lwzu r0,4(r3)
  1406. add r0,r0,r11
  1407. stw r0,0(r3)
  1408. bdnz 1b
  1409. /*
  1410. * Now adjust the fixups and the pointers to the fixups
  1411. * in case we need to move ourselves again.
  1412. */
  1413. 2: li r0,__fixup_entries@sectoff@l
  1414. lwz r3,GOT(_FIXUP_TABLE_)
  1415. cmpwi r0,0
  1416. mtctr r0
  1417. addi r3,r3,-4
  1418. beq 4f
  1419. 3: lwzu r4,4(r3)
  1420. lwzux r0,r4,r11
  1421. add r0,r0,r11
  1422. stw r10,0(r3)
  1423. stw r0,0(r4)
  1424. bdnz 3b
  1425. 4:
  1426. clear_bss:
  1427. /*
  1428. * Now clear BSS segment
  1429. */
  1430. lwz r3,GOT(__bss_start)
  1431. lwz r4,GOT(_end)
  1432. cmplw 0, r3, r4
  1433. beq 7f
  1434. li r0, 0
  1435. andi. r5, r4, 3
  1436. beq 6f
  1437. sub r4, r4, r5
  1438. mtctr r5
  1439. mr r5, r4
  1440. 5: stb r0, 0(r5)
  1441. addi r5, r5, 1
  1442. bdnz 5b
  1443. 6:
  1444. stw r0, 0(r3)
  1445. addi r3, r3, 4
  1446. cmplw 0, r3, r4
  1447. bne 6b
  1448. 7:
  1449. mr r3, r9 /* Init Data pointer */
  1450. mr r4, r10 /* Destination Address */
  1451. bl board_init_r
  1452. /*
  1453. * Copy exception vector code to low memory
  1454. *
  1455. * r3: dest_addr
  1456. * r7: source address, r8: end address, r9: target address
  1457. */
  1458. .globl trap_init
  1459. trap_init:
  1460. lwz r7, GOT(_start_of_vectors)
  1461. lwz r8, GOT(_end_of_vectors)
  1462. li r9, 0x100 /* reset vector always at 0x100 */
  1463. cmplw 0, r7, r8
  1464. bgelr /* return if r7>=r8 - just in case */
  1465. mflr r4 /* save link register */
  1466. 1:
  1467. lwz r0, 0(r7)
  1468. stw r0, 0(r9)
  1469. addi r7, r7, 4
  1470. addi r9, r9, 4
  1471. cmplw 0, r7, r8
  1472. bne 1b
  1473. /*
  1474. * relocate `hdlr' and `int_return' entries
  1475. */
  1476. li r7, .L_MachineCheck - _start + _START_OFFSET
  1477. li r8, Alignment - _start + _START_OFFSET
  1478. 2:
  1479. bl trap_reloc
  1480. addi r7, r7, 0x100 /* next exception vector */
  1481. cmplw 0, r7, r8
  1482. blt 2b
  1483. li r7, .L_Alignment - _start + _START_OFFSET
  1484. bl trap_reloc
  1485. li r7, .L_ProgramCheck - _start + _START_OFFSET
  1486. bl trap_reloc
  1487. #ifdef CONFIG_440
  1488. li r7, .L_FPUnavailable - _start + _START_OFFSET
  1489. bl trap_reloc
  1490. li r7, .L_Decrementer - _start + _START_OFFSET
  1491. bl trap_reloc
  1492. li r7, .L_APU - _start + _START_OFFSET
  1493. bl trap_reloc
  1494. li r7, .L_InstructionTLBError - _start + _START_OFFSET
  1495. bl trap_reloc
  1496. li r7, .L_DataTLBError - _start + _START_OFFSET
  1497. bl trap_reloc
  1498. #else /* CONFIG_440 */
  1499. li r7, .L_PIT - _start + _START_OFFSET
  1500. bl trap_reloc
  1501. li r7, .L_InstructionTLBMiss - _start + _START_OFFSET
  1502. bl trap_reloc
  1503. li r7, .L_DataTLBMiss - _start + _START_OFFSET
  1504. bl trap_reloc
  1505. #endif /* CONFIG_440 */
  1506. li r7, .L_DebugBreakpoint - _start + _START_OFFSET
  1507. bl trap_reloc
  1508. #if !defined(CONFIG_440)
  1509. addi r7,r0,0x1000 /* set ME bit (Machine Exceptions) */
  1510. oris r7,r7,0x0002 /* set CE bit (Critical Exceptions) */
  1511. mtmsr r7 /* change MSR */
  1512. #else
  1513. bl __440_msr_set
  1514. b __440_msr_continue
  1515. __440_msr_set:
  1516. addi r7,r0,0x1000 /* set ME bit (Machine Exceptions) */
  1517. oris r7,r7,0x0002 /* set CE bit (Critical Exceptions) */
  1518. mtspr srr1,r7
  1519. mflr r7
  1520. mtspr srr0,r7
  1521. rfi
  1522. __440_msr_continue:
  1523. #endif
  1524. mtlr r4 /* restore link register */
  1525. blr
  1526. /*
  1527. * Function: relocate entries for one exception vector
  1528. */
  1529. trap_reloc:
  1530. lwz r0, 0(r7) /* hdlr ... */
  1531. add r0, r0, r3 /* ... += dest_addr */
  1532. stw r0, 0(r7)
  1533. lwz r0, 4(r7) /* int_return ... */
  1534. add r0, r0, r3 /* ... += dest_addr */
  1535. stw r0, 4(r7)
  1536. blr
  1537. #if defined(CONFIG_440)
  1538. /*----------------------------------------------------------------------------+
  1539. | dcbz_area.
  1540. +----------------------------------------------------------------------------*/
  1541. function_prolog(dcbz_area)
  1542. rlwinm. r5,r4,0,27,31
  1543. rlwinm r5,r4,27,5,31
  1544. beq ..d_ra2
  1545. addi r5,r5,0x0001
  1546. ..d_ra2:mtctr r5
  1547. ..d_ag2:dcbz r0,r3
  1548. addi r3,r3,32
  1549. bdnz ..d_ag2
  1550. sync
  1551. blr
  1552. function_epilog(dcbz_area)
  1553. #endif /* CONFIG_440 */
  1554. #endif /* CONFIG_NAND_SPL */
  1555. /*------------------------------------------------------------------------------- */
  1556. /* Function: in8 */
  1557. /* Description: Input 8 bits */
  1558. /*------------------------------------------------------------------------------- */
  1559. .globl in8
  1560. in8:
  1561. lbz r3,0x0000(r3)
  1562. blr
  1563. /*------------------------------------------------------------------------------- */
  1564. /* Function: out8 */
  1565. /* Description: Output 8 bits */
  1566. /*------------------------------------------------------------------------------- */
  1567. .globl out8
  1568. out8:
  1569. stb r4,0x0000(r3)
  1570. blr
  1571. /*------------------------------------------------------------------------------- */
  1572. /* Function: out32 */
  1573. /* Description: Output 32 bits */
  1574. /*------------------------------------------------------------------------------- */
  1575. .globl out32
  1576. out32:
  1577. stw r4,0x0000(r3)
  1578. blr
  1579. /*------------------------------------------------------------------------------- */
  1580. /* Function: in32 */
  1581. /* Description: Input 32 bits */
  1582. /*------------------------------------------------------------------------------- */
  1583. .globl in32
  1584. in32:
  1585. lwz 3,0x0000(3)
  1586. blr
  1587. /**************************************************************************/
  1588. /* PPC405EP specific stuff */
  1589. /**************************************************************************/
  1590. #ifdef CONFIG_405EP
  1591. ppc405ep_init:
  1592. #ifdef CONFIG_BUBINGA
  1593. /*
  1594. * Initialize EBC chip selects 1 & 4 and GPIO pins (for alternate
  1595. * function) to support FPGA and NVRAM accesses below.
  1596. */
  1597. lis r3,GPIO0_OSRH@h /* config GPIO output select */
  1598. ori r3,r3,GPIO0_OSRH@l
  1599. lis r4,CONFIG_SYS_GPIO0_OSRH@h
  1600. ori r4,r4,CONFIG_SYS_GPIO0_OSRH@l
  1601. stw r4,0(r3)
  1602. lis r3,GPIO0_OSRL@h
  1603. ori r3,r3,GPIO0_OSRL@l
  1604. lis r4,CONFIG_SYS_GPIO0_OSRL@h
  1605. ori r4,r4,CONFIG_SYS_GPIO0_OSRL@l
  1606. stw r4,0(r3)
  1607. lis r3,GPIO0_ISR1H@h /* config GPIO input select */
  1608. ori r3,r3,GPIO0_ISR1H@l
  1609. lis r4,CONFIG_SYS_GPIO0_ISR1H@h
  1610. ori r4,r4,CONFIG_SYS_GPIO0_ISR1H@l
  1611. stw r4,0(r3)
  1612. lis r3,GPIO0_ISR1L@h
  1613. ori r3,r3,GPIO0_ISR1L@l
  1614. lis r4,CONFIG_SYS_GPIO0_ISR1L@h
  1615. ori r4,r4,CONFIG_SYS_GPIO0_ISR1L@l
  1616. stw r4,0(r3)
  1617. lis r3,GPIO0_TSRH@h /* config GPIO three-state select */
  1618. ori r3,r3,GPIO0_TSRH@l
  1619. lis r4,CONFIG_SYS_GPIO0_TSRH@h
  1620. ori r4,r4,CONFIG_SYS_GPIO0_TSRH@l
  1621. stw r4,0(r3)
  1622. lis r3,GPIO0_TSRL@h
  1623. ori r3,r3,GPIO0_TSRL@l
  1624. lis r4,CONFIG_SYS_GPIO0_TSRL@h
  1625. ori r4,r4,CONFIG_SYS_GPIO0_TSRL@l
  1626. stw r4,0(r3)
  1627. lis r3,GPIO0_TCR@h /* config GPIO driver output enables */
  1628. ori r3,r3,GPIO0_TCR@l
  1629. lis r4,CONFIG_SYS_GPIO0_TCR@h
  1630. ori r4,r4,CONFIG_SYS_GPIO0_TCR@l
  1631. stw r4,0(r3)
  1632. li r3,pb1ap /* program EBC bank 1 for RTC access */
  1633. mtdcr ebccfga,r3
  1634. lis r3,CONFIG_SYS_EBC_PB1AP@h
  1635. ori r3,r3,CONFIG_SYS_EBC_PB1AP@l
  1636. mtdcr ebccfgd,r3
  1637. li r3,pb1cr
  1638. mtdcr ebccfga,r3
  1639. lis r3,CONFIG_SYS_EBC_PB1CR@h
  1640. ori r3,r3,CONFIG_SYS_EBC_PB1CR@l
  1641. mtdcr ebccfgd,r3
  1642. li r3,pb1ap /* program EBC bank 1 for RTC access */
  1643. mtdcr ebccfga,r3
  1644. lis r3,CONFIG_SYS_EBC_PB1AP@h
  1645. ori r3,r3,CONFIG_SYS_EBC_PB1AP@l
  1646. mtdcr ebccfgd,r3
  1647. li r3,pb1cr
  1648. mtdcr ebccfga,r3
  1649. lis r3,CONFIG_SYS_EBC_PB1CR@h
  1650. ori r3,r3,CONFIG_SYS_EBC_PB1CR@l
  1651. mtdcr ebccfgd,r3
  1652. li r3,pb4ap /* program EBC bank 4 for FPGA access */
  1653. mtdcr ebccfga,r3
  1654. lis r3,CONFIG_SYS_EBC_PB4AP@h
  1655. ori r3,r3,CONFIG_SYS_EBC_PB4AP@l
  1656. mtdcr ebccfgd,r3
  1657. li r3,pb4cr
  1658. mtdcr ebccfga,r3
  1659. lis r3,CONFIG_SYS_EBC_PB4CR@h
  1660. ori r3,r3,CONFIG_SYS_EBC_PB4CR@l
  1661. mtdcr ebccfgd,r3
  1662. #endif
  1663. /*
  1664. !-----------------------------------------------------------------------
  1665. ! Check to see if chip is in bypass mode.
  1666. ! If so, write stored CPC0_PLLMR0 and CPC0_PLLMR1 values and perform a
  1667. ! CPU reset Otherwise, skip this step and keep going.
  1668. ! Note: Running BIOS in bypass mode is not supported since PLB speed
  1669. ! will not be fast enough for the SDRAM (min 66MHz)
  1670. !-----------------------------------------------------------------------
  1671. */
  1672. mfdcr r5, CPC0_PLLMR1
  1673. rlwinm r4,r5,1,0x1 /* get system clock source (SSCS) */
  1674. cmpi cr0,0,r4,0x1
  1675. beq pll_done /* if SSCS =b'1' then PLL has */
  1676. /* already been set */
  1677. /* and CPU has been reset */
  1678. /* so skip to next section */
  1679. #ifdef CONFIG_BUBINGA
  1680. /*
  1681. !-----------------------------------------------------------------------
  1682. ! Read NVRAM to get value to write in PLLMR.
  1683. ! If value has not been correctly saved, write default value
  1684. ! Default config values (assuming on-board 33MHz SYS_CLK) are above.
  1685. ! See CPU_DEFAULT_200 and CPU_DEFAULT_266 above.
  1686. !
  1687. ! WARNING: This code assumes the first three words in the nvram_t
  1688. ! structure in openbios.h. Changing the beginning of
  1689. ! the structure will break this code.
  1690. !
  1691. !-----------------------------------------------------------------------
  1692. */
  1693. addis r3,0,NVRAM_BASE@h
  1694. addi r3,r3,NVRAM_BASE@l
  1695. lwz r4, 0(r3)
  1696. addis r5,0,NVRVFY1@h
  1697. addi r5,r5,NVRVFY1@l
  1698. cmp cr0,0,r4,r5 /* Compare 1st NVRAM Magic number*/
  1699. bne ..no_pllset
  1700. addi r3,r3,4
  1701. lwz r4, 0(r3)
  1702. addis r5,0,NVRVFY2@h
  1703. addi r5,r5,NVRVFY2@l
  1704. cmp cr0,0,r4,r5 /* Compare 2 NVRAM Magic number */
  1705. bne ..no_pllset
  1706. addi r3,r3,8 /* Skip over conf_size */
  1707. lwz r4, 4(r3) /* Load PLLMR1 value from NVRAM */
  1708. lwz r3, 0(r3) /* Load PLLMR0 value from NVRAM */
  1709. rlwinm r5,r4,1,0x1 /* get system clock source (SSCS) */
  1710. cmpi cr0,0,r5,1 /* See if PLL is locked */
  1711. beq pll_write
  1712. ..no_pllset:
  1713. #endif /* CONFIG_BUBINGA */
  1714. #ifdef CONFIG_TAIHU
  1715. mfdcr r4, CPC0_BOOT
  1716. andi. r5, r4, CPC0_BOOT_SEP@l
  1717. bne strap_1 /* serial eeprom present */
  1718. addis r5,0,CPLD_REG0_ADDR@h
  1719. ori r5,r5,CPLD_REG0_ADDR@l
  1720. andi. r5, r5, 0x10
  1721. bne _pci_66mhz
  1722. #endif /* CONFIG_TAIHU */
  1723. #if defined(CONFIG_ZEUS)
  1724. mfdcr r4, CPC0_BOOT
  1725. andi. r5, r4, CPC0_BOOT_SEP@l
  1726. bne strap_1 /* serial eeprom present */
  1727. lis r3,0x0000
  1728. addi r3,r3,0x3030
  1729. lis r4,0x8042
  1730. addi r4,r4,0x223e
  1731. b 1f
  1732. strap_1:
  1733. mfdcr r3, CPC0_PLLMR0
  1734. mfdcr r4, CPC0_PLLMR1
  1735. b 1f
  1736. #endif
  1737. addis r3,0,PLLMR0_DEFAULT@h /* PLLMR0 default value */
  1738. ori r3,r3,PLLMR0_DEFAULT@l /* */
  1739. addis r4,0,PLLMR1_DEFAULT@h /* PLLMR1 default value */
  1740. ori r4,r4,PLLMR1_DEFAULT@l /* */
  1741. #ifdef CONFIG_TAIHU
  1742. b 1f
  1743. _pci_66mhz:
  1744. addis r3,0,PLLMR0_DEFAULT_PCI66@h
  1745. ori r3,r3,PLLMR0_DEFAULT_PCI66@l
  1746. addis r4,0,PLLMR1_DEFAULT_PCI66@h
  1747. ori r4,r4,PLLMR1_DEFAULT_PCI66@l
  1748. b 1f
  1749. strap_1:
  1750. mfdcr r3, CPC0_PLLMR0
  1751. mfdcr r4, CPC0_PLLMR1
  1752. #endif /* CONFIG_TAIHU */
  1753. 1:
  1754. b pll_write /* Write the CPC0_PLLMR with new value */
  1755. pll_done:
  1756. /*
  1757. !-----------------------------------------------------------------------
  1758. ! Clear Soft Reset Register
  1759. ! This is needed to enable PCI if not booting from serial EPROM
  1760. !-----------------------------------------------------------------------
  1761. */
  1762. addi r3, 0, 0x0
  1763. mtdcr CPC0_SRR, r3
  1764. addis r3,0,0x0010
  1765. mtctr r3
  1766. pci_wait:
  1767. bdnz pci_wait
  1768. blr /* return to main code */
  1769. /*
  1770. !-----------------------------------------------------------------------------
  1771. ! Function: pll_write
  1772. ! Description: Updates the value of the CPC0_PLLMR according to CMOS27E documentation
  1773. ! That is:
  1774. ! 1. Pll is first disabled (de-activated by putting in bypass mode)
  1775. ! 2. PLL is reset
  1776. ! 3. Clock dividers are set while PLL is held in reset and bypassed
  1777. ! 4. PLL Reset is cleared
  1778. ! 5. Wait 100us for PLL to lock
  1779. ! 6. A core reset is performed
  1780. ! Input: r3 = Value to write to CPC0_PLLMR0
  1781. ! Input: r4 = Value to write to CPC0_PLLMR1
  1782. ! Output r3 = none
  1783. !-----------------------------------------------------------------------------
  1784. */
  1785. pll_write:
  1786. mfdcr r5, CPC0_UCR
  1787. andis. r5,r5,0xFFFF
  1788. ori r5,r5,0x0101 /* Stop the UART clocks */
  1789. mtdcr CPC0_UCR,r5 /* Before changing PLL */
  1790. mfdcr r5, CPC0_PLLMR1
  1791. rlwinm r5,r5,0,0x7FFFFFFF /* Disable PLL */
  1792. mtdcr CPC0_PLLMR1,r5
  1793. oris r5,r5,0x4000 /* Set PLL Reset */
  1794. mtdcr CPC0_PLLMR1,r5
  1795. mtdcr CPC0_PLLMR0,r3 /* Set clock dividers */
  1796. rlwinm r5,r4,0,0x3FFFFFFF /* Reset & Bypass new PLL dividers */
  1797. oris r5,r5,0x4000 /* Set PLL Reset */
  1798. mtdcr CPC0_PLLMR1,r5 /* Set clock dividers */
  1799. rlwinm r5,r5,0,0xBFFFFFFF /* Clear PLL Reset */
  1800. mtdcr CPC0_PLLMR1,r5
  1801. /*
  1802. ! Wait min of 100us for PLL to lock.
  1803. ! See CMOS 27E databook for more info.
  1804. ! At 200MHz, that means waiting 20,000 instructions
  1805. */
  1806. addi r3,0,20000 /* 2000 = 0x4e20 */
  1807. mtctr r3
  1808. pll_wait:
  1809. bdnz pll_wait
  1810. oris r5,r5,0x8000 /* Enable PLL */
  1811. mtdcr CPC0_PLLMR1,r5 /* Engage */
  1812. /*
  1813. * Reset CPU to guarantee timings are OK
  1814. * Not sure if this is needed...
  1815. */
  1816. addis r3,0,0x1000
  1817. mtspr dbcr0,r3 /* This will cause a CPU core reset, and */
  1818. /* execution will continue from the poweron */
  1819. /* vector of 0xfffffffc */
  1820. #endif /* CONFIG_405EP */
  1821. #if defined(CONFIG_440)
  1822. /*----------------------------------------------------------------------------+
  1823. | mttlb3.
  1824. +----------------------------------------------------------------------------*/
  1825. function_prolog(mttlb3)
  1826. TLBWE(4,3,2)
  1827. blr
  1828. function_epilog(mttlb3)
  1829. /*----------------------------------------------------------------------------+
  1830. | mftlb3.
  1831. +----------------------------------------------------------------------------*/
  1832. function_prolog(mftlb3)
  1833. TLBRE(3,3,2)
  1834. blr
  1835. function_epilog(mftlb3)
  1836. /*----------------------------------------------------------------------------+
  1837. | mttlb2.
  1838. +----------------------------------------------------------------------------*/
  1839. function_prolog(mttlb2)
  1840. TLBWE(4,3,1)
  1841. blr
  1842. function_epilog(mttlb2)
  1843. /*----------------------------------------------------------------------------+
  1844. | mftlb2.
  1845. +----------------------------------------------------------------------------*/
  1846. function_prolog(mftlb2)
  1847. TLBRE(3,3,1)
  1848. blr
  1849. function_epilog(mftlb2)
  1850. /*----------------------------------------------------------------------------+
  1851. | mttlb1.
  1852. +----------------------------------------------------------------------------*/
  1853. function_prolog(mttlb1)
  1854. TLBWE(4,3,0)
  1855. blr
  1856. function_epilog(mttlb1)
  1857. /*----------------------------------------------------------------------------+
  1858. | mftlb1.
  1859. +----------------------------------------------------------------------------*/
  1860. function_prolog(mftlb1)
  1861. TLBRE(3,3,0)
  1862. blr
  1863. function_epilog(mftlb1)
  1864. #endif /* CONFIG_440 */
  1865. #if defined(CONFIG_NAND_SPL)
  1866. /*
  1867. * void nand_boot_relocate(dst, src, bytes)
  1868. *
  1869. * r3 = Destination address to copy code to (in SDRAM)
  1870. * r4 = Source address to copy code from
  1871. * r5 = size to copy in bytes
  1872. */
  1873. nand_boot_relocate:
  1874. mr r6,r3
  1875. mr r7,r4
  1876. mflr r8
  1877. /*
  1878. * Copy SPL from icache into SDRAM
  1879. */
  1880. subi r3,r3,4
  1881. subi r4,r4,4
  1882. srwi r5,r5,2
  1883. mtctr r5
  1884. ..spl_loop:
  1885. lwzu r0,4(r4)
  1886. stwu r0,4(r3)
  1887. bdnz ..spl_loop
  1888. /*
  1889. * Calculate "corrected" link register, so that we "continue"
  1890. * in execution in destination range
  1891. */
  1892. sub r3,r7,r6 /* r3 = src - dst */
  1893. sub r8,r8,r3 /* r8 = link-reg - (src - dst) */
  1894. mtlr r8
  1895. blr
  1896. nand_boot_common:
  1897. /*
  1898. * First initialize SDRAM. It has to be available *before* calling
  1899. * nand_boot().
  1900. */
  1901. lis r3,CONFIG_SYS_SDRAM_BASE@h
  1902. ori r3,r3,CONFIG_SYS_SDRAM_BASE@l
  1903. bl initdram
  1904. /*
  1905. * Now copy the 4k SPL code into SDRAM and continue execution
  1906. * from there.
  1907. */
  1908. lis r3,CONFIG_SYS_NAND_BOOT_SPL_DST@h
  1909. ori r3,r3,CONFIG_SYS_NAND_BOOT_SPL_DST@l
  1910. lis r4,CONFIG_SYS_NAND_BOOT_SPL_SRC@h
  1911. ori r4,r4,CONFIG_SYS_NAND_BOOT_SPL_SRC@l
  1912. lis r5,CONFIG_SYS_NAND_BOOT_SPL_SIZE@h
  1913. ori r5,r5,CONFIG_SYS_NAND_BOOT_SPL_SIZE@l
  1914. bl nand_boot_relocate
  1915. /*
  1916. * We're running from SDRAM now!!!
  1917. *
  1918. * It is necessary for 4xx systems to relocate from running at
  1919. * the original location (0xfffffxxx) to somewhere else (SDRAM
  1920. * preferably). This is because CS0 needs to be reconfigured for
  1921. * NAND access. And we can't reconfigure this CS when currently
  1922. * "running" from it.
  1923. */
  1924. /*
  1925. * Finally call nand_boot() to load main NAND U-Boot image from
  1926. * NAND and jump to it.
  1927. */
  1928. bl nand_boot /* will not return */
  1929. #endif /* CONFIG_NAND_SPL */