aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/kernel/process.c30
-rw-r--r--include/asm-sh/cpu-sh4/ubc.h37
2 files changed, 67 insertions, 0 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 0b1d5dd7a93b..91516dca4a85 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -5,6 +5,7 @@
5 * Copyright (C) 1995 Linus Torvalds 5 * Copyright (C) 1995 Linus Torvalds
6 * 6 *
7 * SuperH version: Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima 7 * SuperH version: Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
8 * Copyright (C) 2006 Lineo Solutions Inc. support SH4A UBC
8 */ 9 */
9 10
10/* 11/*
@@ -290,6 +291,24 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
290static void 291static void
291ubc_set_tracing(int asid, unsigned long pc) 292ubc_set_tracing(int asid, unsigned long pc)
292{ 293{
294#if defined(CONFIG_CPU_SH4A)
295 unsigned long val;
296
297 val = (UBC_CBR_ID_INST | UBC_CBR_RW_READ | UBC_CBR_CE);
298 val |= (UBC_CBR_AIE | UBC_CBR_AIV_SET(asid));
299
300 ctrl_outl(val, UBC_CBR0);
301 ctrl_outl(pc, UBC_CAR0);
302 ctrl_outl(0x0, UBC_CAMR0);
303 ctrl_outl(0x0, UBC_CBCR);
304
305 val = (UBC_CRR_RES | UBC_CRR_PCB | UBC_CRR_BIE);
306 ctrl_outl(val, UBC_CRR0);
307
308 /* Read UBC register that we writed last. For chekking UBC Register changed */
309 val = ctrl_inl(UBC_CRR0);
310
311#else /* CONFIG_CPU_SH4A */
293 ctrl_outl(pc, UBC_BARA); 312 ctrl_outl(pc, UBC_BARA);
294 313
295#ifdef CONFIG_MMU 314#ifdef CONFIG_MMU
@@ -307,6 +326,7 @@ ubc_set_tracing(int asid, unsigned long pc)
307 ctrl_outw(BBR_INST | BBR_READ, UBC_BBRA); 326 ctrl_outw(BBR_INST | BBR_READ, UBC_BBRA);
308 ctrl_outw(BRCR_PCBA, UBC_BRCR); 327 ctrl_outw(BRCR_PCBA, UBC_BRCR);
309 } 328 }
329#endif /* CONFIG_CPU_SH4A */
310} 330}
311 331
312/* 332/*
@@ -359,8 +379,13 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
359#endif 379#endif
360 ubc_set_tracing(asid, next->thread.ubc_pc); 380 ubc_set_tracing(asid, next->thread.ubc_pc);
361 } else { 381 } else {
382#if defined(CONFIG_CPU_SH4A)
383 ctrl_outl(UBC_CBR_INIT, UBC_CBR0);
384 ctrl_outl(UBC_CRR_INIT, UBC_CRR0);
385#else
362 ctrl_outw(0, UBC_BBRA); 386 ctrl_outw(0, UBC_BBRA);
363 ctrl_outw(0, UBC_BBRB); 387 ctrl_outw(0, UBC_BBRB);
388#endif
364 } 389 }
365 390
366 return prev; 391 return prev;
@@ -460,8 +485,13 @@ asmlinkage void break_point_trap(unsigned long r4, unsigned long r5,
460 struct pt_regs regs) 485 struct pt_regs regs)
461{ 486{
462 /* Clear tracing. */ 487 /* Clear tracing. */
488#if defined(CONFIG_CPU_SH4A)
489 ctrl_outl(UBC_CBR_INIT, UBC_CBR0);
490 ctrl_outl(UBC_CRR_INIT, UBC_CRR0);
491#else
463 ctrl_outw(0, UBC_BBRA); 492 ctrl_outw(0, UBC_BBRA);
464 ctrl_outw(0, UBC_BBRB); 493 ctrl_outw(0, UBC_BBRB);
494#endif
465 current->thread.ubc_pc = 0; 495 current->thread.ubc_pc = 0;
466 ubc_usercnt -= 1; 496 ubc_usercnt -= 1;
467 497
diff --git a/include/asm-sh/cpu-sh4/ubc.h b/include/asm-sh/cpu-sh4/ubc.h
index 3d0943167659..c86e17050935 100644
--- a/include/asm-sh/cpu-sh4/ubc.h
+++ b/include/asm-sh/cpu-sh4/ubc.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 1999 Niibe Yutaka 4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 Paul Mundt 5 * Copyright (C) 2003 Paul Mundt
6 * Copyright (C) 2006 Lineo Solutions Inc. support SH4A UBC
6 * 7 *
7 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -11,6 +12,41 @@
11#ifndef __ASM_CPU_SH4_UBC_H 12#ifndef __ASM_CPU_SH4_UBC_H
12#define __ASM_CPU_SH4_UBC_H 13#define __ASM_CPU_SH4_UBC_H
13 14
15#if defined(CONFIG_CPU_SH4A)
16#define UBC_CBR0 0xff200000
17#define UBC_CRR0 0xff200004
18#define UBC_CAR0 0xff200008
19#define UBC_CAMR0 0xff20000c
20#define UBC_CBR1 0xff200020
21#define UBC_CRR1 0xff200024
22#define UBC_CAR1 0xff200028
23#define UBC_CAMR1 0xff20002c
24#define UBC_CDR1 0xff200030
25#define UBC_CDMR1 0xff200034
26#define UBC_CETR1 0xff200038
27#define UBC_CCMFR 0xff200600
28#define UBC_CBCR 0xff200620
29
30/* CBR */
31#define UBC_CBR_AIE (0x01<<30)
32#define UBC_CBR_ID_INST (0x01<<4)
33#define UBC_CBR_RW_READ (0x01<<1)
34#define UBC_CBR_CE (0x01)
35
36#define UBC_CBR_AIV_MASK (0x00FF0000)
37#define UBC_CBR_AIV_SHIFT (16)
38#define UBC_CBR_AIV_SET(asid) (((asid)<<UBC_CBR_AIV_SHIFT) & UBC_CBR_AIV_MASK)
39
40#define UBC_CBR_INIT 0x20000000
41
42/* CRR */
43#define UBC_CRR_RES (0x01<<13)
44#define UBC_CRR_PCB (0x01<<1)
45#define UBC_CRR_BIE (0x01)
46
47#define UBC_CRR_INIT 0x00002000
48
49#else /* CONFIG_CPU_SH4 */
14#define UBC_BARA 0xff200000 50#define UBC_BARA 0xff200000
15#define UBC_BAMRA 0xff200004 51#define UBC_BAMRA 0xff200004
16#define UBC_BBRA 0xff200008 52#define UBC_BBRA 0xff200008
@@ -22,6 +58,7 @@
22#define UBC_BDRB 0xff200018 58#define UBC_BDRB 0xff200018
23#define UBC_BDMRB 0xff20001c 59#define UBC_BDMRB 0xff20001c
24#define UBC_BRCR 0xff200020 60#define UBC_BRCR 0xff200020
61#endif /* CONFIG_CPU_SH4 */
25 62
26#endif /* __ASM_CPU_SH4_UBC_H */ 63#endif /* __ASM_CPU_SH4_UBC_H */
27 64