proc-arm720.S 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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/elf.h>
  40. #include <asm/pgtable-hwdef.h>
  41. #include <asm/pgtable.h>
  42. #include <asm/ptrace.h>
  43. #include "proc-macros.S"
  44. /*
  45. * Function: arm720_proc_init (void)
  46. * : arm720_proc_fin (void)
  47. *
  48. * Notes : This processor does not require these
  49. */
  50. ENTRY(cpu_arm720_dcache_clean_area)
  51. ENTRY(cpu_arm720_proc_init)
  52. mov pc, lr
  53. ENTRY(cpu_arm720_proc_fin)
  54. stmfd sp!, {lr}
  55. mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
  56. msr cpsr_c, ip
  57. mrc p15, 0, r0, c1, c0, 0
  58. bic r0, r0, #0x1000 @ ...i............
  59. bic r0, r0, #0x000e @ ............wca.
  60. mcr p15, 0, r0, c1, c0, 0 @ disable caches
  61. mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
  62. ldmfd sp!, {pc}
  63. /*
  64. * Function: arm720_proc_do_idle(void)
  65. * Params : r0 = unused
  66. * Purpose : put the processer in proper idle mode
  67. */
  68. ENTRY(cpu_arm720_do_idle)
  69. mov pc, lr
  70. /*
  71. * Function: arm720_switch_mm(unsigned long pgd_phys)
  72. * Params : pgd_phys Physical address of page table
  73. * Purpose : Perform a task switch, saving the old process' state and restoring
  74. * the new.
  75. */
  76. ENTRY(cpu_arm720_switch_mm)
  77. #ifdef CONFIG_MMU
  78. mov r1, #0
  79. mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
  80. mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
  81. mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
  82. #endif
  83. mov pc, lr
  84. /*
  85. * Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext)
  86. * Params : r0 = Address to set
  87. * : r1 = value to set
  88. * Purpose : Set a PTE and flush it out of any WB cache
  89. */
  90. .align 5
  91. ENTRY(cpu_arm720_set_pte_ext)
  92. #ifdef CONFIG_MMU
  93. str r1, [r0], #-2048 @ linux version
  94. eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
  95. bic r2, r1, #PTE_SMALL_AP_MASK
  96. bic r2, r2, #PTE_TYPE_MASK
  97. orr r2, r2, #PTE_TYPE_SMALL
  98. tst r1, #L_PTE_USER @ User?
  99. orrne r2, r2, #PTE_SMALL_AP_URO_SRW
  100. tst r1, #L_PTE_WRITE | L_PTE_DIRTY @ Write and Dirty?
  101. orreq r2, r2, #PTE_SMALL_AP_UNO_SRW
  102. tst r1, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young
  103. movne r2, #0
  104. str r2, [r0] @ hardware version
  105. #endif
  106. mov pc, lr
  107. /*
  108. * Function: arm720_reset
  109. * Params : r0 = address to jump to
  110. * Notes : This sets up everything for a reset
  111. */
  112. ENTRY(cpu_arm720_reset)
  113. mov ip, #0
  114. mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
  115. #ifdef CONFIG_MMU
  116. mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
  117. #endif
  118. mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
  119. bic ip, ip, #0x000f @ ............wcam
  120. bic ip, ip, #0x2100 @ ..v....s........
  121. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  122. mov pc, r0
  123. __INIT
  124. .type __arm710_setup, #function
  125. __arm710_setup:
  126. mov r0, #0
  127. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  128. #ifdef CONFIG_MMU
  129. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  130. #endif
  131. mrc p15, 0, r0, c1, c0 @ get control register
  132. ldr r5, arm710_cr1_clear
  133. bic r0, r0, r5
  134. ldr r5, arm710_cr1_set
  135. orr r0, r0, r5
  136. mov pc, lr @ __ret (head.S)
  137. .size __arm710_setup, . - __arm710_setup
  138. /*
  139. * R
  140. * .RVI ZFRS BLDP WCAM
  141. * .... 0001 ..11 1101
  142. *
  143. */
  144. .type arm710_cr1_clear, #object
  145. .type arm710_cr1_set, #object
  146. arm710_cr1_clear:
  147. .word 0x0f3f
  148. arm710_cr1_set:
  149. .word 0x013d
  150. .type __arm720_setup, #function
  151. __arm720_setup:
  152. mov r0, #0
  153. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  154. #ifdef CONFIG_MMU
  155. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  156. #endif
  157. adr r5, arm720_crval
  158. ldmia r5, {r5, r6}
  159. mrc p15, 0, r0, c1, c0 @ get control register
  160. bic r0, r0, r5
  161. orr r0, r0, r6
  162. mov pc, lr @ __ret (head.S)
  163. .size __arm720_setup, . - __arm720_setup
  164. /*
  165. * R
  166. * .RVI ZFRS BLDP WCAM
  167. * ..1. 1001 ..11 1101
  168. *
  169. */
  170. .type arm720_crval, #object
  171. arm720_crval:
  172. crval clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130
  173. __INITDATA
  174. /*
  175. * Purpose : Function pointers used to access above functions - all calls
  176. * come through these
  177. */
  178. .type arm720_processor_functions, #object
  179. ENTRY(arm720_processor_functions)
  180. .word v4t_late_abort
  181. .word cpu_arm720_proc_init
  182. .word cpu_arm720_proc_fin
  183. .word cpu_arm720_reset
  184. .word cpu_arm720_do_idle
  185. .word cpu_arm720_dcache_clean_area
  186. .word cpu_arm720_switch_mm
  187. .word cpu_arm720_set_pte_ext
  188. .size arm720_processor_functions, . - arm720_processor_functions
  189. .section ".rodata"
  190. .type cpu_arch_name, #object
  191. cpu_arch_name: .asciz "armv4t"
  192. .size cpu_arch_name, . - cpu_arch_name
  193. .type cpu_elf_name, #object
  194. cpu_elf_name: .asciz "v4"
  195. .size cpu_elf_name, . - cpu_elf_name
  196. .type cpu_arm710_name, #object
  197. cpu_arm710_name:
  198. .asciz "ARM710T"
  199. .size cpu_arm710_name, . - cpu_arm710_name
  200. .type cpu_arm720_name, #object
  201. cpu_arm720_name:
  202. .asciz "ARM720T"
  203. .size cpu_arm720_name, . - cpu_arm720_name
  204. .align
  205. /*
  206. * See linux/include/asm-arm/procinfo.h for a definition of this structure.
  207. */
  208. .section ".proc.info.init", #alloc, #execinstr
  209. .type __arm710_proc_info, #object
  210. __arm710_proc_info:
  211. .long 0x41807100 @ cpu_val
  212. .long 0xffffff00 @ cpu_mask
  213. .long PMD_TYPE_SECT | \
  214. PMD_SECT_BUFFERABLE | \
  215. PMD_SECT_CACHEABLE | \
  216. PMD_BIT4 | \
  217. PMD_SECT_AP_WRITE | \
  218. PMD_SECT_AP_READ
  219. .long PMD_TYPE_SECT | \
  220. PMD_BIT4 | \
  221. PMD_SECT_AP_WRITE | \
  222. PMD_SECT_AP_READ
  223. b __arm710_setup @ cpu_flush
  224. .long cpu_arch_name @ arch_name
  225. .long cpu_elf_name @ elf_name
  226. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  227. .long cpu_arm710_name @ name
  228. .long arm720_processor_functions
  229. .long v4_tlb_fns
  230. .long v4wt_user_fns
  231. .long v4_cache_fns
  232. .size __arm710_proc_info, . - __arm710_proc_info
  233. .type __arm720_proc_info, #object
  234. __arm720_proc_info:
  235. .long 0x41807200 @ cpu_val
  236. .long 0xffffff00 @ cpu_mask
  237. .long PMD_TYPE_SECT | \
  238. PMD_SECT_BUFFERABLE | \
  239. PMD_SECT_CACHEABLE | \
  240. PMD_BIT4 | \
  241. PMD_SECT_AP_WRITE | \
  242. PMD_SECT_AP_READ
  243. .long PMD_TYPE_SECT | \
  244. PMD_BIT4 | \
  245. PMD_SECT_AP_WRITE | \
  246. PMD_SECT_AP_READ
  247. b __arm720_setup @ cpu_flush
  248. .long cpu_arch_name @ arch_name
  249. .long cpu_elf_name @ elf_name
  250. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  251. .long cpu_arm720_name @ name
  252. .long arm720_processor_functions
  253. .long v4_tlb_fns
  254. .long v4wt_user_fns
  255. .long v4_cache_fns
  256. .size __arm720_proc_info, . - __arm720_proc_info