proc-sa110.S
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:19k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/arch/arm/mm/proc-sa110.S
  3.  *
  4.  *  Copyright (C) 1997-2000 Russell King
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License version 2 as
  8.  * published by the Free Software Foundation.
  9.  *
  10.  *  MMU functions for SA110
  11.  *
  12.  *  These are the low level assembler for performing cache and TLB
  13.  *  functions on the StrongARM-110, StrongARM-1100 and StrongARM-1110.
  14.  * 
  15.  *  Note that SA1100 and SA1110 share everything but their name and CPU ID.
  16.  *
  17.  *  12-jun-2000, Erik Mouw (J.A.K.Mouw@its.tudelft.nl):
  18.  *    Flush the read buffer at context switches
  19.  */
  20. #include <linux/linkage.h>
  21. #include <asm/assembler.h>
  22. #include <asm/constants.h>
  23. #include <asm/procinfo.h>
  24. #include <asm/hardware.h>
  25. /* This is the maximum size of an area which will be flushed.  If the area
  26.  * is larger than this, then we flush the whole cache
  27.  */
  28. #define MAX_AREA_SIZE 32768
  29. /*
  30.  * the cache line size of the I and D cache
  31.  */
  32. #define DCACHELINESIZE 32
  33. /*
  34.  * and the page size
  35.  */
  36. #define PAGESIZE 4096
  37. #define FLUSH_OFFSET 32768
  38. .macro flush_110_dcache rd, ra, re
  39. add re, ra, #16384 @ only necessary for 16k
  40. 1001: ldr rd, [ra], #DCACHELINESIZE
  41. teq re, ra
  42. bne 1001b
  43. .endm
  44. .macro flush_1100_dcache rd, ra, re
  45. add re, ra, #8192 @ only necessary for 8k
  46. 1001: ldr rd, [ra], #DCACHELINESIZE
  47. teq re, ra
  48. bne 1001b
  49. #ifdef FLUSH_BASE_MINICACHE
  50. add ra, ra, #FLUSH_BASE_MINICACHE - FLUSH_BASE
  51. add re, ra, #512 @ only 512 bytes
  52. 1002: ldr rd, [ra], #DCACHELINESIZE
  53. teq re, ra
  54. bne 1002b
  55. #endif
  56. .endm
  57. .data
  58. Lclean_switch: .long 0
  59. .text
  60. /*
  61.  * cpu_sa110_data_abort()
  62.  *
  63.  * obtain information about current aborted instruction.
  64.  * Note: we read user space.  This means we might cause a data
  65.  * abort here if the I-TLB and D-TLB aren't seeing the same
  66.  * picture.  Unfortunately, this does happen.  We live with it.
  67.  *
  68.  *  r2 = address of aborted instruction
  69.  *  r3 = cpsr
  70.  *
  71.  * Returns:
  72.  *  r0 = address of abort
  73.  *  r1 != 0 if writing
  74.  *  r3 = FSR
  75.  *  r4 = corrupted
  76.  */
  77. .align 5
  78. ENTRY(cpu_sa110_data_abort)
  79. ENTRY(cpu_sa1100_data_abort)
  80. mrc p15, 0, r3, c5, c0, 0 @ get FSR
  81. mrc p15, 0, r0, c6, c0, 0 @ get FAR
  82. ldr r1, [r2] @ read aborted instruction
  83. and r3, r3, #255
  84. tst r1, r1, lsr #21 @ C = bit 20
  85. sbc r1, r1, r1 @ r1 = C - 1
  86. mov pc, lr
  87. /*
  88.  * cpu_sa110_check_bugs()
  89.  */
  90. ENTRY(cpu_sa110_check_bugs)
  91. ENTRY(cpu_sa1100_check_bugs)
  92. mrs ip, cpsr
  93. bic ip, ip, #F_BIT
  94. msr cpsr, ip
  95. mov pc, lr
  96. /*
  97.  * cpu_sa110_proc_init()
  98.  */
  99. ENTRY(cpu_sa110_proc_init)
  100. ENTRY(cpu_sa1100_proc_init)
  101. mov r0, #0
  102. mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching
  103. mov pc, lr
  104. /*
  105.  * cpu_sa110_proc_fin()
  106.  */
  107. ENTRY(cpu_sa110_proc_fin)
  108. stmfd sp!, {lr}
  109. mov ip, #F_BIT | I_BIT | SVC_MODE
  110. msr cpsr_c, ip
  111. bl cpu_sa110_cache_clean_invalidate_all @ clean caches
  112. 1: mov r0, #0
  113. mcr p15, 0, r0, c15, c2, 2 @ Disable clock switching
  114. mrc p15, 0, r0, c1, c0, 0 @ ctrl register
  115. bic r0, r0, #0x1000 @ ...i............
  116. bic r0, r0, #0x000e @ ............wca.
  117. mcr p15, 0, r0, c1, c0, 0 @ disable caches
  118. ldmfd sp!, {pc}
  119. ENTRY(cpu_sa1100_proc_fin)
  120. stmfd sp!, {lr}
  121. mov ip, #F_BIT | I_BIT | SVC_MODE
  122. msr cpsr_c, ip
  123. bl cpu_sa1100_cache_clean_invalidate_all @ clean caches
  124. b 1b
  125. /*
  126.  * cpu_sa110_reset(loc)
  127.  *
  128.  * Perform a soft reset of the system.  Put the CPU into the
  129.  * same state as it would be if it had been reset, and branch
  130.  * to what would be the reset vector.
  131.  *
  132.  * loc: location to jump to for soft reset
  133.  */
  134. .align 5
  135. ENTRY(cpu_sa110_reset)
  136. ENTRY(cpu_sa1100_reset)
  137. mov ip, #0
  138. mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
  139. mcr p15, 0, ip, c7, c10, 4 @ drain WB
  140. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  141. mrc p15, 0, ip, c1, c0, 0 @ ctrl register
  142. bic ip, ip, #0x000f @ ............wcam
  143. bic ip, ip, #0x1100 @ ...i...s........
  144. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  145. mov pc, r0
  146. /*
  147.  * cpu_sa110_do_idle(type)
  148.  *
  149.  * Cause the processor to idle
  150.  *
  151.  * type: call type:
  152.  *   0 = slow idle
  153.  *   1 = fast idle
  154.  *   2 = switch to slow processor clock
  155.  *   3 = switch to fast processor clock
  156.  */
  157. .align 5
  158. idle: mcr p15, 0, r0, c15, c8, 2 @ Wait for interrupt, cache aligned
  159. mov r0, r0 @ safety
  160. mov pc, lr
  161. ENTRY(cpu_sa110_do_idle)
  162. mov ip, #0
  163. cmp r0, #4
  164. addcc pc, pc, r0, lsl #2
  165. mov pc, lr
  166. b idle
  167. b idle
  168. b slow_clock
  169. b fast_clock
  170. fast_clock:
  171. mcr p15, 0, ip, c15, c1, 2 @ enable clock switching
  172. mov pc, lr
  173. slow_clock:
  174. mcr p15, 0, ip, c15, c2, 2 @ disable clock switching
  175. ldr r1, =UNCACHEABLE_ADDR @ load from uncacheable loc
  176. ldr r1, [r1, #0] @ force switch to MCLK
  177. mov pc, lr
  178. .align 5
  179. ENTRY(cpu_sa1100_do_idle)
  180. mov r0, r0 @ 4 nop padding
  181. mov r0, r0
  182. mov r0, r0
  183. mov r0, #0
  184. ldr r1, =UNCACHEABLE_ADDR @ ptr to uncacheable address
  185. mrs r2, cpsr
  186. orr r3, r2, #192 @ disallow interrupts
  187. msr cpsr_c, r3
  188. @ --- aligned to a cache line
  189. mcr p15, 0, r0, c15, c2, 2 @ disable clock switching
  190. ldr r1, [r1, #0] @ force switch to MCLK
  191. mcr p15, 0, r0, c15, c8, 2 @ wait for interrupt
  192. mov r0, r0 @ safety
  193. mcr p15, 0, r0, c15, c1, 2 @ enable clock switching
  194. msr cpsr_c, r2 @ allow interrupts
  195. mov pc, lr
  196. /* ================================= CACHE ================================ */
  197. /*
  198.  * cpu_sa110_cache_clean_invalidate_all (void)
  199.  *
  200.  * clean and invalidate all cache lines
  201.  *
  202.  * Note:
  203.  *  1. we should preserve r0 at all times
  204.  */
  205. .align 5
  206. ENTRY(cpu_sa110_cache_clean_invalidate_all)
  207. mov r2, #1
  208. cpu_sa110_cache_clean_invalidate_all_r2:
  209. ldr r3, =Lclean_switch
  210. ldr ip, =FLUSH_BASE
  211. ldr r1, [r3]
  212. ands r1, r1, #1
  213. eor r1, r1, #1
  214. str r1, [r3]
  215. addne ip, ip, #FLUSH_OFFSET
  216. flush_110_dcache r3, ip, r1
  217. mov ip, #0
  218. teq r2, #0
  219. mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
  220. mcr p15, 0, ip, c7, c10, 4 @ drain WB
  221. mov pc, lr
  222. .align 5
  223. ENTRY(cpu_sa1100_cache_clean_invalidate_all)
  224. mov r2, #1
  225. cpu_sa1100_cache_clean_invalidate_all_r2:
  226. ldr r3, =Lclean_switch
  227. ldr ip, =FLUSH_BASE
  228. ldr r1, [r3]
  229. ands r1, r1, #1
  230. eor r1, r1, #1
  231. str r1, [r3]
  232. addne ip, ip, #FLUSH_OFFSET
  233. flush_1100_dcache r3, ip, r1
  234. mov ip, #0
  235. teq r2, #0
  236. mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
  237. mcr p15, 0, r1, c9, c0, 0 @ invalidate RB
  238. mcr p15, 0, ip, c7, c10, 4 @ drain WB
  239. mov pc, lr
  240. /*
  241.  * cpu_sa110_cache_clean_invalidate_range(start, end, flags)
  242.  *
  243.  * clean and invalidate all cache lines associated with this area of memory
  244.  *
  245.  * start: Area start address
  246.  * end:   Area end address
  247.  * flags: nonzero for I cache as well
  248.  */
  249. .align 5
  250. ENTRY(cpu_sa110_cache_clean_invalidate_range)
  251. bic r0, r0, #DCACHELINESIZE - 1
  252. sub r3, r1, r0
  253. cmp r3, #MAX_AREA_SIZE
  254. bhi cpu_sa110_cache_clean_invalidate_all_r2
  255. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  256. mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  257. add r0, r0, #DCACHELINESIZE
  258. mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  259. mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  260. add r0, r0, #DCACHELINESIZE
  261. cmp r0, r1
  262. blo 1b
  263. teq r2, #0
  264. movne r0, #0
  265. mcrne p15, 0, r0, c7, c5, 0 @ invalidate I cache
  266. mov pc, lr
  267. ENTRY(cpu_sa1100_cache_clean_invalidate_range)
  268. sub r3, r1, r0
  269. cmp r3, #MAX_AREA_SIZE
  270. bhi cpu_sa1100_cache_clean_invalidate_all_r2
  271. b 1b
  272. /*
  273.  * cpu_sa110_flush_ram_page(page)
  274.  *
  275.  * clean and invalidate all cache lines associated with this area of memory
  276.  *
  277.  * page: page to clean and invalidate
  278.  */
  279. .align 5
  280. ENTRY(cpu_sa110_flush_ram_page)
  281. ENTRY(cpu_sa1100_flush_ram_page)
  282. mov r1, #PAGESIZE
  283. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  284. add r0, r0, #DCACHELINESIZE
  285. mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  286. add r0, r0, #DCACHELINESIZE
  287. subs r1, r1, #2 * DCACHELINESIZE
  288. bne 1b
  289. mcr p15, 0, r1, c7, c10, 4 @ drain WB
  290. mov pc, lr
  291. /* ================================ D-CACHE =============================== */
  292. /*
  293.  * cpu_sa110_dcache_invalidate_range(start, end)
  294.  *
  295.  * throw away all D-cached data in specified region without an obligation
  296.  * to write them back.  Note however that we must clean the D-cached entries
  297.  * around the boundaries if the start and/or end address are not cache
  298.  * aligned.
  299.  *
  300.  * start: virtual start address
  301.  * end:   virtual end address
  302.  */
  303. .align 5
  304. ENTRY(cpu_sa110_dcache_invalidate_range)
  305. ENTRY(cpu_sa1100_dcache_invalidate_range)
  306. tst r0, #DCACHELINESIZE - 1
  307. bic r0, r0, #DCACHELINESIZE - 1
  308. mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
  309. tst r1, #DCACHELINESIZE - 1
  310. mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
  311. 1: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
  312. add r0, r0, #DCACHELINESIZE
  313. cmp r0, r1
  314. blo 1b
  315. mov pc, lr
  316. /*
  317.  * cpu_sa110_dcache_clean_range(start, end)
  318.  *
  319.  * For the specified virtual address range, ensure that all caches contain
  320.  * clean data, such that peripheral accesses to the physical RAM fetch
  321.  * correct data.
  322.  *
  323.  * start: virtual start address
  324.  * end:   virtual end address
  325.  */
  326. .align 5
  327. ENTRY(cpu_sa110_dcache_clean_range)
  328. bic r0, r0, #DCACHELINESIZE - 1
  329. sub r1, r1, r0
  330. cmp r1, #MAX_AREA_SIZE
  331. mov r2, #0
  332. bhi cpu_sa110_cache_clean_invalidate_all_r2
  333. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  334. add r0, r0, #DCACHELINESIZE
  335. mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  336. add r0, r0, #DCACHELINESIZE
  337. subs r1, r1, #2 * DCACHELINESIZE
  338. bpl 1b
  339. mcr p15, 0, r2, c7, c10, 4 @ drain WB
  340. mov pc, lr
  341. ENTRY(cpu_sa1100_dcache_clean_range)
  342. bic r0, r0, #DCACHELINESIZE - 1
  343. sub r1, r1, r0
  344. cmp r1, #MAX_AREA_SIZE
  345. mov r2, #0
  346. bhi cpu_sa1100_cache_clean_invalidate_all_r2
  347. b 1b
  348. /*
  349.  * cpu_sa110_clean_dcache_page(page)
  350.  *
  351.  * Cleans a single page of dcache so that if we have any future aliased
  352.  * mappings, they will be consistent at the time that they are created.
  353.  *
  354.  * Note:
  355.  *  1. we don't need to flush the write buffer in this case.
  356.  *  2. we don't invalidate the entries since when we write the page
  357.  *     out to disk, the entries may get reloaded into the cache.
  358.  */
  359. .align 5
  360. ENTRY(cpu_sa110_dcache_clean_page)
  361. ENTRY(cpu_sa1100_dcache_clean_page)
  362. mov r1, #PAGESIZE
  363. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  364. add r0, r0, #DCACHELINESIZE
  365. mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  366. add r0, r0, #DCACHELINESIZE
  367. subs r1, r1, #2 * DCACHELINESIZE
  368. bne 1b
  369. mov pc, lr
  370. /*
  371.  * cpu_sa110_dcache_clean_entry(addr)
  372.  *
  373.  * Clean the specified entry of any caches such that the MMU
  374.  * translation fetches will obtain correct data.
  375.  *
  376.  * addr: cache-unaligned virtual address
  377.  */
  378. .align 5
  379. ENTRY(cpu_sa110_dcache_clean_entry)
  380. ENTRY(cpu_sa1100_dcache_clean_entry)
  381. mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  382. mcr p15, 0, r0, c7, c10, 4 @ drain WB
  383. mov pc, lr
  384. /* ================================ I-CACHE =============================== */
  385. /*
  386.  * cpu_sa110_icache_invalidate_range(start, end)
  387.  *
  388.  * invalidate a range of virtual addresses from the Icache
  389.  *
  390.  * start: virtual start address
  391.  * end:   virtual end address
  392.  */
  393. .align 5
  394. ENTRY(cpu_sa110_icache_invalidate_range)
  395. ENTRY(cpu_sa1100_icache_invalidate_range)
  396. bic r0, r0, #DCACHELINESIZE - 1
  397. 1: mcr p15, 0, r0, c7, c10, 1 @ Clean D entry
  398. add r0, r0, #DCACHELINESIZE
  399. cmp r0, r1
  400. blo 1b
  401. mov r0, #0
  402. mcr p15, 0, r0, c7, c10, 4 @ drain WB
  403. ENTRY(cpu_sa110_icache_invalidate_page)
  404. ENTRY(cpu_sa1100_icache_invalidate_page)
  405. mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
  406. mov pc, lr
  407. /* ================================== TLB ================================= */
  408. /*
  409.  * cpu_sa110_tlb_invalidate_all()
  410.  *
  411.  * Invalidate all TLB entries
  412.  */
  413. .align 5
  414. ENTRY(cpu_sa110_tlb_invalidate_all)
  415. ENTRY(cpu_sa1100_tlb_invalidate_all)
  416. mov r0, #0
  417. mcr p15, 0, r0, c7, c10, 4 @ drain WB
  418. mcr p15, 0, r0, c8, c7, 0 @ invalidate I & D TLBs
  419. mov pc, lr
  420. /*
  421.  * cpu_sa110_tlb_invalidate_range(start, end)
  422.  *
  423.  * invalidate TLB entries covering the specified range
  424.  *
  425.  * start: range start address
  426.  * end:   range end address
  427.  */
  428. .align 5
  429. ENTRY(cpu_sa110_tlb_invalidate_range)
  430. ENTRY(cpu_sa1100_tlb_invalidate_range)
  431. bic r0, r0, #0x0ff
  432. bic r0, r0, #0xf00
  433. mov r3, #0
  434. mcr p15, 0, r3, c7, c10, 4 @ drain WB
  435. 1: mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry
  436. add r0, r0, #PAGESIZE
  437. cmp r0, r1
  438. blo 1b
  439. mcr p15, 0, r3, c8, c5, 0 @ invalidate I TLB
  440. mov pc, lr
  441. /*
  442.  * cpu_sa110_tlb_invalidate_page(page, flags)
  443.  *
  444.  * invalidate the TLB entries for the specified page.
  445.  *
  446.  * page:  page to invalidate
  447.  * flags: non-zero if we include the I TLB
  448.  */
  449. .align 5
  450. ENTRY(cpu_sa110_tlb_invalidate_page)
  451. ENTRY(cpu_sa1100_tlb_invalidate_page)
  452. mov r3, #0
  453. mcr p15, 0, r3, c7, c10, 4 @ drain WB
  454. teq r1, #0
  455. mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry
  456. mcrne p15, 0, r3, c8, c5, 0 @ invalidate I TLB
  457. mov pc, lr
  458. /* =============================== PageTable ============================== */
  459. /*
  460.  * cpu_sa110_set_pgd(pgd)
  461.  *
  462.  * Set the translation base pointer to be as described by pgd.
  463.  *
  464.  * pgd: new page tables
  465.  */
  466. .align 5
  467. ENTRY(cpu_sa110_set_pgd)
  468. ldr r3, =Lclean_switch
  469. ldr ip, =FLUSH_BASE
  470. ldr r2, [r3]
  471. ands r2, r2, #1
  472. eor r2, r2, #1
  473. str r2, [r3]
  474. addne ip, ip, #FLUSH_OFFSET
  475. flush_110_dcache r3, ip, r1
  476. mov r1, #0
  477. mcr p15, 0, r1, c7, c5, 0 @ invalidate I cache
  478. mcr p15, 0, r1, c7, c10, 4 @ drain WB
  479. mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
  480. mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
  481. mov pc, lr
  482. /*
  483.  * cpu_sa1100_set_pgd(pgd)
  484.  *
  485.  * Set the translation base pointer to be as described by pgd.
  486.  *
  487.  * pgd: new page tables
  488.  */
  489. .align 5
  490. ENTRY(cpu_sa1100_set_pgd)
  491. ldr r3, =Lclean_switch
  492. ldr ip, =FLUSH_BASE
  493. ldr r2, [r3]
  494. ands r2, r2, #1
  495. eor r2, r2, #1
  496. str r2, [r3]
  497. addne ip, ip, #FLUSH_OFFSET
  498. flush_1100_dcache r3, ip, r1
  499. mov ip, #0
  500. mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
  501. mcr p15, 0, ip, c9, c0, 0 @ invalidate RB
  502. mcr p15, 0, ip, c7, c10, 4 @ drain WB
  503. mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
  504. mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
  505. mov pc, lr
  506. /*
  507.  * cpu_sa110_set_pmd(pmdp, pmd)
  508.  *
  509.  * Set a level 1 translation table entry, and clean it out of
  510.  * any caches such that the MMUs can load it correctly.
  511.  *
  512.  * pmdp: pointer to PMD entry
  513.  * pmd:  PMD value to store
  514.  */
  515. .align 5
  516. ENTRY(cpu_sa110_set_pmd)
  517. ENTRY(cpu_sa1100_set_pmd)
  518. str r1, [r0]
  519. mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  520. mcr p15, 0, r0, c7, c10, 4 @ drain WB
  521. mov pc, lr
  522. /*
  523.  * cpu_sa110_set_pte(ptep, pte)
  524.  *
  525.  * Set a PTE and flush it out
  526.  */
  527. .align 5
  528. ENTRY(cpu_sa110_set_pte)
  529. ENTRY(cpu_sa1100_set_pte)
  530. str r1, [r0], #-1024 @ linux version
  531. eor r1, r1, #LPTE_PRESENT | LPTE_YOUNG | LPTE_WRITE | LPTE_DIRTY
  532. bic r2, r1, #0xff0
  533. bic r2, r2, #3
  534. orr r2, r2, #HPTE_TYPE_SMALL
  535. tst r1, #LPTE_USER | LPTE_EXEC @ User or Exec?
  536. orrne r2, r2, #HPTE_AP_READ
  537. tst r1, #LPTE_WRITE | LPTE_DIRTY @ Write and Dirty?
  538. orreq r2, r2, #HPTE_AP_WRITE
  539. tst r1, #LPTE_PRESENT | LPTE_YOUNG @ Present and Young?
  540. movne r2, #0
  541. str r2, [r0] @ hardware version
  542. mov r0, r0
  543. mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  544. mcr p15, 0, r0, c7, c10, 4 @ drain WB
  545. mov pc, lr
  546. cpu_manu_name:
  547. .asciz "Intel"
  548. cpu_sa110_name:
  549. .asciz "StrongARM-110"
  550. cpu_sa1100_name:
  551. .asciz "StrongARM-1100"
  552. cpu_sa1110_name:
  553. .asciz "StrongARM-1110"
  554. .align
  555. .section ".text.init", #alloc, #execinstr
  556. __sa1100_setup: @ Allow read-buffer operations from userland
  557. mcr p15, 0, r0, c9, c0, 5
  558. mrc p15, 0, r0, c1, c0 @ get control register v4
  559. bic r0, r0, #0x0e00 @ ..VI ZFRS BLDP WCAM
  560. bic r0, r0, #0x0002 @ .... 000. .... ..0.
  561. orr r0, r0, #0x003d
  562. orr r0, r0, #0x3100 @ ..11 ...1 ..11 11.1
  563. b __setup_common
  564. __sa110_setup:
  565. mrc p15, 0, r0, c1, c0 @ get control register v4
  566. bic r0, r0, #0x2e00 @ ..VI ZFRS BLDP WCAM
  567. bic r0, r0, #0x0002 @ ..0. 000. .... ..0.
  568. orr r0, r0, #0x003d
  569. orr r0, r0, #0x1100 @ ...1 ...1 ..11 11.1
  570. __setup_common:
  571. mov r10, #0
  572. mcr p15, 0, r10, c7, c7 @ invalidate I,D caches on v4
  573. mcr p15, 0, r10, c7, c10, 4 @ drain write buffer on v4
  574. mcr p15, 0, r10, c8, c7 @ invalidate I,D TLBs on v4
  575. mcr p15, 0, r4, c2, c0 @ load page table pointer
  576. mov r10, #0x1f @ Domains 0, 1 = client
  577. mcr p15, 0, r10, c3, c0 @ load domain access register
  578. mov pc, lr
  579. .text
  580. /*
  581.  * Purpose : Function pointers used to access above functions - all calls
  582.  *      come through these
  583.  */
  584. .type sa110_processor_functions, #object
  585. ENTRY(sa110_processor_functions)
  586. .word cpu_sa110_data_abort
  587. .word cpu_sa110_check_bugs
  588. .word cpu_sa110_proc_init
  589. .word cpu_sa110_proc_fin
  590. .word cpu_sa110_reset
  591. .word cpu_sa110_do_idle
  592. /* cache */
  593. .word cpu_sa110_cache_clean_invalidate_all
  594. .word cpu_sa110_cache_clean_invalidate_range
  595. .word cpu_sa110_flush_ram_page
  596. /* dcache */
  597. .word cpu_sa110_dcache_invalidate_range
  598. .word cpu_sa110_dcache_clean_range
  599. .word cpu_sa110_dcache_clean_page
  600. .word cpu_sa110_dcache_clean_entry
  601. /* icache */
  602. .word cpu_sa110_icache_invalidate_range
  603. .word cpu_sa110_icache_invalidate_page
  604. /* tlb */
  605. .word cpu_sa110_tlb_invalidate_all
  606. .word cpu_sa110_tlb_invalidate_range
  607. .word cpu_sa110_tlb_invalidate_page
  608. /* pgtable */
  609. .word cpu_sa110_set_pgd
  610. .word cpu_sa110_set_pmd
  611. .word cpu_sa110_set_pte
  612. .size sa110_processor_functions, . - sa110_processor_functions
  613. .type cpu_sa110_info, #object
  614. cpu_sa110_info:
  615. .long cpu_manu_name
  616. .long cpu_sa110_name
  617. .size cpu_sa110_info, . - cpu_sa110_info
  618. /*
  619.  * SA1100 and SA1110 share the same function calls
  620.  */
  621. .type sa1100_processor_functions, #object
  622. ENTRY(sa1100_processor_functions)
  623. .word cpu_sa1100_data_abort
  624. .word cpu_sa1100_check_bugs
  625. .word cpu_sa1100_proc_init
  626. .word cpu_sa1100_proc_fin
  627. .word cpu_sa1100_reset
  628. .word cpu_sa1100_do_idle
  629. /* cache */
  630. .word cpu_sa1100_cache_clean_invalidate_all
  631. .word cpu_sa1100_cache_clean_invalidate_range
  632. .word cpu_sa1100_flush_ram_page
  633. /* dcache */
  634. .word cpu_sa1100_dcache_invalidate_range
  635. .word cpu_sa1100_dcache_clean_range
  636. .word cpu_sa1100_dcache_clean_page
  637. .word cpu_sa1100_dcache_clean_entry
  638. /* icache */
  639. .word cpu_sa1100_icache_invalidate_range
  640. .word cpu_sa1100_icache_invalidate_page
  641. /* tlb */
  642. .word cpu_sa1100_tlb_invalidate_all
  643. .word cpu_sa1100_tlb_invalidate_range
  644. .word cpu_sa1100_tlb_invalidate_page
  645. /* pgtable */
  646. .word cpu_sa1100_set_pgd
  647. .word cpu_sa1100_set_pmd
  648. .word cpu_sa1100_set_pte
  649. .size sa1100_processor_functions, . - sa1100_processor_functions
  650. cpu_sa1100_info:
  651. .long cpu_manu_name
  652. .long cpu_sa1100_name
  653. .size cpu_sa1100_info, . - cpu_sa1100_info
  654. cpu_sa1110_info:
  655. .long cpu_manu_name
  656. .long cpu_sa1110_name
  657. .size cpu_sa1110_info, . - cpu_sa1110_info
  658. .type cpu_arch_name, #object
  659. cpu_arch_name:
  660. .asciz "armv4"
  661. .size cpu_arch_name, . - cpu_arch_name
  662. .type cpu_elf_name, #object
  663. cpu_elf_name:
  664. .asciz "v4"
  665. .size cpu_elf_name, . - cpu_elf_name
  666. .align
  667. .section ".proc.info", #alloc, #execinstr
  668. .type __sa110_proc_info,#object
  669. __sa110_proc_info:
  670. .long 0x4401a100
  671. .long 0xfffffff0
  672. .long 0x00000c0e
  673. b __sa110_setup
  674. .long cpu_arch_name
  675. .long cpu_elf_name
  676. .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | HWCAP_FAST_MULT
  677. .long cpu_sa110_info
  678. .long sa110_processor_functions
  679. .size __sa110_proc_info, . - __sa110_proc_info
  680. .type __sa1100_proc_info,#object
  681. __sa1100_proc_info:
  682. .long 0x4401a110
  683. .long 0xfffffff0
  684. .long 0x00000c0e
  685. b __sa1100_setup
  686. .long cpu_arch_name
  687. .long cpu_elf_name
  688. .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | HWCAP_FAST_MULT
  689. .long cpu_sa1100_info
  690. .long sa1100_processor_functions
  691. .size __sa1100_proc_info, . - __sa1100_proc_info
  692. .type __sa1110_proc_info,#object
  693. __sa1110_proc_info:
  694. .long 0x6901b110
  695. .long 0xfffffff0
  696. .long 0x00000c0e
  697. b __sa1100_setup
  698. .long cpu_arch_name
  699. .long cpu_elf_name
  700. .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | HWCAP_FAST_MULT
  701. .long cpu_sa1110_info
  702. .long sa1100_processor_functions
  703. .size __sa1110_proc_info, . - __sa1110_proc_info