| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | *  linux/arch/arm/mm/cache-v6.S | 
|  | 3 | * | 
|  | 4 | *  Copyright (C) 2001 Deep Blue Solutions Ltd. | 
|  | 5 | * | 
|  | 6 | * This program is free software; you can redistribute it and/or modify | 
|  | 7 | * it under the terms of the GNU General Public License version 2 as | 
|  | 8 | * published by the Free Software Foundation. | 
|  | 9 | * | 
|  | 10 | *  This is the "shell" of the ARMv6 processor support. | 
|  | 11 | */ | 
|  | 12 | #include <linux/linkage.h> | 
|  | 13 | #include <linux/init.h> | 
|  | 14 | #include <asm/assembler.h> | 
| Catalin Marinas | 32cfb1b | 2009-10-06 17:57:09 +0100 | [diff] [blame] | 15 | #include <asm/unwind.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 |  | 
|  | 17 | #include "proc-macros.S" | 
|  | 18 |  | 
|  | 19 | #define HARVARD_CACHE | 
|  | 20 | #define CACHE_LINE_SIZE		32 | 
|  | 21 | #define D_CACHE_LINE_SIZE	32 | 
| Gen FUKATSU | 217874f | 2005-09-30 16:09:17 +0100 | [diff] [blame] | 22 | #define BTB_FLUSH_SIZE		8 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 |  | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 24 | /* | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 25 | *	v6_flush_icache_all() | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 26 | * | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 27 | *	Flush the whole I-cache. | 
|  | 28 | * | 
|  | 29 | *	ARM1136 erratum 411920 - Invalidate Instruction Cache operation can fail. | 
|  | 30 | *	This erratum is present in 1136, 1156 and 1176. It does not affect the | 
|  | 31 | *	MPCore. | 
|  | 32 | * | 
|  | 33 | *	Registers: | 
|  | 34 | *	r0 - set to 0 | 
|  | 35 | *	r1 - corrupted | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 36 | */ | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 37 | ENTRY(v6_flush_icache_all) | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 38 | mov	r0, #0 | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 39 | #ifdef CONFIG_ARM_ERRATA_411920 | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 40 | mrs	r1, cpsr | 
|  | 41 | cpsid	ifa				@ disable interrupts | 
|  | 42 | mcr	p15, 0, r0, c7, c5, 0		@ invalidate entire I-cache | 
|  | 43 | mcr	p15, 0, r0, c7, c5, 0		@ invalidate entire I-cache | 
|  | 44 | mcr	p15, 0, r0, c7, c5, 0		@ invalidate entire I-cache | 
|  | 45 | mcr	p15, 0, r0, c7, c5, 0		@ invalidate entire I-cache | 
|  | 46 | msr	cpsr_cx, r1			@ restore interrupts | 
|  | 47 | .rept	11				@ ARM Ltd recommends at least | 
|  | 48 | nop					@ 11 NOPs | 
|  | 49 | .endr | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 50 | #else | 
|  | 51 | mcr	p15, 0, r0, c7, c5, 0		@ invalidate I-cache | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 52 | #endif | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 53 | mov	pc, lr | 
|  | 54 | ENDPROC(v6_flush_icache_all) | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 55 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | /* | 
|  | 57 | *	v6_flush_cache_all() | 
|  | 58 | * | 
|  | 59 | *	Flush the entire cache. | 
|  | 60 | * | 
|  | 61 | *	It is assumed that: | 
|  | 62 | */ | 
|  | 63 | ENTRY(v6_flush_kern_cache_all) | 
|  | 64 | mov	r0, #0 | 
|  | 65 | #ifdef HARVARD_CACHE | 
|  | 66 | mcr	p15, 0, r0, c7, c14, 0		@ D cache clean+invalidate | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 67 | #ifndef CONFIG_ARM_ERRATA_411920 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | mcr	p15, 0, r0, c7, c5, 0		@ I+BTB cache invalidate | 
|  | 69 | #else | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 70 | b	v6_flush_icache_all | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 71 | #endif | 
|  | 72 | #else | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | mcr	p15, 0, r0, c7, c15, 0		@ Cache clean+invalidate | 
|  | 74 | #endif | 
|  | 75 | mov	pc, lr | 
|  | 76 |  | 
|  | 77 | /* | 
|  | 78 | *	v6_flush_cache_all() | 
|  | 79 | * | 
|  | 80 | *	Flush all TLB entries in a particular address space | 
|  | 81 | * | 
|  | 82 | *	- mm    - mm_struct describing address space | 
|  | 83 | */ | 
|  | 84 | ENTRY(v6_flush_user_cache_all) | 
|  | 85 | /*FALLTHROUGH*/ | 
|  | 86 |  | 
|  | 87 | /* | 
|  | 88 | *	v6_flush_cache_range(start, end, flags) | 
|  | 89 | * | 
|  | 90 | *	Flush a range of TLB entries in the specified address space. | 
|  | 91 | * | 
|  | 92 | *	- start - start address (may not be aligned) | 
|  | 93 | *	- end   - end address (exclusive, may not be aligned) | 
|  | 94 | *	- flags	- vm_area_struct flags describing address space | 
|  | 95 | * | 
|  | 96 | *	It is assumed that: | 
|  | 97 | *	- we have a VIPT cache. | 
|  | 98 | */ | 
|  | 99 | ENTRY(v6_flush_user_cache_range) | 
|  | 100 | mov	pc, lr | 
|  | 101 |  | 
|  | 102 | /* | 
|  | 103 | *	v6_coherent_kern_range(start,end) | 
|  | 104 | * | 
|  | 105 | *	Ensure that the I and D caches are coherent within specified | 
|  | 106 | *	region.  This is typically used when code has been written to | 
|  | 107 | *	a memory region, and will be executed. | 
|  | 108 | * | 
|  | 109 | *	- start   - virtual start address of region | 
|  | 110 | *	- end     - virtual end address of region | 
|  | 111 | * | 
|  | 112 | *	It is assumed that: | 
|  | 113 | *	- the Icache does not read data from the write buffer | 
|  | 114 | */ | 
|  | 115 | ENTRY(v6_coherent_kern_range) | 
|  | 116 | /* FALLTHROUGH */ | 
|  | 117 |  | 
|  | 118 | /* | 
|  | 119 | *	v6_coherent_user_range(start,end) | 
|  | 120 | * | 
|  | 121 | *	Ensure that the I and D caches are coherent within specified | 
|  | 122 | *	region.  This is typically used when code has been written to | 
|  | 123 | *	a memory region, and will be executed. | 
|  | 124 | * | 
|  | 125 | *	- start   - virtual start address of region | 
|  | 126 | *	- end     - virtual end address of region | 
|  | 127 | * | 
|  | 128 | *	It is assumed that: | 
|  | 129 | *	- the Icache does not read data from the write buffer | 
|  | 130 | */ | 
|  | 131 | ENTRY(v6_coherent_user_range) | 
| Catalin Marinas | 32cfb1b | 2009-10-06 17:57:09 +0100 | [diff] [blame] | 132 | UNWIND(.fnstart		) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | #ifdef HARVARD_CACHE | 
| Nicolas Pitre | 18afea0 | 2006-02-01 19:26:01 +0000 | [diff] [blame] | 134 | bic	r0, r0, #CACHE_LINE_SIZE - 1 | 
| Catalin Marinas | 32cfb1b | 2009-10-06 17:57:09 +0100 | [diff] [blame] | 135 | 1: | 
|  | 136 | USER(	mcr	p15, 0, r0, c7, c10, 1	)	@ clean D line | 
| Nicolas Pitre | 18afea0 | 2006-02-01 19:26:01 +0000 | [diff] [blame] | 137 | add	r0, r0, #CACHE_LINE_SIZE | 
| Catalin Marinas | 32cfb1b | 2009-10-06 17:57:09 +0100 | [diff] [blame] | 138 | 2: | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | cmp	r0, r1 | 
|  | 140 | blo	1b | 
| Nicolas Pitre | 18afea0 | 2006-02-01 19:26:01 +0000 | [diff] [blame] | 141 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | mov	r0, #0 | 
| Catalin Marinas | 141fa40 | 2006-03-10 22:26:47 +0000 | [diff] [blame] | 143 | #ifdef HARVARD_CACHE | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 145 | #ifndef CONFIG_ARM_ERRATA_411920 | 
| Catalin Marinas | 141fa40 | 2006-03-10 22:26:47 +0000 | [diff] [blame] | 146 | mcr	p15, 0, r0, c7, c5, 0		@ I+BTB cache invalidate | 
|  | 147 | #else | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 148 | b	v6_flush_icache_all | 
| Catalin Marinas | 9cba3cc | 2009-04-30 17:06:03 +0100 | [diff] [blame] | 149 | #endif | 
|  | 150 | #else | 
| Catalin Marinas | 141fa40 | 2006-03-10 22:26:47 +0000 | [diff] [blame] | 151 | mcr	p15, 0, r0, c7, c5, 6		@ invalidate BTB | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | #endif | 
|  | 153 | mov	pc, lr | 
|  | 154 |  | 
|  | 155 | /* | 
| Catalin Marinas | 32cfb1b | 2009-10-06 17:57:09 +0100 | [diff] [blame] | 156 | * Fault handling for the cache operation above. If the virtual address in r0 | 
|  | 157 | * isn't mapped, just try the next page. | 
|  | 158 | */ | 
|  | 159 | 9001: | 
|  | 160 | mov	r0, r0, lsr #12 | 
|  | 161 | mov	r0, r0, lsl #12 | 
|  | 162 | add	r0, r0, #4096 | 
|  | 163 | b	2b | 
|  | 164 | UNWIND(.fnend		) | 
|  | 165 | ENDPROC(v6_coherent_user_range) | 
|  | 166 | ENDPROC(v6_coherent_kern_range) | 
|  | 167 |  | 
|  | 168 | /* | 
| Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 169 | *	v6_flush_kern_dcache_area(void *addr, size_t size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | * | 
|  | 171 | *	Ensure that the data held in the page kaddr is written back | 
|  | 172 | *	to the page in question. | 
|  | 173 | * | 
| Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 174 | *	- addr	- kernel address | 
|  | 175 | *	- size	- region size | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | */ | 
| Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 177 | ENTRY(v6_flush_kern_dcache_area) | 
|  | 178 | add	r1, r0, r1 | 
| Will Deacon | a248b13 | 2011-05-26 11:20:19 +0100 | [diff] [blame] | 179 | bic	r0, r0, #D_CACHE_LINE_SIZE - 1 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | 1: | 
|  | 181 | #ifdef HARVARD_CACHE | 
|  | 182 | mcr	p15, 0, r0, c7, c14, 1		@ clean & invalidate D line | 
|  | 183 | #else | 
|  | 184 | mcr	p15, 0, r0, c7, c15, 1		@ clean & invalidate unified line | 
|  | 185 | #endif | 
|  | 186 | add	r0, r0, #D_CACHE_LINE_SIZE | 
|  | 187 | cmp	r0, r1 | 
|  | 188 | blo	1b | 
|  | 189 | #ifdef HARVARD_CACHE | 
|  | 190 | mov	r0, #0 | 
|  | 191 | mcr	p15, 0, r0, c7, c10, 4 | 
|  | 192 | #endif | 
|  | 193 | mov	pc, lr | 
|  | 194 |  | 
|  | 195 |  | 
|  | 196 | /* | 
|  | 197 | *	v6_dma_inv_range(start,end) | 
|  | 198 | * | 
|  | 199 | *	Invalidate the data cache within the specified region; we will | 
|  | 200 | *	be performing a DMA operation in this region and we want to | 
|  | 201 | *	purge old data in the cache. | 
|  | 202 | * | 
|  | 203 | *	- start   - virtual start address of region | 
|  | 204 | *	- end     - virtual end address of region | 
|  | 205 | */ | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 206 | ENTRY(v6_dma_inv_range) | 
| Valentine Barshak | 85b093b | 2010-12-14 00:03:16 +0100 | [diff] [blame] | 207 | #ifdef CONFIG_DMA_CACHE_RWFO | 
|  | 208 | ldrb	r2, [r0]			@ read for ownership | 
|  | 209 | strb	r2, [r0]			@ write for ownership | 
|  | 210 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | tst	r0, #D_CACHE_LINE_SIZE - 1 | 
|  | 212 | bic	r0, r0, #D_CACHE_LINE_SIZE - 1 | 
|  | 213 | #ifdef HARVARD_CACHE | 
|  | 214 | mcrne	p15, 0, r0, c7, c10, 1		@ clean D line | 
|  | 215 | #else | 
|  | 216 | mcrne	p15, 0, r0, c7, c11, 1		@ clean unified line | 
|  | 217 | #endif | 
|  | 218 | tst	r1, #D_CACHE_LINE_SIZE - 1 | 
| Valentine Barshak | 85b093b | 2010-12-14 00:03:16 +0100 | [diff] [blame] | 219 | #ifdef CONFIG_DMA_CACHE_RWFO | 
|  | 220 | ldrneb	r2, [r1, #-1]			@ read for ownership | 
|  | 221 | strneb	r2, [r1, #-1]			@ write for ownership | 
|  | 222 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | bic	r1, r1, #D_CACHE_LINE_SIZE - 1 | 
|  | 224 | #ifdef HARVARD_CACHE | 
|  | 225 | mcrne	p15, 0, r1, c7, c14, 1		@ clean & invalidate D line | 
|  | 226 | #else | 
|  | 227 | mcrne	p15, 0, r1, c7, c15, 1		@ clean & invalidate unified line | 
|  | 228 | #endif | 
|  | 229 | 1: | 
|  | 230 | #ifdef HARVARD_CACHE | 
|  | 231 | mcr	p15, 0, r0, c7, c6, 1		@ invalidate D line | 
|  | 232 | #else | 
|  | 233 | mcr	p15, 0, r0, c7, c7, 1		@ invalidate unified line | 
|  | 234 | #endif | 
|  | 235 | add	r0, r0, #D_CACHE_LINE_SIZE | 
|  | 236 | cmp	r0, r1 | 
| Valentine Barshak | 85b093b | 2010-12-14 00:03:16 +0100 | [diff] [blame] | 237 | #ifdef CONFIG_DMA_CACHE_RWFO | 
|  | 238 | ldrlo	r2, [r0]			@ read for ownership | 
|  | 239 | strlo	r2, [r0]			@ write for ownership | 
|  | 240 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | blo	1b | 
|  | 242 | mov	r0, #0 | 
|  | 243 | mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer | 
|  | 244 | mov	pc, lr | 
|  | 245 |  | 
|  | 246 | /* | 
|  | 247 | *	v6_dma_clean_range(start,end) | 
|  | 248 | *	- start   - virtual start address of region | 
|  | 249 | *	- end     - virtual end address of region | 
|  | 250 | */ | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 251 | ENTRY(v6_dma_clean_range) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | bic	r0, r0, #D_CACHE_LINE_SIZE - 1 | 
|  | 253 | 1: | 
| Catalin Marinas | ad642d9 | 2010-06-21 15:10:07 +0100 | [diff] [blame] | 254 | #ifdef CONFIG_DMA_CACHE_RWFO | 
| Catalin Marinas | f4d6477 | 2010-05-07 16:26:24 +0100 | [diff] [blame] | 255 | ldr	r2, [r0]			@ read for ownership | 
|  | 256 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | #ifdef HARVARD_CACHE | 
|  | 258 | mcr	p15, 0, r0, c7, c10, 1		@ clean D line | 
|  | 259 | #else | 
|  | 260 | mcr	p15, 0, r0, c7, c11, 1		@ clean unified line | 
|  | 261 | #endif | 
|  | 262 | add	r0, r0, #D_CACHE_LINE_SIZE | 
|  | 263 | cmp	r0, r1 | 
|  | 264 | blo	1b | 
|  | 265 | mov	r0, #0 | 
|  | 266 | mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer | 
|  | 267 | mov	pc, lr | 
|  | 268 |  | 
|  | 269 | /* | 
|  | 270 | *	v6_dma_flush_range(start,end) | 
|  | 271 | *	- start   - virtual start address of region | 
|  | 272 | *	- end     - virtual end address of region | 
|  | 273 | */ | 
|  | 274 | ENTRY(v6_dma_flush_range) | 
| Arve Hjønnevåg | 2d35c83 | 2009-06-09 20:17:45 -0700 | [diff] [blame] | 275 | #ifdef CONFIG_CACHE_FLUSH_RANGE_LIMIT | 
|  | 276 | sub	r2, r1, r0 | 
|  | 277 | cmp	r2, #CONFIG_CACHE_FLUSH_RANGE_LIMIT | 
|  | 278 | bhi	v6_dma_flush_dcache_all | 
|  | 279 | #endif | 
| Valentine Barshak | 85b093b | 2010-12-14 00:03:16 +0100 | [diff] [blame] | 280 | #ifdef CONFIG_DMA_CACHE_RWFO | 
|  | 281 | ldrb	r2, [r0]		@ read for ownership | 
|  | 282 | strb	r2, [r0]		@ write for ownership | 
|  | 283 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | bic	r0, r0, #D_CACHE_LINE_SIZE - 1 | 
|  | 285 | 1: | 
|  | 286 | #ifdef HARVARD_CACHE | 
|  | 287 | mcr	p15, 0, r0, c7, c14, 1		@ clean & invalidate D line | 
|  | 288 | #else | 
|  | 289 | mcr	p15, 0, r0, c7, c15, 1		@ clean & invalidate line | 
|  | 290 | #endif | 
|  | 291 | add	r0, r0, #D_CACHE_LINE_SIZE | 
|  | 292 | cmp	r0, r1 | 
| Valentine Barshak | 85b093b | 2010-12-14 00:03:16 +0100 | [diff] [blame] | 293 | #ifdef CONFIG_DMA_CACHE_RWFO | 
|  | 294 | ldrlob	r2, [r0]			@ read for ownership | 
|  | 295 | strlob	r2, [r0]			@ write for ownership | 
|  | 296 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | blo	1b | 
|  | 298 | mov	r0, #0 | 
|  | 299 | mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer | 
|  | 300 | mov	pc, lr | 
|  | 301 |  | 
| Arve Hjønnevåg | 2d35c83 | 2009-06-09 20:17:45 -0700 | [diff] [blame] | 302 | #ifdef CONFIG_CACHE_FLUSH_RANGE_LIMIT | 
|  | 303 | v6_dma_flush_dcache_all: | 
|  | 304 | mov	r0, #0 | 
|  | 305 | #ifdef HARVARD_CACHE | 
|  | 306 | mcr	p15, 0, r0, c7, c14, 0		@ D cache clean+invalidate | 
|  | 307 | #else | 
|  | 308 | mcr	p15, 0, r0, c7, c15, 0		@ Cache clean+invalidate | 
|  | 309 | #endif | 
|  | 310 | mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer | 
|  | 311 | mov	pc, lr | 
|  | 312 | #endif | 
|  | 313 |  | 
| Russell King | a9c9147 | 2009-11-26 16:19:58 +0000 | [diff] [blame] | 314 | /* | 
|  | 315 | *	dma_map_area(start, size, dir) | 
|  | 316 | *	- start	- kernel virtual start address | 
|  | 317 | *	- size	- size of region | 
|  | 318 | *	- dir	- DMA direction | 
|  | 319 | */ | 
|  | 320 | ENTRY(v6_dma_map_area) | 
|  | 321 | add	r1, r1, r0 | 
| Russell King | 2ffe2da | 2009-10-31 16:52:16 +0000 | [diff] [blame] | 322 | teq	r2, #DMA_FROM_DEVICE | 
|  | 323 | beq	v6_dma_inv_range | 
| Catalin Marinas | ad642d9 | 2010-06-21 15:10:07 +0100 | [diff] [blame] | 324 | #ifndef CONFIG_DMA_CACHE_RWFO | 
|  | 325 | b	v6_dma_clean_range | 
|  | 326 | #else | 
| Catalin Marinas | f4d6477 | 2010-05-07 16:26:24 +0100 | [diff] [blame] | 327 | teq	r2, #DMA_TO_DEVICE | 
|  | 328 | beq	v6_dma_clean_range | 
|  | 329 | b	v6_dma_flush_range | 
| Catalin Marinas | ad642d9 | 2010-06-21 15:10:07 +0100 | [diff] [blame] | 330 | #endif | 
| Russell King | a9c9147 | 2009-11-26 16:19:58 +0000 | [diff] [blame] | 331 | ENDPROC(v6_dma_map_area) | 
|  | 332 |  | 
|  | 333 | /* | 
|  | 334 | *	dma_unmap_area(start, size, dir) | 
|  | 335 | *	- start	- kernel virtual start address | 
|  | 336 | *	- size	- size of region | 
|  | 337 | *	- dir	- DMA direction | 
|  | 338 | */ | 
|  | 339 | ENTRY(v6_dma_unmap_area) | 
| Catalin Marinas | ad642d9 | 2010-06-21 15:10:07 +0100 | [diff] [blame] | 340 | #ifndef CONFIG_DMA_CACHE_RWFO | 
|  | 341 | add	r1, r1, r0 | 
|  | 342 | teq	r2, #DMA_TO_DEVICE | 
|  | 343 | bne	v6_dma_inv_range | 
|  | 344 | #endif | 
| Russell King | a9c9147 | 2009-11-26 16:19:58 +0000 | [diff] [blame] | 345 | mov	pc, lr | 
|  | 346 | ENDPROC(v6_dma_unmap_area) | 
|  | 347 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | __INITDATA | 
|  | 349 |  | 
|  | 350 | .type	v6_cache_fns, #object | 
|  | 351 | ENTRY(v6_cache_fns) | 
| Tony Lindgren | 81d1195 | 2010-09-21 17:16:40 +0100 | [diff] [blame] | 352 | .long	v6_flush_icache_all | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | .long	v6_flush_kern_cache_all | 
|  | 354 | .long	v6_flush_user_cache_all | 
|  | 355 | .long	v6_flush_user_cache_range | 
|  | 356 | .long	v6_coherent_kern_range | 
|  | 357 | .long	v6_coherent_user_range | 
| Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 358 | .long	v6_flush_kern_dcache_area | 
| Russell King | a9c9147 | 2009-11-26 16:19:58 +0000 | [diff] [blame] | 359 | .long	v6_dma_map_area | 
|  | 360 | .long	v6_dma_unmap_area | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 361 | .long	v6_dma_inv_range | 
|  | 362 | .long	v6_dma_clean_range | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | .long	v6_dma_flush_range | 
|  | 364 | .size	v6_cache_fns, . - v6_cache_fns |