xref: /openbmc/linux/arch/arm/mm/proc-arm720.S (revision 6ebbf2ce437b33022d30badd49dc94d33ecfa498)
11da177e4SLinus Torvalds/*
21da177e4SLinus Torvalds *  linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720
31da177e4SLinus Torvalds *
41da177e4SLinus Torvalds *  Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
51da177e4SLinus Torvalds *                     Rob Scott (rscott@mtrob.fdns.net)
61da177e4SLinus Torvalds *  Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd.
7d090dddaSHyok S. Choi *  hacked for non-paged-MM by Hyok S. Choi, 2004.
81da177e4SLinus Torvalds *
91da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify
101da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by
111da177e4SLinus Torvalds * the Free Software Foundation; either version 2 of the License, or
121da177e4SLinus Torvalds * (at your option) any later version.
131da177e4SLinus Torvalds *
141da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful,
151da177e4SLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of
161da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
171da177e4SLinus Torvalds * GNU General Public License for more details.
181da177e4SLinus Torvalds *
191da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License
201da177e4SLinus Torvalds * along with this program; if not, write to the Free Software
211da177e4SLinus Torvalds * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
221da177e4SLinus Torvalds *
231da177e4SLinus Torvalds *
241da177e4SLinus Torvalds * These are the low level assembler for performing cache and TLB
251da177e4SLinus Torvalds * functions on the ARM720T.  The ARM720T has a writethrough IDC
261da177e4SLinus Torvalds * cache, so we don't need to clean it.
271da177e4SLinus Torvalds *
281da177e4SLinus Torvalds *  Changelog:
291da177e4SLinus Torvalds *   05-09-2000 SJH	Created by moving 720 specific functions
301da177e4SLinus Torvalds *			out of 'proc-arm6,7.S' per RMK discussion
311da177e4SLinus Torvalds *   07-25-2000 SJH	Added idle function.
321da177e4SLinus Torvalds *   08-25-2000	DBS	Updated for integration of ARM Ltd version.
33d090dddaSHyok S. Choi *   04-20-2004 HSC	modified for non-paged memory management mode.
341da177e4SLinus Torvalds */
351da177e4SLinus Torvalds#include <linux/linkage.h>
361da177e4SLinus Torvalds#include <linux/init.h>
371da177e4SLinus Torvalds#include <asm/assembler.h>
38e6ae744dSSam Ravnborg#include <asm/asm-offsets.h>
395ec9407dSRussell King#include <asm/hwcap.h>
4074945c86SRussell King#include <asm/pgtable-hwdef.h>
411da177e4SLinus Torvalds#include <asm/pgtable.h>
421da177e4SLinus Torvalds#include <asm/ptrace.h>
431da177e4SLinus Torvalds
44bb8d5a55SThomas Gleixner#include "proc-macros.S"
45bb8d5a55SThomas Gleixner
461da177e4SLinus Torvalds/*
471da177e4SLinus Torvalds * Function: arm720_proc_init (void)
481da177e4SLinus Torvalds *	   : arm720_proc_fin (void)
491da177e4SLinus Torvalds *
501da177e4SLinus Torvalds * Notes   : This processor does not require these
511da177e4SLinus Torvalds */
521da177e4SLinus TorvaldsENTRY(cpu_arm720_dcache_clean_area)
531da177e4SLinus TorvaldsENTRY(cpu_arm720_proc_init)
54*6ebbf2ceSRussell King		ret	lr
551da177e4SLinus Torvalds
561da177e4SLinus TorvaldsENTRY(cpu_arm720_proc_fin)
571da177e4SLinus Torvalds		mrc	p15, 0, r0, c1, c0, 0
581da177e4SLinus Torvalds		bic	r0, r0, #0x1000			@ ...i............
591da177e4SLinus Torvalds		bic	r0, r0, #0x000e			@ ............wca.
601da177e4SLinus Torvalds		mcr	p15, 0, r0, c1, c0, 0		@ disable caches
61*6ebbf2ceSRussell King		ret	lr
621da177e4SLinus Torvalds
631da177e4SLinus Torvalds/*
641da177e4SLinus Torvalds * Function: arm720_proc_do_idle(void)
651da177e4SLinus Torvalds * Params  : r0 = unused
6625985edcSLucas De Marchi * Purpose : put the processor in proper idle mode
671da177e4SLinus Torvalds */
681da177e4SLinus TorvaldsENTRY(cpu_arm720_do_idle)
69*6ebbf2ceSRussell King		ret	lr
701da177e4SLinus Torvalds
711da177e4SLinus Torvalds/*
721da177e4SLinus Torvalds * Function: arm720_switch_mm(unsigned long pgd_phys)
731da177e4SLinus Torvalds * Params  : pgd_phys	Physical address of page table
741da177e4SLinus Torvalds * Purpose : Perform a task switch, saving the old process' state and restoring
751da177e4SLinus Torvalds *	     the new.
761da177e4SLinus Torvalds */
771da177e4SLinus TorvaldsENTRY(cpu_arm720_switch_mm)
78d090dddaSHyok S. Choi#ifdef CONFIG_MMU
791da177e4SLinus Torvalds		mov	r1, #0
801da177e4SLinus Torvalds		mcr	p15, 0, r1, c7, c7, 0		@ invalidate cache
811da177e4SLinus Torvalds		mcr	p15, 0, r0, c2, c0, 0		@ update page table ptr
821da177e4SLinus Torvalds		mcr	p15, 0, r1, c8, c7, 0		@ flush TLB (v4)
83d090dddaSHyok S. Choi#endif
84*6ebbf2ceSRussell King		ret	lr
851da177e4SLinus Torvalds
861da177e4SLinus Torvalds/*
87ad1ae2feSRussell King * Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext)
881da177e4SLinus Torvalds * Params  : r0 = Address to set
891da177e4SLinus Torvalds *	   : r1 = value to set
901da177e4SLinus Torvalds * Purpose : Set a PTE and flush it out of any WB cache
911da177e4SLinus Torvalds */
921da177e4SLinus Torvalds	.align	5
93ad1ae2feSRussell KingENTRY(cpu_arm720_set_pte_ext)
94d090dddaSHyok S. Choi#ifdef CONFIG_MMU
95da091653SRussell King	armv3_set_pte_ext wc_disable=0
96d090dddaSHyok S. Choi#endif
97*6ebbf2ceSRussell King	ret	lr
981da177e4SLinus Torvalds
991da177e4SLinus Torvalds/*
1001da177e4SLinus Torvalds * Function: arm720_reset
1011da177e4SLinus Torvalds * Params  : r0 = address to jump to
1021da177e4SLinus Torvalds * Notes   : This sets up everything for a reset
1031da177e4SLinus Torvalds */
1041a4baafaSWill Deacon		.pushsection	.idmap.text, "ax"
1051da177e4SLinus TorvaldsENTRY(cpu_arm720_reset)
1061da177e4SLinus Torvalds		mov	ip, #0
1071da177e4SLinus Torvalds		mcr	p15, 0, ip, c7, c7, 0		@ invalidate cache
108d090dddaSHyok S. Choi#ifdef CONFIG_MMU
1091da177e4SLinus Torvalds		mcr	p15, 0, ip, c8, c7, 0		@ flush TLB (v4)
110d090dddaSHyok S. Choi#endif
1111da177e4SLinus Torvalds		mrc	p15, 0, ip, c1, c0, 0		@ get ctrl register
1121da177e4SLinus Torvalds		bic	ip, ip, #0x000f			@ ............wcam
1131da177e4SLinus Torvalds		bic	ip, ip, #0x2100			@ ..v....s........
1141da177e4SLinus Torvalds		mcr	p15, 0, ip, c1, c0, 0		@ ctrl register
115*6ebbf2ceSRussell King		ret	r0
1161a4baafaSWill DeaconENDPROC(cpu_arm720_reset)
1171a4baafaSWill Deacon		.popsection
1181da177e4SLinus Torvalds
1191da177e4SLinus Torvalds	.type	__arm710_setup, #function
1201da177e4SLinus Torvalds__arm710_setup:
1211da177e4SLinus Torvalds	mov	r0, #0
1221da177e4SLinus Torvalds	mcr	p15, 0, r0, c7, c7, 0		@ invalidate caches
123d090dddaSHyok S. Choi#ifdef CONFIG_MMU
1241da177e4SLinus Torvalds	mcr	p15, 0, r0, c8, c7, 0		@ flush TLB (v4)
125d090dddaSHyok S. Choi#endif
1261da177e4SLinus Torvalds	mrc	p15, 0, r0, c1, c0		@ get control register
1271da177e4SLinus Torvalds	ldr	r5, arm710_cr1_clear
1281da177e4SLinus Torvalds	bic	r0, r0, r5
1291da177e4SLinus Torvalds	ldr	r5, arm710_cr1_set
1301da177e4SLinus Torvalds	orr	r0, r0, r5
131*6ebbf2ceSRussell King	ret	lr				@ __ret (head.S)
1321da177e4SLinus Torvalds	.size	__arm710_setup, . - __arm710_setup
1331da177e4SLinus Torvalds
1341da177e4SLinus Torvalds	/*
1351da177e4SLinus Torvalds	 *  R
1361da177e4SLinus Torvalds	 * .RVI ZFRS BLDP WCAM
1371da177e4SLinus Torvalds	 * .... 0001 ..11 1101
1381da177e4SLinus Torvalds	 *
1391da177e4SLinus Torvalds	 */
1401da177e4SLinus Torvalds	.type	arm710_cr1_clear, #object
1411da177e4SLinus Torvalds	.type	arm710_cr1_set, #object
1421da177e4SLinus Torvaldsarm710_cr1_clear:
1431da177e4SLinus Torvalds	.word	0x0f3f
1441da177e4SLinus Torvaldsarm710_cr1_set:
1451da177e4SLinus Torvalds	.word	0x013d
1461da177e4SLinus Torvalds
1471da177e4SLinus Torvalds	.type	__arm720_setup, #function
1481da177e4SLinus Torvalds__arm720_setup:
1491da177e4SLinus Torvalds	mov	r0, #0
1501da177e4SLinus Torvalds	mcr	p15, 0, r0, c7, c7, 0		@ invalidate caches
151d090dddaSHyok S. Choi#ifdef CONFIG_MMU
1521da177e4SLinus Torvalds	mcr	p15, 0, r0, c8, c7, 0		@ flush TLB (v4)
153d090dddaSHyok S. Choi#endif
15422b19086SRussell King	adr	r5, arm720_crval
15522b19086SRussell King	ldmia	r5, {r5, r6}
1561da177e4SLinus Torvalds	mrc	p15, 0, r0, c1, c0		@ get control register
1571da177e4SLinus Torvalds	bic	r0, r0, r5
15822b19086SRussell King	orr	r0, r0, r6
159*6ebbf2ceSRussell King	ret	lr				@ __ret (head.S)
1601da177e4SLinus Torvalds	.size	__arm720_setup, . - __arm720_setup
1611da177e4SLinus Torvalds
1621da177e4SLinus Torvalds	/*
1631da177e4SLinus Torvalds	 *  R
1641da177e4SLinus Torvalds	 * .RVI ZFRS BLDP WCAM
1651da177e4SLinus Torvalds	 * ..1. 1001 ..11 1101
1661da177e4SLinus Torvalds	 *
1671da177e4SLinus Torvalds	 */
16822b19086SRussell King	.type	arm720_crval, #object
16922b19086SRussell Kingarm720_crval:
17022b19086SRussell King	crval	clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130
1711da177e4SLinus Torvalds
1721da177e4SLinus Torvalds		__INITDATA
173449870b1SDave Martin	@ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
174449870b1SDave Martin	define_processor_functions arm720, dabort=v4t_late_abort, pabort=legacy_pabort
1751da177e4SLinus Torvalds
1761da177e4SLinus Torvalds		.section ".rodata"
1771da177e4SLinus Torvalds
178449870b1SDave Martin	string	cpu_arch_name, "armv4t"
179449870b1SDave Martin	string	cpu_elf_name, "v4"
180449870b1SDave Martin	string	cpu_arm710_name, "ARM710T"
181449870b1SDave Martin	string	cpu_arm720_name, "ARM720T"
1821da177e4SLinus Torvalds
1831da177e4SLinus Torvalds		.align
1841da177e4SLinus Torvalds
1851da177e4SLinus Torvalds/*
1864baa9922SRussell King * See <asm/procinfo.h> for a definition of this structure.
1871da177e4SLinus Torvalds */
1881da177e4SLinus Torvalds
18902b7dd12SBen Dooks		.section ".proc.info.init", #alloc, #execinstr
1901da177e4SLinus Torvalds
191449870b1SDave Martin.macro arm720_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cpu_flush:req
192449870b1SDave Martin		.type	__\name\()_proc_info,#object
193449870b1SDave Martin__\name\()_proc_info:
194449870b1SDave Martin		.long	\cpu_val
195449870b1SDave Martin		.long	\cpu_mask
1961da177e4SLinus Torvalds		.long   PMD_TYPE_SECT | \
1971da177e4SLinus Torvalds			PMD_SECT_BUFFERABLE | \
1981da177e4SLinus Torvalds			PMD_SECT_CACHEABLE | \
1991da177e4SLinus Torvalds			PMD_BIT4 | \
2001da177e4SLinus Torvalds			PMD_SECT_AP_WRITE | \
2011da177e4SLinus Torvalds			PMD_SECT_AP_READ
2028799ee9fSRussell King		.long   PMD_TYPE_SECT | \
2038799ee9fSRussell King			PMD_BIT4 | \
2048799ee9fSRussell King			PMD_SECT_AP_WRITE | \
2058799ee9fSRussell King			PMD_SECT_AP_READ
206449870b1SDave Martin		b	\cpu_flush				@ cpu_flush
2071da177e4SLinus Torvalds		.long	cpu_arch_name				@ arch_name
2081da177e4SLinus Torvalds		.long	cpu_elf_name				@ elf_name
2091da177e4SLinus Torvalds		.long	HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB	@ elf_hwcap
210449870b1SDave Martin		.long	\cpu_name
2111da177e4SLinus Torvalds		.long	arm720_processor_functions
2121da177e4SLinus Torvalds		.long	v4_tlb_fns
2131da177e4SLinus Torvalds		.long	v4wt_user_fns
2141da177e4SLinus Torvalds		.long	v4_cache_fns
215449870b1SDave Martin		.size	__\name\()_proc_info, . - __\name\()_proc_info
216449870b1SDave Martin.endm
2171da177e4SLinus Torvalds
218449870b1SDave Martin	arm720_proc_info arm710, 0x41807100, 0xffffff00, cpu_arm710_name, __arm710_setup
219449870b1SDave Martin	arm720_proc_info arm720, 0x41807200, 0xffffff00, cpu_arm720_name, __arm720_setup
220