aboutsummaryrefslogtreecommitdiffstats
path: root/arch/c6x
diff options
context:
space:
mode:
Diffstat (limited to 'arch/c6x')
-rw-r--r--arch/c6x/include/asm/Kbuild1
-rw-r--r--arch/c6x/include/asm/barrier.h27
-rw-r--r--arch/c6x/include/asm/bitops.h1
-rw-r--r--arch/c6x/include/asm/bug.h23
-rw-r--r--arch/c6x/include/asm/cmpxchg.h68
-rw-r--r--arch/c6x/include/asm/exec.h6
-rw-r--r--arch/c6x/include/asm/processor.h9
-rw-r--r--arch/c6x/include/asm/setup.h1
-rw-r--r--arch/c6x/include/asm/special_insns.h63
-rw-r--r--arch/c6x/include/asm/switch_to.h33
-rw-r--r--arch/c6x/include/asm/system.h168
-rw-r--r--arch/c6x/kernel/irq.c1
-rw-r--r--arch/c6x/kernel/setup.c1
-rw-r--r--arch/c6x/kernel/soc.c1
-rw-r--r--arch/c6x/kernel/time.c1
-rw-r--r--arch/c6x/kernel/traps.c1
-rw-r--r--arch/c6x/platforms/timer64.c1
17 files changed, 235 insertions, 171 deletions
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index 13dcf78adf91..3af601e31e66 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -3,7 +3,6 @@ include include/asm-generic/Kbuild.asm
3generic-y += atomic.h 3generic-y += atomic.h
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bug.h
7generic-y += bugs.h 6generic-y += bugs.h
8generic-y += cputime.h 7generic-y += cputime.h
9generic-y += current.h 8generic-y += current.h
diff --git a/arch/c6x/include/asm/barrier.h b/arch/c6x/include/asm/barrier.h
new file mode 100644
index 000000000000..538240e85909
--- /dev/null
+++ b/arch/c6x/include/asm/barrier.h
@@ -0,0 +1,27 @@
1/*
2 * Port on Texas Instruments TMS320C6x architecture
3 *
4 * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _ASM_C6X_BARRIER_H
12#define _ASM_C6X_BARRIER_H
13
14#define nop() asm("NOP\n");
15
16#define mb() barrier()
17#define rmb() barrier()
18#define wmb() barrier()
19#define set_mb(var, value) do { var = value; mb(); } while (0)
20#define set_wmb(var, value) do { var = value; wmb(); } while (0)
21
22#define smp_mb() barrier()
23#define smp_rmb() barrier()
24#define smp_wmb() barrier()
25#define smp_read_barrier_depends() do { } while (0)
26
27#endif /* _ASM_C6X_BARRIER_H */
diff --git a/arch/c6x/include/asm/bitops.h b/arch/c6x/include/asm/bitops.h
index 39ab7e874d96..0bec7e5036a8 100644
--- a/arch/c6x/include/asm/bitops.h
+++ b/arch/c6x/include/asm/bitops.h
@@ -15,7 +15,6 @@
15 15
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17 17
18#include <asm/system.h>
19#include <asm/byteorder.h> 18#include <asm/byteorder.h>
20 19
21/* 20/*
diff --git a/arch/c6x/include/asm/bug.h b/arch/c6x/include/asm/bug.h
new file mode 100644
index 000000000000..8d59933dd6fe
--- /dev/null
+++ b/arch/c6x/include/asm/bug.h
@@ -0,0 +1,23 @@
1/*
2 * Port on Texas Instruments TMS320C6x architecture
3 *
4 * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _ASM_C6X_BUG_H
12#define _ASM_C6X_BUG_H
13
14#include <linux/linkage.h>
15#include <asm-generic/bug.h>
16
17struct pt_regs;
18
19extern void die(char *str, struct pt_regs *fp, int nr);
20extern asmlinkage int process_exception(struct pt_regs *regs);
21extern asmlinkage void enable_exception(void);
22
23#endif /* _ASM_C6X_BUG_H */
diff --git a/arch/c6x/include/asm/cmpxchg.h b/arch/c6x/include/asm/cmpxchg.h
new file mode 100644
index 000000000000..b27c8cefb8c3
--- /dev/null
+++ b/arch/c6x/include/asm/cmpxchg.h
@@ -0,0 +1,68 @@
1/*
2 * Port on Texas Instruments TMS320C6x architecture
3 *
4 * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _ASM_C6X_CMPXCHG_H
12#define _ASM_C6X_CMPXCHG_H
13
14#include <linux/irqflags.h>
15
16/*
17 * Misc. functions
18 */
19static inline unsigned int __xchg(unsigned int x, volatile void *ptr, int size)
20{
21 unsigned int tmp;
22 unsigned long flags;
23
24 local_irq_save(flags);
25
26 switch (size) {
27 case 1:
28 tmp = 0;
29 tmp = *((unsigned char *) ptr);
30 *((unsigned char *) ptr) = (unsigned char) x;
31 break;
32 case 2:
33 tmp = 0;
34 tmp = *((unsigned short *) ptr);
35 *((unsigned short *) ptr) = x;
36 break;
37 case 4:
38 tmp = 0;
39 tmp = *((unsigned int *) ptr);
40 *((unsigned int *) ptr) = x;
41 break;
42 }
43 local_irq_restore(flags);
44 return tmp;
45}
46
47#define xchg(ptr, x) \
48 ((__typeof__(*(ptr)))__xchg((unsigned int)(x), (void *) (ptr), \
49 sizeof(*(ptr))))
50#define tas(ptr) xchg((ptr), 1)
51
52
53#include <asm-generic/cmpxchg-local.h>
54
55/*
56 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
57 * them available.
58 */
59#define cmpxchg_local(ptr, o, n) \
60 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), \
61 (unsigned long)(o), \
62 (unsigned long)(n), \
63 sizeof(*(ptr))))
64#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
65
66#include <asm-generic/cmpxchg.h>
67
68#endif /* _ASM_C6X_CMPXCHG_H */
diff --git a/arch/c6x/include/asm/exec.h b/arch/c6x/include/asm/exec.h
new file mode 100644
index 000000000000..0fea482cdc84
--- /dev/null
+++ b/arch/c6x/include/asm/exec.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_C6X_EXEC_H
2#define _ASM_C6X_EXEC_H
3
4#define arch_align_stack(x) (x)
5
6#endif /* _ASM_C6X_EXEC_H */
diff --git a/arch/c6x/include/asm/processor.h b/arch/c6x/include/asm/processor.h
index 77ecbded1f37..3ff7fab956ba 100644
--- a/arch/c6x/include/asm/processor.h
+++ b/arch/c6x/include/asm/processor.h
@@ -129,4 +129,13 @@ extern unsigned long get_wchan(struct task_struct *p);
129 129
130extern const struct seq_operations cpuinfo_op; 130extern const struct seq_operations cpuinfo_op;
131 131
132/* Reset the board */
133#define HARD_RESET_NOW()
134
135extern unsigned int c6x_core_freq;
136
137
138extern void (*c6x_restart)(void);
139extern void (*c6x_halt)(void);
140
132#endif /* ASM_C6X_PROCESSOR_H */ 141#endif /* ASM_C6X_PROCESSOR_H */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index 1808f279f82e..a01e31896fa9 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -27,6 +27,7 @@ extern unsigned int c6x_devstat;
27extern unsigned char c6x_fuse_mac[6]; 27extern unsigned char c6x_fuse_mac[6];
28 28
29extern void machine_init(unsigned long dt_ptr); 29extern void machine_init(unsigned long dt_ptr);
30extern void time_init(void);
30 31
31#endif /* !__ASSEMBLY__ */ 32#endif /* !__ASSEMBLY__ */
32#endif /* _ASM_C6X_SETUP_H */ 33#endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/include/asm/special_insns.h b/arch/c6x/include/asm/special_insns.h
new file mode 100644
index 000000000000..59672bca841d
--- /dev/null
+++ b/arch/c6x/include/asm/special_insns.h
@@ -0,0 +1,63 @@
1/*
2 * Port on Texas Instruments TMS320C6x architecture
3 *
4 * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _ASM_C6X_SPECIAL_INSNS_H
12#define _ASM_C6X_SPECIAL_INSNS_H
13
14
15#define get_creg(reg) \
16 ({ unsigned int __x; \
17 asm volatile ("mvc .s2 " #reg ",%0\n" : "=b"(__x)); __x; })
18
19#define set_creg(reg, v) \
20 do { unsigned int __x = (unsigned int)(v); \
21 asm volatile ("mvc .s2 %0," #reg "\n" : : "b"(__x)); \
22 } while (0)
23
24#define or_creg(reg, n) \
25 do { unsigned __x, __n = (unsigned)(n); \
26 asm volatile ("mvc .s2 " #reg ",%0\n" \
27 "or .l2 %1,%0,%0\n" \
28 "mvc .s2 %0," #reg "\n" \
29 "nop\n" \
30 : "=&b"(__x) : "b"(__n)); \
31 } while (0)
32
33#define and_creg(reg, n) \
34 do { unsigned __x, __n = (unsigned)(n); \
35 asm volatile ("mvc .s2 " #reg ",%0\n" \
36 "and .l2 %1,%0,%0\n" \
37 "mvc .s2 %0," #reg "\n" \
38 "nop\n" \
39 : "=&b"(__x) : "b"(__n)); \
40 } while (0)
41
42#define get_coreid() (get_creg(DNUM) & 0xff)
43
44/* Set/get IST */
45#define set_ist(x) set_creg(ISTP, x)
46#define get_ist() get_creg(ISTP)
47
48/*
49 * Exception management
50 */
51#define disable_exception()
52#define get_except_type() get_creg(EFR)
53#define ack_exception(type) set_creg(ECR, 1 << (type))
54#define get_iexcept() get_creg(IERR)
55#define set_iexcept(mask) set_creg(IERR, (mask))
56
57#define _extu(x, s, e) \
58 ({ unsigned int __x; \
59 asm volatile ("extu .S2 %3,%1,%2,%0\n" : \
60 "=b"(__x) : "n"(s), "n"(e), "b"(x)); \
61 __x; })
62
63#endif /* _ASM_C6X_SPECIAL_INSNS_H */
diff --git a/arch/c6x/include/asm/switch_to.h b/arch/c6x/include/asm/switch_to.h
new file mode 100644
index 000000000000..af6c71fe75ec
--- /dev/null
+++ b/arch/c6x/include/asm/switch_to.h
@@ -0,0 +1,33 @@
1/*
2 * Port on Texas Instruments TMS320C6x architecture
3 *
4 * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _ASM_C6X_SWITCH_TO_H
12#define _ASM_C6X_SWITCH_TO_H
13
14#include <linux/linkage.h>
15
16#define prepare_to_switch() do { } while (0)
17
18struct task_struct;
19struct thread_struct;
20asmlinkage void *__switch_to(struct thread_struct *prev,
21 struct thread_struct *next,
22 struct task_struct *tsk);
23
24#define switch_to(prev, next, last) \
25 do { \
26 current->thread.wchan = (u_long) __builtin_return_address(0); \
27 (last) = __switch_to(&(prev)->thread, \
28 &(next)->thread, (prev)); \
29 mb(); \
30 current->thread.wchan = 0; \
31 } while (0)
32
33#endif /* _ASM_C6X_SWITCH_TO_H */
diff --git a/arch/c6x/include/asm/system.h b/arch/c6x/include/asm/system.h
deleted file mode 100644
index e076dc0eacc8..000000000000
--- a/arch/c6x/include/asm/system.h
+++ /dev/null
@@ -1,168 +0,0 @@
1/*
2 * Port on Texas Instruments TMS320C6x architecture
3 *
4 * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _ASM_C6X_SYSTEM_H
12#define _ASM_C6X_SYSTEM_H
13
14#include <linux/linkage.h>
15#include <linux/irqflags.h>
16
17#define prepare_to_switch() do { } while (0)
18
19struct task_struct;
20struct thread_struct;
21asmlinkage void *__switch_to(struct thread_struct *prev,
22 struct thread_struct *next,
23 struct task_struct *tsk);
24
25#define switch_to(prev, next, last) \
26 do { \
27 current->thread.wchan = (u_long) __builtin_return_address(0); \
28 (last) = __switch_to(&(prev)->thread, \
29 &(next)->thread, (prev)); \
30 mb(); \
31 current->thread.wchan = 0; \
32 } while (0)
33
34/* Reset the board */
35#define HARD_RESET_NOW()
36
37#define get_creg(reg) \
38 ({ unsigned int __x; \
39 asm volatile ("mvc .s2 " #reg ",%0\n" : "=b"(__x)); __x; })
40
41#define set_creg(reg, v) \
42 do { unsigned int __x = (unsigned int)(v); \
43 asm volatile ("mvc .s2 %0," #reg "\n" : : "b"(__x)); \
44 } while (0)
45
46#define or_creg(reg, n) \
47 do { unsigned __x, __n = (unsigned)(n); \
48 asm volatile ("mvc .s2 " #reg ",%0\n" \
49 "or .l2 %1,%0,%0\n" \
50 "mvc .s2 %0," #reg "\n" \
51 "nop\n" \
52 : "=&b"(__x) : "b"(__n)); \
53 } while (0)
54
55#define and_creg(reg, n) \
56 do { unsigned __x, __n = (unsigned)(n); \
57 asm volatile ("mvc .s2 " #reg ",%0\n" \
58 "and .l2 %1,%0,%0\n" \
59 "mvc .s2 %0," #reg "\n" \
60 "nop\n" \
61 : "=&b"(__x) : "b"(__n)); \
62 } while (0)
63
64#define get_coreid() (get_creg(DNUM) & 0xff)
65
66/* Set/get IST */
67#define set_ist(x) set_creg(ISTP, x)
68#define get_ist() get_creg(ISTP)
69
70/*
71 * Exception management
72 */
73asmlinkage void enable_exception(void);
74#define disable_exception()
75#define get_except_type() get_creg(EFR)
76#define ack_exception(type) set_creg(ECR, 1 << (type))
77#define get_iexcept() get_creg(IERR)
78#define set_iexcept(mask) set_creg(IERR, (mask))
79
80/*
81 * Misc. functions
82 */
83#define nop() asm("NOP\n");
84#define mb() barrier()
85#define rmb() barrier()
86#define wmb() barrier()
87#define set_mb(var, value) do { var = value; mb(); } while (0)
88#define set_wmb(var, value) do { var = value; wmb(); } while (0)
89
90#define smp_mb() barrier()
91#define smp_rmb() barrier()
92#define smp_wmb() barrier()
93#define smp_read_barrier_depends() do { } while (0)
94
95#define xchg(ptr, x) \
96 ((__typeof__(*(ptr)))__xchg((unsigned int)(x), (void *) (ptr), \
97 sizeof(*(ptr))))
98#define tas(ptr) xchg((ptr), 1)
99
100unsigned int _lmbd(unsigned int, unsigned int);
101unsigned int _bitr(unsigned int);
102
103struct __xchg_dummy { unsigned int a[100]; };
104#define __xg(x) ((volatile struct __xchg_dummy *)(x))
105
106static inline unsigned int __xchg(unsigned int x, volatile void *ptr, int size)
107{
108 unsigned int tmp;
109 unsigned long flags;
110
111 local_irq_save(flags);
112
113 switch (size) {
114 case 1:
115 tmp = 0;
116 tmp = *((unsigned char *) ptr);
117 *((unsigned char *) ptr) = (unsigned char) x;
118 break;
119 case 2:
120 tmp = 0;
121 tmp = *((unsigned short *) ptr);
122 *((unsigned short *) ptr) = x;
123 break;
124 case 4:
125 tmp = 0;
126 tmp = *((unsigned int *) ptr);
127 *((unsigned int *) ptr) = x;
128 break;
129 }
130 local_irq_restore(flags);
131 return tmp;
132}
133
134#include <asm-generic/cmpxchg-local.h>
135
136/*
137 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
138 * them available.
139 */
140#define cmpxchg_local(ptr, o, n) \
141 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), \
142 (unsigned long)(o), \
143 (unsigned long)(n), \
144 sizeof(*(ptr))))
145#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
146
147#include <asm-generic/cmpxchg.h>
148
149#define _extu(x, s, e) \
150 ({ unsigned int __x; \
151 asm volatile ("extu .S2 %3,%1,%2,%0\n" : \
152 "=b"(__x) : "n"(s), "n"(e), "b"(x)); \
153 __x; })
154
155
156extern unsigned int c6x_core_freq;
157
158struct pt_regs;
159
160extern void die(char *str, struct pt_regs *fp, int nr);
161extern asmlinkage int process_exception(struct pt_regs *regs);
162extern void time_init(void);
163extern void free_initmem(void);
164
165extern void (*c6x_restart)(void);
166extern void (*c6x_halt)(void);
167
168#endif /* _ASM_C6X_SYSTEM_H */
diff --git a/arch/c6x/kernel/irq.c b/arch/c6x/kernel/irq.c
index d77bcfdf0d8e..65b8ddf54b44 100644
--- a/arch/c6x/kernel/irq.c
+++ b/arch/c6x/kernel/irq.c
@@ -27,6 +27,7 @@
27#include <linux/kernel_stat.h> 27#include <linux/kernel_stat.h>
28 28
29#include <asm/megamod-pic.h> 29#include <asm/megamod-pic.h>
30#include <asm/special_insns.h>
30 31
31unsigned long irq_err_count; 32unsigned long irq_err_count;
32 33
diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c
index 0c07921747f4..ce46186600c5 100644
--- a/arch/c6x/kernel/setup.c
+++ b/arch/c6x/kernel/setup.c
@@ -34,6 +34,7 @@
34#include <asm/dscr.h> 34#include <asm/dscr.h>
35#include <asm/clock.h> 35#include <asm/clock.h>
36#include <asm/soc.h> 36#include <asm/soc.h>
37#include <asm/special_insns.h>
37 38
38static const char *c6x_soc_name; 39static const char *c6x_soc_name;
39 40
diff --git a/arch/c6x/kernel/soc.c b/arch/c6x/kernel/soc.c
index dd45bc39af0e..0748c94ebef6 100644
--- a/arch/c6x/kernel/soc.c
+++ b/arch/c6x/kernel/soc.c
@@ -11,7 +11,6 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/ctype.h> 12#include <linux/ctype.h>
13#include <linux/etherdevice.h> 13#include <linux/etherdevice.h>
14#include <asm/system.h>
15#include <asm/setup.h> 14#include <asm/setup.h>
16#include <asm/soc.h> 15#include <asm/soc.h>
17 16
diff --git a/arch/c6x/kernel/time.c b/arch/c6x/kernel/time.c
index 4c9f136165f7..356ee84cad95 100644
--- a/arch/c6x/kernel/time.c
+++ b/arch/c6x/kernel/time.c
@@ -20,6 +20,7 @@
20#include <linux/timex.h> 20#include <linux/timex.h>
21#include <linux/profile.h> 21#include <linux/profile.h>
22 22
23#include <asm/special_insns.h>
23#include <asm/timer64.h> 24#include <asm/timer64.h>
24 25
25static u32 sched_clock_multiplier; 26static u32 sched_clock_multiplier;
diff --git a/arch/c6x/kernel/traps.c b/arch/c6x/kernel/traps.c
index f50e3edd6dad..1be74e5b4788 100644
--- a/arch/c6x/kernel/traps.c
+++ b/arch/c6x/kernel/traps.c
@@ -14,6 +14,7 @@
14#include <linux/bug.h> 14#include <linux/bug.h>
15 15
16#include <asm/soc.h> 16#include <asm/soc.h>
17#include <asm/special_insns.h>
17#include <asm/traps.h> 18#include <asm/traps.h>
18 19
19int (*c6x_nmi_handler)(struct pt_regs *regs); 20int (*c6x_nmi_handler)(struct pt_regs *regs);
diff --git a/arch/c6x/platforms/timer64.c b/arch/c6x/platforms/timer64.c
index 03c03c249191..3c73d74a4674 100644
--- a/arch/c6x/platforms/timer64.c
+++ b/arch/c6x/platforms/timer64.c
@@ -15,6 +15,7 @@
15#include <linux/of_address.h> 15#include <linux/of_address.h>
16#include <asm/soc.h> 16#include <asm/soc.h>
17#include <asm/dscr.h> 17#include <asm/dscr.h>
18#include <asm/special_insns.h>
18#include <asm/timer64.h> 19#include <asm/timer64.h>
19 20
20struct timer_regs { 21struct timer_regs {