proc-xscale.S 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/arch/arm/mm/proc-xscale.S
  4. *
  5. * Author: Nicolas Pitre
  6. * Created: November 2000
  7. * Copyright: (C) 2000, 2001 MontaVista Software Inc.
  8. *
  9. * MMU functions for the Intel XScale CPUs
  10. *
  11. * 2001 Aug 21:
  12. * some contributions by Brett Gaines <brett.w.gaines@intel.com>
  13. * Copyright 2001 by Intel Corp.
  14. *
  15. * 2001 Sep 08:
  16. * Completely revisited, many important fixes
  17. * Nicolas Pitre <nico@fluxnic.net>
  18. */
  19. #include <linux/linkage.h>
  20. #include <linux/init.h>
  21. #include <linux/cfi_types.h>
  22. #include <linux/pgtable.h>
  23. #include <asm/assembler.h>
  24. #include <asm/hwcap.h>
  25. #include <asm/pgtable-hwdef.h>
  26. #include <asm/page.h>
  27. #include <asm/ptrace.h>
  28. #include "proc-macros.S"
  29. /*
  30. * This is the maximum size of an area which will be flushed. If the area
  31. * is larger than this, then we flush the whole cache
  32. */
  33. #define MAX_AREA_SIZE 32768
  34. /*
  35. * the cache line size of the I and D cache
  36. */
  37. #define CACHELINESIZE 32
  38. /*
  39. * the size of the data cache
  40. */
  41. #define CACHESIZE 32768
  42. /*
  43. * Virtual address used to allocate the cache when flushed
  44. *
  45. * This must be an address range which is _never_ used. It should
  46. * apparently have a mapping in the corresponding page table for
  47. * compatibility with future CPUs that _could_ require it. For instance we
  48. * don't care.
  49. *
  50. * This must be aligned on a 2*CACHESIZE boundary. The code selects one of
  51. * the 2 areas in alternance each time the clean_d_cache macro is used.
  52. * Without this the XScale core exhibits cache eviction problems and no one
  53. * knows why.
  54. *
  55. * Reminder: the vector table is located at 0xffff0000-0xffff0fff.
  56. */
  57. #define CLEAN_ADDR 0xfffe0000
  58. /*
  59. * This macro is used to wait for a CP15 write and is needed
  60. * when we have to ensure that the last operation to the co-pro
  61. * was completed before continuing with operation.
  62. */
  63. .macro cpwait, rd
  64. mrc p15, 0, \rd, c2, c0, 0 @ arbitrary read of cp15
  65. mov \rd, \rd @ wait for completion
  66. sub pc, pc, #4 @ flush instruction pipeline
  67. .endm
  68. .macro cpwait_ret, lr, rd
  69. mrc p15, 0, \rd, c2, c0, 0 @ arbitrary read of cp15
  70. sub pc, \lr, \rd, LSR #32 @ wait for completion and
  71. @ flush instruction pipeline
  72. .endm
  73. /*
  74. * This macro cleans the entire dcache using line allocate.
  75. * The main loop has been unrolled to reduce loop overhead.
  76. * rd and rs are two scratch registers.
  77. */
  78. .macro clean_d_cache, rd, rs
  79. ldr \rs, =clean_addr
  80. ldr \rd, [\rs]
  81. eor \rd, \rd, #CACHESIZE
  82. str \rd, [\rs]
  83. add \rs, \rd, #CACHESIZE
  84. 1: mcr p15, 0, \rd, c7, c2, 5 @ allocate D cache line
  85. add \rd, \rd, #CACHELINESIZE
  86. 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. teq \rd, \rs
  93. bne 1b
  94. .endm
  95. .data
  96. .align 2
  97. clean_addr: .word CLEAN_ADDR
  98. .text
  99. /*
  100. * cpu_xscale_proc_init()
  101. *
  102. * Nothing too exciting at the moment
  103. */
  104. SYM_TYPED_FUNC_START(cpu_xscale_proc_init)
  105. @ enable write buffer coalescing. Some bootloader disable it
  106. mrc p15, 0, r1, c1, c0, 1
  107. bic r1, r1, #1
  108. mcr p15, 0, r1, c1, c0, 1
  109. ret lr
  110. SYM_FUNC_END(cpu_xscale_proc_init)
  111. /*
  112. * cpu_xscale_proc_fin()
  113. */
  114. SYM_TYPED_FUNC_START(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. SYM_FUNC_END(cpu_xscale_proc_fin)
  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. SYM_TYPED_FUNC_START(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. SYM_FUNC_END(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. SYM_TYPED_FUNC_START(cpu_xscale_do_idle)
  166. mov r0, #1
  167. mcr p14, 0, r0, c7, c0, 0 @ Go to IDLE
  168. ret lr
  169. SYM_FUNC_END(cpu_xscale_do_idle)
  170. /* ================================= CACHE ================================ */
  171. /*
  172. * flush_icache_all()
  173. *
  174. * Unconditionally clean and invalidate the entire icache.
  175. */
  176. SYM_TYPED_FUNC_START(xscale_flush_icache_all)
  177. mov r0, #0
  178. mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
  179. ret lr
  180. SYM_FUNC_END(xscale_flush_icache_all)
  181. /*
  182. * flush_user_cache_all()
  183. *
  184. * Invalidate all cache entries in a particular address
  185. * space.
  186. */
  187. SYM_FUNC_ALIAS(xscale_flush_user_cache_all, xscale_flush_kern_cache_all)
  188. /*
  189. * flush_kern_cache_all()
  190. *
  191. * Clean and invalidate the entire cache.
  192. */
  193. SYM_TYPED_FUNC_START(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. SYM_FUNC_END(xscale_flush_kern_cache_all)
  203. /*
  204. * flush_user_cache_range(start, end, vm_flags)
  205. *
  206. * Invalidate a range of cache entries in the specified
  207. * address space.
  208. *
  209. * - start - start address (may not be aligned)
  210. * - end - end address (exclusive, may not be aligned)
  211. * - vma - vma_area_struct describing address space
  212. */
  213. .align 5
  214. SYM_TYPED_FUNC_START(xscale_flush_user_cache_range)
  215. mov ip, #0
  216. sub r3, r1, r0 @ calculate total size
  217. cmp r3, #MAX_AREA_SIZE
  218. bhs __flush_whole_cache
  219. 1: tst r2, #VM_EXEC
  220. mcrne p15, 0, r0, c7, c5, 1 @ Invalidate I cache line
  221. mcr p15, 0, r0, c7, c10, 1 @ Clean D cache line
  222. mcr p15, 0, r0, c7, c6, 1 @ Invalidate D cache line
  223. add r0, r0, #CACHELINESIZE
  224. cmp r0, r1
  225. blo 1b
  226. tst r2, #VM_EXEC
  227. mcrne p15, 0, ip, c7, c5, 6 @ Invalidate BTB
  228. mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  229. ret lr
  230. SYM_FUNC_END(xscale_flush_user_cache_range)
  231. /*
  232. * coherent_kern_range(start, end)
  233. *
  234. * Ensure coherency between the Icache and the Dcache in the
  235. * region described by start. If you have non-snooping
  236. * Harvard caches, you need to implement this function.
  237. *
  238. * - start - virtual start address
  239. * - end - virtual end address
  240. *
  241. * Note: single I-cache line invalidation isn't used here since
  242. * it also trashes the mini I-cache used by JTAG debuggers.
  243. */
  244. SYM_TYPED_FUNC_START(xscale_coherent_kern_range)
  245. bic r0, r0, #CACHELINESIZE - 1
  246. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  247. add r0, r0, #CACHELINESIZE
  248. cmp r0, r1
  249. blo 1b
  250. mov r0, #0
  251. mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
  252. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  253. ret lr
  254. SYM_FUNC_END(xscale_coherent_kern_range)
  255. /*
  256. * coherent_user_range(start, end)
  257. *
  258. * Ensure coherency between the Icache and the Dcache in the
  259. * region described by start. If you have non-snooping
  260. * Harvard caches, you need to implement this function.
  261. *
  262. * - start - virtual start address
  263. * - end - virtual end address
  264. */
  265. SYM_TYPED_FUNC_START(xscale_coherent_user_range)
  266. bic r0, r0, #CACHELINESIZE - 1
  267. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  268. mcr p15, 0, r0, c7, c5, 1 @ Invalidate I cache entry
  269. add r0, r0, #CACHELINESIZE
  270. cmp r0, r1
  271. blo 1b
  272. mov r0, #0
  273. mcr p15, 0, r0, c7, c5, 6 @ Invalidate BTB
  274. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  275. ret lr
  276. SYM_FUNC_END(xscale_coherent_user_range)
  277. /*
  278. * flush_kern_dcache_area(void *addr, size_t size)
  279. *
  280. * Ensure no D cache aliasing occurs, either with itself or
  281. * the I cache
  282. *
  283. * - addr - kernel address
  284. * - size - region size
  285. */
  286. SYM_TYPED_FUNC_START(xscale_flush_kern_dcache_area)
  287. add r1, r0, r1
  288. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  289. mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  290. add r0, r0, #CACHELINESIZE
  291. cmp r0, r1
  292. blo 1b
  293. mov r0, #0
  294. mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
  295. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  296. ret lr
  297. SYM_FUNC_END(xscale_flush_kern_dcache_area)
  298. /*
  299. * dma_inv_range(start, end)
  300. *
  301. * Invalidate (discard) the specified virtual address range.
  302. * May not write back any entries. If 'start' or 'end'
  303. * are not cache line aligned, those lines must be written
  304. * back.
  305. *
  306. * - start - virtual start address
  307. * - end - virtual end address
  308. */
  309. xscale_dma_inv_range:
  310. tst r0, #CACHELINESIZE - 1
  311. bic r0, r0, #CACHELINESIZE - 1
  312. mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
  313. tst r1, #CACHELINESIZE - 1
  314. mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
  315. 1: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  316. add r0, r0, #CACHELINESIZE
  317. cmp r0, r1
  318. blo 1b
  319. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  320. ret lr
  321. /*
  322. * dma_clean_range(start, end)
  323. *
  324. * Clean the specified virtual address range.
  325. *
  326. * - start - virtual start address
  327. * - end - virtual end address
  328. */
  329. xscale_dma_clean_range:
  330. bic r0, r0, #CACHELINESIZE - 1
  331. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  332. add r0, r0, #CACHELINESIZE
  333. cmp r0, r1
  334. blo 1b
  335. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  336. ret lr
  337. /*
  338. * dma_flush_range(start, end)
  339. *
  340. * Clean and invalidate the specified virtual address range.
  341. *
  342. * - start - virtual start address
  343. * - end - virtual end address
  344. */
  345. SYM_TYPED_FUNC_START(xscale_dma_flush_range)
  346. bic r0, r0, #CACHELINESIZE - 1
  347. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  348. mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  349. add r0, r0, #CACHELINESIZE
  350. cmp r0, r1
  351. blo 1b
  352. mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
  353. ret lr
  354. SYM_FUNC_END(xscale_dma_flush_range)
  355. /*
  356. * dma_map_area(start, size, dir)
  357. * - start - kernel virtual start address
  358. * - size - size of region
  359. * - dir - DMA direction
  360. */
  361. SYM_TYPED_FUNC_START(xscale_dma_map_area)
  362. add r1, r1, r0
  363. cmp r2, #DMA_TO_DEVICE
  364. beq xscale_dma_clean_range
  365. bcs xscale_dma_inv_range
  366. b xscale_dma_flush_range
  367. SYM_FUNC_END(xscale_dma_map_area)
  368. /*
  369. * On stepping A0/A1 of the 80200, invalidating D-cache by line doesn't
  370. * clear the dirty bits, which means that if we invalidate a dirty line,
  371. * the dirty data can still be written back to external memory later on.
  372. *
  373. * The recommended workaround is to always do a clean D-cache line before
  374. * doing an invalidate D-cache line, so on the affected processors,
  375. * dma_inv_range() is implemented as dma_flush_range().
  376. *
  377. * See erratum #25 of "Intel 80200 Processor Specification Update",
  378. * revision January 22, 2003, available at:
  379. * http://www.intel.com/design/iio/specupdt/273415.htm
  380. */
  381. /*
  382. * dma_map_area(start, size, dir)
  383. * - start - kernel virtual start address
  384. * - size - size of region
  385. * - dir - DMA direction
  386. */
  387. SYM_TYPED_FUNC_START(xscale_80200_A0_A1_dma_map_area)
  388. add r1, r1, r0
  389. teq r2, #DMA_TO_DEVICE
  390. beq xscale_dma_clean_range
  391. b xscale_dma_flush_range
  392. SYM_FUNC_END(xscale_80200_A0_A1_dma_map_area)
  393. /*
  394. * dma_unmap_area(start, size, dir)
  395. * - start - kernel virtual start address
  396. * - size - size of region
  397. * - dir - DMA direction
  398. */
  399. SYM_TYPED_FUNC_START(xscale_dma_unmap_area)
  400. ret lr
  401. SYM_FUNC_END(xscale_dma_unmap_area)
  402. SYM_TYPED_FUNC_START(cpu_xscale_dcache_clean_area)
  403. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  404. add r0, r0, #CACHELINESIZE
  405. subs r1, r1, #CACHELINESIZE
  406. bhi 1b
  407. ret lr
  408. SYM_FUNC_END(cpu_xscale_dcache_clean_area)
  409. /* =============================== PageTable ============================== */
  410. /*
  411. * cpu_xscale_switch_mm(pgd)
  412. *
  413. * Set the translation base pointer to be as described by pgd.
  414. *
  415. * pgd: new page tables
  416. */
  417. .align 5
  418. SYM_TYPED_FUNC_START(cpu_xscale_switch_mm)
  419. clean_d_cache r1, r2
  420. mcr p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
  421. mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  422. mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
  423. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  424. cpwait_ret lr, ip
  425. SYM_FUNC_END(cpu_xscale_switch_mm)
  426. /*
  427. * cpu_xscale_set_pte_ext(ptep, pte, ext)
  428. *
  429. * Set a PTE and flush it out
  430. *
  431. * Errata 40: must set memory to write-through for user read-only pages.
  432. */
  433. cpu_xscale_mt_table:
  434. .long 0x00 @ L_PTE_MT_UNCACHED
  435. .long PTE_BUFFERABLE @ L_PTE_MT_BUFFERABLE
  436. .long PTE_CACHEABLE @ L_PTE_MT_WRITETHROUGH
  437. .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEBACK
  438. .long PTE_EXT_TEX(1) | PTE_BUFFERABLE @ L_PTE_MT_DEV_SHARED
  439. .long 0x00 @ unused
  440. .long PTE_EXT_TEX(1) | PTE_CACHEABLE @ L_PTE_MT_MINICACHE
  441. .long PTE_EXT_TEX(1) | PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEALLOC
  442. .long 0x00 @ unused
  443. .long PTE_BUFFERABLE @ L_PTE_MT_DEV_WC
  444. .long 0x00 @ unused
  445. .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_DEV_CACHED
  446. .long 0x00 @ L_PTE_MT_DEV_NONSHARED
  447. .long 0x00 @ unused
  448. .long 0x00 @ unused
  449. .long 0x00 @ unused
  450. .align 5
  451. SYM_TYPED_FUNC_START(cpu_xscale_set_pte_ext)
  452. xscale_set_pte_ext_prologue
  453. @
  454. @ Erratum 40: must set memory to write-through for user read-only pages
  455. @
  456. and ip, r1, #(L_PTE_MT_MASK | L_PTE_USER | L_PTE_RDONLY) & ~(4 << 2)
  457. teq ip, #L_PTE_MT_WRITEBACK | L_PTE_USER | L_PTE_RDONLY
  458. moveq r1, #L_PTE_MT_WRITETHROUGH
  459. and r1, r1, #L_PTE_MT_MASK
  460. adr ip, cpu_xscale_mt_table
  461. ldr ip, [ip, r1]
  462. bic r2, r2, #0x0c
  463. orr r2, r2, ip
  464. xscale_set_pte_ext_epilogue
  465. ret lr
  466. SYM_FUNC_END(cpu_xscale_set_pte_ext)
  467. .ltorg
  468. .align
  469. .globl cpu_xscale_suspend_size
  470. .equ cpu_xscale_suspend_size, 4 * 6
  471. #ifdef CONFIG_ARM_CPU_SUSPEND
  472. SYM_TYPED_FUNC_START(cpu_xscale_do_suspend)
  473. stmfd sp!, {r4 - r9, lr}
  474. mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
  475. mrc p15, 0, r5, c15, c1, 0 @ CP access reg
  476. mrc p15, 0, r6, c13, c0, 0 @ PID
  477. mrc p15, 0, r7, c3, c0, 0 @ domain ID
  478. mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg
  479. mrc p15, 0, r9, c1, c0, 0 @ control reg
  480. bic r4, r4, #2 @ clear frequency change bit
  481. stmia r0, {r4 - r9} @ store cp regs
  482. ldmfd sp!, {r4 - r9, pc}
  483. SYM_FUNC_END(cpu_xscale_do_suspend)
  484. SYM_TYPED_FUNC_START(cpu_xscale_do_resume)
  485. ldmia r0, {r4 - r9} @ load cp regs
  486. mov ip, #0
  487. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  488. mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB
  489. mcr p14, 0, r4, c6, c0, 0 @ clock configuration, turbo mode.
  490. mcr p15, 0, r5, c15, c1, 0 @ CP access reg
  491. mcr p15, 0, r6, c13, c0, 0 @ PID
  492. mcr p15, 0, r7, c3, c0, 0 @ domain ID
  493. mcr p15, 0, r1, c2, c0, 0 @ translation table base addr
  494. mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg
  495. mov r0, r9 @ control register
  496. b cpu_resume_mmu
  497. SYM_FUNC_END(cpu_xscale_do_resume)
  498. #endif
  499. .type __xscale_setup, #function
  500. __xscale_setup:
  501. mcr p15, 0, ip, c7, c7, 0 @ invalidate I, D caches & BTB
  502. mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  503. mcr p15, 0, ip, c8, c7, 0 @ invalidate I, D TLBs
  504. mov r0, #1 << 6 @ cp6 for IOP3xx and Bulverde
  505. orr r0, r0, #1 << 13 @ Its undefined whether this
  506. mcr p15, 0, r0, c15, c1, 0 @ affects USR or SVC modes
  507. adr r5, xscale_crval
  508. ldmia r5, {r5, r6}
  509. mrc p15, 0, r0, c1, c0, 0 @ get control register
  510. bic r0, r0, r5
  511. orr r0, r0, r6
  512. ret lr
  513. .size __xscale_setup, . - __xscale_setup
  514. /*
  515. * R
  516. * .RVI ZFRS BLDP WCAM
  517. * ..11 1.01 .... .101
  518. *
  519. */
  520. .type xscale_crval, #object
  521. xscale_crval:
  522. crval clear=0x00003b07, mmuset=0x00003905, ucset=0x00001900
  523. __INITDATA
  524. @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
  525. define_processor_functions xscale, dabort=v5t_early_abort, pabort=legacy_pabort, suspend=1
  526. .section ".rodata"
  527. string cpu_arch_name, "armv5te"
  528. string cpu_elf_name, "v5"
  529. string cpu_80200_A0_A1_name, "XScale-80200 A0/A1"
  530. string cpu_80200_name, "XScale-80200"
  531. string cpu_80219_name, "XScale-80219"
  532. string cpu_8032x_name, "XScale-IOP8032x Family"
  533. string cpu_8033x_name, "XScale-IOP8033x Family"
  534. string cpu_pxa250_name, "XScale-PXA250"
  535. string cpu_pxa210_name, "XScale-PXA210"
  536. string cpu_ixp42x_name, "XScale-IXP42x Family"
  537. string cpu_ixp43x_name, "XScale-IXP43x Family"
  538. string cpu_ixp46x_name, "XScale-IXP46x Family"
  539. string cpu_ixp2400_name, "XScale-IXP2400"
  540. string cpu_ixp2800_name, "XScale-IXP2800"
  541. string cpu_pxa255_name, "XScale-PXA255"
  542. string cpu_pxa270_name, "XScale-PXA270"
  543. .align
  544. .section ".proc.info.init", "a"
  545. .macro xscale_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cache
  546. .type __\name\()_proc_info,#object
  547. __\name\()_proc_info:
  548. .long \cpu_val
  549. .long \cpu_mask
  550. .long PMD_TYPE_SECT | \
  551. PMD_SECT_BUFFERABLE | \
  552. PMD_SECT_CACHEABLE | \
  553. PMD_SECT_AP_WRITE | \
  554. PMD_SECT_AP_READ
  555. .long PMD_TYPE_SECT | \
  556. PMD_SECT_AP_WRITE | \
  557. PMD_SECT_AP_READ
  558. initfn __xscale_setup, __\name\()_proc_info
  559. .long cpu_arch_name
  560. .long cpu_elf_name
  561. .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
  562. .long \cpu_name
  563. .long xscale_processor_functions
  564. .long v4wbi_tlb_fns
  565. .long xscale_mc_user_fns
  566. .ifb \cache
  567. .long xscale_cache_fns
  568. .else
  569. .long \cache
  570. .endif
  571. .size __\name\()_proc_info, . - __\name\()_proc_info
  572. .endm
  573. xscale_proc_info 80200_A0_A1, 0x69052000, 0xfffffffe, cpu_80200_name, \
  574. cache=xscale_80200_A0_A1_cache_fns
  575. xscale_proc_info 80200, 0x69052000, 0xfffffff0, cpu_80200_name
  576. xscale_proc_info 80219, 0x69052e20, 0xffffffe0, cpu_80219_name
  577. xscale_proc_info 8032x, 0x69052420, 0xfffff7e0, cpu_8032x_name
  578. xscale_proc_info 8033x, 0x69054010, 0xfffffd30, cpu_8033x_name
  579. xscale_proc_info pxa250, 0x69052100, 0xfffff7f0, cpu_pxa250_name
  580. xscale_proc_info pxa210, 0x69052120, 0xfffff3f0, cpu_pxa210_name
  581. xscale_proc_info ixp2400, 0x69054190, 0xfffffff0, cpu_ixp2400_name
  582. xscale_proc_info ixp2800, 0x690541a0, 0xfffffff0, cpu_ixp2800_name
  583. xscale_proc_info ixp42x, 0x690541c0, 0xffffffc0, cpu_ixp42x_name
  584. xscale_proc_info ixp43x, 0x69054040, 0xfffffff0, cpu_ixp43x_name
  585. xscale_proc_info ixp46x, 0x69054200, 0xffffff00, cpu_ixp46x_name
  586. xscale_proc_info pxa255, 0x69052d00, 0xfffffff0, cpu_pxa255_name
  587. xscale_proc_info pxa270, 0x69054110, 0xfffffff0, cpu_pxa270_name