proc-arm720.S 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. /*
  2. * linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720
  3. *
  4. * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
  5. * Rob Scott (rscott@mtrob.fdns.net)
  6. * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd.
  7. * hacked for non-paged-MM by Hyok S. Choi, 2004.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. *
  24. * These are the low level assembler for performing cache and TLB
  25. * functions on the ARM720T. The ARM720T has a writethrough IDC
  26. * cache, so we don't need to clean it.
  27. *
  28. * Changelog:
  29. * 05-09-2000 SJH Created by moving 720 specific functions
  30. * out of 'proc-arm6,7.S' per RMK discussion
  31. * 07-25-2000 SJH Added idle function.
  32. * 08-25-2000 DBS Updated for integration of ARM Ltd version.
  33. * 04-20-2004 HSC modified for non-paged memory management mode.
  34. */
  35. #include <linux/linkage.h>
  36. #include <linux/init.h>
  37. #include <asm/assembler.h>
  38. #include <asm/asm-offsets.h>
  39. #include <asm/pgtable-hwdef.h>
  40. #include <asm/pgtable.h>
  41. #include <asm/procinfo.h>
  42. #include <asm/ptrace.h>
  43. /*
  44. * Function: arm720_proc_init (void)
  45. * : arm720_proc_fin (void)
  46. *
  47. * Notes : This processor does not require these
  48. */
  49. ENTRY(cpu_arm720_dcache_clean_area)
  50. ENTRY(cpu_arm720_proc_init)
  51. mov pc, lr
  52. ENTRY(cpu_arm720_proc_fin)
  53. stmfd sp!, {lr}
  54. mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
  55. msr cpsr_c, ip
  56. mrc p15, 0, r0, c1, c0, 0
  57. bic r0, r0, #0x1000 @ ...i............
  58. bic r0, r0, #0x000e @ ............wca.
  59. mcr p15, 0, r0, c1, c0, 0 @ disable caches
  60. mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
  61. ldmfd sp!, {pc}
  62. /*
  63. * Function: arm720_proc_do_idle(void)
  64. * Params : r0 = unused
  65. * Purpose : put the processer in proper idle mode
  66. */
  67. ENTRY(cpu_arm720_do_idle)
  68. mov pc, lr
  69. /*
  70. * Function: arm720_switch_mm(unsigned long pgd_phys)
  71. * Params : pgd_phys Physical address of page table
  72. * Purpose : Perform a task switch, saving the old process' state and restoring
  73. * the new.
  74. */
  75. ENTRY(cpu_arm720_switch_mm)
  76. #ifdef CONFIG_MMU
  77. mov r1, #0
  78. mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
  79. mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
  80. mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
  81. #endif
  82. mov pc, lr
  83. /*
  84. * Function: arm720_set_pte(pte_t *ptep, pte_t pte)
  85. * Params : r0 = Address to set
  86. * : r1 = value to set
  87. * Purpose : Set a PTE and flush it out of any WB cache
  88. */
  89. .align 5
  90. ENTRY(cpu_arm720_set_pte)
  91. #ifdef CONFIG_MMU
  92. str r1, [r0], #-2048 @ linux version
  93. eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
  94. bic r2, r1, #PTE_SMALL_AP_MASK
  95. bic r2, r2, #PTE_TYPE_MASK
  96. orr r2, r2, #PTE_TYPE_SMALL
  97. tst r1, #L_PTE_USER @ User?
  98. orrne r2, r2, #PTE_SMALL_AP_URO_SRW
  99. tst r1, #L_PTE_WRITE | L_PTE_DIRTY @ Write and Dirty?
  100. orreq r2, r2, #PTE_SMALL_AP_UNO_SRW
  101. tst r1, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young
  102. movne r2, #0
  103. str r2, [r0] @ hardware version
  104. #endif
  105. mov pc, lr
  106. /*
  107. * Function: arm720_reset
  108. * Params : r0 = address to jump to
  109. * Notes : This sets up everything for a reset
  110. */
  111. ENTRY(cpu_arm720_reset)
  112. mov ip, #0
  113. mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
  114. #ifdef CONFIG_MMU
  115. mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
  116. #endif
  117. mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
  118. bic ip, ip, #0x000f @ ............wcam
  119. bic ip, ip, #0x2100 @ ..v....s........
  120. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  121. mov pc, r0
  122. __INIT
  123. .type __arm710_setup, #function
  124. __arm710_setup:
  125. mov r0, #0
  126. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  127. #ifdef CONFIG_MMU
  128. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  129. #endif
  130. mrc p15, 0, r0, c1, c0 @ get control register
  131. ldr r5, arm710_cr1_clear
  132. bic r0, r0, r5
  133. ldr r5, arm710_cr1_set
  134. orr r0, r0, r5
  135. mov pc, lr @ __ret (head.S)
  136. .size __arm710_setup, . - __arm710_setup
  137. /*
  138. * R
  139. * .RVI ZFRS BLDP WCAM
  140. * .... 0001 ..11 1101
  141. *
  142. */
  143. .type arm710_cr1_clear, #object
  144. .type arm710_cr1_set, #object
  145. arm710_cr1_clear:
  146. .word 0x0f3f
  147. arm710_cr1_set:
  148. .word 0x013d
  149. .type __arm720_setup, #function
  150. __arm720_setup:
  151. mov r0, #0
  152. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  153. #ifdef CONFIG_MMU
  154. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  155. #endif
  156. adr r5, arm720_crval
  157. ldmia r5, {r5, r6}
  158. mrc p15, 0, r0, c1, c0 @ get control register
  159. bic r0, r0, r5
  160. orr r0, r0, r6
  161. mov pc, lr @ __ret (head.S)
  162. .size __arm720_setup, . - __arm720_setup
  163. /*
  164. * R
  165. * .RVI ZFRS BLDP WCAM
  166. * ..1. 1001 ..11 1101
  167. *
  168. */
  169. .type arm720_crval, #object
  170. arm720_crval:
  171. crval clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130
  172. __INITDATA
  173. /*
  174. * Purpose : Function pointers used to access above functions - all calls
  175. * come through these
  176. */
  177. .type arm720_processor_functions, #object
  178. ENTRY(arm720_processor_functions)
  179. .word v4t_late_abort
  180. .word cpu_arm720_proc_init
  181. .word cpu_arm720_proc_fin
  182. .word cpu_arm720_reset
  183. .word cpu_arm720_do_idle
  184. .word cpu_arm720_dcache_clean_area
  185. .word cpu_arm720_switch_mm
  186. .word cpu_arm720_set_pte
  187. .size arm720_processor_functions, . - arm720_processor_functions
  188. .section ".rodata"
  189. .type cpu_arch_name, #object
  190. cpu_arch_name: .asciz "armv4t"
  191. .size cpu_arch_name, . - cpu_arch_name
  192. .type cpu_elf_name, #object
  193. cpu_elf_name: .asciz "v4"
  194. .size cpu_elf_name, . - cpu_elf_name
  195. .type cpu_arm710_name, #object
  196. cpu_arm710_name:
  197. .asciz "ARM710T"
  198. .size cpu_arm710_name, . - cpu_arm710_name
  199. .type cpu_arm720_name, #object
  200. cpu_arm720_name:
  201. .asciz "ARM720T"
  202. .size cpu_arm720_name, . - cpu_arm720_name
  203. .align
  204. /*
  205. * See linux/include/asm-arm/procinfo.h for a definition of this structure.
  206. */
  207. .section ".proc.info.init", #alloc, #execinstr
  208. .type __arm710_proc_info, #object
  209. __arm710_proc_info:
  210. .long 0x41807100 @ cpu_val
  211. .long 0xffffff00 @ cpu_mask
  212. .long PMD_TYPE_SECT | \
  213. PMD_SECT_BUFFERABLE | \
  214. PMD_SECT_CACHEABLE | \
  215. PMD_BIT4 | \
  216. PMD_SECT_AP_WRITE | \
  217. PMD_SECT_AP_READ
  218. .long PMD_TYPE_SECT | \
  219. PMD_BIT4 | \
  220. PMD_SECT_AP_WRITE | \
  221. PMD_SECT_AP_READ
  222. b __arm710_setup @ cpu_flush
  223. .long cpu_arch_name @ arch_name
  224. .long cpu_elf_name @ elf_name
  225. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  226. .long cpu_arm710_name @ name
  227. .long arm720_processor_functions
  228. .long v4_tlb_fns
  229. .long v4wt_user_fns
  230. .long v4_cache_fns
  231. .size __arm710_proc_info, . - __arm710_proc_info
  232. .type __arm720_proc_info, #object
  233. __arm720_proc_info:
  234. .long 0x41807200 @ cpu_val
  235. .long 0xffffff00 @ cpu_mask
  236. .long PMD_TYPE_SECT | \
  237. PMD_SECT_BUFFERABLE | \
  238. PMD_SECT_CACHEABLE | \
  239. PMD_BIT4 | \
  240. PMD_SECT_AP_WRITE | \
  241. PMD_SECT_AP_READ
  242. .long PMD_TYPE_SECT | \
  243. PMD_BIT4 | \
  244. PMD_SECT_AP_WRITE | \
  245. PMD_SECT_AP_READ
  246. b __arm720_setup @ cpu_flush
  247. .long cpu_arch_name @ arch_name
  248. .long cpu_elf_name @ elf_name
  249. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  250. .long cpu_arm720_name @ name
  251. .long arm720_processor_functions
  252. .long v4_tlb_fns
  253. .long v4wt_user_fns
  254. .long v4_cache_fns
  255. .size __arm720_proc_info, . - __arm720_proc_info