blob: 392d6a2db5b9fa75e25452eadf35a3b84cb4334e [file] [log] [blame]
Aneesh V2c451f72011-06-16 23:30:47 +00001/*
2 * (C) Copyright 2010
3 * Texas Instruments, <www.ti.com>
4 * Aneesh V <aneesh@ti.com>
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Aneesh V2c451f72011-06-16 23:30:47 +00007 */
8#ifndef ARMV7_H
9#define ARMV7_H
10#include <linux/types.h>
11
Aneesh Vad577c82011-07-21 09:10:04 -040012/* Cortex-A9 revisions */
13#define MIDR_CORTEX_A9_R0P1 0x410FC091
14#define MIDR_CORTEX_A9_R1P2 0x411FC092
15#define MIDR_CORTEX_A9_R1P3 0x411FC093
Aneesh V5ab12a92011-07-21 09:29:23 -040016#define MIDR_CORTEX_A9_R2P10 0x412FC09A
Aneesh Vad577c82011-07-21 09:10:04 -040017
Sricharan508a58f2011-11-15 09:49:55 -050018/* Cortex-A15 revisions */
19#define MIDR_CORTEX_A15_R0P0 0x410FC0F0
SRICHARAN Reed7c0f2013-02-12 01:33:41 +000020#define MIDR_CORTEX_A15_R2P2 0x412FC0F2
Sricharan508a58f2011-11-15 09:49:55 -050021
Aneesh V2c451f72011-06-16 23:30:47 +000022/* CCSIDR */
23#define CCSIDR_LINE_SIZE_OFFSET 0
24#define CCSIDR_LINE_SIZE_MASK 0x7
25#define CCSIDR_ASSOCIATIVITY_OFFSET 3
26#define CCSIDR_ASSOCIATIVITY_MASK (0x3FF << 3)
27#define CCSIDR_NUM_SETS_OFFSET 13
28#define CCSIDR_NUM_SETS_MASK (0x7FFF << 13)
29
30/*
31 * Values for InD field in CSSELR
32 * Selects the type of cache
33 */
34#define ARMV7_CSSELR_IND_DATA_UNIFIED 0
35#define ARMV7_CSSELR_IND_INSTRUCTION 1
36
37/* Values for Ctype fields in CLIDR */
38#define ARMV7_CLIDR_CTYPE_NO_CACHE 0
39#define ARMV7_CLIDR_CTYPE_INSTRUCTION_ONLY 1
40#define ARMV7_CLIDR_CTYPE_DATA_ONLY 2
41#define ARMV7_CLIDR_CTYPE_INSTRUCTION_DATA 3
42#define ARMV7_CLIDR_CTYPE_UNIFIED 4
43
44/*
45 * CP15 Barrier instructions
46 * Please note that we have separate barrier instructions in ARMv7
47 * However, we use the CP15 based instructtions because we use
48 * -march=armv5 in U-Boot
49 */
50#define CP15ISB asm volatile ("mcr p15, 0, %0, c7, c5, 4" : : "r" (0))
51#define CP15DSB asm volatile ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0))
52#define CP15DMB asm volatile ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0))
53
54void v7_outer_cache_enable(void);
55void v7_outer_cache_disable(void);
56void v7_outer_cache_flush_all(void);
57void v7_outer_cache_inval_all(void);
58void v7_outer_cache_flush_range(u32 start, u32 end);
59void v7_outer_cache_inval_range(u32 start, u32 end);
60
61#endif