proc-arm720.S 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720
  4. *
  5. * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
  6. * Rob Scott (rscott@mtrob.fdns.net)
  7. * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd.
  8. * hacked for non-paged-MM by Hyok S. Choi, 2004.
  9. *
  10. * These are the low level assembler for performing cache and TLB
  11. * functions on the ARM720T. The ARM720T has a writethrough IDC
  12. * cache, so we don't need to clean it.
  13. *
  14. * Changelog:
  15. * 05-09-2000 SJH Created by moving 720 specific functions
  16. * out of 'proc-arm6,7.S' per RMK discussion
  17. * 07-25-2000 SJH Added idle function.
  18. * 08-25-2000 DBS Updated for integration of ARM Ltd version.
  19. * 04-20-2004 HSC modified for non-paged memory management mode.
  20. */
  21. #include <linux/linkage.h>
  22. #include <linux/init.h>
  23. #include <linux/cfi_types.h>
  24. #include <linux/pgtable.h>
  25. #include <asm/assembler.h>
  26. #include <asm/asm-offsets.h>
  27. #include <asm/hwcap.h>
  28. #include <asm/pgtable-hwdef.h>
  29. #include <asm/ptrace.h>
  30. #include "proc-macros.S"
  31. /*
  32. * Function: arm720_proc_init (void)
  33. * : arm720_proc_fin (void)
  34. *
  35. * Notes : This processor does not require these
  36. */
  37. SYM_TYPED_FUNC_START(cpu_arm720_dcache_clean_area)
  38. ret lr
  39. SYM_FUNC_END(cpu_arm720_dcache_clean_area)
  40. SYM_TYPED_FUNC_START(cpu_arm720_proc_init)
  41. ret lr
  42. SYM_FUNC_END(cpu_arm720_proc_init)
  43. SYM_TYPED_FUNC_START(cpu_arm720_proc_fin)
  44. mrc p15, 0, r0, c1, c0, 0
  45. bic r0, r0, #0x1000 @ ...i............
  46. bic r0, r0, #0x000e @ ............wca.
  47. mcr p15, 0, r0, c1, c0, 0 @ disable caches
  48. ret lr
  49. SYM_FUNC_END(cpu_arm720_proc_fin)
  50. /*
  51. * Function: arm720_proc_do_idle(void)
  52. * Params : r0 = unused
  53. * Purpose : put the processor in proper idle mode
  54. */
  55. SYM_TYPED_FUNC_START(cpu_arm720_do_idle)
  56. ret lr
  57. SYM_FUNC_END(cpu_arm720_do_idle)
  58. /*
  59. * Function: arm720_switch_mm(unsigned long pgd_phys)
  60. * Params : pgd_phys Physical address of page table
  61. * Purpose : Perform a task switch, saving the old process' state and restoring
  62. * the new.
  63. */
  64. SYM_TYPED_FUNC_START(cpu_arm720_switch_mm)
  65. #ifdef CONFIG_MMU
  66. mov r1, #0
  67. mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
  68. mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
  69. mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
  70. #endif
  71. ret lr
  72. SYM_FUNC_END(cpu_arm720_switch_mm)
  73. /*
  74. * Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext)
  75. * Params : r0 = Address to set
  76. * : r1 = value to set
  77. * Purpose : Set a PTE and flush it out of any WB cache
  78. */
  79. .align 5
  80. SYM_TYPED_FUNC_START(cpu_arm720_set_pte_ext)
  81. #ifdef CONFIG_MMU
  82. armv3_set_pte_ext wc_disable=0
  83. #endif
  84. ret lr
  85. SYM_FUNC_END(cpu_arm720_set_pte_ext)
  86. /*
  87. * Function: arm720_reset
  88. * Params : r0 = address to jump to
  89. * Notes : This sets up everything for a reset
  90. */
  91. .pushsection .idmap.text, "ax"
  92. SYM_TYPED_FUNC_START(cpu_arm720_reset)
  93. mov ip, #0
  94. mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
  95. #ifdef CONFIG_MMU
  96. mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
  97. #endif
  98. mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
  99. bic ip, ip, #0x000f @ ............wcam
  100. bic ip, ip, #0x2100 @ ..v....s........
  101. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  102. ret r0
  103. SYM_FUNC_END(cpu_arm720_reset)
  104. .popsection
  105. .type __arm710_setup, #function
  106. __arm710_setup:
  107. mov r0, #0
  108. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  109. #ifdef CONFIG_MMU
  110. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  111. #endif
  112. mrc p15, 0, r0, c1, c0 @ get control register
  113. ldr r5, arm710_cr1_clear
  114. bic r0, r0, r5
  115. ldr r5, arm710_cr1_set
  116. orr r0, r0, r5
  117. ret lr @ __ret (head.S)
  118. .size __arm710_setup, . - __arm710_setup
  119. /*
  120. * R
  121. * .RVI ZFRS BLDP WCAM
  122. * .... 0001 ..11 1101
  123. *
  124. */
  125. .type arm710_cr1_clear, #object
  126. .type arm710_cr1_set, #object
  127. arm710_cr1_clear:
  128. .word 0x0f3f
  129. arm710_cr1_set:
  130. .word 0x013d
  131. .type __arm720_setup, #function
  132. __arm720_setup:
  133. mov r0, #0
  134. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  135. #ifdef CONFIG_MMU
  136. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  137. #endif
  138. adr r5, arm720_crval
  139. ldmia r5, {r5, r6}
  140. mrc p15, 0, r0, c1, c0 @ get control register
  141. bic r0, r0, r5
  142. orr r0, r0, r6
  143. ret lr @ __ret (head.S)
  144. .size __arm720_setup, . - __arm720_setup
  145. /*
  146. * R
  147. * .RVI ZFRS BLDP WCAM
  148. * ..1. 1001 ..11 1101
  149. *
  150. */
  151. .type arm720_crval, #object
  152. arm720_crval:
  153. crval clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130
  154. __INITDATA
  155. @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
  156. define_processor_functions arm720, dabort=v4t_late_abort, pabort=legacy_pabort
  157. .section ".rodata"
  158. string cpu_arch_name, "armv4t"
  159. string cpu_elf_name, "v4"
  160. string cpu_arm710_name, "ARM710T"
  161. string cpu_arm720_name, "ARM720T"
  162. .align
  163. /*
  164. * See <asm/procinfo.h> for a definition of this structure.
  165. */
  166. .section ".proc.info.init", "a"
  167. .macro arm720_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cpu_flush:req
  168. .type __\name\()_proc_info,#object
  169. __\name\()_proc_info:
  170. .long \cpu_val
  171. .long \cpu_mask
  172. .long PMD_TYPE_SECT | \
  173. PMD_SECT_BUFFERABLE | \
  174. PMD_SECT_CACHEABLE | \
  175. PMD_BIT4 | \
  176. PMD_SECT_AP_WRITE | \
  177. PMD_SECT_AP_READ
  178. .long PMD_TYPE_SECT | \
  179. PMD_BIT4 | \
  180. PMD_SECT_AP_WRITE | \
  181. PMD_SECT_AP_READ
  182. initfn \cpu_flush, __\name\()_proc_info @ cpu_flush
  183. .long cpu_arch_name @ arch_name
  184. .long cpu_elf_name @ elf_name
  185. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  186. .long \cpu_name
  187. .long arm720_processor_functions
  188. .long v4_tlb_fns
  189. .long v4wt_user_fns
  190. .long v4_cache_fns
  191. .size __\name\()_proc_info, . - __\name\()_proc_info
  192. .endm
  193. arm720_proc_info arm710, 0x41807100, 0xffffff00, cpu_arm710_name, __arm710_setup
  194. arm720_proc_info arm720, 0x41807200, 0xffffff00, cpu_arm720_name, __arm720_setup