xref: /openbmc/linux/arch/arm/mm/proc-mohawk.S (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
11a59d1b8SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-or-later */
249cbe786SEric Miao/*
349cbe786SEric Miao *  linux/arch/arm/mm/proc-mohawk.S: MMU functions for Marvell PJ1 core
449cbe786SEric Miao *
549cbe786SEric Miao *  PJ1 (codename Mohawk) is a hybrid of the xscale3 and Marvell's own core.
649cbe786SEric Miao *
749cbe786SEric Miao *  Heavily based on proc-arm926.S and proc-xsc3.S
849cbe786SEric Miao */
949cbe786SEric Miao
1049cbe786SEric Miao#include <linux/linkage.h>
1149cbe786SEric Miao#include <linux/init.h>
12*65fddcfcSMike Rapoport#include <linux/pgtable.h>
1349cbe786SEric Miao#include <asm/assembler.h>
1449cbe786SEric Miao#include <asm/hwcap.h>
1549cbe786SEric Miao#include <asm/pgtable-hwdef.h>
1649cbe786SEric Miao#include <asm/page.h>
1749cbe786SEric Miao#include <asm/ptrace.h>
1849cbe786SEric Miao#include "proc-macros.S"
1949cbe786SEric Miao
2049cbe786SEric Miao/*
2149cbe786SEric Miao * This is the maximum size of an area which will be flushed.  If the
2249cbe786SEric Miao * area is larger than this, then we flush the whole cache.
2349cbe786SEric Miao */
2449cbe786SEric Miao#define CACHE_DLIMIT	32768
2549cbe786SEric Miao
2649cbe786SEric Miao/*
2749cbe786SEric Miao * The cache line size of the L1 D cache.
2849cbe786SEric Miao */
2949cbe786SEric Miao#define CACHE_DLINESIZE	32
3049cbe786SEric Miao
3149cbe786SEric Miao/*
3249cbe786SEric Miao * cpu_mohawk_proc_init()
3349cbe786SEric Miao */
3449cbe786SEric MiaoENTRY(cpu_mohawk_proc_init)
356ebbf2ceSRussell King	ret	lr
3649cbe786SEric Miao
3749cbe786SEric Miao/*
3849cbe786SEric Miao * cpu_mohawk_proc_fin()
3949cbe786SEric Miao */
4049cbe786SEric MiaoENTRY(cpu_mohawk_proc_fin)
4149cbe786SEric Miao	mrc	p15, 0, r0, c1, c0, 0		@ ctrl register
4249cbe786SEric Miao	bic	r0, r0, #0x1800			@ ...iz...........
4349cbe786SEric Miao	bic	r0, r0, #0x0006			@ .............ca.
4449cbe786SEric Miao	mcr	p15, 0, r0, c1, c0, 0		@ disable caches
456ebbf2ceSRussell King	ret	lr
4649cbe786SEric Miao
4749cbe786SEric Miao/*
4849cbe786SEric Miao * cpu_mohawk_reset(loc)
4949cbe786SEric Miao *
5049cbe786SEric Miao * Perform a soft reset of the system.  Put the CPU into the
5149cbe786SEric Miao * same state as it would be if it had been reset, and branch
5249cbe786SEric Miao * to what would be the reset vector.
5349cbe786SEric Miao *
5449cbe786SEric Miao * loc: location to jump to for soft reset
5549cbe786SEric Miao *
5649cbe786SEric Miao * (same as arm926)
5749cbe786SEric Miao */
5849cbe786SEric Miao	.align	5
591a4baafaSWill Deacon	.pushsection	.idmap.text, "ax"
6049cbe786SEric MiaoENTRY(cpu_mohawk_reset)
6149cbe786SEric Miao	mov	ip, #0
6249cbe786SEric Miao	mcr	p15, 0, ip, c7, c7, 0		@ invalidate I,D caches
6349cbe786SEric Miao	mcr	p15, 0, ip, c7, c10, 4		@ drain WB
6449cbe786SEric Miao	mcr	p15, 0, ip, c8, c7, 0		@ invalidate I & D TLBs
6549cbe786SEric Miao	mrc	p15, 0, ip, c1, c0, 0		@ ctrl register
6649cbe786SEric Miao	bic	ip, ip, #0x0007			@ .............cam
6749cbe786SEric Miao	bic	ip, ip, #0x1100			@ ...i...s........
6849cbe786SEric Miao	mcr	p15, 0, ip, c1, c0, 0		@ ctrl register
696ebbf2ceSRussell King	ret	r0
701a4baafaSWill DeaconENDPROC(cpu_mohawk_reset)
711a4baafaSWill Deacon	.popsection
7249cbe786SEric Miao
7349cbe786SEric Miao/*
7449cbe786SEric Miao * cpu_mohawk_do_idle()
7549cbe786SEric Miao *
7649cbe786SEric Miao * Called with IRQs disabled
7749cbe786SEric Miao */
7849cbe786SEric Miao	.align	5
7949cbe786SEric MiaoENTRY(cpu_mohawk_do_idle)
8049cbe786SEric Miao	mov	r0, #0
8149cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer
8249cbe786SEric Miao	mcr	p15, 0, r0, c7, c0, 4		@ wait for interrupt
836ebbf2ceSRussell King	ret	lr
8449cbe786SEric Miao
8549cbe786SEric Miao/*
86a39a3218SDave Martin *	flush_icache_all()
87a39a3218SDave Martin *
88a39a3218SDave Martin *	Unconditionally clean and invalidate the entire icache.
89a39a3218SDave Martin */
90a39a3218SDave MartinENTRY(mohawk_flush_icache_all)
91a39a3218SDave Martin	mov	r0, #0
92a39a3218SDave Martin	mcr	p15, 0, r0, c7, c5, 0		@ invalidate I cache
936ebbf2ceSRussell King	ret	lr
94a39a3218SDave MartinENDPROC(mohawk_flush_icache_all)
95a39a3218SDave Martin
96a39a3218SDave Martin/*
9749cbe786SEric Miao *	flush_user_cache_all()
9849cbe786SEric Miao *
9949cbe786SEric Miao *	Clean and invalidate all cache entries in a particular
10049cbe786SEric Miao *	address space.
10149cbe786SEric Miao */
10249cbe786SEric MiaoENTRY(mohawk_flush_user_cache_all)
10349cbe786SEric Miao	/* FALLTHROUGH */
10449cbe786SEric Miao
10549cbe786SEric Miao/*
10649cbe786SEric Miao *	flush_kern_cache_all()
10749cbe786SEric Miao *
10849cbe786SEric Miao *	Clean and invalidate the entire cache.
10949cbe786SEric Miao */
11049cbe786SEric MiaoENTRY(mohawk_flush_kern_cache_all)
11149cbe786SEric Miao	mov	r2, #VM_EXEC
11249cbe786SEric Miao	mov	ip, #0
11349cbe786SEric Miao__flush_whole_cache:
11449cbe786SEric Miao	mcr	p15, 0, ip, c7, c14, 0		@ clean & invalidate all D cache
11549cbe786SEric Miao	tst	r2, #VM_EXEC
11649cbe786SEric Miao	mcrne	p15, 0, ip, c7, c5, 0		@ invalidate I cache
11749cbe786SEric Miao	mcrne	p15, 0, ip, c7, c10, 0		@ drain write buffer
1186ebbf2ceSRussell King	ret	lr
11949cbe786SEric Miao
12049cbe786SEric Miao/*
12149cbe786SEric Miao *	flush_user_cache_range(start, end, flags)
12249cbe786SEric Miao *
12349cbe786SEric Miao *	Clean and invalidate a range of cache entries in the
12449cbe786SEric Miao *	specified address range.
12549cbe786SEric Miao *
12649cbe786SEric Miao *	- start	- start address (inclusive)
12749cbe786SEric Miao *	- end	- end address (exclusive)
12849cbe786SEric Miao *	- flags	- vm_flags describing address space
12949cbe786SEric Miao *
13049cbe786SEric Miao * (same as arm926)
13149cbe786SEric Miao */
13249cbe786SEric MiaoENTRY(mohawk_flush_user_cache_range)
13349cbe786SEric Miao	mov	ip, #0
13449cbe786SEric Miao	sub	r3, r1, r0			@ calculate total size
13549cbe786SEric Miao	cmp	r3, #CACHE_DLIMIT
13649cbe786SEric Miao	bgt	__flush_whole_cache
13749cbe786SEric Miao1:	tst	r2, #VM_EXEC
13849cbe786SEric Miao	mcr	p15, 0, r0, c7, c14, 1		@ clean and invalidate D entry
13949cbe786SEric Miao	mcrne	p15, 0, r0, c7, c5, 1		@ invalidate I entry
14049cbe786SEric Miao	add	r0, r0, #CACHE_DLINESIZE
14149cbe786SEric Miao	mcr	p15, 0, r0, c7, c14, 1		@ clean and invalidate D entry
14249cbe786SEric Miao	mcrne	p15, 0, r0, c7, c5, 1		@ invalidate I entry
14349cbe786SEric Miao	add	r0, r0, #CACHE_DLINESIZE
14449cbe786SEric Miao	cmp	r0, r1
14549cbe786SEric Miao	blo	1b
14649cbe786SEric Miao	tst	r2, #VM_EXEC
14749cbe786SEric Miao	mcrne	p15, 0, ip, c7, c10, 4		@ drain WB
1486ebbf2ceSRussell King	ret	lr
14949cbe786SEric Miao
15049cbe786SEric Miao/*
15149cbe786SEric Miao *	coherent_kern_range(start, end)
15249cbe786SEric Miao *
15349cbe786SEric Miao *	Ensure coherency between the Icache and the Dcache in the
15449cbe786SEric Miao *	region described by start, end.  If you have non-snooping
15549cbe786SEric Miao *	Harvard caches, you need to implement this function.
15649cbe786SEric Miao *
15749cbe786SEric Miao *	- start	- virtual start address
15849cbe786SEric Miao *	- end	- virtual end address
15949cbe786SEric Miao */
16049cbe786SEric MiaoENTRY(mohawk_coherent_kern_range)
16149cbe786SEric Miao	/* FALLTHROUGH */
16249cbe786SEric Miao
16349cbe786SEric Miao/*
16449cbe786SEric Miao *	coherent_user_range(start, end)
16549cbe786SEric Miao *
16649cbe786SEric Miao *	Ensure coherency between the Icache and the Dcache in the
16749cbe786SEric Miao *	region described by start, end.  If you have non-snooping
16849cbe786SEric Miao *	Harvard caches, you need to implement this function.
16949cbe786SEric Miao *
17049cbe786SEric Miao *	- start	- virtual start address
17149cbe786SEric Miao *	- end	- virtual end address
17249cbe786SEric Miao *
17349cbe786SEric Miao * (same as arm926)
17449cbe786SEric Miao */
17549cbe786SEric MiaoENTRY(mohawk_coherent_user_range)
17649cbe786SEric Miao	bic	r0, r0, #CACHE_DLINESIZE - 1
17749cbe786SEric Miao1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
17849cbe786SEric Miao	mcr	p15, 0, r0, c7, c5, 1		@ invalidate I entry
17949cbe786SEric Miao	add	r0, r0, #CACHE_DLINESIZE
18049cbe786SEric Miao	cmp	r0, r1
18149cbe786SEric Miao	blo	1b
18249cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain WB
183c5102f59SWill Deacon	mov	r0, #0
1846ebbf2ceSRussell King	ret	lr
18549cbe786SEric Miao
18649cbe786SEric Miao/*
1872c9b9c84SRussell King *	flush_kern_dcache_area(void *addr, size_t size)
18849cbe786SEric Miao *
18949cbe786SEric Miao *	Ensure no D cache aliasing occurs, either with itself or
19049cbe786SEric Miao *	the I cache
19149cbe786SEric Miao *
1922c9b9c84SRussell King *	- addr	- kernel address
1932c9b9c84SRussell King *	- size	- region size
19449cbe786SEric Miao */
1952c9b9c84SRussell KingENTRY(mohawk_flush_kern_dcache_area)
1962c9b9c84SRussell King	add	r1, r0, r1
19749cbe786SEric Miao1:	mcr	p15, 0, r0, c7, c14, 1		@ clean+invalidate D entry
19849cbe786SEric Miao	add	r0, r0, #CACHE_DLINESIZE
19949cbe786SEric Miao	cmp	r0, r1
20049cbe786SEric Miao	blo	1b
20149cbe786SEric Miao	mov	r0, #0
20249cbe786SEric Miao	mcr	p15, 0, r0, c7, c5, 0		@ invalidate I cache
20349cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain WB
2046ebbf2ceSRussell King	ret	lr
20549cbe786SEric Miao
20649cbe786SEric Miao/*
20749cbe786SEric Miao *	dma_inv_range(start, end)
20849cbe786SEric Miao *
20949cbe786SEric Miao *	Invalidate (discard) the specified virtual address range.
21049cbe786SEric Miao *	May not write back any entries.  If 'start' or 'end'
21149cbe786SEric Miao *	are not cache line aligned, those lines must be written
21249cbe786SEric Miao *	back.
21349cbe786SEric Miao *
21449cbe786SEric Miao *	- start	- virtual start address
21549cbe786SEric Miao *	- end	- virtual end address
21649cbe786SEric Miao *
21749cbe786SEric Miao * (same as v4wb)
21849cbe786SEric Miao */
219702b94bfSRussell Kingmohawk_dma_inv_range:
22049cbe786SEric Miao	tst	r0, #CACHE_DLINESIZE - 1
22149cbe786SEric Miao	mcrne	p15, 0, r0, c7, c10, 1		@ clean D entry
22249cbe786SEric Miao	tst	r1, #CACHE_DLINESIZE - 1
22349cbe786SEric Miao	mcrne	p15, 0, r1, c7, c10, 1		@ clean D entry
22449cbe786SEric Miao	bic	r0, r0, #CACHE_DLINESIZE - 1
22549cbe786SEric Miao1:	mcr	p15, 0, r0, c7, c6, 1		@ invalidate D entry
22649cbe786SEric Miao	add	r0, r0, #CACHE_DLINESIZE
22749cbe786SEric Miao	cmp	r0, r1
22849cbe786SEric Miao	blo	1b
22949cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain WB
2306ebbf2ceSRussell King	ret	lr
23149cbe786SEric Miao
23249cbe786SEric Miao/*
23349cbe786SEric Miao *	dma_clean_range(start, end)
23449cbe786SEric Miao *
23549cbe786SEric Miao *	Clean the specified virtual address range.
23649cbe786SEric Miao *
23749cbe786SEric Miao *	- start	- virtual start address
23849cbe786SEric Miao *	- end	- virtual end address
23949cbe786SEric Miao *
24049cbe786SEric Miao * (same as v4wb)
24149cbe786SEric Miao */
242702b94bfSRussell Kingmohawk_dma_clean_range:
24349cbe786SEric Miao	bic	r0, r0, #CACHE_DLINESIZE - 1
24449cbe786SEric Miao1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
24549cbe786SEric Miao	add	r0, r0, #CACHE_DLINESIZE
24649cbe786SEric Miao	cmp	r0, r1
24749cbe786SEric Miao	blo	1b
24849cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain WB
2496ebbf2ceSRussell King	ret	lr
25049cbe786SEric Miao
25149cbe786SEric Miao/*
25249cbe786SEric Miao *	dma_flush_range(start, end)
25349cbe786SEric Miao *
25449cbe786SEric Miao *	Clean and invalidate the specified virtual address range.
25549cbe786SEric Miao *
25649cbe786SEric Miao *	- start	- virtual start address
25749cbe786SEric Miao *	- end	- virtual end address
25849cbe786SEric Miao */
25949cbe786SEric MiaoENTRY(mohawk_dma_flush_range)
26049cbe786SEric Miao	bic	r0, r0, #CACHE_DLINESIZE - 1
26149cbe786SEric Miao1:
26249cbe786SEric Miao	mcr	p15, 0, r0, c7, c14, 1		@ clean+invalidate D entry
26349cbe786SEric Miao	add	r0, r0, #CACHE_DLINESIZE
26449cbe786SEric Miao	cmp	r0, r1
26549cbe786SEric Miao	blo	1b
26649cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain WB
2676ebbf2ceSRussell King	ret	lr
26849cbe786SEric Miao
269a9c9147eSRussell King/*
270a9c9147eSRussell King *	dma_map_area(start, size, dir)
271a9c9147eSRussell King *	- start	- kernel virtual start address
272a9c9147eSRussell King *	- size	- size of region
273a9c9147eSRussell King *	- dir	- DMA direction
274a9c9147eSRussell King */
275a9c9147eSRussell KingENTRY(mohawk_dma_map_area)
276a9c9147eSRussell King	add	r1, r1, r0
277a9c9147eSRussell King	cmp	r2, #DMA_TO_DEVICE
278a9c9147eSRussell King	beq	mohawk_dma_clean_range
279a9c9147eSRussell King	bcs	mohawk_dma_inv_range
280a9c9147eSRussell King	b	mohawk_dma_flush_range
281a9c9147eSRussell KingENDPROC(mohawk_dma_map_area)
282a9c9147eSRussell King
283a9c9147eSRussell King/*
284a9c9147eSRussell King *	dma_unmap_area(start, size, dir)
285a9c9147eSRussell King *	- start	- kernel virtual start address
286a9c9147eSRussell King *	- size	- size of region
287a9c9147eSRussell King *	- dir	- DMA direction
288a9c9147eSRussell King */
289a9c9147eSRussell KingENTRY(mohawk_dma_unmap_area)
2906ebbf2ceSRussell King	ret	lr
291a9c9147eSRussell KingENDPROC(mohawk_dma_unmap_area)
292a9c9147eSRussell King
293031bd879SLorenzo Pieralisi	.globl	mohawk_flush_kern_cache_louis
294031bd879SLorenzo Pieralisi	.equ	mohawk_flush_kern_cache_louis, mohawk_flush_kern_cache_all
295031bd879SLorenzo Pieralisi
296a39a3218SDave Martin	@ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
297a39a3218SDave Martin	define_cache_functions mohawk
29849cbe786SEric Miao
29949cbe786SEric MiaoENTRY(cpu_mohawk_dcache_clean_area)
30049cbe786SEric Miao1:	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
30149cbe786SEric Miao	add	r0, r0, #CACHE_DLINESIZE
30249cbe786SEric Miao	subs	r1, r1, #CACHE_DLINESIZE
30349cbe786SEric Miao	bhi	1b
30449cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain WB
3056ebbf2ceSRussell King	ret	lr
30649cbe786SEric Miao
30749cbe786SEric Miao/*
30849cbe786SEric Miao * cpu_mohawk_switch_mm(pgd)
30949cbe786SEric Miao *
31049cbe786SEric Miao * Set the translation base pointer to be as described by pgd.
31149cbe786SEric Miao *
31249cbe786SEric Miao * pgd: new page tables
31349cbe786SEric Miao */
31449cbe786SEric Miao	.align	5
31549cbe786SEric MiaoENTRY(cpu_mohawk_switch_mm)
31649cbe786SEric Miao	mov	ip, #0
31749cbe786SEric Miao	mcr	p15, 0, ip, c7, c14, 0		@ clean & invalidate all D cache
31849cbe786SEric Miao	mcr	p15, 0, ip, c7, c5, 0		@ invalidate I cache
31949cbe786SEric Miao	mcr	p15, 0, ip, c7, c10, 4		@ drain WB
32049cbe786SEric Miao	orr	r0, r0, #0x18			@ cache the page table in L2
32149cbe786SEric Miao	mcr	p15, 0, r0, c2, c0, 0		@ load page table pointer
32249cbe786SEric Miao	mcr	p15, 0, ip, c8, c7, 0		@ invalidate I & D TLBs
3236ebbf2ceSRussell King	ret	lr
32449cbe786SEric Miao
32549cbe786SEric Miao/*
32649cbe786SEric Miao * cpu_mohawk_set_pte_ext(ptep, pte, ext)
32749cbe786SEric Miao *
32849cbe786SEric Miao * Set a PTE and flush it out
32949cbe786SEric Miao */
33049cbe786SEric Miao	.align	5
33149cbe786SEric MiaoENTRY(cpu_mohawk_set_pte_ext)
3320f67b876SArnd Bergmann#ifdef CONFIG_MMU
33349cbe786SEric Miao	armv3_set_pte_ext
33449cbe786SEric Miao	mov	r0, r0
33549cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 1		@ clean D entry
33649cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain WB
3376ebbf2ceSRussell King	ret	lr
3380f67b876SArnd Bergmann#endif
33949cbe786SEric Miao
3403f5d0819SChao Xie.globl	cpu_mohawk_suspend_size
3413f5d0819SChao Xie.equ	cpu_mohawk_suspend_size, 4 * 6
342b6c7aabdSRussell King#ifdef CONFIG_ARM_CPU_SUSPEND
3433f5d0819SChao XieENTRY(cpu_mohawk_do_suspend)
3443f5d0819SChao Xie	stmfd	sp!, {r4 - r9, lr}
3453f5d0819SChao Xie	mrc	p14, 0, r4, c6, c0, 0	@ clock configuration, for turbo mode
3463f5d0819SChao Xie	mrc	p15, 0, r5, c15, c1, 0	@ CP access reg
3473f5d0819SChao Xie	mrc	p15, 0, r6, c13, c0, 0	@ PID
3483f5d0819SChao Xie	mrc 	p15, 0, r7, c3, c0, 0	@ domain ID
3493f5d0819SChao Xie	mrc	p15, 0, r8, c1, c0, 1	@ auxiliary control reg
3503f5d0819SChao Xie	mrc 	p15, 0, r9, c1, c0, 0	@ control reg
3513f5d0819SChao Xie	bic	r4, r4, #2		@ clear frequency change bit
3523f5d0819SChao Xie	stmia	r0, {r4 - r9}		@ store cp regs
3533f5d0819SChao Xie	ldmia	sp!, {r4 - r9, pc}
3543f5d0819SChao XieENDPROC(cpu_mohawk_do_suspend)
3553f5d0819SChao Xie
3563f5d0819SChao XieENTRY(cpu_mohawk_do_resume)
3573f5d0819SChao Xie	ldmia	r0, {r4 - r9}		@ load cp regs
3583f5d0819SChao Xie	mov	ip, #0
3593f5d0819SChao Xie	mcr	p15, 0, ip, c7, c7, 0	@ invalidate I & D caches, BTB
3603f5d0819SChao Xie	mcr	p15, 0, ip, c7, c10, 4	@ drain write (&fill) buffer
3613f5d0819SChao Xie	mcr	p15, 0, ip, c7, c5, 4	@ flush prefetch buffer
3623f5d0819SChao Xie	mcr	p15, 0, ip, c8, c7, 0	@ invalidate I & D TLBs
3633f5d0819SChao Xie	mcr	p14, 0, r4, c6, c0, 0	@ clock configuration, turbo mode.
3643f5d0819SChao Xie	mcr	p15, 0, r5, c15, c1, 0	@ CP access reg
3653f5d0819SChao Xie	mcr	p15, 0, r6, c13, c0, 0	@ PID
3663f5d0819SChao Xie	mcr	p15, 0, r7, c3, c0, 0	@ domain ID
3673f5d0819SChao Xie	orr	r1, r1, #0x18		@ cache the page table in L2
3683f5d0819SChao Xie	mcr	p15, 0, r1, c2, c0, 0	@ translation table base addr
3693f5d0819SChao Xie	mcr	p15, 0, r8, c1, c0, 1	@ auxiliary control reg
3703f5d0819SChao Xie	mov	r0, r9			@ control register
3713f5d0819SChao Xie	b	cpu_resume_mmu
3723f5d0819SChao XieENDPROC(cpu_mohawk_do_resume)
3733f5d0819SChao Xie#endif
3743f5d0819SChao Xie
37549cbe786SEric Miao	.type	__mohawk_setup, #function
37649cbe786SEric Miao__mohawk_setup:
37749cbe786SEric Miao	mov	r0, #0
37849cbe786SEric Miao	mcr	p15, 0, r0, c7, c7		@ invalidate I,D caches
37949cbe786SEric Miao	mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer
38049cbe786SEric Miao	mcr	p15, 0, r0, c8, c7		@ invalidate I,D TLBs
38149cbe786SEric Miao	orr	r4, r4, #0x18			@ cache the page table in L2
38249cbe786SEric Miao	mcr	p15, 0, r4, c2, c0, 0		@ load page table pointer
38349cbe786SEric Miao
38449cbe786SEric Miao	mov	r0, #0				@ don't allow CP access
38549cbe786SEric Miao	mcr	p15, 0, r0, c15, c1, 0		@ write CP access register
38649cbe786SEric Miao
38749cbe786SEric Miao	adr	r5, mohawk_crval
38849cbe786SEric Miao	ldmia	r5, {r5, r6}
38949cbe786SEric Miao	mrc	p15, 0, r0, c1, c0		@ get control register
39049cbe786SEric Miao	bic	r0, r0, r5
39149cbe786SEric Miao	orr	r0, r0, r6
3926ebbf2ceSRussell King	ret	lr
39349cbe786SEric Miao
39449cbe786SEric Miao	.size	__mohawk_setup, . - __mohawk_setup
39549cbe786SEric Miao
39649cbe786SEric Miao	/*
39749cbe786SEric Miao	 *  R
39849cbe786SEric Miao	 * .RVI ZFRS BLDP WCAM
39949cbe786SEric Miao	 * .011 1001 ..00 0101
40049cbe786SEric Miao	 *
40149cbe786SEric Miao	 */
40249cbe786SEric Miao	.type	mohawk_crval, #object
40349cbe786SEric Miaomohawk_crval:
40449cbe786SEric Miao	crval	clear=0x00007f3f, mmuset=0x00003905, ucset=0x00001134
40549cbe786SEric Miao
40649cbe786SEric Miao	__INITDATA
40749cbe786SEric Miao
408a39a3218SDave Martin	@ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
409a39a3218SDave Martin	define_processor_functions mohawk, dabort=v5t_early_abort, pabort=legacy_pabort
41049cbe786SEric Miao
41149cbe786SEric Miao	.section ".rodata"
41249cbe786SEric Miao
413a39a3218SDave Martin	string	cpu_arch_name, "armv5te"
414a39a3218SDave Martin	string	cpu_elf_name, "v5"
415a39a3218SDave Martin	string	cpu_mohawk_name, "Marvell 88SV331x"
41649cbe786SEric Miao
41749cbe786SEric Miao	.align
41849cbe786SEric Miao
419790756c7SNick Desaulniers	.section ".proc.info.init", "a"
42049cbe786SEric Miao
42149cbe786SEric Miao	.type	__88sv331x_proc_info,#object
42249cbe786SEric Miao__88sv331x_proc_info:
42349cbe786SEric Miao	.long	0x56158000			@ Marvell 88SV331x (MOHAWK)
42449cbe786SEric Miao	.long	0xfffff000
42549cbe786SEric Miao	.long   PMD_TYPE_SECT | \
42649cbe786SEric Miao		PMD_SECT_BUFFERABLE | \
42749cbe786SEric Miao		PMD_SECT_CACHEABLE | \
42849cbe786SEric Miao		PMD_BIT4 | \
42949cbe786SEric Miao		PMD_SECT_AP_WRITE | \
43049cbe786SEric Miao		PMD_SECT_AP_READ
43149cbe786SEric Miao	.long   PMD_TYPE_SECT | \
43249cbe786SEric Miao		PMD_BIT4 | \
43349cbe786SEric Miao		PMD_SECT_AP_WRITE | \
43449cbe786SEric Miao		PMD_SECT_AP_READ
435bf35706fSArd Biesheuvel	initfn	__mohawk_setup, __88sv331x_proc_info
43649cbe786SEric Miao	.long	cpu_arch_name
43749cbe786SEric Miao	.long	cpu_elf_name
43849cbe786SEric Miao	.long	HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
43949cbe786SEric Miao	.long	cpu_mohawk_name
44049cbe786SEric Miao	.long	mohawk_processor_functions
44149cbe786SEric Miao	.long	v4wbi_tlb_fns
44249cbe786SEric Miao	.long	v4wb_user_fns
44349cbe786SEric Miao	.long	mohawk_cache_fns
44449cbe786SEric Miao	.size	__88sv331x_proc_info, . - __88sv331x_proc_info
445