proc-xscale.S 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. /*
  2. * linux/arch/arm/mm/proc-xscale.S
  3. *
  4. * Author: Nicolas Pitre
  5. * Created: November 2000
  6. * Copyright: (C) 2000, 2001 MontaVista Software Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * MMU functions for the Intel XScale CPUs
  13. *
  14. * 2001 Aug 21:
  15. * some contributions by Brett Gaines <brett.w.gaines@intel.com>
  16. * Copyright 2001 by Intel Corp.
  17. *
  18. * 2001 Sep 08:
  19. * Completely revisited, many important fixes
  20. * Nicolas Pitre <nico@fluxnic.net>
  21. */
  22. #include <linux/linkage.h>
  23. #include <linux/init.h>
  24. #include <asm/assembler.h>
  25. #include <asm/hwcap.h>
  26. #include <asm/pgtable.h>
  27. #include <asm/pgtable-hwdef.h>
  28. #include <asm/page.h>
  29. #include <asm/ptrace.h>
  30. #include "proc-macros.S"
  31. /*
  32. * This is the maximum size of an area which will be flushed. If the area
  33. * is larger than this, then we flush the whole cache
  34. */
  35. #define MAX_AREA_SIZE 32768
  36. /*
  37. * the cache line size of the I and D cache
  38. */
  39. #define CACHELINESIZE 32
  40. /*
  41. * the size of the data cache
  42. */
  43. #define CACHESIZE 32768
  44. /*
  45. * Virtual address used to allocate the cache when flushed
  46. *
  47. * This must be an address range which is _never_ used. It should
  48. * apparently have a mapping in the corresponding page table for
  49. * compatibility with future CPUs that _could_ require it. For instance we
  50. * don't care.
  51. *
  52. * This must be aligned on a 2*CACHESIZE boundary. The code selects one of
  53. * the 2 areas in alternance each time the clean_d_cache macro is used.
  54. * Without this the XScale core exhibits cache eviction problems and no one
  55. * knows why.
  56. *
  57. * Reminder: the vector table is located at 0xffff0000-0xffff0fff.
  58. */
  59. #define CLEAN_ADDR 0xfffe0000
  60. /*
  61. * This macro is used to wait for a CP15 write and is needed
  62. * when we have to ensure that the last operation to the co-pro
  63. * was completed before continuing with operation.
  64. */
  65. .macro cpwait, rd
  66. mrc p15, 0, \rd, c2, c0, 0 @ arbitrary read of cp15
  67. mov \rd, \rd @ wait for completion
  68. sub pc, pc, #4 @ flush instruction pipeline
  69. .endm
  70. .macro cpwait_ret, lr, rd
  71. mrc p15, 0, \rd, c2, c0, 0 @ arbitrary read of cp15
  72. sub pc, \lr, \rd, LSR #32 @ wait for completion and
  73. @ flush instruction pipeline
  74. .endm
  75. /*
  76. * This macro cleans the entire dcache using line allocate.
  77. * The main loop has been unrolled to reduce loop overhead.
  78. * rd and rs are two scratch registers.
  79. */
  80. .macro clean_d_cache, rd, rs
  81. ldr \rs, =clean_addr
  82. ldr \rd, [\rs]
  83. eor \rd, \rd, #CACHESIZE
  84. str \rd, [\rs]
  85. add \rs, \rd, #CACHESIZE
  86. 1: mcr p15, 0, \rd, c7, c2, 5 @ allocate D cache line
  87. add \rd, \rd, #CACHELINESIZE
  88. mcr p15, 0, \rd, c7, c2, 5 @ allocate D cache line
  89. add \rd, \rd, #CACHELINESIZE
  90. mcr p15, 0, \rd, c7, c2, 5 @ allocate D cache line
  91. add \rd, \rd, #CACHELINESIZE
  92. mcr p15, 0, \rd, c7, c2, 5 @ allocate D cache line
  93. add \rd, \rd, #CACHELINESIZE
  94. teq \rd, \rs
  95. bne 1b
  96. .endm
  97. .data
  98. clean_addr: .word CLEAN_ADDR
  99. .text
  100. /*
  101. * cpu_xscale_proc_init()
  102. *
  103. * Nothing too exciting at the moment
  104. */
  105. ENTRY(cpu_xscale_proc_init)
  106. @ enable write buffer coalescing. Some bootloader disable it
  107. mrc p15, 0, r1, c1, c0, 1
  108. bic r1, r1, #1
  109. mcr p15, 0, r1, c1, c0, 1
  110. mov pc, lr
  111. /*
  112. * cpu_xscale_proc_fin()
  113. */
  114. ENTRY(cpu_xscale_proc_fin)
  115. mrc p15, 0, r0, c1, c0, 0 @ ctrl register
  116. bic r0, r0, #0x1800 @ ...IZ...........
  117. bic r0, r0, #0x0006 @ .............CA.
  118. mcr p15, 0, r0, c1, c0, 0 @ disable caches
  119. mov pc, lr
  120. /*
  121. * cpu_xscale_reset(loc)
  122. *
  123. * Perform a soft reset of the system. Put the CPU into the
  124. * same state as it would be if it had been reset, and branch
  125. * to what would be the reset vector.
  126. *
  127. * loc: location to jump to for soft reset
  128. *
  129. * Beware PXA270 erratum E7.
  130. */
  131. .align 5
  132. ENTRY(cpu_xscale_reset)
  133. mov r1, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
  134. msr cpsr_c, r1 @ reset CPSR
  135. mcr p15, 0, r1, c10, c4, 1 @ unlock I-TLB
  136. mcr p15, 0, r1, c8, c5, 0 @ invalidate I-TLB
  137. mrc p15, 0, r1, c1, c0, 0 @ ctrl register
  138. bic r1, r1, #0x0086 @ ........B....CA.
  139. bic r1, r1, #0x3900 @ ..VIZ..S........
  140. sub pc, pc, #4 @ flush pipeline
  141. @ *** cache line aligned ***
  142. mcr p15, 0, r1, c1, c0, 0 @ ctrl register
  143. bic r1, r1, #0x0001 @ ...............M
  144. mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches & BTB
  145. mcr p15, 0, r1, c1, c0, 0 @ ctrl register
  146. @ CAUTION: MMU turned off from this point. We count on the pipeline
  147. @ already containing those two last instructions to survive.
  148. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  149. mov pc, r0
  150. /*
  151. * cpu_xscale_do_idle()
  152. *
  153. * Cause the processor to idle
  154. *
  155. * For now we do nothing but go to idle mode for every case
  156. *
  157. * XScale supports clock switching, but using idle mode support
  158. * allows external hardware to react to system state changes.
  159. */
  160. .align 5
  161. ENTRY(cpu_xscale_do_idle)
  162. mov r0, #1
  163. mcr p14, 0, r0, c7, c0, 0 @ Go to IDLE
  164. mov pc, lr
  165. /* ================================= CACHE ================================ */
  166. /*
  167. * flush_icache_all()
  168. *
  169. * Unconditionally clean and invalidate the entire icache.
  170. */
  171. ENTRY(xscale_flush_icache_all)
  172. mov r0, #0
  173. mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
  174. mov pc, lr
  175. ENDPROC(xscale_flush_icache_all)
  176. /*
  177. * flush_user_cache_all()
  178. *
  179. * Invalidate all cache entries in a particular address
  180. * space.
  181. */
  182. ENTRY(xscale_flush_user_cache_all)
  183. /* FALLTHROUGH */
  184. /*
  185. * flush_kern_cache_all()
  186. *
  187. * Clean and invalidate the entire cache.
  188. */
  189. ENTRY(xscale_flush_kern_cache_all)
  190. mov r2, #VM_EXEC
  191. mov ip, #0
  192. __flush_whole_cache:
  193. clean_d_cache r0, r1
  194. tst r2, #VM_EXEC
  195. mcrne p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
  196. mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  197. mov pc, lr
  198. /*
  199. * flush_user_cache_range(start, end, vm_flags)
  200. *
  201. * Invalidate a range of cache entries in the specified
  202. * address space.
  203. *
  204. * - start - start address (may not be aligned)
  205. * - end - end address (exclusive, may not be aligned)
  206. * - vma - vma_area_struct describing address space
  207. */
  208. .align 5
  209. ENTRY(xscale_flush_user_cache_range)
  210. mov ip, #0
  211. sub r3, r1, r0 @ calculate total size
  212. cmp r3, #MAX_AREA_SIZE
  213. bhs __flush_whole_cache
  214. 1: tst r2, #VM_EXEC
  215. mcrne p15, 0, r0, c7, c5, 1 @ Invalidate I cache line
  216. mcr p15, 0, r0, c7, c10, 1 @ Clean D cache line
  217. mcr p15, 0, r0, c7, c6, 1 @ Invalidate D cache line
  218. add r0, r0, #CACHELINESIZE
  219. cmp r0, r1
  220. blo 1b
  221. tst r2, #VM_EXEC
  222. mcrne p15, 0, ip, c7, c5, 6 @ Invalidate BTB
  223. mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  224. mov pc, lr
  225. /*
  226. * coherent_kern_range(start, end)
  227. *
  228. * Ensure coherency between the Icache and the Dcache in the
  229. * region described by start. If you have non-snooping
  230. * Harvard caches, you need to implement this function.
  231. *
  232. * - start - virtual start address
  233. * - end - virtual end address
  234. *
  235. * Note: single I-cache line invalidation isn't used here since
  236. * it also trashes the mini I-cache used by JTAG debuggers.
  237. */
  238. ENTRY(xscale_coherent_kern_range)
  239. bic r0, r0, #CACHELINESIZE - 1
  240. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  241. add r0, r0, #CACHELINESIZE
  242. cmp r0, r1
  243. blo 1b
  244. mov r0, #0
  245. mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
  246. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  247. mov pc, lr
  248. /*
  249. * coherent_user_range(start, end)
  250. *
  251. * Ensure coherency between the Icache and the Dcache in the
  252. * region described by start. If you have non-snooping
  253. * Harvard caches, you need to implement this function.
  254. *
  255. * - start - virtual start address
  256. * - end - virtual end address
  257. */
  258. ENTRY(xscale_coherent_user_range)
  259. bic r0, r0, #CACHELINESIZE - 1
  260. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  261. mcr p15, 0, r0, c7, c5, 1 @ Invalidate I cache entry
  262. add r0, r0, #CACHELINESIZE
  263. cmp r0, r1
  264. blo 1b
  265. mov r0, #0
  266. mcr p15, 0, r0, c7, c5, 6 @ Invalidate BTB
  267. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  268. mov pc, lr
  269. /*
  270. * flush_kern_dcache_area(void *addr, size_t size)
  271. *
  272. * Ensure no D cache aliasing occurs, either with itself or
  273. * the I cache
  274. *
  275. * - addr - kernel address
  276. * - size - region size
  277. */
  278. ENTRY(xscale_flush_kern_dcache_area)
  279. add r1, r0, r1
  280. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  281. mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  282. add r0, r0, #CACHELINESIZE
  283. cmp r0, r1
  284. blo 1b
  285. mov r0, #0
  286. mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
  287. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  288. mov pc, lr
  289. /*
  290. * dma_inv_range(start, end)
  291. *
  292. * Invalidate (discard) the specified virtual address range.
  293. * May not write back any entries. If 'start' or 'end'
  294. * are not cache line aligned, those lines must be written
  295. * back.
  296. *
  297. * - start - virtual start address
  298. * - end - virtual end address
  299. */
  300. xscale_dma_inv_range:
  301. tst r0, #CACHELINESIZE - 1
  302. bic r0, r0, #CACHELINESIZE - 1
  303. mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
  304. tst r1, #CACHELINESIZE - 1
  305. mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
  306. 1: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  307. add r0, r0, #CACHELINESIZE
  308. cmp r0, r1
  309. blo 1b
  310. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  311. mov pc, lr
  312. /*
  313. * dma_clean_range(start, end)
  314. *
  315. * Clean the specified virtual address range.
  316. *
  317. * - start - virtual start address
  318. * - end - virtual end address
  319. */
  320. xscale_dma_clean_range:
  321. bic r0, r0, #CACHELINESIZE - 1
  322. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  323. add r0, r0, #CACHELINESIZE
  324. cmp r0, r1
  325. blo 1b
  326. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  327. mov pc, lr
  328. /*
  329. * dma_flush_range(start, end)
  330. *
  331. * Clean and invalidate the specified virtual address range.
  332. *
  333. * - start - virtual start address
  334. * - end - virtual end address
  335. */
  336. ENTRY(xscale_dma_flush_range)
  337. bic r0, r0, #CACHELINESIZE - 1
  338. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  339. mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  340. add r0, r0, #CACHELINESIZE
  341. cmp r0, r1
  342. blo 1b
  343. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  344. mov pc, lr
  345. /*
  346. * dma_map_area(start, size, dir)
  347. * - start - kernel virtual start address
  348. * - size - size of region
  349. * - dir - DMA direction
  350. */
  351. ENTRY(xscale_dma_map_area)
  352. add r1, r1, r0
  353. cmp r2, #DMA_TO_DEVICE
  354. beq xscale_dma_clean_range
  355. bcs xscale_dma_inv_range
  356. b xscale_dma_flush_range
  357. ENDPROC(xscale_dma_map_area)
  358. /*
  359. * dma_map_area(start, size, dir)
  360. * - start - kernel virtual start address
  361. * - size - size of region
  362. * - dir - DMA direction
  363. */
  364. ENTRY(xscale_dma_a0_map_area)
  365. add r1, r1, r0
  366. teq r2, #DMA_TO_DEVICE
  367. beq xscale_dma_clean_range
  368. b xscale_dma_flush_range
  369. ENDPROC(xscsale_dma_a0_map_area)
  370. /*
  371. * dma_unmap_area(start, size, dir)
  372. * - start - kernel virtual start address
  373. * - size - size of region
  374. * - dir - DMA direction
  375. */
  376. ENTRY(xscale_dma_unmap_area)
  377. mov pc, lr
  378. ENDPROC(xscale_dma_unmap_area)
  379. ENTRY(xscale_cache_fns)
  380. .long xscale_flush_icache_all
  381. .long xscale_flush_kern_cache_all
  382. .long xscale_flush_user_cache_all
  383. .long xscale_flush_user_cache_range
  384. .long xscale_coherent_kern_range
  385. .long xscale_coherent_user_range
  386. .long xscale_flush_kern_dcache_area
  387. .long xscale_dma_map_area
  388. .long xscale_dma_unmap_area
  389. .long xscale_dma_flush_range
  390. /*
  391. * On stepping A0/A1 of the 80200, invalidating D-cache by line doesn't
  392. * clear the dirty bits, which means that if we invalidate a dirty line,
  393. * the dirty data can still be written back to external memory later on.
  394. *
  395. * The recommended workaround is to always do a clean D-cache line before
  396. * doing an invalidate D-cache line, so on the affected processors,
  397. * dma_inv_range() is implemented as dma_flush_range().
  398. *
  399. * See erratum #25 of "Intel 80200 Processor Specification Update",
  400. * revision January 22, 2003, available at:
  401. * http://www.intel.com/design/iio/specupdt/273415.htm
  402. */
  403. ENTRY(xscale_80200_A0_A1_cache_fns)
  404. .long xscale_flush_kern_cache_all
  405. .long xscale_flush_user_cache_all
  406. .long xscale_flush_user_cache_range
  407. .long xscale_coherent_kern_range
  408. .long xscale_coherent_user_range
  409. .long xscale_flush_kern_dcache_area
  410. .long xscale_dma_a0_map_area
  411. .long xscale_dma_unmap_area
  412. .long xscale_dma_flush_range
  413. ENTRY(cpu_xscale_dcache_clean_area)
  414. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  415. add r0, r0, #CACHELINESIZE
  416. subs r1, r1, #CACHELINESIZE
  417. bhi 1b
  418. mov pc, lr
  419. /* =============================== PageTable ============================== */
  420. /*
  421. * cpu_xscale_switch_mm(pgd)
  422. *
  423. * Set the translation base pointer to be as described by pgd.
  424. *
  425. * pgd: new page tables
  426. */
  427. .align 5
  428. ENTRY(cpu_xscale_switch_mm)
  429. clean_d_cache r1, r2
  430. mcr p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
  431. mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  432. mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
  433. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  434. cpwait_ret lr, ip
  435. /*
  436. * cpu_xscale_set_pte_ext(ptep, pte, ext)
  437. *
  438. * Set a PTE and flush it out
  439. *
  440. * Errata 40: must set memory to write-through for user read-only pages.
  441. */
  442. cpu_xscale_mt_table:
  443. .long 0x00 @ L_PTE_MT_UNCACHED
  444. .long PTE_BUFFERABLE @ L_PTE_MT_BUFFERABLE
  445. .long PTE_CACHEABLE @ L_PTE_MT_WRITETHROUGH
  446. .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEBACK
  447. .long PTE_EXT_TEX(1) | PTE_BUFFERABLE @ L_PTE_MT_DEV_SHARED
  448. .long 0x00 @ unused
  449. .long PTE_EXT_TEX(1) | PTE_CACHEABLE @ L_PTE_MT_MINICACHE
  450. .long PTE_EXT_TEX(1) | PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEALLOC
  451. .long 0x00 @ unused
  452. .long PTE_BUFFERABLE @ L_PTE_MT_DEV_WC
  453. .long 0x00 @ unused
  454. .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_DEV_CACHED
  455. .long 0x00 @ L_PTE_MT_DEV_NONSHARED
  456. .long 0x00 @ unused
  457. .long 0x00 @ unused
  458. .long 0x00 @ unused
  459. .align 5
  460. ENTRY(cpu_xscale_set_pte_ext)
  461. xscale_set_pte_ext_prologue
  462. @
  463. @ Erratum 40: must set memory to write-through for user read-only pages
  464. @
  465. and ip, r1, #(L_PTE_MT_MASK | L_PTE_USER | L_PTE_RDONLY) & ~(4 << 2)
  466. teq ip, #L_PTE_MT_WRITEBACK | L_PTE_USER | L_PTE_RDONLY
  467. moveq r1, #L_PTE_MT_WRITETHROUGH
  468. and r1, r1, #L_PTE_MT_MASK
  469. adr ip, cpu_xscale_mt_table
  470. ldr ip, [ip, r1]
  471. bic r2, r2, #0x0c
  472. orr r2, r2, ip
  473. xscale_set_pte_ext_epilogue
  474. mov pc, lr
  475. .ltorg
  476. .align
  477. .globl cpu_xscale_suspend_size
  478. .equ cpu_xscale_suspend_size, 4 * 7
  479. #ifdef CONFIG_PM
  480. ENTRY(cpu_xscale_do_suspend)
  481. stmfd sp!, {r4 - r10, lr}
  482. mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
  483. mrc p15, 0, r5, c15, c1, 0 @ CP access reg
  484. mrc p15, 0, r6, c13, c0, 0 @ PID
  485. mrc p15, 0, r7, c3, c0, 0 @ domain ID
  486. mrc p15, 0, r8, c2, c0, 0 @ translation table base addr
  487. mrc p15, 0, r9, c1, c1, 0 @ auxiliary control reg
  488. mrc p15, 0, r10, c1, c0, 0 @ control reg
  489. bic r4, r4, #2 @ clear frequency change bit
  490. stmia r0, {r4 - r10} @ store cp regs
  491. ldmfd sp!, {r4 - r10, pc}
  492. ENDPROC(cpu_xscale_do_suspend)
  493. ENTRY(cpu_xscale_do_resume)
  494. ldmia r0, {r4 - r10} @ load cp regs
  495. mov ip, #0
  496. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  497. mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB
  498. mcr p14, 0, r4, c6, c0, 0 @ clock configuration, turbo mode.
  499. mcr p15, 0, r5, c15, c1, 0 @ CP access reg
  500. mcr p15, 0, r6, c13, c0, 0 @ PID
  501. mcr p15, 0, r7, c3, c0, 0 @ domain ID
  502. mcr p15, 0, r8, c2, c0, 0 @ translation table base addr
  503. mcr p15, 0, r9, c1, c1, 0 @ auxiliary control reg
  504. mov r0, r10 @ control register
  505. mov r2, r8, lsr #14 @ get TTB0 base
  506. mov r2, r2, lsl #14
  507. ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \
  508. PMD_SECT_CACHEABLE | PMD_SECT_AP_WRITE
  509. b cpu_resume_mmu
  510. ENDPROC(cpu_xscale_do_resume)
  511. #else
  512. #define cpu_xscale_do_suspend 0
  513. #define cpu_xscale_do_resume 0
  514. #endif
  515. __CPUINIT
  516. .type __xscale_setup, #function
  517. __xscale_setup:
  518. mcr p15, 0, ip, c7, c7, 0 @ invalidate I, D caches & BTB
  519. mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  520. mcr p15, 0, ip, c8, c7, 0 @ invalidate I, D TLBs
  521. mov r0, #1 << 6 @ cp6 for IOP3xx and Bulverde
  522. orr r0, r0, #1 << 13 @ Its undefined whether this
  523. mcr p15, 0, r0, c15, c1, 0 @ affects USR or SVC modes
  524. adr r5, xscale_crval
  525. ldmia r5, {r5, r6}
  526. mrc p15, 0, r0, c1, c0, 0 @ get control register
  527. bic r0, r0, r5
  528. orr r0, r0, r6
  529. mov pc, lr
  530. .size __xscale_setup, . - __xscale_setup
  531. /*
  532. * R
  533. * .RVI ZFRS BLDP WCAM
  534. * ..11 1.01 .... .101
  535. *
  536. */
  537. .type xscale_crval, #object
  538. xscale_crval:
  539. crval clear=0x00003b07, mmuset=0x00003905, ucset=0x00001900
  540. __INITDATA
  541. /*
  542. * Purpose : Function pointers used to access above functions - all calls
  543. * come through these
  544. */
  545. .type xscale_processor_functions, #object
  546. ENTRY(xscale_processor_functions)
  547. .word v5t_early_abort
  548. .word legacy_pabort
  549. .word cpu_xscale_proc_init
  550. .word cpu_xscale_proc_fin
  551. .word cpu_xscale_reset
  552. .word cpu_xscale_do_idle
  553. .word cpu_xscale_dcache_clean_area
  554. .word cpu_xscale_switch_mm
  555. .word cpu_xscale_set_pte_ext
  556. .word cpu_xscale_suspend_size
  557. .word cpu_xscale_do_suspend
  558. .word cpu_xscale_do_resume
  559. .size xscale_processor_functions, . - xscale_processor_functions
  560. .section ".rodata"
  561. .type cpu_arch_name, #object
  562. cpu_arch_name:
  563. .asciz "armv5te"
  564. .size cpu_arch_name, . - cpu_arch_name
  565. .type cpu_elf_name, #object
  566. cpu_elf_name:
  567. .asciz "v5"
  568. .size cpu_elf_name, . - cpu_elf_name
  569. .type cpu_80200_A0_A1_name, #object
  570. cpu_80200_A0_A1_name:
  571. .asciz "XScale-80200 A0/A1"
  572. .size cpu_80200_A0_A1_name, . - cpu_80200_A0_A1_name
  573. .type cpu_80200_name, #object
  574. cpu_80200_name:
  575. .asciz "XScale-80200"
  576. .size cpu_80200_name, . - cpu_80200_name
  577. .type cpu_80219_name, #object
  578. cpu_80219_name:
  579. .asciz "XScale-80219"
  580. .size cpu_80219_name, . - cpu_80219_name
  581. .type cpu_8032x_name, #object
  582. cpu_8032x_name:
  583. .asciz "XScale-IOP8032x Family"
  584. .size cpu_8032x_name, . - cpu_8032x_name
  585. .type cpu_8033x_name, #object
  586. cpu_8033x_name:
  587. .asciz "XScale-IOP8033x Family"
  588. .size cpu_8033x_name, . - cpu_8033x_name
  589. .type cpu_pxa250_name, #object
  590. cpu_pxa250_name:
  591. .asciz "XScale-PXA250"
  592. .size cpu_pxa250_name, . - cpu_pxa250_name
  593. .type cpu_pxa210_name, #object
  594. cpu_pxa210_name:
  595. .asciz "XScale-PXA210"
  596. .size cpu_pxa210_name, . - cpu_pxa210_name
  597. .type cpu_ixp42x_name, #object
  598. cpu_ixp42x_name:
  599. .asciz "XScale-IXP42x Family"
  600. .size cpu_ixp42x_name, . - cpu_ixp42x_name
  601. .type cpu_ixp43x_name, #object
  602. cpu_ixp43x_name:
  603. .asciz "XScale-IXP43x Family"
  604. .size cpu_ixp43x_name, . - cpu_ixp43x_name
  605. .type cpu_ixp46x_name, #object
  606. cpu_ixp46x_name:
  607. .asciz "XScale-IXP46x Family"
  608. .size cpu_ixp46x_name, . - cpu_ixp46x_name
  609. .type cpu_ixp2400_name, #object
  610. cpu_ixp2400_name:
  611. .asciz "XScale-IXP2400"
  612. .size cpu_ixp2400_name, . - cpu_ixp2400_name
  613. .type cpu_ixp2800_name, #object
  614. cpu_ixp2800_name:
  615. .asciz "XScale-IXP2800"
  616. .size cpu_ixp2800_name, . - cpu_ixp2800_name
  617. .type cpu_pxa255_name, #object
  618. cpu_pxa255_name:
  619. .asciz "XScale-PXA255"
  620. .size cpu_pxa255_name, . - cpu_pxa255_name
  621. .type cpu_pxa270_name, #object
  622. cpu_pxa270_name:
  623. .asciz "XScale-PXA270"
  624. .size cpu_pxa270_name, . - cpu_pxa270_name
  625. .align
  626. .section ".proc.info.init", #alloc, #execinstr
  627. .type __80200_A0_A1_proc_info,#object
  628. __80200_A0_A1_proc_info:
  629. .long 0x69052000
  630. .long 0xfffffffe
  631. .long PMD_TYPE_SECT | \
  632. PMD_SECT_BUFFERABLE | \
  633. PMD_SECT_CACHEABLE | \
  634. PMD_SECT_AP_WRITE | \
  635. PMD_SECT_AP_READ
  636. .long PMD_TYPE_SECT | \
  637. PMD_SECT_AP_WRITE | \
  638. PMD_SECT_AP_READ
  639. b __xscale_setup
  640. .long cpu_arch_name
  641. .long cpu_elf_name
  642. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  643. .long cpu_80200_name
  644. .long xscale_processor_functions
  645. .long v4wbi_tlb_fns
  646. .long xscale_mc_user_fns
  647. .long xscale_80200_A0_A1_cache_fns
  648. .size __80200_A0_A1_proc_info, . - __80200_A0_A1_proc_info
  649. .type __80200_proc_info,#object
  650. __80200_proc_info:
  651. .long 0x69052000
  652. .long 0xfffffff0
  653. .long PMD_TYPE_SECT | \
  654. PMD_SECT_BUFFERABLE | \
  655. PMD_SECT_CACHEABLE | \
  656. PMD_SECT_AP_WRITE | \
  657. PMD_SECT_AP_READ
  658. .long PMD_TYPE_SECT | \
  659. PMD_SECT_AP_WRITE | \
  660. PMD_SECT_AP_READ
  661. b __xscale_setup
  662. .long cpu_arch_name
  663. .long cpu_elf_name
  664. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  665. .long cpu_80200_name
  666. .long xscale_processor_functions
  667. .long v4wbi_tlb_fns
  668. .long xscale_mc_user_fns
  669. .long xscale_cache_fns
  670. .size __80200_proc_info, . - __80200_proc_info
  671. .type __80219_proc_info,#object
  672. __80219_proc_info:
  673. .long 0x69052e20
  674. .long 0xffffffe0
  675. .long PMD_TYPE_SECT | \
  676. PMD_SECT_BUFFERABLE | \
  677. PMD_SECT_CACHEABLE | \
  678. PMD_SECT_AP_WRITE | \
  679. PMD_SECT_AP_READ
  680. .long PMD_TYPE_SECT | \
  681. PMD_SECT_AP_WRITE | \
  682. PMD_SECT_AP_READ
  683. b __xscale_setup
  684. .long cpu_arch_name
  685. .long cpu_elf_name
  686. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  687. .long cpu_80219_name
  688. .long xscale_processor_functions
  689. .long v4wbi_tlb_fns
  690. .long xscale_mc_user_fns
  691. .long xscale_cache_fns
  692. .size __80219_proc_info, . - __80219_proc_info
  693. .type __8032x_proc_info,#object
  694. __8032x_proc_info:
  695. .long 0x69052420
  696. .long 0xfffff7e0
  697. .long PMD_TYPE_SECT | \
  698. PMD_SECT_BUFFERABLE | \
  699. PMD_SECT_CACHEABLE | \
  700. PMD_SECT_AP_WRITE | \
  701. PMD_SECT_AP_READ
  702. .long PMD_TYPE_SECT | \
  703. PMD_SECT_AP_WRITE | \
  704. PMD_SECT_AP_READ
  705. b __xscale_setup
  706. .long cpu_arch_name
  707. .long cpu_elf_name
  708. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  709. .long cpu_8032x_name
  710. .long xscale_processor_functions
  711. .long v4wbi_tlb_fns
  712. .long xscale_mc_user_fns
  713. .long xscale_cache_fns
  714. .size __8032x_proc_info, . - __8032x_proc_info
  715. .type __8033x_proc_info,#object
  716. __8033x_proc_info:
  717. .long 0x69054010
  718. .long 0xfffffd30
  719. .long PMD_TYPE_SECT | \
  720. PMD_SECT_BUFFERABLE | \
  721. PMD_SECT_CACHEABLE | \
  722. PMD_SECT_AP_WRITE | \
  723. PMD_SECT_AP_READ
  724. .long PMD_TYPE_SECT | \
  725. PMD_SECT_AP_WRITE | \
  726. PMD_SECT_AP_READ
  727. b __xscale_setup
  728. .long cpu_arch_name
  729. .long cpu_elf_name
  730. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  731. .long cpu_8033x_name
  732. .long xscale_processor_functions
  733. .long v4wbi_tlb_fns
  734. .long xscale_mc_user_fns
  735. .long xscale_cache_fns
  736. .size __8033x_proc_info, . - __8033x_proc_info
  737. .type __pxa250_proc_info,#object
  738. __pxa250_proc_info:
  739. .long 0x69052100
  740. .long 0xfffff7f0
  741. .long PMD_TYPE_SECT | \
  742. PMD_SECT_BUFFERABLE | \
  743. PMD_SECT_CACHEABLE | \
  744. PMD_SECT_AP_WRITE | \
  745. PMD_SECT_AP_READ
  746. .long PMD_TYPE_SECT | \
  747. PMD_SECT_AP_WRITE | \
  748. PMD_SECT_AP_READ
  749. b __xscale_setup
  750. .long cpu_arch_name
  751. .long cpu_elf_name
  752. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  753. .long cpu_pxa250_name
  754. .long xscale_processor_functions
  755. .long v4wbi_tlb_fns
  756. .long xscale_mc_user_fns
  757. .long xscale_cache_fns
  758. .size __pxa250_proc_info, . - __pxa250_proc_info
  759. .type __pxa210_proc_info,#object
  760. __pxa210_proc_info:
  761. .long 0x69052120
  762. .long 0xfffff3f0
  763. .long PMD_TYPE_SECT | \
  764. PMD_SECT_BUFFERABLE | \
  765. PMD_SECT_CACHEABLE | \
  766. PMD_SECT_AP_WRITE | \
  767. PMD_SECT_AP_READ
  768. .long PMD_TYPE_SECT | \
  769. PMD_SECT_AP_WRITE | \
  770. PMD_SECT_AP_READ
  771. b __xscale_setup
  772. .long cpu_arch_name
  773. .long cpu_elf_name
  774. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  775. .long cpu_pxa210_name
  776. .long xscale_processor_functions
  777. .long v4wbi_tlb_fns
  778. .long xscale_mc_user_fns
  779. .long xscale_cache_fns
  780. .size __pxa210_proc_info, . - __pxa210_proc_info
  781. .type __ixp2400_proc_info, #object
  782. __ixp2400_proc_info:
  783. .long 0x69054190
  784. .long 0xfffffff0
  785. .long PMD_TYPE_SECT | \
  786. PMD_SECT_BUFFERABLE | \
  787. PMD_SECT_CACHEABLE | \
  788. PMD_SECT_AP_WRITE | \
  789. PMD_SECT_AP_READ
  790. .long PMD_TYPE_SECT | \
  791. PMD_SECT_AP_WRITE | \
  792. PMD_SECT_AP_READ
  793. b __xscale_setup
  794. .long cpu_arch_name
  795. .long cpu_elf_name
  796. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  797. .long cpu_ixp2400_name
  798. .long xscale_processor_functions
  799. .long v4wbi_tlb_fns
  800. .long xscale_mc_user_fns
  801. .long xscale_cache_fns
  802. .size __ixp2400_proc_info, . - __ixp2400_proc_info
  803. .type __ixp2800_proc_info, #object
  804. __ixp2800_proc_info:
  805. .long 0x690541a0
  806. .long 0xfffffff0
  807. .long PMD_TYPE_SECT | \
  808. PMD_SECT_BUFFERABLE | \
  809. PMD_SECT_CACHEABLE | \
  810. PMD_SECT_AP_WRITE | \
  811. PMD_SECT_AP_READ
  812. .long PMD_TYPE_SECT | \
  813. PMD_SECT_AP_WRITE | \
  814. PMD_SECT_AP_READ
  815. b __xscale_setup
  816. .long cpu_arch_name
  817. .long cpu_elf_name
  818. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  819. .long cpu_ixp2800_name
  820. .long xscale_processor_functions
  821. .long v4wbi_tlb_fns
  822. .long xscale_mc_user_fns
  823. .long xscale_cache_fns
  824. .size __ixp2800_proc_info, . - __ixp2800_proc_info
  825. .type __ixp42x_proc_info, #object
  826. __ixp42x_proc_info:
  827. .long 0x690541c0
  828. .long 0xffffffc0
  829. .long PMD_TYPE_SECT | \
  830. PMD_SECT_BUFFERABLE | \
  831. PMD_SECT_CACHEABLE | \
  832. PMD_SECT_AP_WRITE | \
  833. PMD_SECT_AP_READ
  834. .long PMD_TYPE_SECT | \
  835. PMD_SECT_AP_WRITE | \
  836. PMD_SECT_AP_READ
  837. b __xscale_setup
  838. .long cpu_arch_name
  839. .long cpu_elf_name
  840. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  841. .long cpu_ixp42x_name
  842. .long xscale_processor_functions
  843. .long v4wbi_tlb_fns
  844. .long xscale_mc_user_fns
  845. .long xscale_cache_fns
  846. .size __ixp42x_proc_info, . - __ixp42x_proc_info
  847. .type __ixp43x_proc_info, #object
  848. __ixp43x_proc_info:
  849. .long 0x69054040
  850. .long 0xfffffff0
  851. .long PMD_TYPE_SECT | \
  852. PMD_SECT_BUFFERABLE | \
  853. PMD_SECT_CACHEABLE | \
  854. PMD_SECT_AP_WRITE | \
  855. PMD_SECT_AP_READ
  856. .long PMD_TYPE_SECT | \
  857. PMD_SECT_AP_WRITE | \
  858. PMD_SECT_AP_READ
  859. b __xscale_setup
  860. .long cpu_arch_name
  861. .long cpu_elf_name
  862. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  863. .long cpu_ixp43x_name
  864. .long xscale_processor_functions
  865. .long v4wbi_tlb_fns
  866. .long xscale_mc_user_fns
  867. .long xscale_cache_fns
  868. .size __ixp43x_proc_info, . - __ixp43x_proc_info
  869. .type __ixp46x_proc_info, #object
  870. __ixp46x_proc_info:
  871. .long 0x69054200
  872. .long 0xffffff00
  873. .long PMD_TYPE_SECT | \
  874. PMD_SECT_BUFFERABLE | \
  875. PMD_SECT_CACHEABLE | \
  876. PMD_SECT_AP_WRITE | \
  877. PMD_SECT_AP_READ
  878. .long PMD_TYPE_SECT | \
  879. PMD_SECT_AP_WRITE | \
  880. PMD_SECT_AP_READ
  881. b __xscale_setup
  882. .long cpu_arch_name
  883. .long cpu_elf_name
  884. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  885. .long cpu_ixp46x_name
  886. .long xscale_processor_functions
  887. .long v4wbi_tlb_fns
  888. .long xscale_mc_user_fns
  889. .long xscale_cache_fns
  890. .size __ixp46x_proc_info, . - __ixp46x_proc_info
  891. .type __pxa255_proc_info,#object
  892. __pxa255_proc_info:
  893. .long 0x69052d00
  894. .long 0xfffffff0
  895. .long PMD_TYPE_SECT | \
  896. PMD_SECT_BUFFERABLE | \
  897. PMD_SECT_CACHEABLE | \
  898. PMD_SECT_AP_WRITE | \
  899. PMD_SECT_AP_READ
  900. .long PMD_TYPE_SECT | \
  901. PMD_SECT_AP_WRITE | \
  902. PMD_SECT_AP_READ
  903. b __xscale_setup
  904. .long cpu_arch_name
  905. .long cpu_elf_name
  906. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  907. .long cpu_pxa255_name
  908. .long xscale_processor_functions
  909. .long v4wbi_tlb_fns
  910. .long xscale_mc_user_fns
  911. .long xscale_cache_fns
  912. .size __pxa255_proc_info, . - __pxa255_proc_info
  913. .type __pxa270_proc_info,#object
  914. __pxa270_proc_info:
  915. .long 0x69054110
  916. .long 0xfffffff0
  917. .long PMD_TYPE_SECT | \
  918. PMD_SECT_BUFFERABLE | \
  919. PMD_SECT_CACHEABLE | \
  920. PMD_SECT_AP_WRITE | \
  921. PMD_SECT_AP_READ
  922. .long PMD_TYPE_SECT | \
  923. PMD_SECT_AP_WRITE | \
  924. PMD_SECT_AP_READ
  925. b __xscale_setup
  926. .long cpu_arch_name
  927. .long cpu_elf_name
  928. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  929. .long cpu_pxa270_name
  930. .long xscale_processor_functions
  931. .long v4wbi_tlb_fns
  932. .long xscale_mc_user_fns
  933. .long xscale_cache_fns
  934. .size __pxa270_proc_info, . - __pxa270_proc_info