Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 7 | * hacked for non-paged-MM by Hyok S. Choi, 2004. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 33 | * 04-20-2004 HSC modified for non-paged memory management mode. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | */ |
| 35 | #include <linux/linkage.h> |
| 36 | #include <linux/init.h> |
| 37 | #include <asm/assembler.h> |
Sam Ravnborg | e6ae744 | 2005-09-09 21:08:59 +0200 | [diff] [blame] | 38 | #include <asm/asm-offsets.h> |
Russell King | 5ec9407 | 2008-09-07 19:15:31 +0100 | [diff] [blame] | 39 | #include <asm/hwcap.h> |
Russell King | 74945c8 | 2006-03-16 14:44:36 +0000 | [diff] [blame] | 40 | #include <asm/pgtable-hwdef.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | #include <asm/pgtable.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #include <asm/ptrace.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Thomas Gleixner | bb8d5a5 | 2006-07-03 02:21:18 +0200 | [diff] [blame] | 44 | #include "proc-macros.S" |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | /* |
| 47 | * Function: arm720_proc_init (void) |
| 48 | * : arm720_proc_fin (void) |
| 49 | * |
| 50 | * Notes : This processor does not require these |
| 51 | */ |
| 52 | ENTRY(cpu_arm720_dcache_clean_area) |
| 53 | ENTRY(cpu_arm720_proc_init) |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 54 | ret lr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | ENTRY(cpu_arm720_proc_fin) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 61 | ret lr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
| 63 | /* |
| 64 | * Function: arm720_proc_do_idle(void) |
| 65 | * Params : r0 = unused |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 66 | * Purpose : put the processor in proper idle mode |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | */ |
| 68 | ENTRY(cpu_arm720_do_idle) |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 69 | ret lr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
| 71 | /* |
| 72 | * Function: arm720_switch_mm(unsigned long pgd_phys) |
| 73 | * Params : pgd_phys Physical address of page table |
| 74 | * Purpose : Perform a task switch, saving the old process' state and restoring |
| 75 | * the new. |
| 76 | */ |
| 77 | ENTRY(cpu_arm720_switch_mm) |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 78 | #ifdef CONFIG_MMU |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | mov r1, #0 |
| 80 | mcr p15, 0, r1, c7, c7, 0 @ invalidate cache |
| 81 | mcr p15, 0, r0, c2, c0, 0 @ update page table ptr |
| 82 | mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4) |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 83 | #endif |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 84 | ret lr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 86 | /* |
Russell King | ad1ae2f | 2006-12-13 14:34:43 +0000 | [diff] [blame] | 87 | * Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | * Params : r0 = Address to set |
| 89 | * : r1 = value to set |
| 90 | * Purpose : Set a PTE and flush it out of any WB cache |
| 91 | */ |
Russell King | da09165 | 2008-09-06 17:19:08 +0100 | [diff] [blame] | 92 | .align 5 |
Russell King | ad1ae2f | 2006-12-13 14:34:43 +0000 | [diff] [blame] | 93 | ENTRY(cpu_arm720_set_pte_ext) |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 94 | #ifdef CONFIG_MMU |
Russell King | da09165 | 2008-09-06 17:19:08 +0100 | [diff] [blame] | 95 | armv3_set_pte_ext wc_disable=0 |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 96 | #endif |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 97 | ret lr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
| 99 | /* |
| 100 | * Function: arm720_reset |
| 101 | * Params : r0 = address to jump to |
| 102 | * Notes : This sets up everything for a reset |
| 103 | */ |
Will Deacon | 1a4baaf | 2011-11-15 13:25:04 +0000 | [diff] [blame] | 104 | .pushsection .idmap.text, "ax" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | ENTRY(cpu_arm720_reset) |
| 106 | mov ip, #0 |
| 107 | mcr p15, 0, ip, c7, c7, 0 @ invalidate cache |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 108 | #ifdef CONFIG_MMU |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4) |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 110 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | mrc p15, 0, ip, c1, c0, 0 @ get ctrl register |
| 112 | bic ip, ip, #0x000f @ ............wcam |
| 113 | bic ip, ip, #0x2100 @ ..v....s........ |
| 114 | mcr p15, 0, ip, c1, c0, 0 @ ctrl register |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 115 | ret r0 |
Will Deacon | 1a4baaf | 2011-11-15 13:25:04 +0000 | [diff] [blame] | 116 | ENDPROC(cpu_arm720_reset) |
| 117 | .popsection |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | .type __arm710_setup, #function |
| 120 | __arm710_setup: |
| 121 | mov r0, #0 |
| 122 | mcr p15, 0, r0, c7, c7, 0 @ invalidate caches |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_MMU |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 125 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | mrc p15, 0, r0, c1, c0 @ get control register |
| 127 | ldr r5, arm710_cr1_clear |
| 128 | bic r0, r0, r5 |
| 129 | ldr r5, arm710_cr1_set |
| 130 | orr r0, r0, r5 |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 131 | ret lr @ __ret (head.S) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | .size __arm710_setup, . - __arm710_setup |
| 133 | |
| 134 | /* |
| 135 | * R |
| 136 | * .RVI ZFRS BLDP WCAM |
| 137 | * .... 0001 ..11 1101 |
| 138 | * |
| 139 | */ |
| 140 | .type arm710_cr1_clear, #object |
| 141 | .type arm710_cr1_set, #object |
| 142 | arm710_cr1_clear: |
| 143 | .word 0x0f3f |
| 144 | arm710_cr1_set: |
| 145 | .word 0x013d |
| 146 | |
| 147 | .type __arm720_setup, #function |
| 148 | __arm720_setup: |
| 149 | mov r0, #0 |
| 150 | mcr p15, 0, r0, c7, c7, 0 @ invalidate caches |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 151 | #ifdef CONFIG_MMU |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) |
Hyok S. Choi | d090ddd | 2006-06-28 14:10:01 +0100 | [diff] [blame] | 153 | #endif |
Russell King | 22b19086 | 2006-06-29 15:09:57 +0100 | [diff] [blame] | 154 | adr r5, arm720_crval |
| 155 | ldmia r5, {r5, r6} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | mrc p15, 0, r0, c1, c0 @ get control register |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | bic r0, r0, r5 |
Russell King | 22b19086 | 2006-06-29 15:09:57 +0100 | [diff] [blame] | 158 | orr r0, r0, r6 |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 159 | ret lr @ __ret (head.S) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | .size __arm720_setup, . - __arm720_setup |
| 161 | |
| 162 | /* |
| 163 | * R |
| 164 | * .RVI ZFRS BLDP WCAM |
| 165 | * ..1. 1001 ..11 1101 |
| 166 | * |
| 167 | */ |
Russell King | 22b19086 | 2006-06-29 15:09:57 +0100 | [diff] [blame] | 168 | .type arm720_crval, #object |
| 169 | arm720_crval: |
| 170 | crval clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | |
| 172 | __INITDATA |
Dave Martin | 449870b | 2011-06-23 17:18:56 +0100 | [diff] [blame] | 173 | @ define struct processor (see <asm/proc-fns.h> and proc-macros.S) |
| 174 | define_processor_functions arm720, dabort=v4t_late_abort, pabort=legacy_pabort |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | |
| 176 | .section ".rodata" |
| 177 | |
Dave Martin | 449870b | 2011-06-23 17:18:56 +0100 | [diff] [blame] | 178 | string cpu_arch_name, "armv4t" |
| 179 | string cpu_elf_name, "v4" |
| 180 | string cpu_arm710_name, "ARM710T" |
| 181 | string cpu_arm720_name, "ARM720T" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | |
| 183 | .align |
| 184 | |
| 185 | /* |
Russell King | 4baa992 | 2008-08-02 10:55:55 +0100 | [diff] [blame] | 186 | * See <asm/procinfo.h> for a definition of this structure. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | */ |
| 188 | |
Ard Biesheuvel | bf35706 | 2015-03-18 07:29:32 +0100 | [diff] [blame] | 189 | .section ".proc.info.init", #alloc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | |
Dave Martin | 449870b | 2011-06-23 17:18:56 +0100 | [diff] [blame] | 191 | .macro arm720_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cpu_flush:req |
| 192 | .type __\name\()_proc_info,#object |
| 193 | __\name\()_proc_info: |
| 194 | .long \cpu_val |
| 195 | .long \cpu_mask |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | .long PMD_TYPE_SECT | \ |
| 197 | PMD_SECT_BUFFERABLE | \ |
| 198 | PMD_SECT_CACHEABLE | \ |
| 199 | PMD_BIT4 | \ |
| 200 | PMD_SECT_AP_WRITE | \ |
| 201 | PMD_SECT_AP_READ |
Russell King | 8799ee9 | 2006-06-29 18:24:21 +0100 | [diff] [blame] | 202 | .long PMD_TYPE_SECT | \ |
| 203 | PMD_BIT4 | \ |
| 204 | PMD_SECT_AP_WRITE | \ |
| 205 | PMD_SECT_AP_READ |
Ard Biesheuvel | bf35706 | 2015-03-18 07:29:32 +0100 | [diff] [blame] | 206 | initfn \cpu_flush, __\name\()_proc_info @ cpu_flush |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | .long cpu_arch_name @ arch_name |
| 208 | .long cpu_elf_name @ elf_name |
| 209 | .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap |
Dave Martin | 449870b | 2011-06-23 17:18:56 +0100 | [diff] [blame] | 210 | .long \cpu_name |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | .long arm720_processor_functions |
| 212 | .long v4_tlb_fns |
| 213 | .long v4wt_user_fns |
| 214 | .long v4_cache_fns |
Dave Martin | 449870b | 2011-06-23 17:18:56 +0100 | [diff] [blame] | 215 | .size __\name\()_proc_info, . - __\name\()_proc_info |
| 216 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | |
Dave Martin | 449870b | 2011-06-23 17:18:56 +0100 | [diff] [blame] | 218 | arm720_proc_info arm710, 0x41807100, 0xffffff00, cpu_arm710_name, __arm710_setup |
| 219 | arm720_proc_info arm720, 0x41807200, 0xffffff00, cpu_arm720_name, __arm720_setup |