proc-arm720.S 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. 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. mov pc, lr
  59. /*
  60. * Function: arm720_proc_do_idle(void)
  61. * Params : r0 = unused
  62. * Purpose : put the processer in proper idle mode
  63. */
  64. ENTRY(cpu_arm720_do_idle)
  65. mov pc, lr
  66. /*
  67. * Function: arm720_switch_mm(unsigned long pgd_phys)
  68. * Params : pgd_phys Physical address of page table
  69. * Purpose : Perform a task switch, saving the old process' state and restoring
  70. * the new.
  71. */
  72. ENTRY(cpu_arm720_switch_mm)
  73. #ifdef CONFIG_MMU
  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. #endif
  79. mov pc, lr
  80. /*
  81. * Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext)
  82. * Params : r0 = Address to set
  83. * : r1 = value to set
  84. * Purpose : Set a PTE and flush it out of any WB cache
  85. */
  86. .align 5
  87. ENTRY(cpu_arm720_set_pte_ext)
  88. #ifdef CONFIG_MMU
  89. armv3_set_pte_ext wc_disable=0
  90. #endif
  91. mov pc, lr
  92. /*
  93. * Function: arm720_reset
  94. * Params : r0 = address to jump to
  95. * Notes : This sets up everything for a reset
  96. */
  97. ENTRY(cpu_arm720_reset)
  98. mov ip, #0
  99. mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
  100. #ifdef CONFIG_MMU
  101. mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
  102. #endif
  103. mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
  104. bic ip, ip, #0x000f @ ............wcam
  105. bic ip, ip, #0x2100 @ ..v....s........
  106. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  107. mov pc, r0
  108. __INIT
  109. .type __arm710_setup, #function
  110. __arm710_setup:
  111. mov r0, #0
  112. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  113. #ifdef CONFIG_MMU
  114. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  115. #endif
  116. mrc p15, 0, r0, c1, c0 @ get control register
  117. ldr r5, arm710_cr1_clear
  118. bic r0, r0, r5
  119. ldr r5, arm710_cr1_set
  120. orr r0, r0, r5
  121. mov pc, lr @ __ret (head.S)
  122. .size __arm710_setup, . - __arm710_setup
  123. /*
  124. * R
  125. * .RVI ZFRS BLDP WCAM
  126. * .... 0001 ..11 1101
  127. *
  128. */
  129. .type arm710_cr1_clear, #object
  130. .type arm710_cr1_set, #object
  131. arm710_cr1_clear:
  132. .word 0x0f3f
  133. arm710_cr1_set:
  134. .word 0x013d
  135. .type __arm720_setup, #function
  136. __arm720_setup:
  137. mov r0, #0
  138. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  139. #ifdef CONFIG_MMU
  140. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  141. #endif
  142. adr r5, arm720_crval
  143. ldmia r5, {r5, r6}
  144. mrc p15, 0, r0, c1, c0 @ get control register
  145. bic r0, r0, r5
  146. orr r0, r0, r6
  147. mov pc, lr @ __ret (head.S)
  148. .size __arm720_setup, . - __arm720_setup
  149. /*
  150. * R
  151. * .RVI ZFRS BLDP WCAM
  152. * ..1. 1001 ..11 1101
  153. *
  154. */
  155. .type arm720_crval, #object
  156. arm720_crval:
  157. crval clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130
  158. __INITDATA
  159. /*
  160. * Purpose : Function pointers used to access above functions - all calls
  161. * come through these
  162. */
  163. .type arm720_processor_functions, #object
  164. ENTRY(arm720_processor_functions)
  165. .word v4t_late_abort
  166. .word legacy_pabort
  167. .word cpu_arm720_proc_init
  168. .word cpu_arm720_proc_fin
  169. .word cpu_arm720_reset
  170. .word cpu_arm720_do_idle
  171. .word cpu_arm720_dcache_clean_area
  172. .word cpu_arm720_switch_mm
  173. .word cpu_arm720_set_pte_ext
  174. .size arm720_processor_functions, . - arm720_processor_functions
  175. .section ".rodata"
  176. .type cpu_arch_name, #object
  177. cpu_arch_name: .asciz "armv4t"
  178. .size cpu_arch_name, . - cpu_arch_name
  179. .type cpu_elf_name, #object
  180. cpu_elf_name: .asciz "v4"
  181. .size cpu_elf_name, . - cpu_elf_name
  182. .type cpu_arm710_name, #object
  183. cpu_arm710_name:
  184. .asciz "ARM710T"
  185. .size cpu_arm710_name, . - cpu_arm710_name
  186. .type cpu_arm720_name, #object
  187. cpu_arm720_name:
  188. .asciz "ARM720T"
  189. .size cpu_arm720_name, . - cpu_arm720_name
  190. .align
  191. /*
  192. * See <asm/procinfo.h> for a definition of this structure.
  193. */
  194. .section ".proc.info.init", #alloc, #execinstr
  195. .type __arm710_proc_info, #object
  196. __arm710_proc_info:
  197. .long 0x41807100 @ cpu_val
  198. .long 0xffffff00 @ cpu_mask
  199. .long PMD_TYPE_SECT | \
  200. PMD_SECT_BUFFERABLE | \
  201. PMD_SECT_CACHEABLE | \
  202. PMD_BIT4 | \
  203. PMD_SECT_AP_WRITE | \
  204. PMD_SECT_AP_READ
  205. .long PMD_TYPE_SECT | \
  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. .long PMD_TYPE_SECT | \
  230. PMD_BIT4 | \
  231. PMD_SECT_AP_WRITE | \
  232. PMD_SECT_AP_READ
  233. b __arm720_setup @ cpu_flush
  234. .long cpu_arch_name @ arch_name
  235. .long cpu_elf_name @ elf_name
  236. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  237. .long cpu_arm720_name @ name
  238. .long arm720_processor_functions
  239. .long v4_tlb_fns
  240. .long v4wt_user_fns
  241. .long v4_cache_fns
  242. .size __arm720_proc_info, . - __arm720_proc_info