1515#include <linux/types.h>
1616#endif
1717
18- #ifdef CONFIG_MN10300_CPU_AM33V2
1918/* we tell the compiler to pretend to be AM33 so that it doesn't try and use
2019 * the FP regs, but tell the assembler that we're actually allowed AM33v2
2120 * instructions */
@@ -24,7 +23,6 @@ asm(" .am33_2\n");
2423#else
2524.am33_2
2625#endif
27- #endif
2826
2927#ifdef __KERNEL__
3028
@@ -58,6 +56,9 @@ asm(" .am33_2\n");
5856#define EPSW_nAR 0x00040000 /* register bank control */
5957#define EPSW_ML 0x00080000 /* monitor level */
6058#define EPSW_FE 0x00100000 /* FPU enable */
59+ #define EPSW_IM_SHIFT 8 /* EPSW_IM_SHIFT determines the interrupt mode */
60+
61+ #define NUM2EPSW_IM (num ) ((num) << EPSW_IM_SHIFT)
6162
6263/* FPU registers */
6364#define FPCR_EF_I 0x00000001 /* inexact result FPU exception flag */
@@ -99,9 +100,11 @@ asm(" .am33_2\n");
99100#define CPUREV __SYSREGC(0xc0000050, u32) /* CPU revision register */
100101#define CPUREV_TYPE 0x0000000f /* CPU type */
101102#define CPUREV_TYPE_S 0
102- #define CPUREV_TYPE_AM33V1 0x00000000 /* - AM33 V1 core, AM33/1.00 arch */
103- #define CPUREV_TYPE_AM33V2 0x00000001 /* - AM33 V2 core, AM33/2.00 arch */
104- #define CPUREV_TYPE_AM34V1 0x00000002 /* - AM34 V1 core, AM33/2.00 arch */
103+ #define CPUREV_TYPE_AM33_1 0x00000000 /* - AM33-1 core, AM33/1.00 arch */
104+ #define CPUREV_TYPE_AM33_2 0x00000001 /* - AM33-2 core, AM33/2.00 arch */
105+ #define CPUREV_TYPE_AM34_1 0x00000002 /* - AM34-1 core, AM33/2.00 arch */
106+ #define CPUREV_TYPE_AM33_3 0x00000003 /* - AM33-3 core, AM33/2.00 arch */
107+ #define CPUREV_TYPE_AM34_2 0x00000004 /* - AM34-2 core, AM33/3.00 arch */
105108#define CPUREV_REVISION 0x000000f0 /* CPU revision */
106109#define CPUREV_REVISION_S 4
107110#define CPUREV_ICWAY 0x00000f00 /* number of instruction cache ways */
@@ -180,6 +183,21 @@ asm(" .am33_2\n");
180183#define CHCTR_ICWMD 0x0f00 /* instruction cache way mode */
181184#define CHCTR_DCWMD 0xf000 /* data cache way mode */
182185
186+ #ifdef CONFIG_AM34_2
187+ #define ICIVCR __SYSREG(0xc0000c00, u32) /* icache area invalidate control */
188+ #define ICIVCR_ICIVBSY 0x00000008 /* icache area invalidate busy */
189+ #define ICIVCR_ICI 0x00000001 /* icache area invalidate */
190+
191+ #define ICIVMR __SYSREG(0xc0000c04, u32) /* icache area invalidate mask */
192+
193+ #define DCPGCR __SYSREG(0xc0000c10, u32) /* data cache area purge control */
194+ #define DCPGCR_DCPGBSY 0x00000008 /* data cache area purge busy */
195+ #define DCPGCR_DCP 0x00000002 /* data cache area purge */
196+ #define DCPGCR_DCI 0x00000001 /* data cache area invalidate */
197+
198+ #define DCPGMR __SYSREG(0xc0000c14, u32) /* data cache area purge mask */
199+ #endif /* CONFIG_AM34_2 */
200+
183201/* MMU control registers */
184202#define MMUCTR __SYSREG(0xc0000090, u32) /* MMU control register */
185203#define MMUCTR_IRP 0x0000003f /* instruction TLB replace pointer */
@@ -203,6 +221,9 @@ asm(" .am33_2\n");
203221#define MMUCTR_DTL_LOCK0_3 0x03000000 /* - entry 0-3 locked */
204222#define MMUCTR_DTL_LOCK0_7 0x04000000 /* - entry 0-7 locked */
205223#define MMUCTR_DTL_LOCK0_15 0x05000000 /* - entry 0-15 locked */
224+ #ifdef CONFIG_AM34_2
225+ #define MMUCTR_WTE 0x80000000 /* write-through cache TLB entry bit enable */
226+ #endif
206227
207228#define PIDR __SYSREG(0xc0000094, u16) /* PID register */
208229#define PIDR_PID 0x00ff /* process identifier */
@@ -285,6 +306,47 @@ asm(" .am33_2\n");
285306#define MMUFCR_xFC_PR_RWK_RWU 0x01c0 /* - R/W kernel and R/W user */
286307#define MMUFCR_xFC_ILLADDR 0x0200 /* illegal address excep flag */
287308
309+ #ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT
310+ /* atomic operation registers */
311+ #define AAR __SYSREG(0xc0000a00, u32) /* cacheable address */
312+ #define AAR2 __SYSREG(0xc0000a04, u32) /* uncacheable address */
313+ #define ADR __SYSREG(0xc0000a08, u32) /* data */
314+ #define ASR __SYSREG(0xc0000a0c, u32) /* status */
315+ #define AARU __SYSREG(0xd400aa00, u32) /* user address */
316+ #define ADRU __SYSREG(0xd400aa08, u32) /* user data */
317+ #define ASRU __SYSREG(0xd400aa0c, u32) /* user status */
318+
319+ #define ASR_RW 0x00000008 /* read */
320+ #define ASR_BW 0x00000004 /* bus error */
321+ #define ASR_IW 0x00000002 /* interrupt */
322+ #define ASR_LW 0x00000001 /* bus lock */
323+
324+ #define ASRU_RW ASR_RW /* read */
325+ #define ASRU_BW ASR_BW /* bus error */
326+ #define ASRU_IW ASR_IW /* interrupt */
327+ #define ASRU_LW ASR_LW /* bus lock */
328+
329+ /* in inline ASM, we stick the base pointer in to a reg and use offsets from
330+ * it */
331+ #define ATOMIC_OPS_BASE_ADDR 0xc0000a00
332+ #ifndef __ASSEMBLY__
333+ asm(
334+ "_AAR = 0\n"
335+ "_AAR2 = 4\n"
336+ "_ADR = 8\n"
337+ "_ASR = 12\n" );
338+ #else
339+ #define _AAR 0
340+ #define _AAR2 4
341+ #define _ADR 8
342+ #define _ASR 12
343+ #endif
344+
345+ /* physical page address for userspace atomic operations registers */
346+ #define USER_ATOMIC_OPS_PAGE_ADDR 0xd400a000
347+
348+ #endif /* CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT */
349+
288350#endif /* __KERNEL__ */
289351
290352#endif /* _ASM_CPU_REGS_H */
0 commit comments