proc-arm720.S 7.1 KB

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