proc-arm720.S 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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/hwcap.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. armv3_set_pte_ext wc_disable=0
  94. #endif
  95. mov pc, lr
  96. /*
  97. * Function: arm720_reset
  98. * Params : r0 = address to jump to
  99. * Notes : This sets up everything for a reset
  100. */
  101. ENTRY(cpu_arm720_reset)
  102. mov ip, #0
  103. mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
  104. #ifdef CONFIG_MMU
  105. mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
  106. #endif
  107. mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
  108. bic ip, ip, #0x000f @ ............wcam
  109. bic ip, ip, #0x2100 @ ..v....s........
  110. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  111. mov pc, r0
  112. __INIT
  113. .type __arm710_setup, #function
  114. __arm710_setup:
  115. mov r0, #0
  116. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  117. #ifdef CONFIG_MMU
  118. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  119. #endif
  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. #ifdef CONFIG_MMU
  144. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  145. #endif
  146. adr r5, arm720_crval
  147. ldmia r5, {r5, r6}
  148. mrc p15, 0, r0, c1, c0 @ get control register
  149. bic r0, r0, r5
  150. orr r0, r0, r6
  151. mov pc, lr @ __ret (head.S)
  152. .size __arm720_setup, . - __arm720_setup
  153. /*
  154. * R
  155. * .RVI ZFRS BLDP WCAM
  156. * ..1. 1001 ..11 1101
  157. *
  158. */
  159. .type arm720_crval, #object
  160. arm720_crval:
  161. crval clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130
  162. __INITDATA
  163. /*
  164. * Purpose : Function pointers used to access above functions - all calls
  165. * come through these
  166. */
  167. .type arm720_processor_functions, #object
  168. ENTRY(arm720_processor_functions)
  169. .word v4t_late_abort
  170. .word pabort_noifar
  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_ext
  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 <asm/procinfo.h> for a definition of this structure.
  197. */
  198. .section ".proc.info.init", #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. .long PMD_TYPE_SECT | \
  210. PMD_BIT4 | \
  211. PMD_SECT_AP_WRITE | \
  212. PMD_SECT_AP_READ
  213. b __arm710_setup @ cpu_flush
  214. .long cpu_arch_name @ arch_name
  215. .long cpu_elf_name @ elf_name
  216. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  217. .long cpu_arm710_name @ name
  218. .long arm720_processor_functions
  219. .long v4_tlb_fns
  220. .long v4wt_user_fns
  221. .long v4_cache_fns
  222. .size __arm710_proc_info, . - __arm710_proc_info
  223. .type __arm720_proc_info, #object
  224. __arm720_proc_info:
  225. .long 0x41807200 @ cpu_val
  226. .long 0xffffff00 @ cpu_mask
  227. .long PMD_TYPE_SECT | \
  228. PMD_SECT_BUFFERABLE | \
  229. PMD_SECT_CACHEABLE | \
  230. PMD_BIT4 | \
  231. PMD_SECT_AP_WRITE | \
  232. PMD_SECT_AP_READ
  233. .long PMD_TYPE_SECT | \
  234. PMD_BIT4 | \
  235. PMD_SECT_AP_WRITE | \
  236. PMD_SECT_AP_READ
  237. b __arm720_setup @ cpu_flush
  238. .long cpu_arch_name @ arch_name
  239. .long cpu_elf_name @ elf_name
  240. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  241. .long cpu_arm720_name @ name
  242. .long arm720_processor_functions
  243. .long v4_tlb_fns
  244. .long v4wt_user_fns
  245. .long v4_cache_fns
  246. .size __arm720_proc_info, . - __arm720_proc_info