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. 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_80200_A0_A1_dma_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(xscale_80200_A0_A1_dma_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. @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
  380. define_cache_functions xscale
  381. /*
  382. * On stepping A0/A1 of the 80200, invalidating D-cache by line doesn't
  383. * clear the dirty bits, which means that if we invalidate a dirty line,
  384. * the dirty data can still be written back to external memory later on.
  385. *
  386. * The recommended workaround is to always do a clean D-cache line before
  387. * doing an invalidate D-cache line, so on the affected processors,
  388. * dma_inv_range() is implemented as dma_flush_range().
  389. *
  390. * See erratum #25 of "Intel 80200 Processor Specification Update",
  391. * revision January 22, 2003, available at:
  392. * http://www.intel.com/design/iio/specupdt/273415.htm
  393. */
  394. .macro a0_alias basename
  395. .globl xscale_80200_A0_A1_\basename
  396. .type xscale_80200_A0_A1_\basename , %function
  397. .equ xscale_80200_A0_A1_\basename , xscale_\basename
  398. .endm
  399. /*
  400. * Most of the cache functions are unchanged for these processor revisions.
  401. * Export suitable alias symbols for the unchanged functions:
  402. */
  403. a0_alias flush_icache_all
  404. a0_alias flush_user_cache_all
  405. a0_alias flush_kern_cache_all
  406. a0_alias flush_user_cache_range
  407. a0_alias coherent_kern_range
  408. a0_alias coherent_user_range
  409. a0_alias flush_kern_dcache_area
  410. a0_alias dma_flush_range
  411. a0_alias dma_unmap_area
  412. @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
  413. define_cache_functions xscale_80200_A0_A1
  414. ENTRY(cpu_xscale_dcache_clean_area)
  415. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  416. add r0, r0, #CACHELINESIZE
  417. subs r1, r1, #CACHELINESIZE
  418. bhi 1b
  419. mov pc, lr
  420. /* =============================== PageTable ============================== */
  421. /*
  422. * cpu_xscale_switch_mm(pgd)
  423. *
  424. * Set the translation base pointer to be as described by pgd.
  425. *
  426. * pgd: new page tables
  427. */
  428. .align 5
  429. ENTRY(cpu_xscale_switch_mm)
  430. clean_d_cache r1, r2
  431. mcr p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
  432. mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
  433. mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
  434. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  435. cpwait_ret lr, ip
  436. /*
  437. * cpu_xscale_set_pte_ext(ptep, pte, ext)
  438. *
  439. * Set a PTE and flush it out
  440. *
  441. * Errata 40: must set memory to write-through for user read-only pages.
  442. */
  443. cpu_xscale_mt_table:
  444. .long 0x00 @ L_PTE_MT_UNCACHED
  445. .long PTE_BUFFERABLE @ L_PTE_MT_BUFFERABLE
  446. .long PTE_CACHEABLE @ L_PTE_MT_WRITETHROUGH
  447. .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEBACK
  448. .long PTE_EXT_TEX(1) | PTE_BUFFERABLE @ L_PTE_MT_DEV_SHARED
  449. .long 0x00 @ unused
  450. .long PTE_EXT_TEX(1) | PTE_CACHEABLE @ L_PTE_MT_MINICACHE
  451. .long PTE_EXT_TEX(1) | PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEALLOC
  452. .long 0x00 @ unused
  453. .long PTE_BUFFERABLE @ L_PTE_MT_DEV_WC
  454. .long 0x00 @ unused
  455. .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_DEV_CACHED
  456. .long 0x00 @ L_PTE_MT_DEV_NONSHARED
  457. .long 0x00 @ unused
  458. .long 0x00 @ unused
  459. .long 0x00 @ unused
  460. .align 5
  461. ENTRY(cpu_xscale_set_pte_ext)
  462. xscale_set_pte_ext_prologue
  463. @
  464. @ Erratum 40: must set memory to write-through for user read-only pages
  465. @
  466. and ip, r1, #(L_PTE_MT_MASK | L_PTE_USER | L_PTE_RDONLY) & ~(4 << 2)
  467. teq ip, #L_PTE_MT_WRITEBACK | L_PTE_USER | L_PTE_RDONLY
  468. moveq r1, #L_PTE_MT_WRITETHROUGH
  469. and r1, r1, #L_PTE_MT_MASK
  470. adr ip, cpu_xscale_mt_table
  471. ldr ip, [ip, r1]
  472. bic r2, r2, #0x0c
  473. orr r2, r2, ip
  474. xscale_set_pte_ext_epilogue
  475. mov pc, lr
  476. .ltorg
  477. .align
  478. .globl cpu_xscale_suspend_size
  479. .equ cpu_xscale_suspend_size, 4 * 7
  480. #ifdef CONFIG_PM_SLEEP
  481. ENTRY(cpu_xscale_do_suspend)
  482. stmfd sp!, {r4 - r10, lr}
  483. mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
  484. mrc p15, 0, r5, c15, c1, 0 @ CP access reg
  485. mrc p15, 0, r6, c13, c0, 0 @ PID
  486. mrc p15, 0, r7, c3, c0, 0 @ domain ID
  487. mrc p15, 0, r8, c2, c0, 0 @ translation table base addr
  488. mrc p15, 0, r9, c1, c1, 0 @ auxiliary control reg
  489. mrc p15, 0, r10, c1, c0, 0 @ control reg
  490. bic r4, r4, #2 @ clear frequency change bit
  491. stmia r0, {r4 - r10} @ store cp regs
  492. ldmfd sp!, {r4 - r10, pc}
  493. ENDPROC(cpu_xscale_do_suspend)
  494. ENTRY(cpu_xscale_do_resume)
  495. ldmia r0, {r4 - r10} @ load cp regs
  496. mov ip, #0
  497. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  498. mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB
  499. mcr p14, 0, r4, c6, c0, 0 @ clock configuration, turbo mode.
  500. mcr p15, 0, r5, c15, c1, 0 @ CP access reg
  501. mcr p15, 0, r6, c13, c0, 0 @ PID
  502. mcr p15, 0, r7, c3, c0, 0 @ domain ID
  503. mcr p15, 0, r8, c2, c0, 0 @ translation table base addr
  504. mcr p15, 0, r9, c1, c1, 0 @ auxiliary control reg
  505. mov r0, r10 @ control register
  506. mov r2, r8, lsr #14 @ get TTB0 base
  507. mov r2, r2, lsl #14
  508. ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \
  509. PMD_SECT_CACHEABLE | PMD_SECT_AP_WRITE
  510. b cpu_resume_mmu
  511. ENDPROC(cpu_xscale_do_resume)
  512. #endif
  513. __CPUINIT
  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. mov pc, 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, #execinstr
  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. b __xscale_setup
  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