start.S 59 KB

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