proc-xscale.S 18 KB

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