11a59d1b8SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-or-later */ 21da177e4SLinus Torvalds/* 31da177e4SLinus Torvalds * linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * Copyright (C) 2000 Steve Hill (sjhill@cotw.com) 61da177e4SLinus Torvalds * Rob Scott (rscott@mtrob.fdns.net) 71da177e4SLinus Torvalds * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd. 8d090dddaSHyok S. Choi * hacked for non-paged-MM by Hyok S. Choi, 2004. 91da177e4SLinus Torvalds * 101da177e4SLinus Torvalds * These are the low level assembler for performing cache and TLB 111da177e4SLinus Torvalds * functions on the ARM720T. The ARM720T has a writethrough IDC 121da177e4SLinus Torvalds * cache, so we don't need to clean it. 131da177e4SLinus Torvalds * 141da177e4SLinus Torvalds * Changelog: 151da177e4SLinus Torvalds * 05-09-2000 SJH Created by moving 720 specific functions 161da177e4SLinus Torvalds * out of 'proc-arm6,7.S' per RMK discussion 171da177e4SLinus Torvalds * 07-25-2000 SJH Added idle function. 181da177e4SLinus Torvalds * 08-25-2000 DBS Updated for integration of ARM Ltd version. 19d090dddaSHyok S. Choi * 04-20-2004 HSC modified for non-paged memory management mode. 201da177e4SLinus Torvalds */ 211da177e4SLinus Torvalds#include <linux/linkage.h> 221da177e4SLinus Torvalds#include <linux/init.h> 23*65fddcfcSMike Rapoport#include <linux/pgtable.h> 241da177e4SLinus Torvalds#include <asm/assembler.h> 25e6ae744dSSam Ravnborg#include <asm/asm-offsets.h> 265ec9407dSRussell King#include <asm/hwcap.h> 2774945c86SRussell King#include <asm/pgtable-hwdef.h> 281da177e4SLinus Torvalds#include <asm/ptrace.h> 291da177e4SLinus Torvalds 30bb8d5a55SThomas Gleixner#include "proc-macros.S" 31bb8d5a55SThomas Gleixner 321da177e4SLinus Torvalds/* 331da177e4SLinus Torvalds * Function: arm720_proc_init (void) 341da177e4SLinus Torvalds * : arm720_proc_fin (void) 351da177e4SLinus Torvalds * 361da177e4SLinus Torvalds * Notes : This processor does not require these 371da177e4SLinus Torvalds */ 381da177e4SLinus TorvaldsENTRY(cpu_arm720_dcache_clean_area) 391da177e4SLinus TorvaldsENTRY(cpu_arm720_proc_init) 406ebbf2ceSRussell King ret lr 411da177e4SLinus Torvalds 421da177e4SLinus TorvaldsENTRY(cpu_arm720_proc_fin) 431da177e4SLinus Torvalds mrc p15, 0, r0, c1, c0, 0 441da177e4SLinus Torvalds bic r0, r0, #0x1000 @ ...i............ 451da177e4SLinus Torvalds bic r0, r0, #0x000e @ ............wca. 461da177e4SLinus Torvalds mcr p15, 0, r0, c1, c0, 0 @ disable caches 476ebbf2ceSRussell King ret lr 481da177e4SLinus Torvalds 491da177e4SLinus Torvalds/* 501da177e4SLinus Torvalds * Function: arm720_proc_do_idle(void) 511da177e4SLinus Torvalds * Params : r0 = unused 5225985edcSLucas De Marchi * Purpose : put the processor in proper idle mode 531da177e4SLinus Torvalds */ 541da177e4SLinus TorvaldsENTRY(cpu_arm720_do_idle) 556ebbf2ceSRussell King ret lr 561da177e4SLinus Torvalds 571da177e4SLinus Torvalds/* 581da177e4SLinus Torvalds * Function: arm720_switch_mm(unsigned long pgd_phys) 591da177e4SLinus Torvalds * Params : pgd_phys Physical address of page table 601da177e4SLinus Torvalds * Purpose : Perform a task switch, saving the old process' state and restoring 611da177e4SLinus Torvalds * the new. 621da177e4SLinus Torvalds */ 631da177e4SLinus TorvaldsENTRY(cpu_arm720_switch_mm) 64d090dddaSHyok S. Choi#ifdef CONFIG_MMU 651da177e4SLinus Torvalds mov r1, #0 661da177e4SLinus Torvalds mcr p15, 0, r1, c7, c7, 0 @ invalidate cache 671da177e4SLinus Torvalds mcr p15, 0, r0, c2, c0, 0 @ update page table ptr 681da177e4SLinus Torvalds mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4) 69d090dddaSHyok S. Choi#endif 706ebbf2ceSRussell King ret lr 711da177e4SLinus Torvalds 721da177e4SLinus Torvalds/* 73ad1ae2feSRussell King * Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext) 741da177e4SLinus Torvalds * Params : r0 = Address to set 751da177e4SLinus Torvalds * : r1 = value to set 761da177e4SLinus Torvalds * Purpose : Set a PTE and flush it out of any WB cache 771da177e4SLinus Torvalds */ 781da177e4SLinus Torvalds .align 5 79ad1ae2feSRussell KingENTRY(cpu_arm720_set_pte_ext) 80d090dddaSHyok S. Choi#ifdef CONFIG_MMU 81da091653SRussell King armv3_set_pte_ext wc_disable=0 82d090dddaSHyok S. Choi#endif 836ebbf2ceSRussell King ret lr 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds/* 861da177e4SLinus Torvalds * Function: arm720_reset 871da177e4SLinus Torvalds * Params : r0 = address to jump to 881da177e4SLinus Torvalds * Notes : This sets up everything for a reset 891da177e4SLinus Torvalds */ 901a4baafaSWill Deacon .pushsection .idmap.text, "ax" 911da177e4SLinus TorvaldsENTRY(cpu_arm720_reset) 921da177e4SLinus Torvalds mov ip, #0 931da177e4SLinus Torvalds mcr p15, 0, ip, c7, c7, 0 @ invalidate cache 94d090dddaSHyok S. Choi#ifdef CONFIG_MMU 951da177e4SLinus Torvalds mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4) 96d090dddaSHyok S. Choi#endif 971da177e4SLinus Torvalds mrc p15, 0, ip, c1, c0, 0 @ get ctrl register 981da177e4SLinus Torvalds bic ip, ip, #0x000f @ ............wcam 991da177e4SLinus Torvalds bic ip, ip, #0x2100 @ ..v....s........ 1001da177e4SLinus Torvalds mcr p15, 0, ip, c1, c0, 0 @ ctrl register 1016ebbf2ceSRussell King ret r0 1021a4baafaSWill DeaconENDPROC(cpu_arm720_reset) 1031a4baafaSWill Deacon .popsection 1041da177e4SLinus Torvalds 1051da177e4SLinus Torvalds .type __arm710_setup, #function 1061da177e4SLinus Torvalds__arm710_setup: 1071da177e4SLinus Torvalds mov r0, #0 1081da177e4SLinus Torvalds mcr p15, 0, r0, c7, c7, 0 @ invalidate caches 109d090dddaSHyok S. Choi#ifdef CONFIG_MMU 1101da177e4SLinus Torvalds mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) 111d090dddaSHyok S. Choi#endif 1121da177e4SLinus Torvalds mrc p15, 0, r0, c1, c0 @ get control register 1131da177e4SLinus Torvalds ldr r5, arm710_cr1_clear 1141da177e4SLinus Torvalds bic r0, r0, r5 1151da177e4SLinus Torvalds ldr r5, arm710_cr1_set 1161da177e4SLinus Torvalds orr r0, r0, r5 1176ebbf2ceSRussell King ret lr @ __ret (head.S) 1181da177e4SLinus Torvalds .size __arm710_setup, . - __arm710_setup 1191da177e4SLinus Torvalds 1201da177e4SLinus Torvalds /* 1211da177e4SLinus Torvalds * R 1221da177e4SLinus Torvalds * .RVI ZFRS BLDP WCAM 1231da177e4SLinus Torvalds * .... 0001 ..11 1101 1241da177e4SLinus Torvalds * 1251da177e4SLinus Torvalds */ 1261da177e4SLinus Torvalds .type arm710_cr1_clear, #object 1271da177e4SLinus Torvalds .type arm710_cr1_set, #object 1281da177e4SLinus Torvaldsarm710_cr1_clear: 1291da177e4SLinus Torvalds .word 0x0f3f 1301da177e4SLinus Torvaldsarm710_cr1_set: 1311da177e4SLinus Torvalds .word 0x013d 1321da177e4SLinus Torvalds 1331da177e4SLinus Torvalds .type __arm720_setup, #function 1341da177e4SLinus Torvalds__arm720_setup: 1351da177e4SLinus Torvalds mov r0, #0 1361da177e4SLinus Torvalds mcr p15, 0, r0, c7, c7, 0 @ invalidate caches 137d090dddaSHyok S. Choi#ifdef CONFIG_MMU 1381da177e4SLinus Torvalds mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) 139d090dddaSHyok S. Choi#endif 14022b19086SRussell King adr r5, arm720_crval 14122b19086SRussell King ldmia r5, {r5, r6} 1421da177e4SLinus Torvalds mrc p15, 0, r0, c1, c0 @ get control register 1431da177e4SLinus Torvalds bic r0, r0, r5 14422b19086SRussell King orr r0, r0, r6 1456ebbf2ceSRussell King ret lr @ __ret (head.S) 1461da177e4SLinus Torvalds .size __arm720_setup, . - __arm720_setup 1471da177e4SLinus Torvalds 1481da177e4SLinus Torvalds /* 1491da177e4SLinus Torvalds * R 1501da177e4SLinus Torvalds * .RVI ZFRS BLDP WCAM 1511da177e4SLinus Torvalds * ..1. 1001 ..11 1101 1521da177e4SLinus Torvalds * 1531da177e4SLinus Torvalds */ 15422b19086SRussell King .type arm720_crval, #object 15522b19086SRussell Kingarm720_crval: 15622b19086SRussell King crval clear=0x00002f3f, mmuset=0x0000213d, ucset=0x00000130 1571da177e4SLinus Torvalds 1581da177e4SLinus Torvalds __INITDATA 159449870b1SDave Martin @ define struct processor (see <asm/proc-fns.h> and proc-macros.S) 160449870b1SDave Martin define_processor_functions arm720, dabort=v4t_late_abort, pabort=legacy_pabort 1611da177e4SLinus Torvalds 1621da177e4SLinus Torvalds .section ".rodata" 1631da177e4SLinus Torvalds 164449870b1SDave Martin string cpu_arch_name, "armv4t" 165449870b1SDave Martin string cpu_elf_name, "v4" 166449870b1SDave Martin string cpu_arm710_name, "ARM710T" 167449870b1SDave Martin string cpu_arm720_name, "ARM720T" 1681da177e4SLinus Torvalds 1691da177e4SLinus Torvalds .align 1701da177e4SLinus Torvalds 1711da177e4SLinus Torvalds/* 1724baa9922SRussell King * See <asm/procinfo.h> for a definition of this structure. 1731da177e4SLinus Torvalds */ 1741da177e4SLinus Torvalds 175790756c7SNick Desaulniers .section ".proc.info.init", "a" 1761da177e4SLinus Torvalds 177449870b1SDave Martin.macro arm720_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cpu_flush:req 178449870b1SDave Martin .type __\name\()_proc_info,#object 179449870b1SDave Martin__\name\()_proc_info: 180449870b1SDave Martin .long \cpu_val 181449870b1SDave Martin .long \cpu_mask 1821da177e4SLinus Torvalds .long PMD_TYPE_SECT | \ 1831da177e4SLinus Torvalds PMD_SECT_BUFFERABLE | \ 1841da177e4SLinus Torvalds PMD_SECT_CACHEABLE | \ 1851da177e4SLinus Torvalds PMD_BIT4 | \ 1861da177e4SLinus Torvalds PMD_SECT_AP_WRITE | \ 1871da177e4SLinus Torvalds PMD_SECT_AP_READ 1888799ee9fSRussell King .long PMD_TYPE_SECT | \ 1898799ee9fSRussell King PMD_BIT4 | \ 1908799ee9fSRussell King PMD_SECT_AP_WRITE | \ 1918799ee9fSRussell King PMD_SECT_AP_READ 192bf35706fSArd Biesheuvel initfn \cpu_flush, __\name\()_proc_info @ cpu_flush 1931da177e4SLinus Torvalds .long cpu_arch_name @ arch_name 1941da177e4SLinus Torvalds .long cpu_elf_name @ elf_name 1951da177e4SLinus Torvalds .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap 196449870b1SDave Martin .long \cpu_name 1971da177e4SLinus Torvalds .long arm720_processor_functions 1981da177e4SLinus Torvalds .long v4_tlb_fns 1991da177e4SLinus Torvalds .long v4wt_user_fns 2001da177e4SLinus Torvalds .long v4_cache_fns 201449870b1SDave Martin .size __\name\()_proc_info, . - __\name\()_proc_info 202449870b1SDave Martin.endm 2031da177e4SLinus Torvalds 204449870b1SDave Martin arm720_proc_info arm710, 0x41807100, 0xffffff00, cpu_arm710_name, __arm710_setup 205449870b1SDave Martin arm720_proc_info arm720, 0x41807200, 0xffffff00, cpu_arm720_name, __arm720_setup 206