18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  linux/arch/arm/mm/proc-xscale.S
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Author:	Nicolas Pitre
68c2ecf20Sopenharmony_ci *  Created:	November 2000
78c2ecf20Sopenharmony_ci *  Copyright:	(C) 2000, 2001 MontaVista Software Inc.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * MMU functions for the Intel XScale CPUs
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * 2001 Aug 21:
128c2ecf20Sopenharmony_ci *	some contributions by Brett Gaines <brett.w.gaines@intel.com>
138c2ecf20Sopenharmony_ci *	Copyright 2001 by Intel Corp.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * 2001 Sep 08:
168c2ecf20Sopenharmony_ci *	Completely revisited, many important fixes
178c2ecf20Sopenharmony_ci *	Nicolas Pitre <nico@fluxnic.net>
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <linux/linkage.h>
218c2ecf20Sopenharmony_ci#include <linux/init.h>
228c2ecf20Sopenharmony_ci#include <linux/pgtable.h>
238c2ecf20Sopenharmony_ci#include <asm/assembler.h>
248c2ecf20Sopenharmony_ci#include <asm/hwcap.h>
258c2ecf20Sopenharmony_ci#include <asm/pgtable-hwdef.h>
268c2ecf20Sopenharmony_ci#include <asm/page.h>
278c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
288c2ecf20Sopenharmony_ci#include "proc-macros.S"
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/*
318c2ecf20Sopenharmony_ci * This is the maximum size of an area which will be flushed.  If the area
328c2ecf20Sopenharmony_ci * is larger than this, then we flush the whole cache
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#define MAX_AREA_SIZE	32768
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci * the cache line size of the I and D cache
388c2ecf20Sopenharmony_ci */
398c2ecf20Sopenharmony_ci#define CACHELINESIZE	32
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/*
428c2ecf20Sopenharmony_ci * the size of the data cache
438c2ecf20Sopenharmony_ci */
448c2ecf20Sopenharmony_ci#define CACHESIZE	32768
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/*
478c2ecf20Sopenharmony_ci * Virtual address used to allocate the cache when flushed
488c2ecf20Sopenharmony_ci *
498c2ecf20Sopenharmony_ci * This must be an address range which is _never_ used.  It should
508c2ecf20Sopenharmony_ci * apparently have a mapping in the corresponding page table for
518c2ecf20Sopenharmony_ci * compatibility with future CPUs that _could_ require it.  For instance we
528c2ecf20Sopenharmony_ci * don't care.
538c2ecf20Sopenharmony_ci *
548c2ecf20Sopenharmony_ci * This must be aligned on a 2*CACHESIZE boundary.  The code selects one of
558c2ecf20Sopenharmony_ci * the 2 areas in alternance each time the clean_d_cache macro is used.
568c2ecf20Sopenharmony_ci * Without this the XScale core exhibits cache eviction problems and no one
578c2ecf20Sopenharmony_ci * knows why.
588c2ecf20Sopenharmony_ci *
598c2ecf20Sopenharmony_ci * Reminder: the vector table is located at 0xffff0000-0xffff0fff.
608c2ecf20Sopenharmony_ci */
618c2ecf20Sopenharmony_ci#define CLEAN_ADDR	0xfffe0000
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/*
648c2ecf20Sopenharmony_ci * This macro is used to wait for a CP15 write and is needed
658c2ecf20Sopenharmony_ci * when we have to ensure that the last operation to the co-pro
668c2ecf20Sopenharmony_ci * was completed before continuing with operation.
678c2ecf20Sopenharmony_ci */
688c2ecf20Sopenharmony_ci	.macro	cpwait, rd
698c2ecf20Sopenharmony_ci	mrc	p15, 0, \rd, c2, c0, 0		@ arbitrary read of cp15
708c2ecf20Sopenharmony_ci	mov	\rd, \rd			@ wait for completion
718c2ecf20Sopenharmony_ci	sub 	pc, pc, #4			@ flush instruction pipeline
728c2ecf20Sopenharmony_ci	.endm
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci	.macro	cpwait_ret, lr, rd
758c2ecf20Sopenharmony_ci	mrc	p15, 0, \rd, c2, c0, 0		@ arbitrary read of cp15
768c2ecf20Sopenharmony_ci	sub	pc, \lr, \rd, LSR #32		@ wait for completion and
778c2ecf20Sopenharmony_ci						@ flush instruction pipeline
788c2ecf20Sopenharmony_ci	.endm
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci/*
818c2ecf20Sopenharmony_ci * This macro cleans the entire dcache using line allocate.
828c2ecf20Sopenharmony_ci * The main loop has been unrolled to reduce loop overhead.
838c2ecf20Sopenharmony_ci * rd and rs are two scratch registers.
848c2ecf20Sopenharmony_ci */
858c2ecf20Sopenharmony_ci	.macro  clean_d_cache, rd, rs
868c2ecf20Sopenharmony_ci	ldr	\rs, =clean_addr
878c2ecf20Sopenharmony_ci	ldr	\rd, [\rs]
888c2ecf20Sopenharmony_ci	eor	\rd, \rd, #CACHESIZE
898c2ecf20Sopenharmony_ci	str	\rd, [\rs]
908c2ecf20Sopenharmony_ci	add	\rs, \rd, #CACHESIZE
918c2ecf20Sopenharmony_ci1:	mcr	p15, 0, \rd, c7, c2, 5		@ allocate D cache line
928c2ecf20Sopenharmony_ci	add	\rd, \rd, #CACHELINESIZE
938c2ecf20Sopenharmony_ci	mcr	p15, 0, \rd, c7, c2, 5		@ allocate D cache line
948c2ecf20Sopenharmony_ci	add	\rd, \rd, #CACHELINESIZE
958c2ecf20Sopenharmony_ci	mcr	p15, 0, \rd, c7, c2, 5		@ allocate D cache line
968c2ecf20Sopenharmony_ci	add	\rd, \rd, #CACHELINESIZE
978c2ecf20Sopenharmony_ci	mcr	p15, 0, \rd, c7, c2, 5		@ allocate D cache line
988c2ecf20Sopenharmony_ci	add	\rd, \rd, #CACHELINESIZE
998c2ecf20Sopenharmony_ci	teq	\rd, \rs
1008c2ecf20Sopenharmony_ci	bne	1b
1018c2ecf20Sopenharmony_ci	.endm
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci	.data
1048c2ecf20Sopenharmony_ci	.align	2
1058c2ecf20Sopenharmony_ciclean_addr:	.word	CLEAN_ADDR
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	.text
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/*
1108c2ecf20Sopenharmony_ci * cpu_xscale_proc_init()
1118c2ecf20Sopenharmony_ci *
1128c2ecf20Sopenharmony_ci * Nothing too exciting at the moment
1138c2ecf20Sopenharmony_ci */
1148c2ecf20Sopenharmony_ciENTRY(cpu_xscale_proc_init)
1158c2ecf20Sopenharmony_ci	@ enable write buffer coalescing. Some bootloader disable it
1168c2ecf20Sopenharmony_ci	mrc	p15, 0, r1, c1, c0, 1
1178c2ecf20Sopenharmony_ci	bic	r1, r1, #1
1188c2ecf20Sopenharmony_ci	mcr	p15, 0, r1, c1, c0, 1
1198c2ecf20Sopenharmony_ci	ret	lr
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci/*
1228c2ecf20Sopenharmony_ci * cpu_xscale_proc_fin()
1238c2ecf20Sopenharmony_ci */
1248c2ecf20Sopenharmony_ciENTRY(cpu_xscale_proc_fin)
1258c2ecf20Sopenharmony_ci	mrc	p15, 0, r0, c1, c0, 0		@ ctrl register
1268c2ecf20Sopenharmony_ci	bic	r0, r0, #0x1800			@ ...IZ...........
1278c2ecf20Sopenharmony_ci	bic	r0, r0, #0x0006			@ .............CA.
1288c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c1, c0, 0		@ disable caches
1298c2ecf20Sopenharmony_ci	ret	lr
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/*
1328c2ecf20Sopenharmony_ci * cpu_xscale_reset(loc)
1338c2ecf20Sopenharmony_ci *
1348c2ecf20Sopenharmony_ci * Perform a soft reset of the system.  Put the CPU into the
1358c2ecf20Sopenharmony_ci * same state as it would be if it had been reset, and branch
1368c2ecf20Sopenharmony_ci * to what would be the reset vector.
1378c2ecf20Sopenharmony_ci *
1388c2ecf20Sopenharmony_ci * loc: location to jump to for soft reset
1398c2ecf20Sopenharmony_ci *
1408c2ecf20Sopenharmony_ci * Beware PXA270 erratum E7.
1418c2ecf20Sopenharmony_ci */
1428c2ecf20Sopenharmony_ci	.align	5
1438c2ecf20Sopenharmony_ci	.pushsection	.idmap.text, "ax"
1448c2ecf20Sopenharmony_ciENTRY(cpu_xscale_reset)
1458c2ecf20Sopenharmony_ci	mov	r1, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
1468c2ecf20Sopenharmony_ci	msr	cpsr_c, r1			@ reset CPSR
1478c2ecf20Sopenharmony_ci	mcr	p15, 0, r1, c10, c4, 1		@ unlock I-TLB
1488c2ecf20Sopenharmony_ci	mcr	p15, 0, r1, c8, c5, 0		@ invalidate I-TLB
1498c2ecf20Sopenharmony_ci	mrc	p15, 0, r1, c1, c0, 0		@ ctrl register
1508c2ecf20Sopenharmony_ci	bic	r1, r1, #0x0086			@ ........B....CA.
1518c2ecf20Sopenharmony_ci	bic	r1, r1, #0x3900			@ ..VIZ..S........
1528c2ecf20Sopenharmony_ci	sub	pc, pc, #4			@ flush pipeline
1538c2ecf20Sopenharmony_ci	@ *** cache line aligned ***
1548c2ecf20Sopenharmony_ci	mcr	p15, 0, r1, c1, c0, 0		@ ctrl register
1558c2ecf20Sopenharmony_ci	bic	r1, r1, #0x0001			@ ...............M
1568c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c7, c7, 0		@ invalidate I,D caches & BTB
1578c2ecf20Sopenharmony_ci	mcr	p15, 0, r1, c1, c0, 0		@ ctrl register
1588c2ecf20Sopenharmony_ci	@ CAUTION: MMU turned off from this point. We count on the pipeline
1598c2ecf20Sopenharmony_ci	@ already containing those two last instructions to survive.
1608c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c8, c7, 0		@ invalidate I & D TLBs
1618c2ecf20Sopenharmony_ci	ret	r0
1628c2ecf20Sopenharmony_ciENDPROC(cpu_xscale_reset)
1638c2ecf20Sopenharmony_ci	.popsection
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/*
1668c2ecf20Sopenharmony_ci * cpu_xscale_do_idle()
1678c2ecf20Sopenharmony_ci *
1688c2ecf20Sopenharmony_ci * Cause the processor to idle
1698c2ecf20Sopenharmony_ci *
1708c2ecf20Sopenharmony_ci * For now we do nothing but go to idle mode for every case
1718c2ecf20Sopenharmony_ci *
1728c2ecf20Sopenharmony_ci * XScale supports clock switching, but using idle mode support
1738c2ecf20Sopenharmony_ci * allows external hardware to react to system state changes.
1748c2ecf20Sopenharmony_ci */
1758c2ecf20Sopenharmony_ci	.align	5
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ciENTRY(cpu_xscale_do_idle)
1788c2ecf20Sopenharmony_ci	mov	r0, #1
1798c2ecf20Sopenharmony_ci	mcr	p14, 0, r0, c7, c0, 0		@ Go to IDLE
1808c2ecf20Sopenharmony_ci	ret	lr
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci/* ================================= CACHE ================================ */
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci/*
1858c2ecf20Sopenharmony_ci *	flush_icache_all()
1868c2ecf20Sopenharmony_ci *
1878c2ecf20Sopenharmony_ci *	Unconditionally clean and invalidate the entire icache.
1888c2ecf20Sopenharmony_ci */
1898c2ecf20Sopenharmony_ciENTRY(xscale_flush_icache_all)
1908c2ecf20Sopenharmony_ci	mov	r0, #0
1918c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c5, 0		@ invalidate I cache
1928c2ecf20Sopenharmony_ci	ret	lr
1938c2ecf20Sopenharmony_ciENDPROC(xscale_flush_icache_all)
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci/*
1968c2ecf20Sopenharmony_ci *	flush_user_cache_all()
1978c2ecf20Sopenharmony_ci *
1988c2ecf20Sopenharmony_ci *	Invalidate all cache entries in a particular address
1998c2ecf20Sopenharmony_ci *	space.
2008c2ecf20Sopenharmony_ci */
2018c2ecf20Sopenharmony_ciENTRY(xscale_flush_user_cache_all)
2028c2ecf20Sopenharmony_ci	/* FALLTHROUGH */
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/*
2058c2ecf20Sopenharmony_ci *	flush_kern_cache_all()
2068c2ecf20Sopenharmony_ci *
2078c2ecf20Sopenharmony_ci *	Clean and invalidate the entire cache.
2088c2ecf20Sopenharmony_ci */
2098c2ecf20Sopenharmony_ciENTRY(xscale_flush_kern_cache_all)
2108c2ecf20Sopenharmony_ci	mov	r2, #VM_EXEC
2118c2ecf20Sopenharmony_ci	mov	ip, #0
2128c2ecf20Sopenharmony_ci__flush_whole_cache:
2138c2ecf20Sopenharmony_ci	clean_d_cache r0, r1
2148c2ecf20Sopenharmony_ci	tst	r2, #VM_EXEC
2158c2ecf20Sopenharmony_ci	mcrne	p15, 0, ip, c7, c5, 0		@ Invalidate I cache & BTB
2168c2ecf20Sopenharmony_ci	mcrne	p15, 0, ip, c7, c10, 4		@ Drain Write (& Fill) Buffer
2178c2ecf20Sopenharmony_ci	ret	lr
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci/*
2208c2ecf20Sopenharmony_ci *	flush_user_cache_range(start, end, vm_flags)
2218c2ecf20Sopenharmony_ci *
2228c2ecf20Sopenharmony_ci *	Invalidate a range of cache entries in the specified
2238c2ecf20Sopenharmony_ci *	address space.
2248c2ecf20Sopenharmony_ci *
2258c2ecf20Sopenharmony_ci *	- start - start address (may not be aligned)
2268c2ecf20Sopenharmony_ci *	- end	- end address (exclusive, may not be aligned)
2278c2ecf20Sopenharmony_ci *	- vma	- vma_area_struct describing address space
2288c2ecf20Sopenharmony_ci */
2298c2ecf20Sopenharmony_ci	.align	5
2308c2ecf20Sopenharmony_ciENTRY(xscale_flush_user_cache_range)
2318c2ecf20Sopenharmony_ci	mov	ip, #0
2328c2ecf20Sopenharmony_ci	sub	r3, r1, r0			@ calculate total size
2338c2ecf20Sopenharmony_ci	cmp	r3, #MAX_AREA_SIZE
2348c2ecf20Sopenharmony_ci	bhs	__flush_whole_cache
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci1:	tst	r2, #VM_EXEC
2378c2ecf20Sopenharmony_ci	mcrne	p15, 0, r0, c7, c5, 1		@ Invalidate I cache line
2388c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c10, 1		@ Clean D cache line
2398c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c6, 1		@ Invalidate D cache line
2408c2ecf20Sopenharmony_ci	add	r0, r0, #CACHELINESIZE
2418c2ecf20Sopenharmony_ci	cmp	r0, r1
2428c2ecf20Sopenharmony_ci	blo	1b
2438c2ecf20Sopenharmony_ci	tst	r2, #VM_EXEC
2448c2ecf20Sopenharmony_ci	mcrne	p15, 0, ip, c7, c5, 6		@ Invalidate BTB
2458c2ecf20Sopenharmony_ci	mcrne	p15, 0, ip, c7, c10, 4		@ Drain Write (& Fill) Buffer
2468c2ecf20Sopenharmony_ci	ret	lr
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/*
2498c2ecf20Sopenharmony_ci *	coherent_kern_range(start, end)
2508c2ecf20Sopenharmony_ci *
2518c2ecf20Sopenharmony_ci *	Ensure coherency between the Icache and the Dcache in the
2528c2ecf20Sopenharmony_ci *	region described by start.  If you have non-snooping
2538c2ecf20Sopenharmony_ci *	Harvard caches, you need to implement this function.
2548c2ecf20Sopenharmony_ci *
2558c2ecf20Sopenharmony_ci *	- start  - virtual start address
2568c2ecf20Sopenharmony_ci *	- end	 - virtual end address
2578c2ecf20Sopenharmony_ci *
2588c2ecf20Sopenharmony_ci *	Note: single I-cache line invalidation isn't used here since
2598c2ecf20Sopenharmony_ci *	it also trashes the mini I-cache used by JTAG debuggers.
2608c2ecf20Sopenharmony_ci */
2618c2ecf20Sopenharmony_ciENTRY(xscale_coherent_kern_range)
2628c2ecf20Sopenharmony_ci	bic	r0, r0, #CACHELINESIZE - 1
2638c2ecf20Sopenharmony_ci1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
2648c2ecf20Sopenharmony_ci	add	r0, r0, #CACHELINESIZE
2658c2ecf20Sopenharmony_ci	cmp	r0, r1
2668c2ecf20Sopenharmony_ci	blo	1b
2678c2ecf20Sopenharmony_ci	mov	r0, #0
2688c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c5, 0		@ Invalidate I cache & BTB
2698c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
2708c2ecf20Sopenharmony_ci	ret	lr
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci/*
2738c2ecf20Sopenharmony_ci *	coherent_user_range(start, end)
2748c2ecf20Sopenharmony_ci *
2758c2ecf20Sopenharmony_ci *	Ensure coherency between the Icache and the Dcache in the
2768c2ecf20Sopenharmony_ci *	region described by start.  If you have non-snooping
2778c2ecf20Sopenharmony_ci *	Harvard caches, you need to implement this function.
2788c2ecf20Sopenharmony_ci *
2798c2ecf20Sopenharmony_ci *	- start  - virtual start address
2808c2ecf20Sopenharmony_ci *	- end	 - virtual end address
2818c2ecf20Sopenharmony_ci */
2828c2ecf20Sopenharmony_ciENTRY(xscale_coherent_user_range)
2838c2ecf20Sopenharmony_ci	bic	r0, r0, #CACHELINESIZE - 1
2848c2ecf20Sopenharmony_ci1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
2858c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c5, 1		@ Invalidate I cache entry
2868c2ecf20Sopenharmony_ci	add	r0, r0, #CACHELINESIZE
2878c2ecf20Sopenharmony_ci	cmp	r0, r1
2888c2ecf20Sopenharmony_ci	blo	1b
2898c2ecf20Sopenharmony_ci	mov	r0, #0
2908c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c5, 6		@ Invalidate BTB
2918c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
2928c2ecf20Sopenharmony_ci	ret	lr
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci/*
2958c2ecf20Sopenharmony_ci *	flush_kern_dcache_area(void *addr, size_t size)
2968c2ecf20Sopenharmony_ci *
2978c2ecf20Sopenharmony_ci *	Ensure no D cache aliasing occurs, either with itself or
2988c2ecf20Sopenharmony_ci *	the I cache
2998c2ecf20Sopenharmony_ci *
3008c2ecf20Sopenharmony_ci *	- addr	- kernel address
3018c2ecf20Sopenharmony_ci *	- size	- region size
3028c2ecf20Sopenharmony_ci */
3038c2ecf20Sopenharmony_ciENTRY(xscale_flush_kern_dcache_area)
3048c2ecf20Sopenharmony_ci	add	r1, r0, r1
3058c2ecf20Sopenharmony_ci1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
3068c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c6, 1		@ invalidate D entry
3078c2ecf20Sopenharmony_ci	add	r0, r0, #CACHELINESIZE
3088c2ecf20Sopenharmony_ci	cmp	r0, r1
3098c2ecf20Sopenharmony_ci	blo	1b
3108c2ecf20Sopenharmony_ci	mov	r0, #0
3118c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c5, 0		@ Invalidate I cache & BTB
3128c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
3138c2ecf20Sopenharmony_ci	ret	lr
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci/*
3168c2ecf20Sopenharmony_ci *	dma_inv_range(start, end)
3178c2ecf20Sopenharmony_ci *
3188c2ecf20Sopenharmony_ci *	Invalidate (discard) the specified virtual address range.
3198c2ecf20Sopenharmony_ci *	May not write back any entries.  If 'start' or 'end'
3208c2ecf20Sopenharmony_ci *	are not cache line aligned, those lines must be written
3218c2ecf20Sopenharmony_ci *	back.
3228c2ecf20Sopenharmony_ci *
3238c2ecf20Sopenharmony_ci *	- start  - virtual start address
3248c2ecf20Sopenharmony_ci *	- end	 - virtual end address
3258c2ecf20Sopenharmony_ci */
3268c2ecf20Sopenharmony_cixscale_dma_inv_range:
3278c2ecf20Sopenharmony_ci	tst	r0, #CACHELINESIZE - 1
3288c2ecf20Sopenharmony_ci	bic	r0, r0, #CACHELINESIZE - 1
3298c2ecf20Sopenharmony_ci	mcrne	p15, 0, r0, c7, c10, 1		@ clean D entry
3308c2ecf20Sopenharmony_ci	tst	r1, #CACHELINESIZE - 1
3318c2ecf20Sopenharmony_ci	mcrne	p15, 0, r1, c7, c10, 1		@ clean D entry
3328c2ecf20Sopenharmony_ci1:	mcr	p15, 0, r0, c7, c6, 1		@ invalidate D entry
3338c2ecf20Sopenharmony_ci	add	r0, r0, #CACHELINESIZE
3348c2ecf20Sopenharmony_ci	cmp	r0, r1
3358c2ecf20Sopenharmony_ci	blo	1b
3368c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
3378c2ecf20Sopenharmony_ci	ret	lr
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci/*
3408c2ecf20Sopenharmony_ci *	dma_clean_range(start, end)
3418c2ecf20Sopenharmony_ci *
3428c2ecf20Sopenharmony_ci *	Clean the specified virtual address range.
3438c2ecf20Sopenharmony_ci *
3448c2ecf20Sopenharmony_ci *	- start  - virtual start address
3458c2ecf20Sopenharmony_ci *	- end	 - virtual end address
3468c2ecf20Sopenharmony_ci */
3478c2ecf20Sopenharmony_cixscale_dma_clean_range:
3488c2ecf20Sopenharmony_ci	bic	r0, r0, #CACHELINESIZE - 1
3498c2ecf20Sopenharmony_ci1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
3508c2ecf20Sopenharmony_ci	add	r0, r0, #CACHELINESIZE
3518c2ecf20Sopenharmony_ci	cmp	r0, r1
3528c2ecf20Sopenharmony_ci	blo	1b
3538c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
3548c2ecf20Sopenharmony_ci	ret	lr
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci/*
3578c2ecf20Sopenharmony_ci *	dma_flush_range(start, end)
3588c2ecf20Sopenharmony_ci *
3598c2ecf20Sopenharmony_ci *	Clean and invalidate the specified virtual address range.
3608c2ecf20Sopenharmony_ci *
3618c2ecf20Sopenharmony_ci *	- start  - virtual start address
3628c2ecf20Sopenharmony_ci *	- end	 - virtual end address
3638c2ecf20Sopenharmony_ci */
3648c2ecf20Sopenharmony_ciENTRY(xscale_dma_flush_range)
3658c2ecf20Sopenharmony_ci	bic	r0, r0, #CACHELINESIZE - 1
3668c2ecf20Sopenharmony_ci1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
3678c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c6, 1		@ invalidate D entry
3688c2ecf20Sopenharmony_ci	add	r0, r0, #CACHELINESIZE
3698c2ecf20Sopenharmony_ci	cmp	r0, r1
3708c2ecf20Sopenharmony_ci	blo	1b
3718c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
3728c2ecf20Sopenharmony_ci	ret	lr
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci/*
3758c2ecf20Sopenharmony_ci *	dma_map_area(start, size, dir)
3768c2ecf20Sopenharmony_ci *	- start	- kernel virtual start address
3778c2ecf20Sopenharmony_ci *	- size	- size of region
3788c2ecf20Sopenharmony_ci *	- dir	- DMA direction
3798c2ecf20Sopenharmony_ci */
3808c2ecf20Sopenharmony_ciENTRY(xscale_dma_map_area)
3818c2ecf20Sopenharmony_ci	add	r1, r1, r0
3828c2ecf20Sopenharmony_ci	cmp	r2, #DMA_TO_DEVICE
3838c2ecf20Sopenharmony_ci	beq	xscale_dma_clean_range
3848c2ecf20Sopenharmony_ci	bcs	xscale_dma_inv_range
3858c2ecf20Sopenharmony_ci	b	xscale_dma_flush_range
3868c2ecf20Sopenharmony_ciENDPROC(xscale_dma_map_area)
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/*
3898c2ecf20Sopenharmony_ci *	dma_map_area(start, size, dir)
3908c2ecf20Sopenharmony_ci *	- start	- kernel virtual start address
3918c2ecf20Sopenharmony_ci *	- size	- size of region
3928c2ecf20Sopenharmony_ci *	- dir	- DMA direction
3938c2ecf20Sopenharmony_ci */
3948c2ecf20Sopenharmony_ciENTRY(xscale_80200_A0_A1_dma_map_area)
3958c2ecf20Sopenharmony_ci	add	r1, r1, r0
3968c2ecf20Sopenharmony_ci	teq	r2, #DMA_TO_DEVICE
3978c2ecf20Sopenharmony_ci	beq	xscale_dma_clean_range
3988c2ecf20Sopenharmony_ci	b	xscale_dma_flush_range
3998c2ecf20Sopenharmony_ciENDPROC(xscale_80200_A0_A1_dma_map_area)
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci/*
4028c2ecf20Sopenharmony_ci *	dma_unmap_area(start, size, dir)
4038c2ecf20Sopenharmony_ci *	- start	- kernel virtual start address
4048c2ecf20Sopenharmony_ci *	- size	- size of region
4058c2ecf20Sopenharmony_ci *	- dir	- DMA direction
4068c2ecf20Sopenharmony_ci */
4078c2ecf20Sopenharmony_ciENTRY(xscale_dma_unmap_area)
4088c2ecf20Sopenharmony_ci	ret	lr
4098c2ecf20Sopenharmony_ciENDPROC(xscale_dma_unmap_area)
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci	.globl	xscale_flush_kern_cache_louis
4128c2ecf20Sopenharmony_ci	.equ	xscale_flush_kern_cache_louis, xscale_flush_kern_cache_all
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci	@ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
4158c2ecf20Sopenharmony_ci	define_cache_functions xscale
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci/*
4188c2ecf20Sopenharmony_ci * On stepping A0/A1 of the 80200, invalidating D-cache by line doesn't
4198c2ecf20Sopenharmony_ci * clear the dirty bits, which means that if we invalidate a dirty line,
4208c2ecf20Sopenharmony_ci * the dirty data can still be written back to external memory later on.
4218c2ecf20Sopenharmony_ci *
4228c2ecf20Sopenharmony_ci * The recommended workaround is to always do a clean D-cache line before
4238c2ecf20Sopenharmony_ci * doing an invalidate D-cache line, so on the affected processors,
4248c2ecf20Sopenharmony_ci * dma_inv_range() is implemented as dma_flush_range().
4258c2ecf20Sopenharmony_ci *
4268c2ecf20Sopenharmony_ci * See erratum #25 of "Intel 80200 Processor Specification Update",
4278c2ecf20Sopenharmony_ci * revision January 22, 2003, available at:
4288c2ecf20Sopenharmony_ci *     http://www.intel.com/design/iio/specupdt/273415.htm
4298c2ecf20Sopenharmony_ci */
4308c2ecf20Sopenharmony_ci.macro a0_alias basename
4318c2ecf20Sopenharmony_ci	.globl xscale_80200_A0_A1_\basename
4328c2ecf20Sopenharmony_ci	.type xscale_80200_A0_A1_\basename , %function
4338c2ecf20Sopenharmony_ci	.equ xscale_80200_A0_A1_\basename , xscale_\basename
4348c2ecf20Sopenharmony_ci.endm
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci/*
4378c2ecf20Sopenharmony_ci * Most of the cache functions are unchanged for these processor revisions.
4388c2ecf20Sopenharmony_ci * Export suitable alias symbols for the unchanged functions:
4398c2ecf20Sopenharmony_ci */
4408c2ecf20Sopenharmony_ci	a0_alias flush_icache_all
4418c2ecf20Sopenharmony_ci	a0_alias flush_user_cache_all
4428c2ecf20Sopenharmony_ci	a0_alias flush_kern_cache_all
4438c2ecf20Sopenharmony_ci	a0_alias flush_kern_cache_louis
4448c2ecf20Sopenharmony_ci	a0_alias flush_user_cache_range
4458c2ecf20Sopenharmony_ci	a0_alias coherent_kern_range
4468c2ecf20Sopenharmony_ci	a0_alias coherent_user_range
4478c2ecf20Sopenharmony_ci	a0_alias flush_kern_dcache_area
4488c2ecf20Sopenharmony_ci	a0_alias dma_flush_range
4498c2ecf20Sopenharmony_ci	a0_alias dma_unmap_area
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci	@ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
4528c2ecf20Sopenharmony_ci	define_cache_functions xscale_80200_A0_A1
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ciENTRY(cpu_xscale_dcache_clean_area)
4558c2ecf20Sopenharmony_ci1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
4568c2ecf20Sopenharmony_ci	add	r0, r0, #CACHELINESIZE
4578c2ecf20Sopenharmony_ci	subs	r1, r1, #CACHELINESIZE
4588c2ecf20Sopenharmony_ci	bhi	1b
4598c2ecf20Sopenharmony_ci	ret	lr
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci/* =============================== PageTable ============================== */
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci/*
4648c2ecf20Sopenharmony_ci * cpu_xscale_switch_mm(pgd)
4658c2ecf20Sopenharmony_ci *
4668c2ecf20Sopenharmony_ci * Set the translation base pointer to be as described by pgd.
4678c2ecf20Sopenharmony_ci *
4688c2ecf20Sopenharmony_ci * pgd: new page tables
4698c2ecf20Sopenharmony_ci */
4708c2ecf20Sopenharmony_ci	.align	5
4718c2ecf20Sopenharmony_ciENTRY(cpu_xscale_switch_mm)
4728c2ecf20Sopenharmony_ci	clean_d_cache r1, r2
4738c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c7, c5, 0		@ Invalidate I cache & BTB
4748c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c7, c10, 4		@ Drain Write (& Fill) Buffer
4758c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c2, c0, 0		@ load page table pointer
4768c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c8, c7, 0		@ invalidate I & D TLBs
4778c2ecf20Sopenharmony_ci	cpwait_ret lr, ip
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci/*
4808c2ecf20Sopenharmony_ci * cpu_xscale_set_pte_ext(ptep, pte, ext)
4818c2ecf20Sopenharmony_ci *
4828c2ecf20Sopenharmony_ci * Set a PTE and flush it out
4838c2ecf20Sopenharmony_ci *
4848c2ecf20Sopenharmony_ci * Errata 40: must set memory to write-through for user read-only pages.
4858c2ecf20Sopenharmony_ci */
4868c2ecf20Sopenharmony_cicpu_xscale_mt_table:
4878c2ecf20Sopenharmony_ci	.long	0x00						@ L_PTE_MT_UNCACHED
4888c2ecf20Sopenharmony_ci	.long	PTE_BUFFERABLE					@ L_PTE_MT_BUFFERABLE
4898c2ecf20Sopenharmony_ci	.long	PTE_CACHEABLE					@ L_PTE_MT_WRITETHROUGH
4908c2ecf20Sopenharmony_ci	.long	PTE_CACHEABLE | PTE_BUFFERABLE			@ L_PTE_MT_WRITEBACK
4918c2ecf20Sopenharmony_ci	.long	PTE_EXT_TEX(1) | PTE_BUFFERABLE			@ L_PTE_MT_DEV_SHARED
4928c2ecf20Sopenharmony_ci	.long	0x00						@ unused
4938c2ecf20Sopenharmony_ci	.long	PTE_EXT_TEX(1) | PTE_CACHEABLE			@ L_PTE_MT_MINICACHE
4948c2ecf20Sopenharmony_ci	.long	PTE_EXT_TEX(1) | PTE_CACHEABLE | PTE_BUFFERABLE	@ L_PTE_MT_WRITEALLOC
4958c2ecf20Sopenharmony_ci	.long	0x00						@ unused
4968c2ecf20Sopenharmony_ci	.long	PTE_BUFFERABLE					@ L_PTE_MT_DEV_WC
4978c2ecf20Sopenharmony_ci	.long	0x00						@ unused
4988c2ecf20Sopenharmony_ci	.long	PTE_CACHEABLE | PTE_BUFFERABLE			@ L_PTE_MT_DEV_CACHED
4998c2ecf20Sopenharmony_ci	.long	0x00						@ L_PTE_MT_DEV_NONSHARED
5008c2ecf20Sopenharmony_ci	.long	0x00						@ unused
5018c2ecf20Sopenharmony_ci	.long	0x00						@ unused
5028c2ecf20Sopenharmony_ci	.long	0x00						@ unused
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci	.align	5
5058c2ecf20Sopenharmony_ciENTRY(cpu_xscale_set_pte_ext)
5068c2ecf20Sopenharmony_ci	xscale_set_pte_ext_prologue
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci	@
5098c2ecf20Sopenharmony_ci	@ Erratum 40: must set memory to write-through for user read-only pages
5108c2ecf20Sopenharmony_ci	@
5118c2ecf20Sopenharmony_ci	and	ip, r1, #(L_PTE_MT_MASK | L_PTE_USER | L_PTE_RDONLY) & ~(4 << 2)
5128c2ecf20Sopenharmony_ci	teq	ip, #L_PTE_MT_WRITEBACK | L_PTE_USER | L_PTE_RDONLY
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci	moveq	r1, #L_PTE_MT_WRITETHROUGH
5158c2ecf20Sopenharmony_ci	and	r1, r1, #L_PTE_MT_MASK
5168c2ecf20Sopenharmony_ci	adr	ip, cpu_xscale_mt_table
5178c2ecf20Sopenharmony_ci	ldr	ip, [ip, r1]
5188c2ecf20Sopenharmony_ci	bic	r2, r2, #0x0c
5198c2ecf20Sopenharmony_ci	orr	r2, r2, ip
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci	xscale_set_pte_ext_epilogue
5228c2ecf20Sopenharmony_ci	ret	lr
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci	.ltorg
5258c2ecf20Sopenharmony_ci	.align
5268c2ecf20Sopenharmony_ci
5278c2ecf20Sopenharmony_ci.globl	cpu_xscale_suspend_size
5288c2ecf20Sopenharmony_ci.equ	cpu_xscale_suspend_size, 4 * 6
5298c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM_CPU_SUSPEND
5308c2ecf20Sopenharmony_ciENTRY(cpu_xscale_do_suspend)
5318c2ecf20Sopenharmony_ci	stmfd	sp!, {r4 - r9, lr}
5328c2ecf20Sopenharmony_ci	mrc	p14, 0, r4, c6, c0, 0	@ clock configuration, for turbo mode
5338c2ecf20Sopenharmony_ci	mrc	p15, 0, r5, c15, c1, 0	@ CP access reg
5348c2ecf20Sopenharmony_ci	mrc	p15, 0, r6, c13, c0, 0	@ PID
5358c2ecf20Sopenharmony_ci	mrc	p15, 0, r7, c3, c0, 0	@ domain ID
5368c2ecf20Sopenharmony_ci	mrc	p15, 0, r8, c1, c0, 1	@ auxiliary control reg
5378c2ecf20Sopenharmony_ci	mrc	p15, 0, r9, c1, c0, 0	@ control reg
5388c2ecf20Sopenharmony_ci	bic	r4, r4, #2		@ clear frequency change bit
5398c2ecf20Sopenharmony_ci	stmia	r0, {r4 - r9}		@ store cp regs
5408c2ecf20Sopenharmony_ci	ldmfd	sp!, {r4 - r9, pc}
5418c2ecf20Sopenharmony_ciENDPROC(cpu_xscale_do_suspend)
5428c2ecf20Sopenharmony_ci
5438c2ecf20Sopenharmony_ciENTRY(cpu_xscale_do_resume)
5448c2ecf20Sopenharmony_ci	ldmia	r0, {r4 - r9}		@ load cp regs
5458c2ecf20Sopenharmony_ci	mov	ip, #0
5468c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c8, c7, 0	@ invalidate I & D TLBs
5478c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c7, c7, 0	@ invalidate I & D caches, BTB
5488c2ecf20Sopenharmony_ci	mcr	p14, 0, r4, c6, c0, 0	@ clock configuration, turbo mode.
5498c2ecf20Sopenharmony_ci	mcr	p15, 0, r5, c15, c1, 0	@ CP access reg
5508c2ecf20Sopenharmony_ci	mcr	p15, 0, r6, c13, c0, 0	@ PID
5518c2ecf20Sopenharmony_ci	mcr	p15, 0, r7, c3, c0, 0	@ domain ID
5528c2ecf20Sopenharmony_ci	mcr	p15, 0, r1, c2, c0, 0	@ translation table base addr
5538c2ecf20Sopenharmony_ci	mcr	p15, 0, r8, c1, c0, 1	@ auxiliary control reg
5548c2ecf20Sopenharmony_ci	mov	r0, r9			@ control register
5558c2ecf20Sopenharmony_ci	b	cpu_resume_mmu
5568c2ecf20Sopenharmony_ciENDPROC(cpu_xscale_do_resume)
5578c2ecf20Sopenharmony_ci#endif
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ci	.type	__xscale_setup, #function
5608c2ecf20Sopenharmony_ci__xscale_setup:
5618c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c7, c7, 0		@ invalidate I, D caches & BTB
5628c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c7, c10, 4		@ Drain Write (& Fill) Buffer
5638c2ecf20Sopenharmony_ci	mcr	p15, 0, ip, c8, c7, 0		@ invalidate I, D TLBs
5648c2ecf20Sopenharmony_ci	mov	r0, #1 << 6			@ cp6 for IOP3xx and Bulverde
5658c2ecf20Sopenharmony_ci	orr	r0, r0, #1 << 13		@ Its undefined whether this
5668c2ecf20Sopenharmony_ci	mcr	p15, 0, r0, c15, c1, 0		@ affects USR or SVC modes
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci	adr	r5, xscale_crval
5698c2ecf20Sopenharmony_ci	ldmia	r5, {r5, r6}
5708c2ecf20Sopenharmony_ci	mrc	p15, 0, r0, c1, c0, 0		@ get control register
5718c2ecf20Sopenharmony_ci	bic	r0, r0, r5
5728c2ecf20Sopenharmony_ci	orr	r0, r0, r6
5738c2ecf20Sopenharmony_ci	ret	lr
5748c2ecf20Sopenharmony_ci	.size	__xscale_setup, . - __xscale_setup
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_ci	/*
5778c2ecf20Sopenharmony_ci	 *  R
5788c2ecf20Sopenharmony_ci	 * .RVI ZFRS BLDP WCAM
5798c2ecf20Sopenharmony_ci	 * ..11 1.01 .... .101
5808c2ecf20Sopenharmony_ci	 *
5818c2ecf20Sopenharmony_ci	 */
5828c2ecf20Sopenharmony_ci	.type	xscale_crval, #object
5838c2ecf20Sopenharmony_cixscale_crval:
5848c2ecf20Sopenharmony_ci	crval	clear=0x00003b07, mmuset=0x00003905, ucset=0x00001900
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci	__INITDATA
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci	@ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
5898c2ecf20Sopenharmony_ci	define_processor_functions xscale, dabort=v5t_early_abort, pabort=legacy_pabort, suspend=1
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci	.section ".rodata"
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci	string	cpu_arch_name, "armv5te"
5948c2ecf20Sopenharmony_ci	string	cpu_elf_name, "v5"
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci	string	cpu_80200_A0_A1_name, "XScale-80200 A0/A1"
5978c2ecf20Sopenharmony_ci	string	cpu_80200_name, "XScale-80200"
5988c2ecf20Sopenharmony_ci	string	cpu_80219_name, "XScale-80219"
5998c2ecf20Sopenharmony_ci	string	cpu_8032x_name, "XScale-IOP8032x Family"
6008c2ecf20Sopenharmony_ci	string	cpu_8033x_name, "XScale-IOP8033x Family"
6018c2ecf20Sopenharmony_ci	string	cpu_pxa250_name, "XScale-PXA250"
6028c2ecf20Sopenharmony_ci	string	cpu_pxa210_name, "XScale-PXA210"
6038c2ecf20Sopenharmony_ci	string	cpu_ixp42x_name, "XScale-IXP42x Family"
6048c2ecf20Sopenharmony_ci	string	cpu_ixp43x_name, "XScale-IXP43x Family"
6058c2ecf20Sopenharmony_ci	string	cpu_ixp46x_name, "XScale-IXP46x Family"
6068c2ecf20Sopenharmony_ci	string	cpu_ixp2400_name, "XScale-IXP2400"
6078c2ecf20Sopenharmony_ci	string	cpu_ixp2800_name, "XScale-IXP2800"
6088c2ecf20Sopenharmony_ci	string	cpu_pxa255_name, "XScale-PXA255"
6098c2ecf20Sopenharmony_ci	string	cpu_pxa270_name, "XScale-PXA270"
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci	.align
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ci	.section ".proc.info.init", "a"
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci.macro xscale_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cache
6168c2ecf20Sopenharmony_ci	.type	__\name\()_proc_info,#object
6178c2ecf20Sopenharmony_ci__\name\()_proc_info:
6188c2ecf20Sopenharmony_ci	.long	\cpu_val
6198c2ecf20Sopenharmony_ci	.long	\cpu_mask
6208c2ecf20Sopenharmony_ci	.long	PMD_TYPE_SECT | \
6218c2ecf20Sopenharmony_ci		PMD_SECT_BUFFERABLE | \
6228c2ecf20Sopenharmony_ci		PMD_SECT_CACHEABLE | \
6238c2ecf20Sopenharmony_ci		PMD_SECT_AP_WRITE | \
6248c2ecf20Sopenharmony_ci		PMD_SECT_AP_READ
6258c2ecf20Sopenharmony_ci	.long	PMD_TYPE_SECT | \
6268c2ecf20Sopenharmony_ci		PMD_SECT_AP_WRITE | \
6278c2ecf20Sopenharmony_ci		PMD_SECT_AP_READ
6288c2ecf20Sopenharmony_ci	initfn	__xscale_setup, __\name\()_proc_info
6298c2ecf20Sopenharmony_ci	.long	cpu_arch_name
6308c2ecf20Sopenharmony_ci	.long	cpu_elf_name
6318c2ecf20Sopenharmony_ci	.long	HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
6328c2ecf20Sopenharmony_ci	.long	\cpu_name
6338c2ecf20Sopenharmony_ci	.long	xscale_processor_functions
6348c2ecf20Sopenharmony_ci	.long	v4wbi_tlb_fns
6358c2ecf20Sopenharmony_ci	.long	xscale_mc_user_fns
6368c2ecf20Sopenharmony_ci	.ifb \cache
6378c2ecf20Sopenharmony_ci		.long	xscale_cache_fns
6388c2ecf20Sopenharmony_ci	.else
6398c2ecf20Sopenharmony_ci		.long	\cache
6408c2ecf20Sopenharmony_ci	.endif
6418c2ecf20Sopenharmony_ci	.size	__\name\()_proc_info, . - __\name\()_proc_info
6428c2ecf20Sopenharmony_ci.endm
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_ci	xscale_proc_info 80200_A0_A1, 0x69052000, 0xfffffffe, cpu_80200_name, \
6458c2ecf20Sopenharmony_ci		cache=xscale_80200_A0_A1_cache_fns
6468c2ecf20Sopenharmony_ci	xscale_proc_info 80200, 0x69052000, 0xfffffff0, cpu_80200_name
6478c2ecf20Sopenharmony_ci	xscale_proc_info 80219, 0x69052e20, 0xffffffe0, cpu_80219_name
6488c2ecf20Sopenharmony_ci	xscale_proc_info 8032x, 0x69052420, 0xfffff7e0, cpu_8032x_name
6498c2ecf20Sopenharmony_ci	xscale_proc_info 8033x, 0x69054010, 0xfffffd30, cpu_8033x_name
6508c2ecf20Sopenharmony_ci	xscale_proc_info pxa250, 0x69052100, 0xfffff7f0, cpu_pxa250_name
6518c2ecf20Sopenharmony_ci	xscale_proc_info pxa210, 0x69052120, 0xfffff3f0, cpu_pxa210_name
6528c2ecf20Sopenharmony_ci	xscale_proc_info ixp2400, 0x69054190, 0xfffffff0, cpu_ixp2400_name
6538c2ecf20Sopenharmony_ci	xscale_proc_info ixp2800, 0x690541a0, 0xfffffff0, cpu_ixp2800_name
6548c2ecf20Sopenharmony_ci	xscale_proc_info ixp42x, 0x690541c0, 0xffffffc0, cpu_ixp42x_name
6558c2ecf20Sopenharmony_ci	xscale_proc_info ixp43x, 0x69054040, 0xfffffff0, cpu_ixp43x_name
6568c2ecf20Sopenharmony_ci	xscale_proc_info ixp46x, 0x69054200, 0xffffff00, cpu_ixp46x_name
6578c2ecf20Sopenharmony_ci	xscale_proc_info pxa255, 0x69052d00, 0xfffffff0, cpu_pxa255_name
6588c2ecf20Sopenharmony_ci	xscale_proc_info pxa270, 0x69054110, 0xfffffff0, cpu_pxa270_name
659