proc-xscale.S 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  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. .align 2
  99. clean_addr: .word CLEAN_ADDR
  100. .text
  101. /*
  102. * cpu_xscale_proc_init()
  103. *
  104. * Nothing too exciting at the moment
  105. */
  106. ENTRY(cpu_xscale_proc_init)
  107. @ enable write buffer coalescing. Some bootloader disable it
  108. mrc p15, 0, r1, c1, c0, 1
  109. bic r1, r1, #1
  110. mcr p15, 0, r1, c1, c0, 1
  111. ret lr
  112. /*
  113. * cpu_xscale_proc_fin()
  114. */
  115. ENTRY(cpu_xscale_proc_fin)
  116. mrc p15, 0, r0, c1, c0, 0 @ ctrl register
  117. bic r0, r0, #0x1800 @ ...IZ...........
  118. bic r0, r0, #0x0006 @ .............CA.
  119. mcr p15, 0, r0, c1, c0, 0 @ disable caches
  120. ret lr
  121. /*
  122. * cpu_xscale_reset(loc)
  123. *
  124. * Perform a soft reset of the system. Put the CPU into the
  125. * same state as it would be if it had been reset, and branch
  126. * to what would be the reset vector.
  127. *
  128. * loc: location to jump to for soft reset
  129. *
  130. * Beware PXA270 erratum E7.
  131. */
  132. .align 5
  133. .pushsection .idmap.text, "ax"
  134. ENTRY(cpu_xscale_reset)
  135. mov r1, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
  136. msr cpsr_c, r1 @ reset CPSR
  137. mcr p15, 0, r1, c10, c4, 1 @ unlock I-TLB
  138. mcr p15, 0, r1, c8, c5, 0 @ invalidate I-TLB
  139. mrc p15, 0, r1, c1, c0, 0 @ ctrl register
  140. bic r1, r1, #0x0086 @ ........B....CA.
  141. bic r1, r1, #0x3900 @ ..VIZ..S........
  142. sub pc, pc, #4 @ flush pipeline
  143. @ *** cache line aligned ***
  144. mcr p15, 0, r1, c1, c0, 0 @ ctrl register
  145. bic r1, r1, #0x0001 @ ...............M
  146. mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches & BTB
  147. mcr p15, 0, r1, c1, c0, 0 @ ctrl register
  148. @ CAUTION: MMU turned off from this point. We count on the pipeline
  149. @ already containing those two last instructions to survive.
  150. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  151. ret r0
  152. ENDPROC(cpu_xscale_reset)
  153. .popsection
  154. /*
  155. * cpu_xscale_do_idle()
  156. *
  157. * Cause the processor to idle
  158. *
  159. * For now we do nothing but go to idle mode for every case
  160. *
  161. * XScale supports clock switching, but using idle mode support
  162. * allows external hardware to react to system state changes.
  163. */
  164. .align 5
  165. ENTRY(cpu_xscale_do_idle)
  166. mov r0, #1
  167. mcr p14, 0, r0, c7, c0, 0 @ Go to IDLE
  168. ret lr
  169. /* ================================= CACHE ================================ */
  170. /*
  171. * flush_icache_all()
  172. *
  173. * Unconditionally clean and invalidate the entire icache.
  174. */
  175. ENTRY(xscale_flush_icache_all)
  176. mov r0, #0
  177. mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
  178. ret lr
  179. ENDPROC(xscale_flush_icache_all)
  180. /*
  181. * flush_user_cache_all()
  182. *
  183. * Invalidate all cache entries in a particular address
  184. * space.
  185. */
  186. ENTRY(xscale_flush_user_cache_all)
  187. /* FALLTHROUGH */
  188. /*
  189. * flush_kern_cache_all()
  190. *
  191. * Clean and invalidate the entire cache.
  192. */
  193. ENTRY(xscale_flush_kern_cache_all)
  194. mov r2, #VM_EXEC
  195. mov ip, #0
  196. __flush_whole_cache:
  197. clean_d_cache r0, r1
  198. tst r2, #VM_EXEC
  199. mcrne p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
  200. mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  201. ret lr
  202. /*
  203. * flush_user_cache_range(start, end, vm_flags)
  204. *
  205. * Invalidate a range of cache entries in the specified
  206. * address space.
  207. *
  208. * - start - start address (may not be aligned)
  209. * - end - end address (exclusive, may not be aligned)
  210. * - vma - vma_area_struct describing address space
  211. */
  212. .align 5
  213. ENTRY(xscale_flush_user_cache_range)
  214. mov ip, #0
  215. sub r3, r1, r0 @ calculate total size
  216. cmp r3, #MAX_AREA_SIZE
  217. bhs __flush_whole_cache
  218. 1: tst r2, #VM_EXEC
  219. mcrne p15, 0, r0, c7, c5, 1 @ Invalidate I cache line
  220. mcr p15, 0, r0, c7, c10, 1 @ Clean D cache line
  221. mcr p15, 0, r0, c7, c6, 1 @ Invalidate D cache line
  222. add r0, r0, #CACHELINESIZE
  223. cmp r0, r1
  224. blo 1b
  225. tst r2, #VM_EXEC
  226. mcrne p15, 0, ip, c7, c5, 6 @ Invalidate BTB
  227. mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  228. ret lr
  229. /*
  230. * coherent_kern_range(start, end)
  231. *
  232. * Ensure coherency between the Icache and the Dcache in the
  233. * region described by start. If you have non-snooping
  234. * Harvard caches, you need to implement this function.
  235. *
  236. * - start - virtual start address
  237. * - end - virtual end address
  238. *
  239. * Note: single I-cache line invalidation isn't used here since
  240. * it also trashes the mini I-cache used by JTAG debuggers.
  241. */
  242. ENTRY(xscale_coherent_kern_range)
  243. bic r0, r0, #CACHELINESIZE - 1
  244. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  245. add r0, r0, #CACHELINESIZE
  246. cmp r0, r1
  247. blo 1b
  248. mov r0, #0
  249. mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
  250. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  251. ret lr
  252. /*
  253. * coherent_user_range(start, end)
  254. *
  255. * Ensure coherency between the Icache and the Dcache in the
  256. * region described by start. If you have non-snooping
  257. * Harvard caches, you need to implement this function.
  258. *
  259. * - start - virtual start address
  260. * - end - virtual end address
  261. */
  262. ENTRY(xscale_coherent_user_range)
  263. bic r0, r0, #CACHELINESIZE - 1
  264. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  265. mcr p15, 0, r0, c7, c5, 1 @ Invalidate I cache entry
  266. add r0, r0, #CACHELINESIZE
  267. cmp r0, r1
  268. blo 1b
  269. mov r0, #0
  270. mcr p15, 0, r0, c7, c5, 6 @ Invalidate BTB
  271. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  272. ret lr
  273. /*
  274. * flush_kern_dcache_area(void *addr, size_t size)
  275. *
  276. * Ensure no D cache aliasing occurs, either with itself or
  277. * the I cache
  278. *
  279. * - addr - kernel address
  280. * - size - region size
  281. */
  282. ENTRY(xscale_flush_kern_dcache_area)
  283. add r1, r0, r1
  284. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  285. mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  286. add r0, r0, #CACHELINESIZE
  287. cmp r0, r1
  288. blo 1b
  289. mov r0, #0
  290. mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
  291. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  292. ret lr
  293. /*
  294. * dma_inv_range(start, end)
  295. *
  296. * Invalidate (discard) the specified virtual address range.
  297. * May not write back any entries. If 'start' or 'end'
  298. * are not cache line aligned, those lines must be written
  299. * back.
  300. *
  301. * - start - virtual start address
  302. * - end - virtual end address
  303. */
  304. xscale_dma_inv_range:
  305. tst r0, #CACHELINESIZE - 1
  306. bic r0, r0, #CACHELINESIZE - 1
  307. mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
  308. tst r1, #CACHELINESIZE - 1
  309. mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
  310. 1: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  311. add r0, r0, #CACHELINESIZE
  312. cmp r0, r1
  313. blo 1b
  314. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  315. ret lr
  316. /*
  317. * dma_clean_range(start, end)
  318. *
  319. * Clean the specified virtual address range.
  320. *
  321. * - start - virtual start address
  322. * - end - virtual end address
  323. */
  324. xscale_dma_clean_range:
  325. bic r0, r0, #CACHELINESIZE - 1
  326. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  327. add r0, r0, #CACHELINESIZE
  328. cmp r0, r1
  329. blo 1b
  330. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  331. ret lr
  332. /*
  333. * dma_flush_range(start, end)
  334. *
  335. * Clean and invalidate the specified virtual address range.
  336. *
  337. * - start - virtual start address
  338. * - end - virtual end address
  339. */
  340. ENTRY(xscale_dma_flush_range)
  341. bic r0, r0, #CACHELINESIZE - 1
  342. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  343. mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  344. add r0, r0, #CACHELINESIZE
  345. cmp r0, r1
  346. blo 1b
  347. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  348. ret lr
  349. /*
  350. * dma_map_area(start, size, dir)
  351. * - start - kernel virtual start address
  352. * - size - size of region
  353. * - dir - DMA direction
  354. */
  355. ENTRY(xscale_dma_map_area)
  356. add r1, r1, r0
  357. cmp r2, #DMA_TO_DEVICE
  358. beq xscale_dma_clean_range
  359. bcs xscale_dma_inv_range
  360. b xscale_dma_flush_range
  361. ENDPROC(xscale_dma_map_area)
  362. /*
  363. * dma_map_area(start, size, dir)
  364. * - start - kernel virtual start address
  365. * - size - size of region
  366. * - dir - DMA direction
  367. */
  368. ENTRY(xscale_80200_A0_A1_dma_map_area)
  369. add r1, r1, r0
  370. teq r2, #DMA_TO_DEVICE
  371. beq xscale_dma_clean_range
  372. b xscale_dma_flush_range
  373. ENDPROC(xscale_80200_A0_A1_dma_map_area)
  374. /*
  375. * dma_unmap_area(start, size, dir)
  376. * - start - kernel virtual start address
  377. * - size - size of region
  378. * - dir - DMA direction
  379. */
  380. ENTRY(xscale_dma_unmap_area)
  381. ret lr
  382. ENDPROC(xscale_dma_unmap_area)
  383. .globl xscale_flush_kern_cache_louis
  384. .equ xscale_flush_kern_cache_louis, xscale_flush_kern_cache_all
  385. @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
  386. define_cache_functions xscale
  387. /*
  388. * On stepping A0/A1 of the 80200, invalidating D-cache by line doesn't
  389. * clear the dirty bits, which means that if we invalidate a dirty line,
  390. * the dirty data can still be written back to external memory later on.
  391. *
  392. * The recommended workaround is to always do a clean D-cache line before
  393. * doing an invalidate D-cache line, so on the affected processors,
  394. * dma_inv_range() is implemented as dma_flush_range().
  395. *
  396. * See erratum #25 of "Intel 80200 Processor Specification Update",
  397. * revision January 22, 2003, available at:
  398. * http://www.intel.com/design/iio/specupdt/273415.htm
  399. */
  400. .macro a0_alias basename
  401. .globl xscale_80200_A0_A1_\basename
  402. .type xscale_80200_A0_A1_\basename , %function
  403. .equ xscale_80200_A0_A1_\basename , xscale_\basename
  404. .endm
  405. /*
  406. * Most of the cache functions are unchanged for these processor revisions.
  407. * Export suitable alias symbols for the unchanged functions:
  408. */
  409. a0_alias flush_icache_all
  410. a0_alias flush_user_cache_all
  411. a0_alias flush_kern_cache_all
  412. a0_alias flush_kern_cache_louis
  413. a0_alias flush_user_cache_range
  414. a0_alias coherent_kern_range
  415. a0_alias coherent_user_range
  416. a0_alias flush_kern_dcache_area
  417. a0_alias dma_flush_range
  418. a0_alias dma_unmap_area
  419. @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
  420. define_cache_functions xscale_80200_A0_A1
  421. ENTRY(cpu_xscale_dcache_clean_area)
  422. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  423. add r0, r0, #CACHELINESIZE
  424. subs r1, r1, #CACHELINESIZE
  425. bhi 1b
  426. ret lr
  427. /* =============================== PageTable ============================== */
  428. /*
  429. * cpu_xscale_switch_mm(pgd)
  430. *
  431. * Set the translation base pointer to be as described by pgd.
  432. *
  433. * pgd: new page tables
  434. */
  435. .align 5
  436. ENTRY(cpu_xscale_switch_mm)
  437. clean_d_cache r1, r2
  438. mcr p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
  439. mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  440. mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
  441. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  442. cpwait_ret lr, ip
  443. /*
  444. * cpu_xscale_set_pte_ext(ptep, pte, ext)
  445. *
  446. * Set a PTE and flush it out
  447. *
  448. * Errata 40: must set memory to write-through for user read-only pages.
  449. */
  450. cpu_xscale_mt_table:
  451. .long 0x00 @ L_PTE_MT_UNCACHED
  452. .long PTE_BUFFERABLE @ L_PTE_MT_BUFFERABLE
  453. .long PTE_CACHEABLE @ L_PTE_MT_WRITETHROUGH
  454. .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEBACK
  455. .long PTE_EXT_TEX(1) | PTE_BUFFERABLE @ L_PTE_MT_DEV_SHARED
  456. .long 0x00 @ unused
  457. .long PTE_EXT_TEX(1) | PTE_CACHEABLE @ L_PTE_MT_MINICACHE
  458. .long PTE_EXT_TEX(1) | PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEALLOC
  459. .long 0x00 @ unused
  460. .long PTE_BUFFERABLE @ L_PTE_MT_DEV_WC
  461. .long 0x00 @ unused
  462. .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_DEV_CACHED
  463. .long 0x00 @ L_PTE_MT_DEV_NONSHARED
  464. .long 0x00 @ unused
  465. .long 0x00 @ unused
  466. .long 0x00 @ unused
  467. .align 5
  468. ENTRY(cpu_xscale_set_pte_ext)
  469. xscale_set_pte_ext_prologue
  470. @
  471. @ Erratum 40: must set memory to write-through for user read-only pages
  472. @
  473. and ip, r1, #(L_PTE_MT_MASK | L_PTE_USER | L_PTE_RDONLY) & ~(4 << 2)
  474. teq ip, #L_PTE_MT_WRITEBACK | L_PTE_USER | L_PTE_RDONLY
  475. moveq r1, #L_PTE_MT_WRITETHROUGH
  476. and r1, r1, #L_PTE_MT_MASK
  477. adr ip, cpu_xscale_mt_table
  478. ldr ip, [ip, r1]
  479. bic r2, r2, #0x0c
  480. orr r2, r2, ip
  481. xscale_set_pte_ext_epilogue
  482. ret lr
  483. .ltorg
  484. .align
  485. .globl cpu_xscale_suspend_size
  486. .equ cpu_xscale_suspend_size, 4 * 6
  487. #ifdef CONFIG_ARM_CPU_SUSPEND
  488. ENTRY(cpu_xscale_do_suspend)
  489. stmfd sp!, {r4 - r9, lr}
  490. mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
  491. mrc p15, 0, r5, c15, c1, 0 @ CP access reg
  492. mrc p15, 0, r6, c13, c0, 0 @ PID
  493. mrc p15, 0, r7, c3, c0, 0 @ domain ID
  494. mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg
  495. mrc p15, 0, r9, c1, c0, 0 @ control reg
  496. bic r4, r4, #2 @ clear frequency change bit
  497. stmia r0, {r4 - r9} @ store cp regs
  498. ldmfd sp!, {r4 - r9, pc}
  499. ENDPROC(cpu_xscale_do_suspend)
  500. ENTRY(cpu_xscale_do_resume)
  501. ldmia r0, {r4 - r9} @ load cp regs
  502. mov ip, #0
  503. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  504. mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB
  505. mcr p14, 0, r4, c6, c0, 0 @ clock configuration, turbo mode.
  506. mcr p15, 0, r5, c15, c1, 0 @ CP access reg
  507. mcr p15, 0, r6, c13, c0, 0 @ PID
  508. mcr p15, 0, r7, c3, c0, 0 @ domain ID
  509. mcr p15, 0, r1, c2, c0, 0 @ translation table base addr
  510. mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg
  511. mov r0, r9 @ control register
  512. b cpu_resume_mmu
  513. ENDPROC(cpu_xscale_do_resume)
  514. #endif
  515. .type __xscale_setup, #function
  516. __xscale_setup:
  517. mcr p15, 0, ip, c7, c7, 0 @ invalidate I, D caches & BTB
  518. mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  519. mcr p15, 0, ip, c8, c7, 0 @ invalidate I, D TLBs
  520. mov r0, #1 << 6 @ cp6 for IOP3xx and Bulverde
  521. orr r0, r0, #1 << 13 @ Its undefined whether this
  522. mcr p15, 0, r0, c15, c1, 0 @ affects USR or SVC modes
  523. adr r5, xscale_crval
  524. ldmia r5, {r5, r6}
  525. mrc p15, 0, r0, c1, c0, 0 @ get control register
  526. bic r0, r0, r5
  527. orr r0, r0, r6
  528. ret lr
  529. .size __xscale_setup, . - __xscale_setup
  530. /*
  531. * R
  532. * .RVI ZFRS BLDP WCAM
  533. * ..11 1.01 .... .101
  534. *
  535. */
  536. .type xscale_crval, #object
  537. xscale_crval:
  538. crval clear=0x00003b07, mmuset=0x00003905, ucset=0x00001900
  539. __INITDATA
  540. @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
  541. define_processor_functions xscale, dabort=v5t_early_abort, pabort=legacy_pabort, suspend=1
  542. .section ".rodata"
  543. string cpu_arch_name, "armv5te"
  544. string cpu_elf_name, "v5"
  545. string cpu_80200_A0_A1_name, "XScale-80200 A0/A1"
  546. string cpu_80200_name, "XScale-80200"
  547. string cpu_80219_name, "XScale-80219"
  548. string cpu_8032x_name, "XScale-IOP8032x Family"
  549. string cpu_8033x_name, "XScale-IOP8033x Family"
  550. string cpu_pxa250_name, "XScale-PXA250"
  551. string cpu_pxa210_name, "XScale-PXA210"
  552. string cpu_ixp42x_name, "XScale-IXP42x Family"
  553. string cpu_ixp43x_name, "XScale-IXP43x Family"
  554. string cpu_ixp46x_name, "XScale-IXP46x Family"
  555. string cpu_ixp2400_name, "XScale-IXP2400"
  556. string cpu_ixp2800_name, "XScale-IXP2800"
  557. string cpu_pxa255_name, "XScale-PXA255"
  558. string cpu_pxa270_name, "XScale-PXA270"
  559. .align
  560. .section ".proc.info.init", #alloc
  561. .macro xscale_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cache
  562. .type __\name\()_proc_info,#object
  563. __\name\()_proc_info:
  564. .long \cpu_val
  565. .long \cpu_mask
  566. .long PMD_TYPE_SECT | \
  567. PMD_SECT_BUFFERABLE | \
  568. PMD_SECT_CACHEABLE | \
  569. PMD_SECT_AP_WRITE | \
  570. PMD_SECT_AP_READ
  571. .long PMD_TYPE_SECT | \
  572. PMD_SECT_AP_WRITE | \
  573. PMD_SECT_AP_READ
  574. initfn __xscale_setup, __\name\()_proc_info
  575. .long cpu_arch_name
  576. .long cpu_elf_name
  577. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  578. .long \cpu_name
  579. .long xscale_processor_functions
  580. .long v4wbi_tlb_fns
  581. .long xscale_mc_user_fns
  582. .ifb \cache
  583. .long xscale_cache_fns
  584. .else
  585. .long \cache
  586. .endif
  587. .size __\name\()_proc_info, . - __\name\()_proc_info
  588. .endm
  589. xscale_proc_info 80200_A0_A1, 0x69052000, 0xfffffffe, cpu_80200_name, \
  590. cache=xscale_80200_A0_A1_cache_fns
  591. xscale_proc_info 80200, 0x69052000, 0xfffffff0, cpu_80200_name
  592. xscale_proc_info 80219, 0x69052e20, 0xffffffe0, cpu_80219_name
  593. xscale_proc_info 8032x, 0x69052420, 0xfffff7e0, cpu_8032x_name
  594. xscale_proc_info 8033x, 0x69054010, 0xfffffd30, cpu_8033x_name
  595. xscale_proc_info pxa250, 0x69052100, 0xfffff7f0, cpu_pxa250_name
  596. xscale_proc_info pxa210, 0x69052120, 0xfffff3f0, cpu_pxa210_name
  597. xscale_proc_info ixp2400, 0x69054190, 0xfffffff0, cpu_ixp2400_name
  598. xscale_proc_info ixp2800, 0x690541a0, 0xfffffff0, cpu_ixp2800_name
  599. xscale_proc_info ixp42x, 0x690541c0, 0xffffffc0, cpu_ixp42x_name
  600. xscale_proc_info ixp43x, 0x69054040, 0xfffffff0, cpu_ixp43x_name
  601. xscale_proc_info ixp46x, 0x69054200, 0xffffff00, cpu_ixp46x_name
  602. xscale_proc_info pxa255, 0x69052d00, 0xfffffff0, cpu_pxa255_name
  603. xscale_proc_info pxa270, 0x69054110, 0xfffffff0, cpu_pxa270_name