proc-arm720.S 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. ret 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. ret lr
  59. /*
  60. * Function: arm720_proc_do_idle(void)
  61. * Params : r0 = unused
  62. * Purpose : put the processor in proper idle mode
  63. */
  64. ENTRY(cpu_arm720_do_idle)
  65. ret 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. ret 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. ret lr
  92. /*
  93. * Function: arm720_reset
  94. * Params : r0 = address to jump to
  95. * Notes : This sets up everything for a reset
  96. */
  97. .pushsection .idmap.text, "ax"
  98. ENTRY(cpu_arm720_reset)
  99. mov ip, #0
  100. mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
  101. #ifdef CONFIG_MMU
  102. mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
  103. #endif
  104. mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
  105. bic ip, ip, #0x000f @ ............wcam
  106. bic ip, ip, #0x2100 @ ..v....s........
  107. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  108. ret r0
  109. ENDPROC(cpu_arm720_reset)
  110. .popsection
  111. .type __arm710_setup, #function
  112. __arm710_setup:
  113. mov r0, #0
  114. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  115. #ifdef CONFIG_MMU
  116. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  117. #endif
  118. mrc p15, 0, r0, c1, c0 @ get control register
  119. ldr r5, arm710_cr1_clear
  120. bic r0, r0, r5
  121. ldr r5, arm710_cr1_set
  122. orr r0, r0, r5
  123. ret lr @ __ret (head.S)
  124. .size __arm710_setup, . - __arm710_setup
  125. /*
  126. * R
  127. * .RVI ZFRS BLDP WCAM
  128. * .... 0001 ..11 1101
  129. *
  130. */
  131. .type arm710_cr1_clear, #object
  132. .type arm710_cr1_set, #object
  133. arm710_cr1_clear:
  134. .word 0x0f3f
  135. arm710_cr1_set:
  136. .word 0x013d
  137. .type __arm720_setup, #function
  138. __arm720_setup:
  139. mov r0, #0
  140. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  141. #ifdef CONFIG_MMU
  142. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  143. #endif
  144. adr r5, arm720_crval
  145. ldmia r5, {r5, r6}
  146. mrc p15, 0, r0, c1, c0 @ get control register
  147. bic r0, r0, r5
  148. orr r0, r0, r6
  149. ret 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_crval, #object
  158. arm720_crval:
  159. crval clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130
  160. __INITDATA
  161. @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
  162. define_processor_functions arm720, dabort=v4t_late_abort, pabort=legacy_pabort
  163. .section ".rodata"
  164. string cpu_arch_name, "armv4t"
  165. string cpu_elf_name, "v4"
  166. string cpu_arm710_name, "ARM710T"
  167. string cpu_arm720_name, "ARM720T"
  168. .align
  169. /*
  170. * See <asm/procinfo.h> for a definition of this structure.
  171. */
  172. .section ".proc.info.init", #alloc
  173. .macro arm720_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cpu_flush:req
  174. .type __\name\()_proc_info,#object
  175. __\name\()_proc_info:
  176. .long \cpu_val
  177. .long \cpu_mask
  178. .long PMD_TYPE_SECT | \
  179. PMD_SECT_BUFFERABLE | \
  180. PMD_SECT_CACHEABLE | \
  181. PMD_BIT4 | \
  182. PMD_SECT_AP_WRITE | \
  183. PMD_SECT_AP_READ
  184. .long PMD_TYPE_SECT | \
  185. PMD_BIT4 | \
  186. PMD_SECT_AP_WRITE | \
  187. PMD_SECT_AP_READ
  188. initfn \cpu_flush, __\name\()_proc_info @ cpu_flush
  189. .long cpu_arch_name @ arch_name
  190. .long cpu_elf_name @ elf_name
  191. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  192. .long \cpu_name
  193. .long arm720_processor_functions
  194. .long v4_tlb_fns
  195. .long v4wt_user_fns
  196. .long v4_cache_fns
  197. .size __\name\()_proc_info, . - __\name\()_proc_info
  198. .endm
  199. arm720_proc_info arm710, 0x41807100, 0xffffff00, cpu_arm710_name, __arm710_setup
  200. arm720_proc_info arm720, 0x41807200, 0xffffff00, cpu_arm720_name, __arm720_setup