aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r--arch/blackfin/include/asm/asm-offsets.h1
-rw-r--r--arch/blackfin/include/asm/bfin-global.h10
-rw-r--r--arch/blackfin/include/asm/bfin-lq035q1.h40
-rw-r--r--arch/blackfin/include/asm/bfin_can.h725
-rw-r--r--arch/blackfin/include/asm/bfin_sport.h227
-rw-r--r--arch/blackfin/include/asm/bfin_watchdog.h30
-rw-r--r--arch/blackfin/include/asm/bitops.h74
-rw-r--r--arch/blackfin/include/asm/bug.h2
-rw-r--r--arch/blackfin/include/asm/cacheflush.h3
-rw-r--r--arch/blackfin/include/asm/checksum.h70
-rw-r--r--arch/blackfin/include/asm/clocks.h2
-rw-r--r--arch/blackfin/include/asm/context.S22
-rw-r--r--arch/blackfin/include/asm/cpu.h2
-rw-r--r--arch/blackfin/include/asm/def_LPBlackfin.h58
-rw-r--r--arch/blackfin/include/asm/delay.h16
-rw-r--r--arch/blackfin/include/asm/dma-mapping.h160
-rw-r--r--arch/blackfin/include/asm/dma.h97
-rw-r--r--arch/blackfin/include/asm/dpmc.h107
-rw-r--r--arch/blackfin/include/asm/elf.h9
-rw-r--r--arch/blackfin/include/asm/fcntl.h2
-rw-r--r--arch/blackfin/include/asm/ftrace.h53
-rw-r--r--arch/blackfin/include/asm/gpio.h22
-rw-r--r--arch/blackfin/include/asm/gptimers.h32
-rw-r--r--arch/blackfin/include/asm/io.h95
-rw-r--r--arch/blackfin/include/asm/ipipe.h14
-rw-r--r--arch/blackfin/include/asm/ipipe_base.h26
-rw-r--r--arch/blackfin/include/asm/irq.h7
-rw-r--r--arch/blackfin/include/asm/irqflags.h13
-rw-r--r--arch/blackfin/include/asm/kgdb.h3
-rw-r--r--arch/blackfin/include/asm/mem_init.h153
-rw-r--r--arch/blackfin/include/asm/mmu_context.h49
-rw-r--r--arch/blackfin/include/asm/module.h2
-rw-r--r--arch/blackfin/include/asm/nand.h4
-rw-r--r--arch/blackfin/include/asm/nmi.h12
-rw-r--r--arch/blackfin/include/asm/page.h8
-rw-r--r--arch/blackfin/include/asm/pci.h130
-rw-r--r--arch/blackfin/include/asm/ptrace.h31
-rw-r--r--arch/blackfin/include/asm/sections.h19
-rw-r--r--arch/blackfin/include/asm/smp.h15
-rw-r--r--arch/blackfin/include/asm/spinlock.h62
-rw-r--r--arch/blackfin/include/asm/spinlock_types.h8
-rw-r--r--arch/blackfin/include/asm/syscall.h96
-rw-r--r--arch/blackfin/include/asm/thread_info.h23
-rw-r--r--arch/blackfin/include/asm/time.h13
-rw-r--r--arch/blackfin/include/asm/trace.h2
-rw-r--r--arch/blackfin/include/asm/uaccess.h4
-rw-r--r--arch/blackfin/include/asm/unistd.h3
47 files changed, 1764 insertions, 792 deletions
diff --git a/arch/blackfin/include/asm/asm-offsets.h b/arch/blackfin/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/blackfin/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h
index 10064f902d20..e6485c305ea6 100644
--- a/arch/blackfin/include/asm/bfin-global.h
+++ b/arch/blackfin/include/asm/bfin-global.h
@@ -11,9 +11,6 @@
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13 13
14#include <asm/sections.h>
15#include <asm/ptrace.h>
16#include <asm/user.h>
17#include <linux/linkage.h> 14#include <linux/linkage.h>
18#include <linux/types.h> 15#include <linux/types.h>
19 16
@@ -23,6 +20,12 @@
23# define DMA_UNCACHED_REGION (2 * 1024 * 1024) 20# define DMA_UNCACHED_REGION (2 * 1024 * 1024)
24#elif defined(CONFIG_DMA_UNCACHED_1M) 21#elif defined(CONFIG_DMA_UNCACHED_1M)
25# define DMA_UNCACHED_REGION (1024 * 1024) 22# define DMA_UNCACHED_REGION (1024 * 1024)
23#elif defined(CONFIG_DMA_UNCACHED_512K)
24# define DMA_UNCACHED_REGION (512 * 1024)
25#elif defined(CONFIG_DMA_UNCACHED_256K)
26# define DMA_UNCACHED_REGION (256 * 1024)
27#elif defined(CONFIG_DMA_UNCACHED_128K)
28# define DMA_UNCACHED_REGION (128 * 1024)
26#else 29#else
27# define DMA_UNCACHED_REGION (0) 30# define DMA_UNCACHED_REGION (0)
28#endif 31#endif
@@ -35,6 +38,7 @@ extern unsigned long get_sclk(void);
35extern unsigned long sclk_to_usecs(unsigned long sclk); 38extern unsigned long sclk_to_usecs(unsigned long sclk);
36extern unsigned long usecs_to_sclk(unsigned long usecs); 39extern unsigned long usecs_to_sclk(unsigned long usecs);
37 40
41struct pt_regs;
38extern void dump_bfin_process(struct pt_regs *regs); 42extern void dump_bfin_process(struct pt_regs *regs);
39extern void dump_bfin_mem(struct pt_regs *regs); 43extern void dump_bfin_mem(struct pt_regs *regs);
40extern void dump_bfin_trace_buffer(void); 44extern void dump_bfin_trace_buffer(void);
diff --git a/arch/blackfin/include/asm/bfin-lq035q1.h b/arch/blackfin/include/asm/bfin-lq035q1.h
new file mode 100644
index 000000000000..836895156b5b
--- /dev/null
+++ b/arch/blackfin/include/asm/bfin-lq035q1.h
@@ -0,0 +1,40 @@
1/*
2 * Blackfin LCD Framebuffer driver SHARP LQ035Q1DH02
3 *
4 * Copyright 2008-2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef BFIN_LQ035Q1_H
9#define BFIN_LQ035Q1_H
10
11/*
12 * LCD Modes
13 */
14#define LQ035_RL (0 << 8) /* Right -> Left Scan */
15#define LQ035_LR (1 << 8) /* Left -> Right Scan */
16#define LQ035_TB (1 << 9) /* Top -> Botton Scan */
17#define LQ035_BT (0 << 9) /* Botton -> Top Scan */
18#define LQ035_BGR (1 << 11) /* Use BGR format */
19#define LQ035_RGB (0 << 11) /* Use RGB format */
20#define LQ035_NORM (1 << 13) /* Reversal */
21#define LQ035_REV (0 << 13) /* Reversal */
22
23/*
24 * PPI Modes
25 */
26
27#define USE_RGB565_16_BIT_PPI 1
28#define USE_RGB565_8_BIT_PPI 2
29#define USE_RGB888_8_BIT_PPI 3
30
31struct bfin_lq035q1fb_disp_info {
32
33 unsigned mode;
34 unsigned ppi_mode;
35 /* GPIOs */
36 int use_bl;
37 unsigned gpio_bl;
38};
39
40#endif /* BFIN_LQ035Q1_H */
diff --git a/arch/blackfin/include/asm/bfin_can.h b/arch/blackfin/include/asm/bfin_can.h
new file mode 100644
index 000000000000..eec0076a385b
--- /dev/null
+++ b/arch/blackfin/include/asm/bfin_can.h
@@ -0,0 +1,725 @@
1/*
2 * bfin_can.h - interface to Blackfin CANs
3 *
4 * Copyright 2004-2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __ASM_BFIN_CAN_H__
10#define __ASM_BFIN_CAN_H__
11
12/*
13 * transmit and receive channels
14 */
15#define TRANSMIT_CHL 24
16#define RECEIVE_STD_CHL 0
17#define RECEIVE_EXT_CHL 4
18#define RECEIVE_RTR_CHL 8
19#define RECEIVE_EXT_RTR_CHL 12
20#define MAX_CHL_NUMBER 32
21
22/*
23 * All Blackfin system MMRs are padded to 32bits even if the register
24 * itself is only 16bits. So use a helper macro to streamline this.
25 */
26#define __BFP(m) u16 m; u16 __pad_##m
27
28/*
29 * bfin can registers layout
30 */
31struct bfin_can_mask_regs {
32 __BFP(aml);
33 __BFP(amh);
34};
35
36struct bfin_can_channel_regs {
37 u16 data[8];
38 __BFP(dlc);
39 __BFP(tsv);
40 __BFP(id0);
41 __BFP(id1);
42};
43
44struct bfin_can_regs {
45 /*
46 * global control and status registers
47 */
48 __BFP(mc1); /* offset 0x00 */
49 __BFP(md1); /* offset 0x04 */
50 __BFP(trs1); /* offset 0x08 */
51 __BFP(trr1); /* offset 0x0c */
52 __BFP(ta1); /* offset 0x10 */
53 __BFP(aa1); /* offset 0x14 */
54 __BFP(rmp1); /* offset 0x18 */
55 __BFP(rml1); /* offset 0x1c */
56 __BFP(mbtif1); /* offset 0x20 */
57 __BFP(mbrif1); /* offset 0x24 */
58 __BFP(mbim1); /* offset 0x28 */
59 __BFP(rfh1); /* offset 0x2c */
60 __BFP(opss1); /* offset 0x30 */
61 u32 __pad1[3];
62 __BFP(mc2); /* offset 0x40 */
63 __BFP(md2); /* offset 0x44 */
64 __BFP(trs2); /* offset 0x48 */
65 __BFP(trr2); /* offset 0x4c */
66 __BFP(ta2); /* offset 0x50 */
67 __BFP(aa2); /* offset 0x54 */
68 __BFP(rmp2); /* offset 0x58 */
69 __BFP(rml2); /* offset 0x5c */
70 __BFP(mbtif2); /* offset 0x60 */
71 __BFP(mbrif2); /* offset 0x64 */
72 __BFP(mbim2); /* offset 0x68 */
73 __BFP(rfh2); /* offset 0x6c */
74 __BFP(opss2); /* offset 0x70 */
75 u32 __pad2[3];
76 __BFP(clock); /* offset 0x80 */
77 __BFP(timing); /* offset 0x84 */
78 __BFP(debug); /* offset 0x88 */
79 __BFP(status); /* offset 0x8c */
80 __BFP(cec); /* offset 0x90 */
81 __BFP(gis); /* offset 0x94 */
82 __BFP(gim); /* offset 0x98 */
83 __BFP(gif); /* offset 0x9c */
84 __BFP(control); /* offset 0xa0 */
85 __BFP(intr); /* offset 0xa4 */
86 u32 __pad3[1];
87 __BFP(mbtd); /* offset 0xac */
88 __BFP(ewr); /* offset 0xb0 */
89 __BFP(esr); /* offset 0xb4 */
90 u32 __pad4[2];
91 __BFP(ucreg); /* offset 0xc0 */
92 __BFP(uccnt); /* offset 0xc4 */
93 __BFP(ucrc); /* offset 0xc8 */
94 __BFP(uccnf); /* offset 0xcc */
95 u32 __pad5[12];
96
97 /*
98 * channel(mailbox) mask and message registers
99 */
100 struct bfin_can_mask_regs msk[MAX_CHL_NUMBER]; /* offset 0x100 */
101 struct bfin_can_channel_regs chl[MAX_CHL_NUMBER]; /* offset 0x200 */
102};
103
104#undef __BFP
105
106/* CAN_CONTROL Masks */
107#define SRS 0x0001 /* Software Reset */
108#define DNM 0x0002 /* Device Net Mode */
109#define ABO 0x0004 /* Auto-Bus On Enable */
110#define TXPRIO 0x0008 /* TX Priority (Priority/Mailbox*) */
111#define WBA 0x0010 /* Wake-Up On CAN Bus Activity Enable */
112#define SMR 0x0020 /* Sleep Mode Request */
113#define CSR 0x0040 /* CAN Suspend Mode Request */
114#define CCR 0x0080 /* CAN Configuration Mode Request */
115
116/* CAN_STATUS Masks */
117#define WT 0x0001 /* TX Warning Flag */
118#define WR 0x0002 /* RX Warning Flag */
119#define EP 0x0004 /* Error Passive Mode */
120#define EBO 0x0008 /* Error Bus Off Mode */
121#define SMA 0x0020 /* Sleep Mode Acknowledge */
122#define CSA 0x0040 /* Suspend Mode Acknowledge */
123#define CCA 0x0080 /* Configuration Mode Acknowledge */
124#define MBPTR 0x1F00 /* Mailbox Pointer */
125#define TRM 0x4000 /* Transmit Mode */
126#define REC 0x8000 /* Receive Mode */
127
128/* CAN_CLOCK Masks */
129#define BRP 0x03FF /* Bit-Rate Pre-Scaler */
130
131/* CAN_TIMING Masks */
132#define TSEG1 0x000F /* Time Segment 1 */
133#define TSEG2 0x0070 /* Time Segment 2 */
134#define SAM 0x0080 /* Sampling */
135#define SJW 0x0300 /* Synchronization Jump Width */
136
137/* CAN_DEBUG Masks */
138#define DEC 0x0001 /* Disable CAN Error Counters */
139#define DRI 0x0002 /* Disable CAN RX Input */
140#define DTO 0x0004 /* Disable CAN TX Output */
141#define DIL 0x0008 /* Disable CAN Internal Loop */
142#define MAA 0x0010 /* Mode Auto-Acknowledge Enable */
143#define MRB 0x0020 /* Mode Read Back Enable */
144#define CDE 0x8000 /* CAN Debug Enable */
145
146/* CAN_CEC Masks */
147#define RXECNT 0x00FF /* Receive Error Counter */
148#define TXECNT 0xFF00 /* Transmit Error Counter */
149
150/* CAN_INTR Masks */
151#define MBRIRQ 0x0001 /* Mailbox Receive Interrupt */
152#define MBTIRQ 0x0002 /* Mailbox Transmit Interrupt */
153#define GIRQ 0x0004 /* Global Interrupt */
154#define SMACK 0x0008 /* Sleep Mode Acknowledge */
155#define CANTX 0x0040 /* CAN TX Bus Value */
156#define CANRX 0x0080 /* CAN RX Bus Value */
157
158/* CAN_MBxx_ID1 and CAN_MBxx_ID0 Masks */
159#define DFC 0xFFFF /* Data Filtering Code (If Enabled) (ID0) */
160#define EXTID_LO 0xFFFF /* Lower 16 Bits of Extended Identifier (ID0) */
161#define EXTID_HI 0x0003 /* Upper 2 Bits of Extended Identifier (ID1) */
162#define BASEID 0x1FFC /* Base Identifier */
163#define IDE 0x2000 /* Identifier Extension */
164#define RTR 0x4000 /* Remote Frame Transmission Request */
165#define AME 0x8000 /* Acceptance Mask Enable */
166
167/* CAN_MBxx_TIMESTAMP Masks */
168#define TSV 0xFFFF /* Timestamp */
169
170/* CAN_MBxx_LENGTH Masks */
171#define DLC 0x000F /* Data Length Code */
172
173/* CAN_AMxxH and CAN_AMxxL Masks */
174#define DFM 0xFFFF /* Data Field Mask (If Enabled) (CAN_AMxxL) */
175#define EXTID_LO 0xFFFF /* Lower 16 Bits of Extended Identifier (CAN_AMxxL) */
176#define EXTID_HI 0x0003 /* Upper 2 Bits of Extended Identifier (CAN_AMxxH) */
177#define BASEID 0x1FFC /* Base Identifier */
178#define AMIDE 0x2000 /* Acceptance Mask ID Extension Enable */
179#define FMD 0x4000 /* Full Mask Data Field Enable */
180#define FDF 0x8000 /* Filter On Data Field Enable */
181
182/* CAN_MC1 Masks */
183#define MC0 0x0001 /* Enable Mailbox 0 */
184#define MC1 0x0002 /* Enable Mailbox 1 */
185#define MC2 0x0004 /* Enable Mailbox 2 */
186#define MC3 0x0008 /* Enable Mailbox 3 */
187#define MC4 0x0010 /* Enable Mailbox 4 */
188#define MC5 0x0020 /* Enable Mailbox 5 */
189#define MC6 0x0040 /* Enable Mailbox 6 */
190#define MC7 0x0080 /* Enable Mailbox 7 */
191#define MC8 0x0100 /* Enable Mailbox 8 */
192#define MC9 0x0200 /* Enable Mailbox 9 */
193#define MC10 0x0400 /* Enable Mailbox 10 */
194#define MC11 0x0800 /* Enable Mailbox 11 */
195#define MC12 0x1000 /* Enable Mailbox 12 */
196#define MC13 0x2000 /* Enable Mailbox 13 */
197#define MC14 0x4000 /* Enable Mailbox 14 */
198#define MC15 0x8000 /* Enable Mailbox 15 */
199
200/* CAN_MC2 Masks */
201#define MC16 0x0001 /* Enable Mailbox 16 */
202#define MC17 0x0002 /* Enable Mailbox 17 */
203#define MC18 0x0004 /* Enable Mailbox 18 */
204#define MC19 0x0008 /* Enable Mailbox 19 */
205#define MC20 0x0010 /* Enable Mailbox 20 */
206#define MC21 0x0020 /* Enable Mailbox 21 */
207#define MC22 0x0040 /* Enable Mailbox 22 */
208#define MC23 0x0080 /* Enable Mailbox 23 */
209#define MC24 0x0100 /* Enable Mailbox 24 */
210#define MC25 0x0200 /* Enable Mailbox 25 */
211#define MC26 0x0400 /* Enable Mailbox 26 */
212#define MC27 0x0800 /* Enable Mailbox 27 */
213#define MC28 0x1000 /* Enable Mailbox 28 */
214#define MC29 0x2000 /* Enable Mailbox 29 */
215#define MC30 0x4000 /* Enable Mailbox 30 */
216#define MC31 0x8000 /* Enable Mailbox 31 */
217
218/* CAN_MD1 Masks */
219#define MD0 0x0001 /* Enable Mailbox 0 For Receive */
220#define MD1 0x0002 /* Enable Mailbox 1 For Receive */
221#define MD2 0x0004 /* Enable Mailbox 2 For Receive */
222#define MD3 0x0008 /* Enable Mailbox 3 For Receive */
223#define MD4 0x0010 /* Enable Mailbox 4 For Receive */
224#define MD5 0x0020 /* Enable Mailbox 5 For Receive */
225#define MD6 0x0040 /* Enable Mailbox 6 For Receive */
226#define MD7 0x0080 /* Enable Mailbox 7 For Receive */
227#define MD8 0x0100 /* Enable Mailbox 8 For Receive */
228#define MD9 0x0200 /* Enable Mailbox 9 For Receive */
229#define MD10 0x0400 /* Enable Mailbox 10 For Receive */
230#define MD11 0x0800 /* Enable Mailbox 11 For Receive */
231#define MD12 0x1000 /* Enable Mailbox 12 For Receive */
232#define MD13 0x2000 /* Enable Mailbox 13 For Receive */
233#define MD14 0x4000 /* Enable Mailbox 14 For Receive */
234#define MD15 0x8000 /* Enable Mailbox 15 For Receive */
235
236/* CAN_MD2 Masks */
237#define MD16 0x0001 /* Enable Mailbox 16 For Receive */
238#define MD17 0x0002 /* Enable Mailbox 17 For Receive */
239#define MD18 0x0004 /* Enable Mailbox 18 For Receive */
240#define MD19 0x0008 /* Enable Mailbox 19 For Receive */
241#define MD20 0x0010 /* Enable Mailbox 20 For Receive */
242#define MD21 0x0020 /* Enable Mailbox 21 For Receive */
243#define MD22 0x0040 /* Enable Mailbox 22 For Receive */
244#define MD23 0x0080 /* Enable Mailbox 23 For Receive */
245#define MD24 0x0100 /* Enable Mailbox 24 For Receive */
246#define MD25 0x0200 /* Enable Mailbox 25 For Receive */
247#define MD26 0x0400 /* Enable Mailbox 26 For Receive */
248#define MD27 0x0800 /* Enable Mailbox 27 For Receive */
249#define MD28 0x1000 /* Enable Mailbox 28 For Receive */
250#define MD29 0x2000 /* Enable Mailbox 29 For Receive */
251#define MD30 0x4000 /* Enable Mailbox 30 For Receive */
252#define MD31 0x8000 /* Enable Mailbox 31 For Receive */
253
254/* CAN_RMP1 Masks */
255#define RMP0 0x0001 /* RX Message Pending In Mailbox 0 */
256#define RMP1 0x0002 /* RX Message Pending In Mailbox 1 */
257#define RMP2 0x0004 /* RX Message Pending In Mailbox 2 */
258#define RMP3 0x0008 /* RX Message Pending In Mailbox 3 */
259#define RMP4 0x0010 /* RX Message Pending In Mailbox 4 */
260#define RMP5 0x0020 /* RX Message Pending In Mailbox 5 */
261#define RMP6 0x0040 /* RX Message Pending In Mailbox 6 */
262#define RMP7 0x0080 /* RX Message Pending In Mailbox 7 */
263#define RMP8 0x0100 /* RX Message Pending In Mailbox 8 */
264#define RMP9 0x0200 /* RX Message Pending In Mailbox 9 */
265#define RMP10 0x0400 /* RX Message Pending In Mailbox 10 */
266#define RMP11 0x0800 /* RX Message Pending In Mailbox 11 */
267#define RMP12 0x1000 /* RX Message Pending In Mailbox 12 */
268#define RMP13 0x2000 /* RX Message Pending In Mailbox 13 */
269#define RMP14 0x4000 /* RX Message Pending In Mailbox 14 */
270#define RMP15 0x8000 /* RX Message Pending In Mailbox 15 */
271
272/* CAN_RMP2 Masks */
273#define RMP16 0x0001 /* RX Message Pending In Mailbox 16 */
274#define RMP17 0x0002 /* RX Message Pending In Mailbox 17 */
275#define RMP18 0x0004 /* RX Message Pending In Mailbox 18 */
276#define RMP19 0x0008 /* RX Message Pending In Mailbox 19 */
277#define RMP20 0x0010 /* RX Message Pending In Mailbox 20 */
278#define RMP21 0x0020 /* RX Message Pending In Mailbox 21 */
279#define RMP22 0x0040 /* RX Message Pending In Mailbox 22 */
280#define RMP23 0x0080 /* RX Message Pending In Mailbox 23 */
281#define RMP24 0x0100 /* RX Message Pending In Mailbox 24 */
282#define RMP25 0x0200 /* RX Message Pending In Mailbox 25 */
283#define RMP26 0x0400 /* RX Message Pending In Mailbox 26 */
284#define RMP27 0x0800 /* RX Message Pending In Mailbox 27 */
285#define RMP28 0x1000 /* RX Message Pending In Mailbox 28 */
286#define RMP29 0x2000 /* RX Message Pending In Mailbox 29 */
287#define RMP30 0x4000 /* RX Message Pending In Mailbox 30 */
288#define RMP31 0x8000 /* RX Message Pending In Mailbox 31 */
289
290/* CAN_RML1 Masks */
291#define RML0 0x0001 /* RX Message Lost In Mailbox 0 */
292#define RML1 0x0002 /* RX Message Lost In Mailbox 1 */
293#define RML2 0x0004 /* RX Message Lost In Mailbox 2 */
294#define RML3 0x0008 /* RX Message Lost In Mailbox 3 */
295#define RML4 0x0010 /* RX Message Lost In Mailbox 4 */
296#define RML5 0x0020 /* RX Message Lost In Mailbox 5 */
297#define RML6 0x0040 /* RX Message Lost In Mailbox 6 */
298#define RML7 0x0080 /* RX Message Lost In Mailbox 7 */
299#define RML8 0x0100 /* RX Message Lost In Mailbox 8 */
300#define RML9 0x0200 /* RX Message Lost In Mailbox 9 */
301#define RML10 0x0400 /* RX Message Lost In Mailbox 10 */
302#define RML11 0x0800 /* RX Message Lost In Mailbox 11 */
303#define RML12 0x1000 /* RX Message Lost In Mailbox 12 */
304#define RML13 0x2000 /* RX Message Lost In Mailbox 13 */
305#define RML14 0x4000 /* RX Message Lost In Mailbox 14 */
306#define RML15 0x8000 /* RX Message Lost In Mailbox 15 */
307
308/* CAN_RML2 Masks */
309#define RML16 0x0001 /* RX Message Lost In Mailbox 16 */
310#define RML17 0x0002 /* RX Message Lost In Mailbox 17 */
311#define RML18 0x0004 /* RX Message Lost In Mailbox 18 */
312#define RML19 0x0008 /* RX Message Lost In Mailbox 19 */
313#define RML20 0x0010 /* RX Message Lost In Mailbox 20 */
314#define RML21 0x0020 /* RX Message Lost In Mailbox 21 */
315#define RML22 0x0040 /* RX Message Lost In Mailbox 22 */
316#define RML23 0x0080 /* RX Message Lost In Mailbox 23 */
317#define RML24 0x0100 /* RX Message Lost In Mailbox 24 */
318#define RML25 0x0200 /* RX Message Lost In Mailbox 25 */
319#define RML26 0x0400 /* RX Message Lost In Mailbox 26 */
320#define RML27 0x0800 /* RX Message Lost In Mailbox 27 */
321#define RML28 0x1000 /* RX Message Lost In Mailbox 28 */
322#define RML29 0x2000 /* RX Message Lost In Mailbox 29 */
323#define RML30 0x4000 /* RX Message Lost In Mailbox 30 */
324#define RML31 0x8000 /* RX Message Lost In Mailbox 31 */
325
326/* CAN_OPSS1 Masks */
327#define OPSS0 0x0001 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 0 */
328#define OPSS1 0x0002 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 1 */
329#define OPSS2 0x0004 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 2 */
330#define OPSS3 0x0008 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 3 */
331#define OPSS4 0x0010 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 4 */
332#define OPSS5 0x0020 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 5 */
333#define OPSS6 0x0040 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 6 */
334#define OPSS7 0x0080 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 7 */
335#define OPSS8 0x0100 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 8 */
336#define OPSS9 0x0200 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 9 */
337#define OPSS10 0x0400 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 10 */
338#define OPSS11 0x0800 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 11 */
339#define OPSS12 0x1000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 12 */
340#define OPSS13 0x2000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 13 */
341#define OPSS14 0x4000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 14 */
342#define OPSS15 0x8000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 15 */
343
344/* CAN_OPSS2 Masks */
345#define OPSS16 0x0001 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 16 */
346#define OPSS17 0x0002 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 17 */
347#define OPSS18 0x0004 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 18 */
348#define OPSS19 0x0008 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 19 */
349#define OPSS20 0x0010 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 20 */
350#define OPSS21 0x0020 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 21 */
351#define OPSS22 0x0040 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 22 */
352#define OPSS23 0x0080 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 23 */
353#define OPSS24 0x0100 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 24 */
354#define OPSS25 0x0200 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 25 */
355#define OPSS26 0x0400 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 26 */
356#define OPSS27 0x0800 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 27 */
357#define OPSS28 0x1000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 28 */
358#define OPSS29 0x2000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 29 */
359#define OPSS30 0x4000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 30 */
360#define OPSS31 0x8000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 31 */
361
362/* CAN_TRR1 Masks */
363#define TRR0 0x0001 /* Deny But Don't Lock Access To Mailbox 0 */
364#define TRR1 0x0002 /* Deny But Don't Lock Access To Mailbox 1 */
365#define TRR2 0x0004 /* Deny But Don't Lock Access To Mailbox 2 */
366#define TRR3 0x0008 /* Deny But Don't Lock Access To Mailbox 3 */
367#define TRR4 0x0010 /* Deny But Don't Lock Access To Mailbox 4 */
368#define TRR5 0x0020 /* Deny But Don't Lock Access To Mailbox 5 */
369#define TRR6 0x0040 /* Deny But Don't Lock Access To Mailbox 6 */
370#define TRR7 0x0080 /* Deny But Don't Lock Access To Mailbox 7 */
371#define TRR8 0x0100 /* Deny But Don't Lock Access To Mailbox 8 */
372#define TRR9 0x0200 /* Deny But Don't Lock Access To Mailbox 9 */
373#define TRR10 0x0400 /* Deny But Don't Lock Access To Mailbox 10 */
374#define TRR11 0x0800 /* Deny But Don't Lock Access To Mailbox 11 */
375#define TRR12 0x1000 /* Deny But Don't Lock Access To Mailbox 12 */
376#define TRR13 0x2000 /* Deny But Don't Lock Access To Mailbox 13 */
377#define TRR14 0x4000 /* Deny But Don't Lock Access To Mailbox 14 */
378#define TRR15 0x8000 /* Deny But Don't Lock Access To Mailbox 15 */
379
380/* CAN_TRR2 Masks */
381#define TRR16 0x0001 /* Deny But Don't Lock Access To Mailbox 16 */
382#define TRR17 0x0002 /* Deny But Don't Lock Access To Mailbox 17 */
383#define TRR18 0x0004 /* Deny But Don't Lock Access To Mailbox 18 */
384#define TRR19 0x0008 /* Deny But Don't Lock Access To Mailbox 19 */
385#define TRR20 0x0010 /* Deny But Don't Lock Access To Mailbox 20 */
386#define TRR21 0x0020 /* Deny But Don't Lock Access To Mailbox 21 */
387#define TRR22 0x0040 /* Deny But Don't Lock Access To Mailbox 22 */
388#define TRR23 0x0080 /* Deny But Don't Lock Access To Mailbox 23 */
389#define TRR24 0x0100 /* Deny But Don't Lock Access To Mailbox 24 */
390#define TRR25 0x0200 /* Deny But Don't Lock Access To Mailbox 25 */
391#define TRR26 0x0400 /* Deny But Don't Lock Access To Mailbox 26 */
392#define TRR27 0x0800 /* Deny But Don't Lock Access To Mailbox 27 */
393#define TRR28 0x1000 /* Deny But Don't Lock Access To Mailbox 28 */
394#define TRR29 0x2000 /* Deny But Don't Lock Access To Mailbox 29 */
395#define TRR30 0x4000 /* Deny But Don't Lock Access To Mailbox 30 */
396#define TRR31 0x8000 /* Deny But Don't Lock Access To Mailbox 31 */
397
398/* CAN_TRS1 Masks */
399#define TRS0 0x0001 /* Remote Frame Request For Mailbox 0 */
400#define TRS1 0x0002 /* Remote Frame Request For Mailbox 1 */
401#define TRS2 0x0004 /* Remote Frame Request For Mailbox 2 */
402#define TRS3 0x0008 /* Remote Frame Request For Mailbox 3 */
403#define TRS4 0x0010 /* Remote Frame Request For Mailbox 4 */
404#define TRS5 0x0020 /* Remote Frame Request For Mailbox 5 */
405#define TRS6 0x0040 /* Remote Frame Request For Mailbox 6 */
406#define TRS7 0x0080 /* Remote Frame Request For Mailbox 7 */
407#define TRS8 0x0100 /* Remote Frame Request For Mailbox 8 */
408#define TRS9 0x0200 /* Remote Frame Request For Mailbox 9 */
409#define TRS10 0x0400 /* Remote Frame Request For Mailbox 10 */
410#define TRS11 0x0800 /* Remote Frame Request For Mailbox 11 */
411#define TRS12 0x1000 /* Remote Frame Request For Mailbox 12 */
412#define TRS13 0x2000 /* Remote Frame Request For Mailbox 13 */
413#define TRS14 0x4000 /* Remote Frame Request For Mailbox 14 */
414#define TRS15 0x8000 /* Remote Frame Request For Mailbox 15 */
415
416/* CAN_TRS2 Masks */
417#define TRS16 0x0001 /* Remote Frame Request For Mailbox 16 */
418#define TRS17 0x0002 /* Remote Frame Request For Mailbox 17 */
419#define TRS18 0x0004 /* Remote Frame Request For Mailbox 18 */
420#define TRS19 0x0008 /* Remote Frame Request For Mailbox 19 */
421#define TRS20 0x0010 /* Remote Frame Request For Mailbox 20 */
422#define TRS21 0x0020 /* Remote Frame Request For Mailbox 21 */
423#define TRS22 0x0040 /* Remote Frame Request For Mailbox 22 */
424#define TRS23 0x0080 /* Remote Frame Request For Mailbox 23 */
425#define TRS24 0x0100 /* Remote Frame Request For Mailbox 24 */
426#define TRS25 0x0200 /* Remote Frame Request For Mailbox 25 */
427#define TRS26 0x0400 /* Remote Frame Request For Mailbox 26 */
428#define TRS27 0x0800 /* Remote Frame Request For Mailbox 27 */
429#define TRS28 0x1000 /* Remote Frame Request For Mailbox 28 */
430#define TRS29 0x2000 /* Remote Frame Request For Mailbox 29 */
431#define TRS30 0x4000 /* Remote Frame Request For Mailbox 30 */
432#define TRS31 0x8000 /* Remote Frame Request For Mailbox 31 */
433
434/* CAN_AA1 Masks */
435#define AA0 0x0001 /* Aborted Message In Mailbox 0 */
436#define AA1 0x0002 /* Aborted Message In Mailbox 1 */
437#define AA2 0x0004 /* Aborted Message In Mailbox 2 */
438#define AA3 0x0008 /* Aborted Message In Mailbox 3 */
439#define AA4 0x0010 /* Aborted Message In Mailbox 4 */
440#define AA5 0x0020 /* Aborted Message In Mailbox 5 */
441#define AA6 0x0040 /* Aborted Message In Mailbox 6 */
442#define AA7 0x0080 /* Aborted Message In Mailbox 7 */
443#define AA8 0x0100 /* Aborted Message In Mailbox 8 */
444#define AA9 0x0200 /* Aborted Message In Mailbox 9 */
445#define AA10 0x0400 /* Aborted Message In Mailbox 10 */
446#define AA11 0x0800 /* Aborted Message In Mailbox 11 */
447#define AA12 0x1000 /* Aborted Message In Mailbox 12 */
448#define AA13 0x2000 /* Aborted Message In Mailbox 13 */
449#define AA14 0x4000 /* Aborted Message In Mailbox 14 */
450#define AA15 0x8000 /* Aborted Message In Mailbox 15 */
451
452/* CAN_AA2 Masks */
453#define AA16 0x0001 /* Aborted Message In Mailbox 16 */
454#define AA17 0x0002 /* Aborted Message In Mailbox 17 */
455#define AA18 0x0004 /* Aborted Message In Mailbox 18 */
456#define AA19 0x0008 /* Aborted Message In Mailbox 19 */
457#define AA20 0x0010 /* Aborted Message In Mailbox 20 */
458#define AA21 0x0020 /* Aborted Message In Mailbox 21 */
459#define AA22 0x0040 /* Aborted Message In Mailbox 22 */
460#define AA23 0x0080 /* Aborted Message In Mailbox 23 */
461#define AA24 0x0100 /* Aborted Message In Mailbox 24 */
462#define AA25 0x0200 /* Aborted Message In Mailbox 25 */
463#define AA26 0x0400 /* Aborted Message In Mailbox 26 */
464#define AA27 0x0800 /* Aborted Message In Mailbox 27 */
465#define AA28 0x1000 /* Aborted Message In Mailbox 28 */
466#define AA29 0x2000 /* Aborted Message In Mailbox 29 */
467#define AA30 0x4000 /* Aborted Message In Mailbox 30 */
468#define AA31 0x8000 /* Aborted Message In Mailbox 31 */
469
470/* CAN_TA1 Masks */
471#define TA0 0x0001 /* Transmit Successful From Mailbox 0 */
472#define TA1 0x0002 /* Transmit Successful From Mailbox 1 */
473#define TA2 0x0004 /* Transmit Successful From Mailbox 2 */
474#define TA3 0x0008 /* Transmit Successful From Mailbox 3 */
475#define TA4 0x0010 /* Transmit Successful From Mailbox 4 */
476#define TA5 0x0020 /* Transmit Successful From Mailbox 5 */
477#define TA6 0x0040 /* Transmit Successful From Mailbox 6 */
478#define TA7 0x0080 /* Transmit Successful From Mailbox 7 */
479#define TA8 0x0100 /* Transmit Successful From Mailbox 8 */
480#define TA9 0x0200 /* Transmit Successful From Mailbox 9 */
481#define TA10 0x0400 /* Transmit Successful From Mailbox 10 */
482#define TA11 0x0800 /* Transmit Successful From Mailbox 11 */
483#define TA12 0x1000 /* Transmit Successful From Mailbox 12 */
484#define TA13 0x2000 /* Transmit Successful From Mailbox 13 */
485#define TA14 0x4000 /* Transmit Successful From Mailbox 14 */
486#define TA15 0x8000 /* Transmit Successful From Mailbox 15 */
487
488/* CAN_TA2 Masks */
489#define TA16 0x0001 /* Transmit Successful From Mailbox 16 */
490#define TA17 0x0002 /* Transmit Successful From Mailbox 17 */
491#define TA18 0x0004 /* Transmit Successful From Mailbox 18 */
492#define TA19 0x0008 /* Transmit Successful From Mailbox 19 */
493#define TA20 0x0010 /* Transmit Successful From Mailbox 20 */
494#define TA21 0x0020 /* Transmit Successful From Mailbox 21 */
495#define TA22 0x0040 /* Transmit Successful From Mailbox 22 */
496#define TA23 0x0080 /* Transmit Successful From Mailbox 23 */
497#define TA24 0x0100 /* Transmit Successful From Mailbox 24 */
498#define TA25 0x0200 /* Transmit Successful From Mailbox 25 */
499#define TA26 0x0400 /* Transmit Successful From Mailbox 26 */
500#define TA27 0x0800 /* Transmit Successful From Mailbox 27 */
501#define TA28 0x1000 /* Transmit Successful From Mailbox 28 */
502#define TA29 0x2000 /* Transmit Successful From Mailbox 29 */
503#define TA30 0x4000 /* Transmit Successful From Mailbox 30 */
504#define TA31 0x8000 /* Transmit Successful From Mailbox 31 */
505
506/* CAN_MBTD Masks */
507#define TDPTR 0x001F /* Mailbox To Temporarily Disable */
508#define TDA 0x0040 /* Temporary Disable Acknowledge */
509#define TDR 0x0080 /* Temporary Disable Request */
510
511/* CAN_RFH1 Masks */
512#define RFH0 0x0001 /* Enable Automatic Remote Frame Handling For Mailbox 0 */
513#define RFH1 0x0002 /* Enable Automatic Remote Frame Handling For Mailbox 1 */
514#define RFH2 0x0004 /* Enable Automatic Remote Frame Handling For Mailbox 2 */
515#define RFH3 0x0008 /* Enable Automatic Remote Frame Handling For Mailbox 3 */
516#define RFH4 0x0010 /* Enable Automatic Remote Frame Handling For Mailbox 4 */
517#define RFH5 0x0020 /* Enable Automatic Remote Frame Handling For Mailbox 5 */
518#define RFH6 0x0040 /* Enable Automatic Remote Frame Handling For Mailbox 6 */
519#define RFH7 0x0080 /* Enable Automatic Remote Frame Handling For Mailbox 7 */
520#define RFH8 0x0100 /* Enable Automatic Remote Frame Handling For Mailbox 8 */
521#define RFH9 0x0200 /* Enable Automatic Remote Frame Handling For Mailbox 9 */
522#define RFH10 0x0400 /* Enable Automatic Remote Frame Handling For Mailbox 10 */
523#define RFH11 0x0800 /* Enable Automatic Remote Frame Handling For Mailbox 11 */
524#define RFH12 0x1000 /* Enable Automatic Remote Frame Handling For Mailbox 12 */
525#define RFH13 0x2000 /* Enable Automatic Remote Frame Handling For Mailbox 13 */
526#define RFH14 0x4000 /* Enable Automatic Remote Frame Handling For Mailbox 14 */
527#define RFH15 0x8000 /* Enable Automatic Remote Frame Handling For Mailbox 15 */
528
529/* CAN_RFH2 Masks */
530#define RFH16 0x0001 /* Enable Automatic Remote Frame Handling For Mailbox 16 */
531#define RFH17 0x0002 /* Enable Automatic Remote Frame Handling For Mailbox 17 */
532#define RFH18 0x0004 /* Enable Automatic Remote Frame Handling For Mailbox 18 */
533#define RFH19 0x0008 /* Enable Automatic Remote Frame Handling For Mailbox 19 */
534#define RFH20 0x0010 /* Enable Automatic Remote Frame Handling For Mailbox 20 */
535#define RFH21 0x0020 /* Enable Automatic Remote Frame Handling For Mailbox 21 */
536#define RFH22 0x0040 /* Enable Automatic Remote Frame Handling For Mailbox 22 */
537#define RFH23 0x0080 /* Enable Automatic Remote Frame Handling For Mailbox 23 */
538#define RFH24 0x0100 /* Enable Automatic Remote Frame Handling For Mailbox 24 */
539#define RFH25 0x0200 /* Enable Automatic Remote Frame Handling For Mailbox 25 */
540#define RFH26 0x0400 /* Enable Automatic Remote Frame Handling For Mailbox 26 */
541#define RFH27 0x0800 /* Enable Automatic Remote Frame Handling For Mailbox 27 */
542#define RFH28 0x1000 /* Enable Automatic Remote Frame Handling For Mailbox 28 */
543#define RFH29 0x2000 /* Enable Automatic Remote Frame Handling For Mailbox 29 */
544#define RFH30 0x4000 /* Enable Automatic Remote Frame Handling For Mailbox 30 */
545#define RFH31 0x8000 /* Enable Automatic Remote Frame Handling For Mailbox 31 */
546
547/* CAN_MBTIF1 Masks */
548#define MBTIF0 0x0001 /* TX Interrupt Active In Mailbox 0 */
549#define MBTIF1 0x0002 /* TX Interrupt Active In Mailbox 1 */
550#define MBTIF2 0x0004 /* TX Interrupt Active In Mailbox 2 */
551#define MBTIF3 0x0008 /* TX Interrupt Active In Mailbox 3 */
552#define MBTIF4 0x0010 /* TX Interrupt Active In Mailbox 4 */
553#define MBTIF5 0x0020 /* TX Interrupt Active In Mailbox 5 */
554#define MBTIF6 0x0040 /* TX Interrupt Active In Mailbox 6 */
555#define MBTIF7 0x0080 /* TX Interrupt Active In Mailbox 7 */
556#define MBTIF8 0x0100 /* TX Interrupt Active In Mailbox 8 */
557#define MBTIF9 0x0200 /* TX Interrupt Active In Mailbox 9 */
558#define MBTIF10 0x0400 /* TX Interrupt Active In Mailbox 10 */
559#define MBTIF11 0x0800 /* TX Interrupt Active In Mailbox 11 */
560#define MBTIF12 0x1000 /* TX Interrupt Active In Mailbox 12 */
561#define MBTIF13 0x2000 /* TX Interrupt Active In Mailbox 13 */
562#define MBTIF14 0x4000 /* TX Interrupt Active In Mailbox 14 */
563#define MBTIF15 0x8000 /* TX Interrupt Active In Mailbox 15 */
564
565/* CAN_MBTIF2 Masks */
566#define MBTIF16 0x0001 /* TX Interrupt Active In Mailbox 16 */
567#define MBTIF17 0x0002 /* TX Interrupt Active In Mailbox 17 */
568#define MBTIF18 0x0004 /* TX Interrupt Active In Mailbox 18 */
569#define MBTIF19 0x0008 /* TX Interrupt Active In Mailbox 19 */
570#define MBTIF20 0x0010 /* TX Interrupt Active In Mailbox 20 */
571#define MBTIF21 0x0020 /* TX Interrupt Active In Mailbox 21 */
572#define MBTIF22 0x0040 /* TX Interrupt Active In Mailbox 22 */
573#define MBTIF23 0x0080 /* TX Interrupt Active In Mailbox 23 */
574#define MBTIF24 0x0100 /* TX Interrupt Active In Mailbox 24 */
575#define MBTIF25 0x0200 /* TX Interrupt Active In Mailbox 25 */
576#define MBTIF26 0x0400 /* TX Interrupt Active In Mailbox 26 */
577#define MBTIF27 0x0800 /* TX Interrupt Active In Mailbox 27 */
578#define MBTIF28 0x1000 /* TX Interrupt Active In Mailbox 28 */
579#define MBTIF29 0x2000 /* TX Interrupt Active In Mailbox 29 */
580#define MBTIF30 0x4000 /* TX Interrupt Active In Mailbox 30 */
581#define MBTIF31 0x8000 /* TX Interrupt Active In Mailbox 31 */
582
583/* CAN_MBRIF1 Masks */
584#define MBRIF0 0x0001 /* RX Interrupt Active In Mailbox 0 */
585#define MBRIF1 0x0002 /* RX Interrupt Active In Mailbox 1 */
586#define MBRIF2 0x0004 /* RX Interrupt Active In Mailbox 2 */
587#define MBRIF3 0x0008 /* RX Interrupt Active In Mailbox 3 */
588#define MBRIF4 0x0010 /* RX Interrupt Active In Mailbox 4 */
589#define MBRIF5 0x0020 /* RX Interrupt Active In Mailbox 5 */
590#define MBRIF6 0x0040 /* RX Interrupt Active In Mailbox 6 */
591#define MBRIF7 0x0080 /* RX Interrupt Active In Mailbox 7 */
592#define MBRIF8 0x0100 /* RX Interrupt Active In Mailbox 8 */
593#define MBRIF9 0x0200 /* RX Interrupt Active In Mailbox 9 */
594#define MBRIF10 0x0400 /* RX Interrupt Active In Mailbox 10 */
595#define MBRIF11 0x0800 /* RX Interrupt Active In Mailbox 11 */
596#define MBRIF12 0x1000 /* RX Interrupt Active In Mailbox 12 */
597#define MBRIF13 0x2000 /* RX Interrupt Active In Mailbox 13 */
598#define MBRIF14 0x4000 /* RX Interrupt Active In Mailbox 14 */
599#define MBRIF15 0x8000 /* RX Interrupt Active In Mailbox 15 */
600
601/* CAN_MBRIF2 Masks */
602#define MBRIF16 0x0001 /* RX Interrupt Active In Mailbox 16 */
603#define MBRIF17 0x0002 /* RX Interrupt Active In Mailbox 17 */
604#define MBRIF18 0x0004 /* RX Interrupt Active In Mailbox 18 */
605#define MBRIF19 0x0008 /* RX Interrupt Active In Mailbox 19 */
606#define MBRIF20 0x0010 /* RX Interrupt Active In Mailbox 20 */
607#define MBRIF21 0x0020 /* RX Interrupt Active In Mailbox 21 */
608#define MBRIF22 0x0040 /* RX Interrupt Active In Mailbox 22 */
609#define MBRIF23 0x0080 /* RX Interrupt Active In Mailbox 23 */
610#define MBRIF24 0x0100 /* RX Interrupt Active In Mailbox 24 */
611#define MBRIF25 0x0200 /* RX Interrupt Active In Mailbox 25 */
612#define MBRIF26 0x0400 /* RX Interrupt Active In Mailbox 26 */
613#define MBRIF27 0x0800 /* RX Interrupt Active In Mailbox 27 */
614#define MBRIF28 0x1000 /* RX Interrupt Active In Mailbox 28 */
615#define MBRIF29 0x2000 /* RX Interrupt Active In Mailbox 29 */
616#define MBRIF30 0x4000 /* RX Interrupt Active In Mailbox 30 */
617#define MBRIF31 0x8000 /* RX Interrupt Active In Mailbox 31 */
618
619/* CAN_MBIM1 Masks */
620#define MBIM0 0x0001 /* Enable Interrupt For Mailbox 0 */
621#define MBIM1 0x0002 /* Enable Interrupt For Mailbox 1 */
622#define MBIM2 0x0004 /* Enable Interrupt For Mailbox 2 */
623#define MBIM3 0x0008 /* Enable Interrupt For Mailbox 3 */
624#define MBIM4 0x0010 /* Enable Interrupt For Mailbox 4 */
625#define MBIM5 0x0020 /* Enable Interrupt For Mailbox 5 */
626#define MBIM6 0x0040 /* Enable Interrupt For Mailbox 6 */
627#define MBIM7 0x0080 /* Enable Interrupt For Mailbox 7 */
628#define MBIM8 0x0100 /* Enable Interrupt For Mailbox 8 */
629#define MBIM9 0x0200 /* Enable Interrupt For Mailbox 9 */
630#define MBIM10 0x0400 /* Enable Interrupt For Mailbox 10 */
631#define MBIM11 0x0800 /* Enable Interrupt For Mailbox 11 */
632#define MBIM12 0x1000 /* Enable Interrupt For Mailbox 12 */
633#define MBIM13 0x2000 /* Enable Interrupt For Mailbox 13 */
634#define MBIM14 0x4000 /* Enable Interrupt For Mailbox 14 */
635#define MBIM15 0x8000 /* Enable Interrupt For Mailbox 15 */
636
637/* CAN_MBIM2 Masks */
638#define MBIM16 0x0001 /* Enable Interrupt For Mailbox 16 */
639#define MBIM17 0x0002 /* Enable Interrupt For Mailbox 17 */
640#define MBIM18 0x0004 /* Enable Interrupt For Mailbox 18 */
641#define MBIM19 0x0008 /* Enable Interrupt For Mailbox 19 */
642#define MBIM20 0x0010 /* Enable Interrupt For Mailbox 20 */
643#define MBIM21 0x0020 /* Enable Interrupt For Mailbox 21 */
644#define MBIM22 0x0040 /* Enable Interrupt For Mailbox 22 */
645#define MBIM23 0x0080 /* Enable Interrupt For Mailbox 23 */
646#define MBIM24 0x0100 /* Enable Interrupt For Mailbox 24 */
647#define MBIM25 0x0200 /* Enable Interrupt For Mailbox 25 */
648#define MBIM26 0x0400 /* Enable Interrupt For Mailbox 26 */
649#define MBIM27 0x0800 /* Enable Interrupt For Mailbox 27 */
650#define MBIM28 0x1000 /* Enable Interrupt For Mailbox 28 */
651#define MBIM29 0x2000 /* Enable Interrupt For Mailbox 29 */
652#define MBIM30 0x4000 /* Enable Interrupt For Mailbox 30 */
653#define MBIM31 0x8000 /* Enable Interrupt For Mailbox 31 */
654
655/* CAN_GIM Masks */
656#define EWTIM 0x0001 /* Enable TX Error Count Interrupt */
657#define EWRIM 0x0002 /* Enable RX Error Count Interrupt */
658#define EPIM 0x0004 /* Enable Error-Passive Mode Interrupt */
659#define BOIM 0x0008 /* Enable Bus Off Interrupt */
660#define WUIM 0x0010 /* Enable Wake-Up Interrupt */
661#define UIAIM 0x0020 /* Enable Access To Unimplemented Address Interrupt */
662#define AAIM 0x0040 /* Enable Abort Acknowledge Interrupt */
663#define RMLIM 0x0080 /* Enable RX Message Lost Interrupt */
664#define UCEIM 0x0100 /* Enable Universal Counter Overflow Interrupt */
665#define EXTIM 0x0200 /* Enable External Trigger Output Interrupt */
666#define ADIM 0x0400 /* Enable Access Denied Interrupt */
667
668/* CAN_GIS Masks */
669#define EWTIS 0x0001 /* TX Error Count IRQ Status */
670#define EWRIS 0x0002 /* RX Error Count IRQ Status */
671#define EPIS 0x0004 /* Error-Passive Mode IRQ Status */
672#define BOIS 0x0008 /* Bus Off IRQ Status */
673#define WUIS 0x0010 /* Wake-Up IRQ Status */
674#define UIAIS 0x0020 /* Access To Unimplemented Address IRQ Status */
675#define AAIS 0x0040 /* Abort Acknowledge IRQ Status */
676#define RMLIS 0x0080 /* RX Message Lost IRQ Status */
677#define UCEIS 0x0100 /* Universal Counter Overflow IRQ Status */
678#define EXTIS 0x0200 /* External Trigger Output IRQ Status */
679#define ADIS 0x0400 /* Access Denied IRQ Status */
680
681/* CAN_GIF Masks */
682#define EWTIF 0x0001 /* TX Error Count IRQ Flag */
683#define EWRIF 0x0002 /* RX Error Count IRQ Flag */
684#define EPIF 0x0004 /* Error-Passive Mode IRQ Flag */
685#define BOIF 0x0008 /* Bus Off IRQ Flag */
686#define WUIF 0x0010 /* Wake-Up IRQ Flag */
687#define UIAIF 0x0020 /* Access To Unimplemented Address IRQ Flag */
688#define AAIF 0x0040 /* Abort Acknowledge IRQ Flag */
689#define RMLIF 0x0080 /* RX Message Lost IRQ Flag */
690#define UCEIF 0x0100 /* Universal Counter Overflow IRQ Flag */
691#define EXTIF 0x0200 /* External Trigger Output IRQ Flag */
692#define ADIF 0x0400 /* Access Denied IRQ Flag */
693
694/* CAN_UCCNF Masks */
695#define UCCNF 0x000F /* Universal Counter Mode */
696#define UC_STAMP 0x0001 /* Timestamp Mode */
697#define UC_WDOG 0x0002 /* Watchdog Mode */
698#define UC_AUTOTX 0x0003 /* Auto-Transmit Mode */
699#define UC_ERROR 0x0006 /* CAN Error Frame Count */
700#define UC_OVER 0x0007 /* CAN Overload Frame Count */
701#define UC_LOST 0x0008 /* Arbitration Lost During TX Count */
702#define UC_AA 0x0009 /* TX Abort Count */
703#define UC_TA 0x000A /* TX Successful Count */
704#define UC_REJECT 0x000B /* RX Message Rejected Count */
705#define UC_RML 0x000C /* RX Message Lost Count */
706#define UC_RX 0x000D /* Total Successful RX Messages Count */
707#define UC_RMP 0x000E /* Successful RX W/Matching ID Count */
708#define UC_ALL 0x000F /* Correct Message On CAN Bus Line Count */
709#define UCRC 0x0020 /* Universal Counter Reload/Clear */
710#define UCCT 0x0040 /* Universal Counter CAN Trigger */
711#define UCE 0x0080 /* Universal Counter Enable */
712
713/* CAN_ESR Masks */
714#define ACKE 0x0004 /* Acknowledge Error */
715#define SER 0x0008 /* Stuff Error */
716#define CRCE 0x0010 /* CRC Error */
717#define SA0 0x0020 /* Stuck At Dominant Error */
718#define BEF 0x0040 /* Bit Error Flag */
719#define FER 0x0080 /* Form Error Flag */
720
721/* CAN_EWR Masks */
722#define EWLREC 0x00FF /* RX Error Count Limit (For EWRIS) */
723#define EWLTEC 0xFF00 /* TX Error Count Limit (For EWTIS) */
724
725#endif
diff --git a/arch/blackfin/include/asm/bfin_sport.h b/arch/blackfin/include/asm/bfin_sport.h
index b558908e1c79..9626cf7e4251 100644
--- a/arch/blackfin/include/asm/bfin_sport.h
+++ b/arch/blackfin/include/asm/bfin_sport.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * bfin_sport.h - userspace header for bfin sport driver 2 * bfin_sport.h - interface to Blackfin SPORTs
3 * 3 *
4 * Copyright 2004-2008 Analog Devices Inc. 4 * Copyright 2004-2009 Analog Devices Inc.
5 * 5 *
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
@@ -9,16 +9,6 @@
9#ifndef __BFIN_SPORT_H__ 9#ifndef __BFIN_SPORT_H__
10#define __BFIN_SPORT_H__ 10#define __BFIN_SPORT_H__
11 11
12#ifdef __KERNEL__
13#include <linux/cdev.h>
14#include <linux/mutex.h>
15#include <linux/sched.h>
16#include <linux/wait.h>
17#endif
18
19#define SPORT_MAJOR 237
20#define SPORT_NR_DEVS 2
21
22/* Sport mode: it can be set to TDM, i2s or others */ 12/* Sport mode: it can be set to TDM, i2s or others */
23#define NORM_MODE 0x0 13#define NORM_MODE 0x0
24#define TDM_MODE 0x1 14#define TDM_MODE 0x1
@@ -35,7 +25,7 @@ struct sport_config {
35 unsigned int mode:3; 25 unsigned int mode:3;
36 26
37 /* if TDM mode is selected, channels must be set */ 27 /* if TDM mode is selected, channels must be set */
38 int channels; /* Must be in 8 units */ 28 int channels; /* Must be in 8 units */
39 unsigned int frame_delay:4; /* Delay between frame sync pulse and first bit */ 29 unsigned int frame_delay:4; /* Delay between frame sync pulse and first bit */
40 30
41 /* I2S mode */ 31 /* I2S mode */
@@ -69,94 +59,137 @@ struct sport_config {
69 59
70#ifdef __KERNEL__ 60#ifdef __KERNEL__
71 61
72struct sport_register { 62#include <linux/types.h>
73 unsigned short tcr1;
74 unsigned short reserved0;
75 unsigned short tcr2;
76 unsigned short reserved1;
77 unsigned short tclkdiv;
78 unsigned short reserved2;
79 unsigned short tfsdiv;
80 unsigned short reserved3;
81 unsigned long tx;
82 unsigned long reserved_l0;
83 unsigned long rx;
84 unsigned long reserved_l1;
85 unsigned short rcr1;
86 unsigned short reserved4;
87 unsigned short rcr2;
88 unsigned short reserved5;
89 unsigned short rclkdiv;
90 unsigned short reserved6;
91 unsigned short rfsdiv;
92 unsigned short reserved7;
93 unsigned short stat;
94 unsigned short reserved8;
95 unsigned short chnl;
96 unsigned short reserved9;
97 unsigned short mcmc1;
98 unsigned short reserved10;
99 unsigned short mcmc2;
100 unsigned short reserved11;
101 unsigned long mtcs0;
102 unsigned long mtcs1;
103 unsigned long mtcs2;
104 unsigned long mtcs3;
105 unsigned long mrcs0;
106 unsigned long mrcs1;
107 unsigned long mrcs2;
108 unsigned long mrcs3;
109};
110
111struct sport_dev {
112 struct cdev cdev; /* Char device structure */
113
114 int sport_num;
115 63
116 int dma_rx_chan; 64/*
117 int dma_tx_chan; 65 * All Blackfin system MMRs are padded to 32bits even if the register
118 66 * itself is only 16bits. So use a helper macro to streamline this.
119 int rx_irq; 67 */
120 unsigned char *rx_buf; /* Buffer store the received data */ 68#define __BFP(m) u16 m; u16 __pad_##m
121 int rx_len; /* How many bytes will be received */ 69struct sport_register {
122 int rx_received; /* How many bytes has been received */ 70 __BFP(tcr1);
123 71 __BFP(tcr2);
124 int tx_irq; 72 __BFP(tclkdiv);
125 const unsigned char *tx_buf; 73 __BFP(tfsdiv);
126 int tx_len; 74 union {
127 int tx_sent; 75 u32 tx32;
128 76 u16 tx16;
129 int err_irq; 77 };
130 78 u32 __pad_tx;
131 struct mutex mutex; /* mutual exclusion semaphore */ 79 union {
132 struct task_struct *task; 80 u32 rx32; /* use the anomaly wrapper below */
133 81 u16 rx16;
134 wait_queue_head_t waitq; 82 };
135 int wait_con; 83 u32 __pad_rx;
136 struct sport_register *regs; 84 __BFP(rcr1);
137 struct sport_config config; 85 __BFP(rcr2);
86 __BFP(rclkdiv);
87 __BFP(rfsdiv);
88 __BFP(stat);
89 __BFP(chnl);
90 __BFP(mcmc1);
91 __BFP(mcmc2);
92 u32 mtcs0;
93 u32 mtcs1;
94 u32 mtcs2;
95 u32 mtcs3;
96 u32 mrcs0;
97 u32 mrcs1;
98 u32 mrcs2;
99 u32 mrcs3;
138}; 100};
101#undef __BFP
102
103#define bfin_read_sport_rx32(base) \
104({ \
105 struct sport_register *__mmrs = (void *)base; \
106 u32 __ret; \
107 unsigned long flags; \
108 if (ANOMALY_05000473) \
109 local_irq_save(flags); \
110 __ret = __mmrs->rx32; \
111 if (ANOMALY_05000473) \
112 local_irq_restore(flags); \
113 __ret; \
114})
139 115
140#endif 116#endif
141 117
142#define SPORT_TCR1 0 118/* Workaround defBF*.h SPORT MMRs till they get cleansed */
143#define SPORT_TCR2 1 119#undef DTYPE_NORM
144#define SPORT_TCLKDIV 2 120#undef SLEN
145#define SPORT_TFSDIV 3 121#undef SP_WOFF
146#define SPORT_RCR1 8 122#undef SP_WSIZE
147#define SPORT_RCR2 9 123
148#define SPORT_RCLKDIV 10 124/* SPORT_TCR1 Masks */
149#define SPORT_RFSDIV 11 125#define TSPEN 0x0001 /* TX enable */
150#define SPORT_CHANNEL 13 126#define ITCLK 0x0002 /* Internal TX Clock Select */
151#define SPORT_MCMC1 14 127#define TDTYPE 0x000C /* TX Data Formatting Select */
152#define SPORT_MCMC2 15 128#define DTYPE_NORM 0x0000 /* Data Format Normal */
153#define SPORT_MTCS0 16 129#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */
154#define SPORT_MTCS1 17 130#define DTYPE_ALAW 0x000C /* Compand Using A-Law */
155#define SPORT_MTCS2 18 131#define TLSBIT 0x0010 /* TX Bit Order */
156#define SPORT_MTCS3 19 132#define ITFS 0x0200 /* Internal TX Frame Sync Select */
157#define SPORT_MRCS0 20 133#define TFSR 0x0400 /* TX Frame Sync Required Select */
158#define SPORT_MRCS1 21 134#define DITFS 0x0800 /* Data Independent TX Frame Sync Select */
159#define SPORT_MRCS2 22 135#define LTFS 0x1000 /* Low TX Frame Sync Select */
160#define SPORT_MRCS3 23 136#define LATFS 0x2000 /* Late TX Frame Sync Select */
137#define TCKFE 0x4000 /* TX Clock Falling Edge Select */
138
139/* SPORT_TCR2 Masks */
140#define SLEN 0x001F /* SPORT TX Word Length (2 - 31) */
141#define DP_SLEN(x) BFIN_DEPOSIT(SLEN, x)
142#define EX_SLEN(x) BFIN_EXTRACT(SLEN, x)
143#define TXSE 0x0100 /* TX Secondary Enable */
144#define TSFSE 0x0200 /* TX Stereo Frame Sync Enable */
145#define TRFST 0x0400 /* TX Right-First Data Order */
146
147/* SPORT_RCR1 Masks */
148#define RSPEN 0x0001 /* RX enable */
149#define IRCLK 0x0002 /* Internal RX Clock Select */
150#define RDTYPE 0x000C /* RX Data Formatting Select */
151/* DTYPE_* defined above */
152#define RLSBIT 0x0010 /* RX Bit Order */
153#define IRFS 0x0200 /* Internal RX Frame Sync Select */
154#define RFSR 0x0400 /* RX Frame Sync Required Select */
155#define LRFS 0x1000 /* Low RX Frame Sync Select */
156#define LARFS 0x2000 /* Late RX Frame Sync Select */
157#define RCKFE 0x4000 /* RX Clock Falling Edge Select */
158
159/* SPORT_RCR2 Masks */
160/* SLEN defined above */
161#define RXSE 0x0100 /* RX Secondary Enable */
162#define RSFSE 0x0200 /* RX Stereo Frame Sync Enable */
163#define RRFST 0x0400 /* Right-First Data Order */
164
165/* SPORT_STAT Masks */
166#define RXNE 0x0001 /* RX FIFO Not Empty Status */
167#define RUVF 0x0002 /* RX Underflow Status */
168#define ROVF 0x0004 /* RX Overflow Status */
169#define TXF 0x0008 /* TX FIFO Full Status */
170#define TUVF 0x0010 /* TX Underflow Status */
171#define TOVF 0x0020 /* TX Overflow Status */
172#define TXHRE 0x0040 /* TX Hold Register Empty */
173
174/* SPORT_MCMC1 Masks */
175#define SP_WOFF 0x03FF /* Multichannel Window Offset Field */
176#define DP_SP_WOFF(x) BFIN_DEPOSIT(SP_WOFF, x)
177#define EX_SP_WOFF(x) BFIN_EXTRACT(SP_WOFF, x)
178#define SP_WSIZE 0xF000 /* Multichannel Window Size Field */
179#define DP_SP_WSIZE(x) BFIN_DEPOSIT(SP_WSIZE, x)
180#define EX_SP_WSIZE(x) BFIN_EXTRACT(SP_WSIZE, x)
181
182/* SPORT_MCMC2 Masks */
183#define MCCRM 0x0003 /* Multichannel Clock Recovery Mode */
184#define REC_BYPASS 0x0000 /* Bypass Mode (No Clock Recovery) */
185#define REC_2FROM4 0x0002 /* Recover 2 MHz Clock from 4 MHz Clock */
186#define REC_8FROM16 0x0003 /* Recover 8 MHz Clock from 16 MHz Clock */
187#define MCDTXPE 0x0004 /* Multichannel DMA Transmit Packing */
188#define MCDRXPE 0x0008 /* Multichannel DMA Receive Packing */
189#define MCMEN 0x0010 /* Multichannel Frame Mode Enable */
190#define FSDR 0x0080 /* Multichannel Frame Sync to Data Relationship */
191#define MFD 0xF000 /* Multichannel Frame Delay */
192#define DP_MFD(x) BFIN_DEPOSIT(MFD, x)
193#define EX_MFD(x) BFIN_EXTRACT(MFD, x)
161 194
162#endif 195#endif
diff --git a/arch/blackfin/include/asm/bfin_watchdog.h b/arch/blackfin/include/asm/bfin_watchdog.h
new file mode 100644
index 000000000000..dce09829a095
--- /dev/null
+++ b/arch/blackfin/include/asm/bfin_watchdog.h
@@ -0,0 +1,30 @@
1/*
2 * bfin_watchdog.h - Blackfin watchdog definitions
3 *
4 * Copyright 2006-2010 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef _BFIN_WATCHDOG_H
10#define _BFIN_WATCHDOG_H
11
12/* Bit in SWRST that indicates boot caused by watchdog */
13#define SWRST_RESET_WDOG 0x4000
14
15/* Bit in WDOG_CTL that indicates watchdog has expired (WDR0) */
16#define WDOG_EXPIRED 0x8000
17
18/* Masks for WDEV field in WDOG_CTL register */
19#define ICTL_RESET 0x0
20#define ICTL_NMI 0x2
21#define ICTL_GPI 0x4
22#define ICTL_NONE 0x6
23#define ICTL_MASK 0x6
24
25/* Masks for WDEN field in WDOG_CTL register */
26#define WDEN_MASK 0x0FF0
27#define WDEN_ENABLE 0x0000
28#define WDEN_DISABLE 0x0AD0
29
30#endif
diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h
index a2ff3fb3568d..605ba8e9b2e4 100644
--- a/arch/blackfin/include/asm/bitops.h
+++ b/arch/blackfin/include/asm/bitops.h
@@ -7,22 +7,41 @@
7#ifndef _BLACKFIN_BITOPS_H 7#ifndef _BLACKFIN_BITOPS_H
8#define _BLACKFIN_BITOPS_H 8#define _BLACKFIN_BITOPS_H
9 9
10#ifndef CONFIG_SMP 10#include <linux/compiler.h>
11# include <asm-generic/bitops.h> 11
12#else 12#include <asm-generic/bitops/__ffs.h>
13#include <asm-generic/bitops/ffz.h>
14#include <asm-generic/bitops/fls.h>
15#include <asm-generic/bitops/__fls.h>
16#include <asm-generic/bitops/fls64.h>
17#include <asm-generic/bitops/find.h>
13 18
14#ifndef _LINUX_BITOPS_H 19#ifndef _LINUX_BITOPS_H
15#error only <linux/bitops.h> can be included directly 20#error only <linux/bitops.h> can be included directly
16#endif 21#endif
17 22
18#include <linux/compiler.h>
19#include <asm/byteorder.h> /* swab32 */
20
21#include <asm-generic/bitops/ffs.h>
22#include <asm-generic/bitops/__ffs.h>
23#include <asm-generic/bitops/sched.h> 23#include <asm-generic/bitops/sched.h>
24#include <asm-generic/bitops/ffz.h> 24#include <asm-generic/bitops/ffs.h>
25#include <asm-generic/bitops/lock.h>
26#include <asm-generic/bitops/ext2-non-atomic.h>
27#include <asm-generic/bitops/ext2-atomic.h>
28#include <asm-generic/bitops/minix.h>
29
30#ifndef CONFIG_SMP
31#include <linux/irqflags.h>
32
33/*
34 * clear_bit may not imply a memory barrier
35 */
36#ifndef smp_mb__before_clear_bit
37#define smp_mb__before_clear_bit() smp_mb()
38#define smp_mb__after_clear_bit() smp_mb()
39#endif
40#include <asm-generic/bitops/atomic.h>
41#include <asm-generic/bitops/non-atomic.h>
42#else
25 43
44#include <asm/byteorder.h> /* swab32 */
26#include <linux/linkage.h> 45#include <linux/linkage.h>
27 46
28asmlinkage int __raw_bit_set_asm(volatile unsigned long *addr, int nr); 47asmlinkage int __raw_bit_set_asm(volatile unsigned long *addr, int nr);
@@ -89,19 +108,36 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
89 108
90#include <asm-generic/bitops/non-atomic.h> 109#include <asm-generic/bitops/non-atomic.h>
91 110
92#include <asm-generic/bitops/find.h> 111#endif /* CONFIG_SMP */
93#include <asm-generic/bitops/hweight.h>
94#include <asm-generic/bitops/lock.h>
95 112
96#include <asm-generic/bitops/ext2-atomic.h> 113/*
97#include <asm-generic/bitops/ext2-non-atomic.h> 114 * hweightN: returns the hamming weight (i.e. the number
115 * of bits set) of a N-bit word
116 */
98 117
99#include <asm-generic/bitops/minix.h> 118static inline unsigned int hweight32(unsigned int w)
119{
120 unsigned int res;
100 121
101#include <asm-generic/bitops/fls.h> 122 __asm__ ("%0.l = ONES %0;"
102#include <asm-generic/bitops/__fls.h> 123 "%0 = %0.l (Z);"
103#include <asm-generic/bitops/fls64.h> 124 : "=d" (res) : "d" (w));
125 return res;
126}
104 127
105#endif /* CONFIG_SMP */ 128static inline unsigned int hweight64(__u64 w)
129{
130 return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
131}
132
133static inline unsigned int hweight16(unsigned int w)
134{
135 return hweight32(w & 0xffff);
136}
137
138static inline unsigned int hweight8(unsigned int w)
139{
140 return hweight32(w & 0xff);
141}
106 142
107#endif /* _BLACKFIN_BITOPS_H */ 143#endif /* _BLACKFIN_BITOPS_H */
diff --git a/arch/blackfin/include/asm/bug.h b/arch/blackfin/include/asm/bug.h
index 6f4548a13555..75f6dc336d46 100644
--- a/arch/blackfin/include/asm/bug.h
+++ b/arch/blackfin/include/asm/bug.h
@@ -47,7 +47,7 @@
47#define BUG() \ 47#define BUG() \
48 do { \ 48 do { \
49 _BUG_OR_WARN(0); \ 49 _BUG_OR_WARN(0); \
50 for (;;); \ 50 unreachable(); \
51 } while (0) 51 } while (0)
52 52
53#define WARN_ON(condition) \ 53#define WARN_ON(condition) \
diff --git a/arch/blackfin/include/asm/cacheflush.h b/arch/blackfin/include/asm/cacheflush.h
index af03a36c7a4e..2666ff8ea952 100644
--- a/arch/blackfin/include/asm/cacheflush.h
+++ b/arch/blackfin/include/asm/cacheflush.h
@@ -10,6 +10,7 @@
10#define _BLACKFIN_CACHEFLUSH_H 10#define _BLACKFIN_CACHEFLUSH_H
11 11
12#include <asm/blackfin.h> /* for SSYNC() */ 12#include <asm/blackfin.h> /* for SSYNC() */
13#include <asm/sections.h> /* for _ramend */
13 14
14extern void blackfin_icache_flush_range(unsigned long start_address, unsigned long end_address); 15extern void blackfin_icache_flush_range(unsigned long start_address, unsigned long end_address);
15extern void blackfin_dcache_flush_range(unsigned long start_address, unsigned long end_address); 16extern void blackfin_dcache_flush_range(unsigned long start_address, unsigned long end_address);
@@ -68,9 +69,11 @@ do { memcpy(dst, src, len); \
68#endif 69#endif
69#if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) || defined(CONFIG_BFIN_L2_WRITEBACK) 70#if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) || defined(CONFIG_BFIN_L2_WRITEBACK)
70# define flush_dcache_range(start,end) blackfin_dcache_flush_range((start), (end)) 71# define flush_dcache_range(start,end) blackfin_dcache_flush_range((start), (end))
72#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
71# define flush_dcache_page(page) blackfin_dflush_page(page_address(page)) 73# define flush_dcache_page(page) blackfin_dflush_page(page_address(page))
72#else 74#else
73# define flush_dcache_range(start,end) do { } while (0) 75# define flush_dcache_range(start,end) do { } while (0)
76#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
74# define flush_dcache_page(page) do { } while (0) 77# define flush_dcache_page(page) do { } while (0)
75#endif 78#endif
76 79
diff --git a/arch/blackfin/include/asm/checksum.h b/arch/blackfin/include/asm/checksum.h
index a23415be0de1..623cc7fb00bc 100644
--- a/arch/blackfin/include/asm/checksum.h
+++ b/arch/blackfin/include/asm/checksum.h
@@ -9,63 +9,12 @@
9#define _BFIN_CHECKSUM_H 9#define _BFIN_CHECKSUM_H
10 10
11/* 11/*
12 * computes the checksum of a memory block at buff, length len,
13 * and adds in "sum" (32-bit)
14 *
15 * returns a 32-bit number suitable for feeding into itself
16 * or csum_tcpudp_magic
17 *
18 * this function must be called with even lengths, except
19 * for the last fragment, which may be odd
20 *
21 * it's best to have buff aligned on a 32-bit boundary
22 */
23__wsum csum_partial(const void *buff, int len, __wsum sum);
24
25/*
26 * the same as csum_partial, but copies from src while it
27 * checksums
28 *
29 * here even more important to align src and dst on a 32-bit (or even
30 * better 64-bit) boundary
31 */
32
33__wsum csum_partial_copy(const void *src, void *dst,
34 int len, __wsum sum);
35
36/*
37 * the same as csum_partial_copy, but copies from user space.
38 *
39 * here even more important to align src and dst on a 32-bit (or even
40 * better 64-bit) boundary
41 */
42
43extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
44 int len, __wsum sum, int *csum_err);
45
46#define csum_partial_copy_nocheck(src, dst, len, sum) \
47 csum_partial_copy((src), (dst), (len), (sum))
48
49__sum16 ip_fast_csum(unsigned char *iph, unsigned int ihl);
50
51/*
52 * Fold a partial checksum
53 */
54
55static inline __sum16 csum_fold(__wsum sum)
56{
57 while (sum >> 16)
58 sum = (sum & 0xffff) + (sum >> 16);
59 return ((~(sum << 16)) >> 16);
60}
61
62/*
63 * computes the checksum of the TCP/UDP pseudo-header 12 * computes the checksum of the TCP/UDP pseudo-header
64 * returns a 16-bit checksum, already complemented 13 * returns a 16-bit checksum, already complemented
65 */ 14 */
66 15
67static inline __wsum 16static inline __wsum
68csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 17__csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
69 unsigned short proto, __wsum sum) 18 unsigned short proto, __wsum sum)
70{ 19{
71 unsigned int carry; 20 unsigned int carry;
@@ -88,19 +37,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
88 37
89 return (sum); 38 return (sum);
90} 39}
40#define csum_tcpudp_nofold __csum_tcpudp_nofold
91 41
92static inline __sum16 42#include <asm-generic/checksum.h>
93csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
94 unsigned short proto, __wsum sum)
95{
96 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
97}
98
99/*
100 * this routine is used for miscellaneous IP-like checksums, mainly
101 * in icmp.c
102 */
103
104extern __sum16 ip_compute_csum(const void *buff, int len);
105 43
106#endif /* _BFIN_CHECKSUM_H */ 44#endif
diff --git a/arch/blackfin/include/asm/clocks.h b/arch/blackfin/include/asm/clocks.h
index f80dad5ff257..6f0b61852f58 100644
--- a/arch/blackfin/include/asm/clocks.h
+++ b/arch/blackfin/include/asm/clocks.h
@@ -9,6 +9,8 @@
9#ifndef _BFIN_CLOCKS_H 9#ifndef _BFIN_CLOCKS_H
10#define _BFIN_CLOCKS_H 10#define _BFIN_CLOCKS_H
11 11
12#include <asm/dpmc.h>
13
12#ifdef CONFIG_CCLK_DIV_1 14#ifdef CONFIG_CCLK_DIV_1
13# define CONFIG_CCLK_ACT_DIV CCLK_DIV1 15# define CONFIG_CCLK_ACT_DIV CCLK_DIV1
14# define CONFIG_CCLK_DIV 1 16# define CONFIG_CCLK_DIV 1
diff --git a/arch/blackfin/include/asm/context.S b/arch/blackfin/include/asm/context.S
index 5dffaf582a22..1f9060395a0a 100644
--- a/arch/blackfin/include/asm/context.S
+++ b/arch/blackfin/include/asm/context.S
@@ -73,6 +73,11 @@
73#else 73#else
74 cli r0; 74 cli r0;
75#endif 75#endif
76#ifdef CONFIG_TRACE_IRQFLAGS
77 sp += -12;
78 call _trace_hardirqs_off;
79 sp += 12;
80#endif
76 [--sp] = RETI; /*orig_pc*/ 81 [--sp] = RETI; /*orig_pc*/
77 /* Clear all L registers. */ 82 /* Clear all L registers. */
78 r0 = 0 (x); 83 r0 = 0 (x);
@@ -279,6 +284,13 @@
279 RETN = [sp++]; 284 RETN = [sp++];
280 RETX = [sp++]; 285 RETX = [sp++];
281 RETI = [sp++]; 286 RETI = [sp++];
287
288#ifdef CONFIG_TRACE_IRQFLAGS
289 sp += -12;
290 call _trace_hardirqs_on;
291 sp += 12;
292#endif
293
282 RETS = [sp++]; 294 RETS = [sp++];
283 295
284#ifdef CONFIG_SMP 296#ifdef CONFIG_SMP
@@ -374,3 +386,13 @@
374 386
375 (R7:0, P5:0) = [SP++]; 387 (R7:0, P5:0) = [SP++];
376.endm 388.endm
389
390.macro pseudo_long_call func:req, scratch:req
391#ifdef CONFIG_ROMKERNEL
392 \scratch\().l = \func;
393 \scratch\().h = \func;
394 call (\scratch);
395#else
396 call \func;
397#endif
398.endm
diff --git a/arch/blackfin/include/asm/cpu.h b/arch/blackfin/include/asm/cpu.h
index b191dc662bd8..16883e582e3c 100644
--- a/arch/blackfin/include/asm/cpu.h
+++ b/arch/blackfin/include/asm/cpu.h
@@ -17,8 +17,6 @@ struct blackfin_cpudata {
17 struct task_struct *idle; 17 struct task_struct *idle;
18 unsigned int imemctl; 18 unsigned int imemctl;
19 unsigned int dmemctl; 19 unsigned int dmemctl;
20 unsigned long dcache_invld_count;
21 unsigned long icache_invld_count;
22}; 20};
23 21
24DECLARE_PER_CPU(struct blackfin_cpudata, cpu_data); 22DECLARE_PER_CPU(struct blackfin_cpudata, cpu_data);
diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h
index 25906468622f..f342ff0319df 100644
--- a/arch/blackfin/include/asm/def_LPBlackfin.h
+++ b/arch/blackfin/include/asm/def_LPBlackfin.h
@@ -12,6 +12,8 @@
12#include <mach/anomaly.h> 12#include <mach/anomaly.h>
13 13
14#define MK_BMSK_(x) (1<<x) 14#define MK_BMSK_(x) (1<<x)
15#define BFIN_DEPOSIT(mask, x) (((x) << __ffs(mask)) & (mask))
16#define BFIN_EXTRACT(mask, x) (((x) & (mask)) >> __ffs(mask))
15 17
16#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
17 19
@@ -23,62 +25,30 @@
23# define NOP_PAD_ANOMALY_05000198 25# define NOP_PAD_ANOMALY_05000198
24#endif 26#endif
25 27
26#define bfin_read8(addr) ({ \ 28#define _bfin_readX(addr, size, asm_size, asm_ext) ({ \
27 uint32_t __v; \ 29 u32 __v; \
28 __asm__ __volatile__( \ 30 __asm__ __volatile__( \
29 NOP_PAD_ANOMALY_05000198 \ 31 NOP_PAD_ANOMALY_05000198 \
30 "%0 = b[%1] (z);" \ 32 "%0 = " #asm_size "[%1]" #asm_ext ";" \
31 : "=d" (__v) \ 33 : "=d" (__v) \
32 : "a" (addr) \ 34 : "a" (addr) \
33 ); \ 35 ); \
34 __v; }) 36 __v; })
35 37#define _bfin_writeX(addr, val, size, asm_size) \
36#define bfin_read16(addr) ({ \
37 uint32_t __v; \
38 __asm__ __volatile__( \
39 NOP_PAD_ANOMALY_05000198 \
40 "%0 = w[%1] (z);" \
41 : "=d" (__v) \
42 : "a" (addr) \
43 ); \
44 __v; })
45
46#define bfin_read32(addr) ({ \
47 uint32_t __v; \
48 __asm__ __volatile__( \
49 NOP_PAD_ANOMALY_05000198 \
50 "%0 = [%1];" \
51 : "=d" (__v) \
52 : "a" (addr) \
53 ); \
54 __v; })
55
56#define bfin_write8(addr, val) \
57 __asm__ __volatile__( \ 38 __asm__ __volatile__( \
58 NOP_PAD_ANOMALY_05000198 \ 39 NOP_PAD_ANOMALY_05000198 \
59 "b[%0] = %1;" \ 40 #asm_size "[%0] = %1;" \
60 : \ 41 : \
61 : "a" (addr), "d" ((uint8_t)(val)) \ 42 : "a" (addr), "d" ((u##size)(val)) \
62 : "memory" \ 43 : "memory" \
63 ) 44 )
64 45
65#define bfin_write16(addr, val) \ 46#define bfin_read8(addr) _bfin_readX(addr, 8, b, (z))
66 __asm__ __volatile__( \ 47#define bfin_read16(addr) _bfin_readX(addr, 16, w, (z))
67 NOP_PAD_ANOMALY_05000198 \ 48#define bfin_read32(addr) _bfin_readX(addr, 32, , )
68 "w[%0] = %1;" \ 49#define bfin_write8(addr, val) _bfin_writeX(addr, val, 8, b)
69 : \ 50#define bfin_write16(addr, val) _bfin_writeX(addr, val, 16, w)
70 : "a" (addr), "d" ((uint16_t)(val)) \ 51#define bfin_write32(addr, val) _bfin_writeX(addr, val, 32, )
71 : "memory" \
72 )
73
74#define bfin_write32(addr, val) \
75 __asm__ __volatile__( \
76 NOP_PAD_ANOMALY_05000198 \
77 "[%0] = %1;" \
78 : \
79 : "a" (addr), "d" (val) \
80 : "memory" \
81 )
82 52
83#endif /* __ASSEMBLY__ */ 53#endif /* __ASSEMBLY__ */
84 54
diff --git a/arch/blackfin/include/asm/delay.h b/arch/blackfin/include/asm/delay.h
index c31f91cc1d5d..171d8deb04a5 100644
--- a/arch/blackfin/include/asm/delay.h
+++ b/arch/blackfin/include/asm/delay.h
@@ -30,10 +30,22 @@ __asm__ __volatile__ (
30 30
31#define HZSCALE (268435456 / (1000000/HZ)) 31#define HZSCALE (268435456 / (1000000/HZ))
32 32
33static inline void udelay(unsigned long usecs) 33static inline unsigned long __to_delay(unsigned long scale)
34{ 34{
35 extern unsigned long loops_per_jiffy; 35 extern unsigned long loops_per_jiffy;
36 __delay((((usecs * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6); 36 return (((scale * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6;
37}
38
39static inline void udelay(unsigned long usecs)
40{
41 __delay(__to_delay(usecs));
37} 42}
38 43
44static inline void ndelay(unsigned long nsecs)
45{
46 __delay(__to_delay(1) * nsecs / 1000);
47}
48
49#define ndelay ndelay
50
39#endif 51#endif
diff --git a/arch/blackfin/include/asm/dma-mapping.h b/arch/blackfin/include/asm/dma-mapping.h
index 7a23d824ac96..212cb80fd74b 100644
--- a/arch/blackfin/include/asm/dma-mapping.h
+++ b/arch/blackfin/include/asm/dma-mapping.h
@@ -7,9 +7,9 @@
7#ifndef _BLACKFIN_DMA_MAPPING_H 7#ifndef _BLACKFIN_DMA_MAPPING_H
8#define _BLACKFIN_DMA_MAPPING_H 8#define _BLACKFIN_DMA_MAPPING_H
9 9
10#include <asm/scatterlist.h> 10#include <asm/cacheflush.h>
11struct scatterlist;
11 12
12void dma_alloc_init(unsigned long start, unsigned long end);
13void *dma_alloc_coherent(struct device *dev, size_t size, 13void *dma_alloc_coherent(struct device *dev, size_t size,
14 dma_addr_t *dma_handle, gfp_t gfp); 14 dma_addr_t *dma_handle, gfp_t gfp);
15void dma_free_coherent(struct device *dev, size_t size, void *vaddr, 15void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
@@ -20,22 +20,61 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
20 */ 20 */
21#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 21#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
22#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 22#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
23#define dma_supported(d, m) (1)
24#define dma_get_cache_alignment() (32)
25#define dma_is_consistent(d, h) (1)
23 26
24static inline 27static inline int
25int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 28dma_set_mask(struct device *dev, u64 dma_mask)
26{ 29{
30 if (!dev->dma_mask || !dma_supported(dev, dma_mask))
31 return -EIO;
32
33 *dev->dma_mask = dma_mask;
34
27 return 0; 35 return 0;
28} 36}
29 37
30/* 38static inline int
31 * Map a single buffer of the indicated size for DMA in streaming mode. 39dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
32 * The 32-bit bus address to use is returned. 40{
33 * 41 return 0;
34 * Once the device is given the dma address, the device owns this memory 42}
35 * until either pci_unmap_single or pci_dma_sync_single is performed. 43
36 */ 44extern void
37extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, 45__dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir);
38 enum dma_data_direction direction); 46static inline void
47__dma_sync_inline(dma_addr_t addr, size_t size, enum dma_data_direction dir)
48{
49 switch (dir) {
50 case DMA_NONE:
51 BUG();
52 case DMA_TO_DEVICE: /* writeback only */
53 flush_dcache_range(addr, addr + size);
54 break;
55 case DMA_FROM_DEVICE: /* invalidate only */
56 case DMA_BIDIRECTIONAL: /* flush and invalidate */
57 /* Blackfin has no dedicated invalidate (it includes a flush) */
58 invalidate_dcache_range(addr, addr + size);
59 break;
60 }
61}
62static inline void
63_dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
64{
65 if (__builtin_constant_p(dir))
66 __dma_sync_inline(addr, size, dir);
67 else
68 __dma_sync(addr, size, dir);
69}
70
71static inline dma_addr_t
72dma_map_single(struct device *dev, void *ptr, size_t size,
73 enum dma_data_direction dir)
74{
75 _dma_sync((dma_addr_t)ptr, size, dir);
76 return (dma_addr_t) ptr;
77}
39 78
40static inline dma_addr_t 79static inline dma_addr_t
41dma_map_page(struct device *dev, struct page *page, 80dma_map_page(struct device *dev, struct page *page,
@@ -45,16 +84,12 @@ dma_map_page(struct device *dev, struct page *page,
45 return dma_map_single(dev, page_address(page) + offset, size, dir); 84 return dma_map_single(dev, page_address(page) + offset, size, dir);
46} 85}
47 86
48/* 87static inline void
49 * Unmap a single streaming mode DMA translation. The dma_addr and size 88dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
50 * must match what was provided for in a previous pci_map_single call. All 89 enum dma_data_direction dir)
51 * other usages are undefined. 90{
52 * 91 BUG_ON(!valid_dma_direction(dir));
53 * After this call, reads by the cpu to the buffer are guarenteed to see 92}
54 * whatever the device wrote there.
55 */
56extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
57 enum dma_data_direction direction);
58 93
59static inline void 94static inline void
60dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, 95dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,
@@ -63,55 +98,62 @@ dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,
63 dma_unmap_single(dev, dma_addr, size, dir); 98 dma_unmap_single(dev, dma_addr, size, dir);
64} 99}
65 100
66/*
67 * Map a set of buffers described by scatterlist in streaming
68 * mode for DMA. This is the scather-gather version of the
69 * above pci_map_single interface. Here the scatter gather list
70 * elements are each tagged with the appropriate dma address
71 * and length. They are obtained via sg_dma_{address,length}(SG).
72 *
73 * NOTE: An implementation may be able to use a smaller number of
74 * DMA address/length pairs than there are SG table elements.
75 * (for example via virtual mapping capabilities)
76 * The routine returns the number of addr/length pairs actually
77 * used, at most nents.
78 *
79 * Device ownership issues as mentioned above for pci_map_single are
80 * the same here.
81 */
82extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 101extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
83 enum dma_data_direction direction); 102 enum dma_data_direction dir);
84 103
85/* 104static inline void
86 * Unmap a set of streaming mode DMA translations. 105dma_unmap_sg(struct device *dev, struct scatterlist *sg,
87 * Again, cpu read rules concerning calls here are the same as for 106 int nhwentries, enum dma_data_direction dir)
88 * pci_unmap_single() above. 107{
89 */ 108 BUG_ON(!valid_dma_direction(dir));
90extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 109}
91 int nhwentries, enum dma_data_direction direction); 110
111static inline void
112dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t handle,
113 unsigned long offset, size_t size,
114 enum dma_data_direction dir)
115{
116 BUG_ON(!valid_dma_direction(dir));
117}
118
119static inline void
120dma_sync_single_range_for_device(struct device *dev, dma_addr_t handle,
121 unsigned long offset, size_t size,
122 enum dma_data_direction dir)
123{
124 _dma_sync(handle + offset, size, dir);
125}
92 126
93static inline void dma_sync_single_for_cpu(struct device *dev, 127static inline void
94 dma_addr_t handle, size_t size, 128dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, size_t size,
95 enum dma_data_direction dir) 129 enum dma_data_direction dir)
96{ 130{
131 dma_sync_single_range_for_cpu(dev, handle, 0, size, dir);
97} 132}
98 133
99static inline void dma_sync_single_for_device(struct device *dev, 134static inline void
100 dma_addr_t handle, size_t size, 135dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size,
101 enum dma_data_direction dir) 136 enum dma_data_direction dir)
102{ 137{
138 dma_sync_single_range_for_device(dev, handle, 0, size, dir);
103} 139}
104 140
105static inline void dma_sync_sg_for_cpu(struct device *dev, 141static inline void
106 struct scatterlist *sg, 142dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
107 int nents, enum dma_data_direction dir) 143 enum dma_data_direction dir)
108{ 144{
145 BUG_ON(!valid_dma_direction(dir));
109} 146}
110 147
111static inline void dma_sync_sg_for_device(struct device *dev, 148extern void
112 struct scatterlist *sg, 149dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
113 int nents, enum dma_data_direction dir) 150 int nents, enum dma_data_direction dir);
151
152static inline void
153dma_cache_sync(struct device *dev, void *vaddr, size_t size,
154 enum dma_data_direction dir)
114{ 155{
156 _dma_sync((dma_addr_t)vaddr, size, dir);
115} 157}
116 158
117#endif /* _BLACKFIN_DMA_MAPPING_H */ 159#endif /* _BLACKFIN_DMA_MAPPING_H */
diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h
index c9a59622e23f..2c09b1d50ec9 100644
--- a/arch/blackfin/include/asm/dma.h
+++ b/arch/blackfin/include/asm/dma.h
@@ -10,46 +10,70 @@
10 10
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <mach/dma.h> 12#include <mach/dma.h>
13#include <asm/atomic.h>
13#include <asm/blackfin.h> 14#include <asm/blackfin.h>
14#include <asm/page.h> 15#include <asm/page.h>
15 16#include <asm-generic/dma.h>
16#define MAX_DMA_ADDRESS PAGE_OFFSET 17
17 18/* DMA_CONFIG Masks */
18/***************************************************************************** 19#define DMAEN 0x0001 /* DMA Channel Enable */
19* Generic DMA Declarations 20#define WNR 0x0002 /* Channel Direction (W/R*) */
20* 21#define WDSIZE_8 0x0000 /* Transfer Word Size = 8 */
21****************************************************************************/ 22#define WDSIZE_16 0x0004 /* Transfer Word Size = 16 */
22enum dma_chan_status { 23#define WDSIZE_32 0x0008 /* Transfer Word Size = 32 */
23 DMA_CHANNEL_FREE, 24#define DMA2D 0x0010 /* DMA Mode (2D/1D*) */
24 DMA_CHANNEL_REQUESTED, 25#define RESTART 0x0020 /* DMA Buffer Clear */
25 DMA_CHANNEL_ENABLED, 26#define DI_SEL 0x0040 /* Data Interrupt Timing Select */
26}; 27#define DI_EN 0x0080 /* Data Interrupt Enable */
28#define NDSIZE_0 0x0000 /* Next Descriptor Size = 0 (Stop/Autobuffer) */
29#define NDSIZE_1 0x0100 /* Next Descriptor Size = 1 */
30#define NDSIZE_2 0x0200 /* Next Descriptor Size = 2 */
31#define NDSIZE_3 0x0300 /* Next Descriptor Size = 3 */
32#define NDSIZE_4 0x0400 /* Next Descriptor Size = 4 */
33#define NDSIZE_5 0x0500 /* Next Descriptor Size = 5 */
34#define NDSIZE_6 0x0600 /* Next Descriptor Size = 6 */
35#define NDSIZE_7 0x0700 /* Next Descriptor Size = 7 */
36#define NDSIZE_8 0x0800 /* Next Descriptor Size = 8 */
37#define NDSIZE_9 0x0900 /* Next Descriptor Size = 9 */
38#define NDSIZE 0x0f00 /* Next Descriptor Size */
39#define DMAFLOW 0x7000 /* Flow Control */
40#define DMAFLOW_STOP 0x0000 /* Stop Mode */
41#define DMAFLOW_AUTO 0x1000 /* Autobuffer Mode */
42#define DMAFLOW_ARRAY 0x4000 /* Descriptor Array Mode */
43#define DMAFLOW_SMALL 0x6000 /* Small Model Descriptor List Mode */
44#define DMAFLOW_LARGE 0x7000 /* Large Model Descriptor List Mode */
45
46/* DMA_IRQ_STATUS Masks */
47#define DMA_DONE 0x0001 /* DMA Completion Interrupt Status */
48#define DMA_ERR 0x0002 /* DMA Error Interrupt Status */
49#define DFETCH 0x0004 /* DMA Descriptor Fetch Indicator */
50#define DMA_RUN 0x0008 /* DMA Channel Running Indicator */
27 51
28/*------------------------- 52/*-------------------------
29 * config reg bits value 53 * config reg bits value
30 *-------------------------*/ 54 *-------------------------*/
31#define DATA_SIZE_8 0 55#define DATA_SIZE_8 0
32#define DATA_SIZE_16 1 56#define DATA_SIZE_16 1
33#define DATA_SIZE_32 2 57#define DATA_SIZE_32 2
34 58
35#define DMA_FLOW_STOP 0 59#define DMA_FLOW_STOP 0
36#define DMA_FLOW_AUTO 1 60#define DMA_FLOW_AUTO 1
37#define DMA_FLOW_ARRAY 4 61#define DMA_FLOW_ARRAY 4
38#define DMA_FLOW_SMALL 6 62#define DMA_FLOW_SMALL 6
39#define DMA_FLOW_LARGE 7 63#define DMA_FLOW_LARGE 7
40 64
41#define DIMENSION_LINEAR 0 65#define DIMENSION_LINEAR 0
42#define DIMENSION_2D 1 66#define DIMENSION_2D 1
43 67
44#define DIR_READ 0 68#define DIR_READ 0
45#define DIR_WRITE 1 69#define DIR_WRITE 1
46 70
47#define INTR_DISABLE 0 71#define INTR_DISABLE 0
48#define INTR_ON_BUF 2 72#define INTR_ON_BUF 2
49#define INTR_ON_ROW 3 73#define INTR_ON_ROW 3
50 74
51#define DMA_NOSYNC_KEEP_DMA_BUF 0 75#define DMA_NOSYNC_KEEP_DMA_BUF 0
52#define DMA_SYNC_RESTART 1 76#define DMA_SYNC_RESTART 1
53 77
54struct dmasg { 78struct dmasg {
55 void *next_desc_addr; 79 void *next_desc_addr;
@@ -104,11 +128,9 @@ struct dma_register {
104 128
105}; 129};
106 130
107struct mutex;
108struct dma_channel { 131struct dma_channel {
109 struct mutex dmalock;
110 const char *device_id; 132 const char *device_id;
111 enum dma_chan_status chan_status; 133 atomic_t chan_status;
112 volatile struct dma_register *regs; 134 volatile struct dma_register *regs;
113 struct dmasg *sg; /* large mode descriptor */ 135 struct dmasg *sg; /* large mode descriptor */
114 unsigned int irq; 136 unsigned int irq;
@@ -220,33 +242,30 @@ static inline void set_dma_sg(unsigned int channel, struct dmasg *sg, int ndsize
220 242
221static inline int dma_channel_active(unsigned int channel) 243static inline int dma_channel_active(unsigned int channel)
222{ 244{
223 if (dma_ch[channel].chan_status == DMA_CHANNEL_FREE) 245 return atomic_read(&dma_ch[channel].chan_status);
224 return 0;
225 else
226 return 1;
227} 246}
228 247
229static inline void disable_dma(unsigned int channel) 248static inline void disable_dma(unsigned int channel)
230{ 249{
231 dma_ch[channel].regs->cfg &= ~DMAEN; 250 dma_ch[channel].regs->cfg &= ~DMAEN;
232 SSYNC(); 251 SSYNC();
233 dma_ch[channel].chan_status = DMA_CHANNEL_REQUESTED;
234} 252}
235static inline void enable_dma(unsigned int channel) 253static inline void enable_dma(unsigned int channel)
236{ 254{
237 dma_ch[channel].regs->curr_x_count = 0; 255 dma_ch[channel].regs->curr_x_count = 0;
238 dma_ch[channel].regs->curr_y_count = 0; 256 dma_ch[channel].regs->curr_y_count = 0;
239 dma_ch[channel].regs->cfg |= DMAEN; 257 dma_ch[channel].regs->cfg |= DMAEN;
240 dma_ch[channel].chan_status = DMA_CHANNEL_ENABLED;
241} 258}
242void free_dma(unsigned int channel);
243int request_dma(unsigned int channel, const char *device_id);
244int set_dma_callback(unsigned int channel, irq_handler_t callback, void *data); 259int set_dma_callback(unsigned int channel, irq_handler_t callback, void *data);
245 260
246static inline void dma_disable_irq(unsigned int channel) 261static inline void dma_disable_irq(unsigned int channel)
247{ 262{
248 disable_irq(dma_ch[channel].irq); 263 disable_irq(dma_ch[channel].irq);
249} 264}
265static inline void dma_disable_irq_nosync(unsigned int channel)
266{
267 disable_irq_nosync(dma_ch[channel].irq);
268}
250static inline void dma_enable_irq(unsigned int channel) 269static inline void dma_enable_irq(unsigned int channel)
251{ 270{
252 enable_irq(dma_ch[channel].irq); 271 enable_irq(dma_ch[channel].irq);
diff --git a/arch/blackfin/include/asm/dpmc.h b/arch/blackfin/include/asm/dpmc.h
index 925e66cb2d49..efcc3aebeae4 100644
--- a/arch/blackfin/include/asm/dpmc.h
+++ b/arch/blackfin/include/asm/dpmc.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Miscellaneous IOCTL commands for Dynamic Power Management Controller Driver 2 * Miscellaneous IOCTL commands for Dynamic Power Management Controller Driver
3 * 3 *
4 * Copyright (C) 2004-2008 Analog Device Inc. 4 * Copyright (C) 2004-2009 Analog Device Inc.
5 * 5 *
6 * Licensed under the GPL-2 6 * Licensed under the GPL-2
7 */ 7 */
@@ -9,7 +9,109 @@
9#ifndef _BLACKFIN_DPMC_H_ 9#ifndef _BLACKFIN_DPMC_H_
10#define _BLACKFIN_DPMC_H_ 10#define _BLACKFIN_DPMC_H_
11 11
12#ifdef __KERNEL__ 12/* PLL_CTL Masks */
13#define DF 0x0001 /* 0: PLL = CLKIN, 1: PLL = CLKIN/2 */
14#define PLL_OFF 0x0002 /* PLL Not Powered */
15#define STOPCK 0x0008 /* Core Clock Off */
16#define PDWN 0x0020 /* Enter Deep Sleep Mode */
17#ifdef __ADSPBF539__
18# define IN_DELAY 0x0014 /* Add 200ps Delay To EBIU Input Latches */
19# define OUT_DELAY 0x00C0 /* Add 200ps Delay To EBIU Output Signals */
20#else
21# define IN_DELAY 0x0040 /* Add 200ps Delay To EBIU Input Latches */
22# define OUT_DELAY 0x0080 /* Add 200ps Delay To EBIU Output Signals */
23#endif
24#define BYPASS 0x0100 /* Bypass the PLL */
25#define MSEL 0x7E00 /* Multiplier Select For CCLK/VCO Factors */
26#define SPORT_HYST 0x8000 /* Enable Additional Hysteresis on SPORT Input Pins */
27#define SET_MSEL(x) (((x)&0x3F) << 0x9) /* Set MSEL = 0-63 --> VCO = CLKIN*MSEL */
28
29/* PLL_DIV Masks */
30#define SSEL 0x000F /* System Select */
31#define CSEL 0x0030 /* Core Select */
32#define CSEL_DIV1 0x0000 /* CCLK = VCO / 1 */
33#define CSEL_DIV2 0x0010 /* CCLK = VCO / 2 */
34#define CSEL_DIV4 0x0020 /* CCLK = VCO / 4 */
35#define CSEL_DIV8 0x0030 /* CCLK = VCO / 8 */
36
37#define CCLK_DIV1 CSEL_DIV1
38#define CCLK_DIV2 CSEL_DIV2
39#define CCLK_DIV4 CSEL_DIV4
40#define CCLK_DIV8 CSEL_DIV8
41
42#define SET_SSEL(x) ((x) & 0xF) /* Set SSEL = 0-15 --> SCLK = VCO/SSEL */
43#define SCLK_DIV(x) (x) /* SCLK = VCO / x */
44
45/* PLL_STAT Masks */
46#define ACTIVE_PLLENABLED 0x0001 /* Processor In Active Mode With PLL Enabled */
47#define FULL_ON 0x0002 /* Processor In Full On Mode */
48#define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */
49#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */
50
51#define RTCWS 0x0400 /* RTC/Reset Wake-Up Status */
52#define CANWS 0x0800 /* CAN Wake-Up Status */
53#define USBWS 0x2000 /* USB Wake-Up Status */
54#define KPADWS 0x4000 /* Keypad Wake-Up Status */
55#define ROTWS 0x8000 /* Rotary Wake-Up Status */
56#define GPWS 0x1000 /* General-Purpose Wake-Up Status */
57
58/* VR_CTL Masks */
59#if defined(__ADSPBF52x__) || defined(__ADSPBF51x__)
60#define FREQ 0x3000 /* Switching Oscillator Frequency For Regulator */
61#define FREQ_1000 0x3000 /* Switching Frequency Is 1 MHz */
62#else
63#define FREQ 0x0003 /* Switching Oscillator Frequency For Regulator */
64#define FREQ_333 0x0001 /* Switching Frequency Is 333 kHz */
65#define FREQ_667 0x0002 /* Switching Frequency Is 667 kHz */
66#define FREQ_1000 0x0003 /* Switching Frequency Is 1 MHz */
67#endif
68#define HIBERNATE 0x0000 /* Powerdown/Bypass On-Board Regulation */
69
70#define GAIN 0x000C /* Voltage Level Gain */
71#define GAIN_5 0x0000 /* GAIN = 5 */
72#define GAIN_10 0x0004 /* GAIN = 1 */
73#define GAIN_20 0x0008 /* GAIN = 2 */
74#define GAIN_50 0x000C /* GAIN = 5 */
75
76#define VLEV 0x00F0 /* Internal Voltage Level */
77#ifdef __ADSPBF52x__
78#define VLEV_085 0x0040 /* VLEV = 0.85 V (-5% - +10% Accuracy) */
79#define VLEV_090 0x0050 /* VLEV = 0.90 V (-5% - +10% Accuracy) */
80#define VLEV_095 0x0060 /* VLEV = 0.95 V (-5% - +10% Accuracy) */
81#define VLEV_100 0x0070 /* VLEV = 1.00 V (-5% - +10% Accuracy) */
82#define VLEV_105 0x0080 /* VLEV = 1.05 V (-5% - +10% Accuracy) */
83#define VLEV_110 0x0090 /* VLEV = 1.10 V (-5% - +10% Accuracy) */
84#define VLEV_115 0x00A0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */
85#define VLEV_120 0x00B0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */
86#else
87#define VLEV_085 0x0060 /* VLEV = 0.85 V (-5% - +10% Accuracy) */
88#define VLEV_090 0x0070 /* VLEV = 0.90 V (-5% - +10% Accuracy) */
89#define VLEV_095 0x0080 /* VLEV = 0.95 V (-5% - +10% Accuracy) */
90#define VLEV_100 0x0090 /* VLEV = 1.00 V (-5% - +10% Accuracy) */
91#define VLEV_105 0x00A0 /* VLEV = 1.05 V (-5% - +10% Accuracy) */
92#define VLEV_110 0x00B0 /* VLEV = 1.10 V (-5% - +10% Accuracy) */
93#define VLEV_115 0x00C0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */
94#define VLEV_120 0x00D0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */
95#define VLEV_125 0x00E0 /* VLEV = 1.25 V (-5% - +10% Accuracy) */
96#define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */
97#endif
98
99#define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */
100#define CANWE 0x0200 /* Enable CAN Wakeup From Hibernate */
101#define PHYWE 0x0400 /* Enable PHY Wakeup From Hibernate */
102#define GPWE 0x0400 /* General-Purpose Wake-Up Enable */
103#define MXVRWE 0x0400 /* Enable MXVR Wakeup From Hibernate */
104#define KPADWE 0x1000 /* Keypad Wake-Up Enable */
105#define ROTWE 0x2000 /* Rotary Wake-Up Enable */
106#define CLKBUFOE 0x4000 /* CLKIN Buffer Output Enable */
107#define SCKELOW 0x8000 /* Do Not Drive SCKE High During Reset After Hibernate */
108
109#if defined(__ADSPBF52x__) || defined(__ADSPBF51x__)
110#define USBWE 0x0200 /* Enable USB Wakeup From Hibernate */
111#else
112#define USBWE 0x0800 /* Enable USB Wakeup From Hibernate */
113#endif
114
13#ifndef __ASSEMBLY__ 115#ifndef __ASSEMBLY__
14 116
15void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); 117void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
@@ -54,6 +156,5 @@ struct bfin_dpmc_platform_data {
54 w[P0 + (x - PLL_CTL)] = R0;\ 156 w[P0 + (x - PLL_CTL)] = R0;\
55 157
56#endif 158#endif
57#endif /* __KERNEL__ */
58 159
59#endif /*_BLACKFIN_DPMC_H_*/ 160#endif /*_BLACKFIN_DPMC_H_*/
diff --git a/arch/blackfin/include/asm/elf.h b/arch/blackfin/include/asm/elf.h
index 8e0764c81eaf..117713adea7f 100644
--- a/arch/blackfin/include/asm/elf.h
+++ b/arch/blackfin/include/asm/elf.h
@@ -22,12 +22,15 @@
22#define EF_BFIN_CODE_IN_L2 0x00000040 /* --code-in-l2 */ 22#define EF_BFIN_CODE_IN_L2 0x00000040 /* --code-in-l2 */
23#define EF_BFIN_DATA_IN_L2 0x00000080 /* --data-in-l2 */ 23#define EF_BFIN_DATA_IN_L2 0x00000080 /* --data-in-l2 */
24 24
25#if 1 /* core dumps not supported, but linux/elfcore.h needs these */
25typedef unsigned long elf_greg_t; 26typedef unsigned long elf_greg_t;
26 27
27#define ELF_NGREG 40 /* (sizeof(struct user_regs_struct) / sizeof(elf_greg_t)) */ 28#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
28typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 29typedef elf_greg_t elf_gregset_t[ELF_NGREG];
29 30
30typedef struct { } elf_fpregset_t; 31typedef struct { } elf_fpregset_t;
32#endif
33
31/* 34/*
32 * This is used to ensure we don't load something for the wrong architecture. 35 * This is used to ensure we don't load something for the wrong architecture.
33 */ 36 */
@@ -55,7 +58,9 @@ do { \
55 _regs->p2 = _dynamic_addr; \ 58 _regs->p2 = _dynamic_addr; \
56} while(0) 59} while(0)
57 60
58#define USE_ELF_CORE_DUMP 61#if 0
62#define CORE_DUMP_USE_REGSET
63#endif
59#define ELF_FDPIC_CORE_EFLAGS EF_BFIN_FDPIC 64#define ELF_FDPIC_CORE_EFLAGS EF_BFIN_FDPIC
60#define ELF_EXEC_PAGESIZE 4096 65#define ELF_EXEC_PAGESIZE 4096
61 66
diff --git a/arch/blackfin/include/asm/fcntl.h b/arch/blackfin/include/asm/fcntl.h
index 8727b2b382f1..251c911d59c1 100644
--- a/arch/blackfin/include/asm/fcntl.h
+++ b/arch/blackfin/include/asm/fcntl.h
@@ -7,8 +7,6 @@
7#ifndef _BFIN_FCNTL_H 7#ifndef _BFIN_FCNTL_H
8#define _BFIN_FCNTL_H 8#define _BFIN_FCNTL_H
9 9
10/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
11 located on an ext2 file system */
12#define O_DIRECTORY 040000 /* must be a directory */ 10#define O_DIRECTORY 040000 /* must be a directory */
13#define O_NOFOLLOW 0100000 /* don't follow links */ 11#define O_NOFOLLOW 0100000 /* don't follow links */
14#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ 12#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
diff --git a/arch/blackfin/include/asm/ftrace.h b/arch/blackfin/include/asm/ftrace.h
index 90c9b400ba6d..4cfe2d9ba7e8 100644
--- a/arch/blackfin/include/asm/ftrace.h
+++ b/arch/blackfin/include/asm/ftrace.h
@@ -10,4 +10,57 @@
10 10
11#define MCOUNT_INSN_SIZE 6 /* sizeof "[++sp] = rets; call __mcount;" */ 11#define MCOUNT_INSN_SIZE 6 /* sizeof "[++sp] = rets; call __mcount;" */
12 12
13#ifndef __ASSEMBLY__
14
15#ifdef CONFIG_FRAME_POINTER
16#include <linux/mm.h>
17
18extern inline void *return_address(unsigned int level)
19{
20 unsigned long *endstack, *fp, *ret_addr;
21 unsigned int current_level = 0;
22
23 if (level == 0)
24 return __builtin_return_address(0);
25
26 fp = (unsigned long *)__builtin_frame_address(0);
27 endstack = (unsigned long *)PAGE_ALIGN((unsigned long)&level);
28
29 while (((unsigned long)fp & 0x3) == 0 && fp &&
30 (fp + 1) < endstack && current_level < level) {
31 fp = (unsigned long *)*fp;
32 current_level++;
33 }
34
35 if (((unsigned long)fp & 0x3) == 0 && fp &&
36 (fp + 1) < endstack)
37 ret_addr = (unsigned long *)*(fp + 1);
38 else
39 ret_addr = NULL;
40
41 return ret_addr;
42}
43
44#else
45
46extern inline void *return_address(unsigned int level)
47{
48 return NULL;
49}
50
51#endif /* CONFIG_FRAME_POINTER */
52
53#define HAVE_ARCH_CALLER_ADDR
54
55/* inline function or macro may lead to unexpected result */
56#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
57#define CALLER_ADDR1 ((unsigned long)return_address(1))
58#define CALLER_ADDR2 ((unsigned long)return_address(2))
59#define CALLER_ADDR3 ((unsigned long)return_address(3))
60#define CALLER_ADDR4 ((unsigned long)return_address(4))
61#define CALLER_ADDR5 ((unsigned long)return_address(5))
62#define CALLER_ADDR6 ((unsigned long)return_address(6))
63
64#endif /* __ASSEMBLY__ */
65
13#endif 66#endif
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 5b44d05ca53e..91bd2d7b9d55 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -70,6 +70,8 @@
70 70
71#ifndef __ASSEMBLY__ 71#ifndef __ASSEMBLY__
72 72
73#include <linux/compiler.h>
74
73/*********************************************************** 75/***********************************************************
74* 76*
75* FUNCTIONS: Blackfin General Purpose Ports Access Functions 77* FUNCTIONS: Blackfin General Purpose Ports Access Functions
@@ -159,6 +161,11 @@ struct gpio_port_t {
159}; 161};
160#endif 162#endif
161 163
164#ifdef BFIN_SPECIAL_GPIO_BANKS
165void bfin_special_gpio_free(unsigned gpio);
166int bfin_special_gpio_request(unsigned gpio, const char *label);
167#endif
168
162#ifdef CONFIG_PM 169#ifdef CONFIG_PM
163 170
164unsigned int bfin_pm_standby_setup(void); 171unsigned int bfin_pm_standby_setup(void);
@@ -218,6 +225,9 @@ int bfin_gpio_direction_output(unsigned gpio, int value);
218int bfin_gpio_get_value(unsigned gpio); 225int bfin_gpio_get_value(unsigned gpio);
219void bfin_gpio_set_value(unsigned gpio, int value); 226void bfin_gpio_set_value(unsigned gpio, int value);
220 227
228#include <asm/irq.h>
229#include <asm/errno.h>
230
221#ifdef CONFIG_GPIOLIB 231#ifdef CONFIG_GPIOLIB
222#include <asm-generic/gpio.h> /* cansleep wrappers */ 232#include <asm-generic/gpio.h> /* cansleep wrappers */
223 233
@@ -242,6 +252,11 @@ static inline int gpio_cansleep(unsigned int gpio)
242 return __gpio_cansleep(gpio); 252 return __gpio_cansleep(gpio);
243} 253}
244 254
255static inline int gpio_to_irq(unsigned gpio)
256{
257 return __gpio_to_irq(gpio);
258}
259
245#else /* !CONFIG_GPIOLIB */ 260#else /* !CONFIG_GPIOLIB */
246 261
247static inline int gpio_request(unsigned gpio, const char *label) 262static inline int gpio_request(unsigned gpio, const char *label)
@@ -274,10 +289,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
274 return bfin_gpio_set_value(gpio, value); 289 return bfin_gpio_set_value(gpio, value);
275} 290}
276 291
277#include <asm-generic/gpio.h> /* cansleep wrappers */
278#endif /* !CONFIG_GPIOLIB */
279#include <asm/irq.h>
280
281static inline int gpio_to_irq(unsigned gpio) 292static inline int gpio_to_irq(unsigned gpio)
282{ 293{
283 if (likely(gpio < MAX_BLACKFIN_GPIOS)) 294 if (likely(gpio < MAX_BLACKFIN_GPIOS))
@@ -286,6 +297,9 @@ static inline int gpio_to_irq(unsigned gpio)
286 return -EINVAL; 297 return -EINVAL;
287} 298}
288 299
300#include <asm-generic/gpio.h> /* cansleep wrappers */
301#endif /* !CONFIG_GPIOLIB */
302
289static inline int irq_to_gpio(unsigned irq) 303static inline int irq_to_gpio(unsigned irq)
290{ 304{
291 return (irq - GPIO_IRQ_BASE); 305 return (irq - GPIO_IRQ_BASE);
diff --git a/arch/blackfin/include/asm/gptimers.h b/arch/blackfin/include/asm/gptimers.h
index 89f08decb8e0..c722acdda0d3 100644
--- a/arch/blackfin/include/asm/gptimers.h
+++ b/arch/blackfin/include/asm/gptimers.h
@@ -172,25 +172,25 @@
172 172
173/* The actual gptimer API */ 173/* The actual gptimer API */
174 174
175void set_gptimer_pwidth(int timer_id, uint32_t width); 175void set_gptimer_pwidth(unsigned int timer_id, uint32_t width);
176uint32_t get_gptimer_pwidth(int timer_id); 176uint32_t get_gptimer_pwidth(unsigned int timer_id);
177void set_gptimer_period(int timer_id, uint32_t period); 177void set_gptimer_period(unsigned int timer_id, uint32_t period);
178uint32_t get_gptimer_period(int timer_id); 178uint32_t get_gptimer_period(unsigned int timer_id);
179uint32_t get_gptimer_count(int timer_id); 179uint32_t get_gptimer_count(unsigned int timer_id);
180int get_gptimer_intr(int timer_id); 180int get_gptimer_intr(unsigned int timer_id);
181void clear_gptimer_intr(int timer_id); 181void clear_gptimer_intr(unsigned int timer_id);
182int get_gptimer_over(int timer_id); 182int get_gptimer_over(unsigned int timer_id);
183void clear_gptimer_over(int timer_id); 183void clear_gptimer_over(unsigned int timer_id);
184void set_gptimer_config(int timer_id, uint16_t config); 184void set_gptimer_config(unsigned int timer_id, uint16_t config);
185uint16_t get_gptimer_config(int timer_id); 185uint16_t get_gptimer_config(unsigned int timer_id);
186int get_gptimer_run(int timer_id); 186int get_gptimer_run(unsigned int timer_id);
187void set_gptimer_pulse_hi(int timer_id); 187void set_gptimer_pulse_hi(unsigned int timer_id);
188void clear_gptimer_pulse_hi(int timer_id); 188void clear_gptimer_pulse_hi(unsigned int timer_id);
189void enable_gptimers(uint16_t mask); 189void enable_gptimers(uint16_t mask);
190void disable_gptimers(uint16_t mask); 190void disable_gptimers(uint16_t mask);
191void disable_gptimers_sync(uint16_t mask); 191void disable_gptimers_sync(uint16_t mask);
192uint16_t get_enabled_gptimers(void); 192uint16_t get_enabled_gptimers(void);
193uint32_t get_gptimer_status(int group); 193uint32_t get_gptimer_status(unsigned int group);
194void set_gptimer_status(int group, uint32_t value); 194void set_gptimer_status(unsigned int group, uint32_t value);
195 195
196#endif 196#endif
diff --git a/arch/blackfin/include/asm/io.h b/arch/blackfin/include/asm/io.h
index d1f5029189a7..29e55b9d88bc 100644
--- a/arch/blackfin/include/asm/io.h
+++ b/arch/blackfin/include/asm/io.h
@@ -31,12 +31,14 @@ static inline unsigned char readb(const volatile void __iomem *addr)
31 unsigned int val; 31 unsigned int val;
32 int tmp; 32 int tmp;
33 33
34 __asm__ __volatile__ ("cli %1;\n\t" 34 __asm__ __volatile__ (
35 "NOP; NOP; SSYNC;\n\t" 35 "cli %1;"
36 "%0 = b [%2] (z);\n\t" 36 "NOP; NOP; SSYNC;"
37 "sti %1;\n\t" 37 "%0 = b [%2] (z);"
38 : "=d"(val), "=d"(tmp): "a"(addr) 38 "sti %1;"
39 ); 39 : "=d"(val), "=d"(tmp)
40 : "a"(addr)
41 );
40 42
41 return (unsigned char) val; 43 return (unsigned char) val;
42} 44}
@@ -46,12 +48,14 @@ static inline unsigned short readw(const volatile void __iomem *addr)
46 unsigned int val; 48 unsigned int val;
47 int tmp; 49 int tmp;
48 50
49 __asm__ __volatile__ ("cli %1;\n\t" 51 __asm__ __volatile__ (
50 "NOP; NOP; SSYNC;\n\t" 52 "cli %1;"
51 "%0 = w [%2] (z);\n\t" 53 "NOP; NOP; SSYNC;"
52 "sti %1;\n\t" 54 "%0 = w [%2] (z);"
53 : "=d"(val), "=d"(tmp): "a"(addr) 55 "sti %1;"
54 ); 56 : "=d"(val), "=d"(tmp)
57 : "a"(addr)
58 );
55 59
56 return (unsigned short) val; 60 return (unsigned short) val;
57} 61}
@@ -61,20 +65,23 @@ static inline unsigned int readl(const volatile void __iomem *addr)
61 unsigned int val; 65 unsigned int val;
62 int tmp; 66 int tmp;
63 67
64 __asm__ __volatile__ ("cli %1;\n\t" 68 __asm__ __volatile__ (
65 "NOP; NOP; SSYNC;\n\t" 69 "cli %1;"
66 "%0 = [%2];\n\t" 70 "NOP; NOP; SSYNC;"
67 "sti %1;\n\t" 71 "%0 = [%2];"
68 : "=d"(val), "=d"(tmp): "a"(addr) 72 "sti %1;"
69 ); 73 : "=d"(val), "=d"(tmp)
74 : "a"(addr)
75 );
76
70 return val; 77 return val;
71} 78}
72 79
73#endif /* __ASSEMBLY__ */ 80#endif /* __ASSEMBLY__ */
74 81
75#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b)) 82#define writeb(b, addr) (void)((*(volatile unsigned char *) (addr)) = (b))
76#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b)) 83#define writew(b, addr) (void)((*(volatile unsigned short *) (addr)) = (b))
77#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b)) 84#define writel(b, addr) (void)((*(volatile unsigned int *) (addr)) = (b))
78 85
79#define __raw_readb readb 86#define __raw_readb readb
80#define __raw_readw readw 87#define __raw_readw readw
@@ -82,9 +89,9 @@ static inline unsigned int readl(const volatile void __iomem *addr)
82#define __raw_writeb writeb 89#define __raw_writeb writeb
83#define __raw_writew writew 90#define __raw_writew writew
84#define __raw_writel writel 91#define __raw_writel writel
85#define memset_io(a,b,c) memset((void *)(a),(b),(c)) 92#define memset_io(a, b, c) memset((void *)(a), (b), (c))
86#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) 93#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
87#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) 94#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
88 95
89/* Convert "I/O port addresses" to actual addresses. i.e. ugly casts. */ 96/* Convert "I/O port addresses" to actual addresses. i.e. ugly casts. */
90#define __io(port) ((void *)(unsigned long)(port)) 97#define __io(port) ((void *)(unsigned long)(port))
@@ -92,30 +99,30 @@ static inline unsigned int readl(const volatile void __iomem *addr)
92#define inb(port) readb(__io(port)) 99#define inb(port) readb(__io(port))
93#define inw(port) readw(__io(port)) 100#define inw(port) readw(__io(port))
94#define inl(port) readl(__io(port)) 101#define inl(port) readl(__io(port))
95#define outb(x,port) writeb(x,__io(port)) 102#define outb(x, port) writeb(x, __io(port))
96#define outw(x,port) writew(x,__io(port)) 103#define outw(x, port) writew(x, __io(port))
97#define outl(x,port) writel(x,__io(port)) 104#define outl(x, port) writel(x, __io(port))
98 105
99#define inb_p(port) inb(__io(port)) 106#define inb_p(port) inb(__io(port))
100#define inw_p(port) inw(__io(port)) 107#define inw_p(port) inw(__io(port))
101#define inl_p(port) inl(__io(port)) 108#define inl_p(port) inl(__io(port))
102#define outb_p(x,port) outb(x,__io(port)) 109#define outb_p(x, port) outb(x, __io(port))
103#define outw_p(x,port) outw(x,__io(port)) 110#define outw_p(x, port) outw(x, __io(port))
104#define outl_p(x,port) outl(x,__io(port)) 111#define outl_p(x, port) outl(x, __io(port))
105 112
106#define ioread8_rep(a,d,c) readsb(a,d,c) 113#define ioread8_rep(a, d, c) readsb(a, d, c)
107#define ioread16_rep(a,d,c) readsw(a,d,c) 114#define ioread16_rep(a, d, c) readsw(a, d, c)
108#define ioread32_rep(a,d,c) readsl(a,d,c) 115#define ioread32_rep(a, d, c) readsl(a, d, c)
109#define iowrite8_rep(a,s,c) writesb(a,s,c) 116#define iowrite8_rep(a, s, c) writesb(a, s, c)
110#define iowrite16_rep(a,s,c) writesw(a,s,c) 117#define iowrite16_rep(a, s, c) writesw(a, s, c)
111#define iowrite32_rep(a,s,c) writesl(a,s,c) 118#define iowrite32_rep(a, s, c) writesl(a, s, c)
112 119
113#define ioread8(X) readb(X) 120#define ioread8(x) readb(x)
114#define ioread16(X) readw(X) 121#define ioread16(x) readw(x)
115#define ioread32(X) readl(X) 122#define ioread32(x) readl(x)
116#define iowrite8(val,X) writeb(val,X) 123#define iowrite8(val, x) writeb(val, x)
117#define iowrite16(val,X) writew(val,X) 124#define iowrite16(val, x) writew(val, x)
118#define iowrite32(val,X) writel(val,X) 125#define iowrite32(val, x) writel(val, x)
119 126
120#define mmiowb() wmb() 127#define mmiowb() wmb()
121 128
diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h
index 4617ba66278f..d3b40449ca0e 100644
--- a/arch/blackfin/include/asm/ipipe.h
+++ b/arch/blackfin/include/asm/ipipe.h
@@ -35,9 +35,9 @@
35#include <asm/atomic.h> 35#include <asm/atomic.h>
36#include <asm/traps.h> 36#include <asm/traps.h>
37 37
38#define IPIPE_ARCH_STRING "1.11-00" 38#define IPIPE_ARCH_STRING "1.12-00"
39#define IPIPE_MAJOR_NUMBER 1 39#define IPIPE_MAJOR_NUMBER 1
40#define IPIPE_MINOR_NUMBER 11 40#define IPIPE_MINOR_NUMBER 12
41#define IPIPE_PATCH_NUMBER 0 41#define IPIPE_PATCH_NUMBER 0
42 42
43#ifdef CONFIG_SMP 43#ifdef CONFIG_SMP
@@ -124,16 +124,6 @@ static inline int __ipipe_check_tickdev(const char *devname)
124 return 1; 124 return 1;
125} 125}
126 126
127static inline void __ipipe_lock_root(void)
128{
129 set_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status));
130}
131
132static inline void __ipipe_unlock_root(void)
133{
134 clear_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status));
135}
136
137void __ipipe_enable_pipeline(void); 127void __ipipe_enable_pipeline(void);
138 128
139#define __ipipe_hook_critical_ipi(ipd) do { } while (0) 129#define __ipipe_hook_critical_ipi(ipd) do { } while (0)
diff --git a/arch/blackfin/include/asm/ipipe_base.h b/arch/blackfin/include/asm/ipipe_base.h
index 490098f532a7..00409201d9ed 100644
--- a/arch/blackfin/include/asm/ipipe_base.h
+++ b/arch/blackfin/include/asm/ipipe_base.h
@@ -51,23 +51,15 @@
51 51
52extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */ 52extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */
53 53
54#define __ipipe_stall_root() \ 54void __ipipe_stall_root(void);
55 do { \ 55
56 volatile unsigned long *p = &__ipipe_root_status; \ 56unsigned long __ipipe_test_and_stall_root(void);
57 set_bit(0, p); \ 57
58 } while (0) 58unsigned long __ipipe_test_root(void);
59 59
60#define __ipipe_test_and_stall_root() \ 60void __ipipe_lock_root(void);
61 ({ \ 61
62 volatile unsigned long *p = &__ipipe_root_status; \ 62void __ipipe_unlock_root(void);
63 test_and_set_bit(0, p); \
64 })
65
66#define __ipipe_test_root() \
67 ({ \
68 const unsigned long *p = &__ipipe_root_status; \
69 test_bit(0, p); \
70 })
71 63
72#endif /* !__ASSEMBLY__ */ 64#endif /* !__ASSEMBLY__ */
73 65
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h
index e7c0623f9091..12f4060a31b0 100644
--- a/arch/blackfin/include/asm/irq.h
+++ b/arch/blackfin/include/asm/irq.h
@@ -12,6 +12,9 @@
12 12
13#include <linux/irqflags.h> 13#include <linux/irqflags.h>
14 14
15/* IRQs that may be used by external irq_chip controllers */
16#define NR_SPARE_IRQS 32
17
15#include <mach/anomaly.h> 18#include <mach/anomaly.h>
16 19
17/* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h> */ 20/* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h> */
@@ -35,4 +38,8 @@
35 38
36#include <asm-generic/irq.h> 39#include <asm-generic/irq.h>
37 40
41#ifdef CONFIG_NMI_WATCHDOG
42# define ARCH_HAS_NMI_WATCHDOG
43#endif
44
38#endif /* _BFIN_IRQ_H_ */ 45#endif /* _BFIN_IRQ_H_ */
diff --git a/arch/blackfin/include/asm/irqflags.h b/arch/blackfin/include/asm/irqflags.h
index 9b19a19d9ae9..813a1af3e865 100644
--- a/arch/blackfin/include/asm/irqflags.h
+++ b/arch/blackfin/include/asm/irqflags.h
@@ -33,6 +33,7 @@ static inline unsigned long bfin_cli(void)
33 33
34#ifdef CONFIG_IPIPE 34#ifdef CONFIG_IPIPE
35 35
36#include <linux/compiler.h>
36#include <linux/ipipe_base.h> 37#include <linux/ipipe_base.h>
37#include <linux/ipipe_trace.h> 38#include <linux/ipipe_trace.h>
38 39
@@ -49,12 +50,12 @@ static inline unsigned long bfin_cli(void)
49 barrier(); \ 50 barrier(); \
50 } while (0) 51 } while (0)
51 52
52static inline void raw_local_irq_enable(void) 53#define raw_local_irq_enable() \
53{ 54 do { \
54 barrier(); 55 barrier(); \
55 ipipe_check_context(ipipe_root_domain); 56 ipipe_check_context(ipipe_root_domain); \
56 __ipipe_unstall_root(); 57 __ipipe_unstall_root(); \
57} 58 } while (0)
58 59
59#define raw_local_save_flags_ptr(x) \ 60#define raw_local_save_flags_ptr(x) \
60 do { \ 61 do { \
diff --git a/arch/blackfin/include/asm/kgdb.h b/arch/blackfin/include/asm/kgdb.h
index c8b256d2ea30..8651afe12990 100644
--- a/arch/blackfin/include/asm/kgdb.h
+++ b/arch/blackfin/include/asm/kgdb.h
@@ -10,9 +10,6 @@
10 10
11#include <linux/ptrace.h> 11#include <linux/ptrace.h>
12 12
13/* gdb locks */
14#define KGDB_MAX_NO_CPUS 8
15
16/* 13/*
17 * BUFMAX defines the maximum number of characters in inbound/outbound buffers. 14 * BUFMAX defines the maximum number of characters in inbound/outbound buffers.
18 * At least NUMREGBYTES*2 are needed for register packets. 15 * At least NUMREGBYTES*2 are needed for register packets.
diff --git a/arch/blackfin/include/asm/mem_init.h b/arch/blackfin/include/asm/mem_init.h
index 4179e329b9c9..7c8fe834ff22 100644
--- a/arch/blackfin/include/asm/mem_init.h
+++ b/arch/blackfin/include/asm/mem_init.h
@@ -295,156 +295,3 @@
295#else 295#else
296#define PLL_BYPASS 0 296#define PLL_BYPASS 0
297#endif 297#endif
298
299/***************************************Currently Not Being Used *********************************/
300
301#if defined(CONFIG_FLASH_SPEED_BWAT) && \
302defined(CONFIG_FLASH_SPEED_BRAT) && \
303defined(CONFIG_FLASH_SPEED_BHT) && \
304defined(CONFIG_FLASH_SPEED_BST) && \
305defined(CONFIG_FLASH_SPEED_BTT)
306
307#define flash_EBIU_AMBCTL_WAT ((CONFIG_FLASH_SPEED_BWAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
308#define flash_EBIU_AMBCTL_RAT ((CONFIG_FLASH_SPEED_BRAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
309#define flash_EBIU_AMBCTL_HT ((CONFIG_FLASH_SPEED_BHT * 4) / (4000000000 / CONFIG_SCLK_HZ))
310#define flash_EBIU_AMBCTL_ST ((CONFIG_FLASH_SPEED_BST * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
311#define flash_EBIU_AMBCTL_TT ((CONFIG_FLASH_SPEED_BTT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
312
313#if (flash_EBIU_AMBCTL_TT > 3)
314#define flash_EBIU_AMBCTL0_TT B0TT_4
315#endif
316#if (flash_EBIU_AMBCTL_TT == 3)
317#define flash_EBIU_AMBCTL0_TT B0TT_3
318#endif
319#if (flash_EBIU_AMBCTL_TT == 2)
320#define flash_EBIU_AMBCTL0_TT B0TT_2
321#endif
322#if (flash_EBIU_AMBCTL_TT < 2)
323#define flash_EBIU_AMBCTL0_TT B0TT_1
324#endif
325
326#if (flash_EBIU_AMBCTL_ST > 3)
327#define flash_EBIU_AMBCTL0_ST B0ST_4
328#endif
329#if (flash_EBIU_AMBCTL_ST == 3)
330#define flash_EBIU_AMBCTL0_ST B0ST_3
331#endif
332#if (flash_EBIU_AMBCTL_ST == 2)
333#define flash_EBIU_AMBCTL0_ST B0ST_2
334#endif
335#if (flash_EBIU_AMBCTL_ST < 2)
336#define flash_EBIU_AMBCTL0_ST B0ST_1
337#endif
338
339#if (flash_EBIU_AMBCTL_HT > 2)
340#define flash_EBIU_AMBCTL0_HT B0HT_3
341#endif
342#if (flash_EBIU_AMBCTL_HT == 2)
343#define flash_EBIU_AMBCTL0_HT B0HT_2
344#endif
345#if (flash_EBIU_AMBCTL_HT == 1)
346#define flash_EBIU_AMBCTL0_HT B0HT_1
347#endif
348#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT == 0)
349#define flash_EBIU_AMBCTL0_HT B0HT_0
350#endif
351#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT != 0)
352#define flash_EBIU_AMBCTL0_HT B0HT_1
353#endif
354
355#if (flash_EBIU_AMBCTL_WAT > 14)
356#define flash_EBIU_AMBCTL0_WAT B0WAT_15
357#endif
358#if (flash_EBIU_AMBCTL_WAT == 14)
359#define flash_EBIU_AMBCTL0_WAT B0WAT_14
360#endif
361#if (flash_EBIU_AMBCTL_WAT == 13)
362#define flash_EBIU_AMBCTL0_WAT B0WAT_13
363#endif
364#if (flash_EBIU_AMBCTL_WAT == 12)
365#define flash_EBIU_AMBCTL0_WAT B0WAT_12
366#endif
367#if (flash_EBIU_AMBCTL_WAT == 11)
368#define flash_EBIU_AMBCTL0_WAT B0WAT_11
369#endif
370#if (flash_EBIU_AMBCTL_WAT == 10)
371#define flash_EBIU_AMBCTL0_WAT B0WAT_10
372#endif
373#if (flash_EBIU_AMBCTL_WAT == 9)
374#define flash_EBIU_AMBCTL0_WAT B0WAT_9
375#endif
376#if (flash_EBIU_AMBCTL_WAT == 8)
377#define flash_EBIU_AMBCTL0_WAT B0WAT_8
378#endif
379#if (flash_EBIU_AMBCTL_WAT == 7)
380#define flash_EBIU_AMBCTL0_WAT B0WAT_7
381#endif
382#if (flash_EBIU_AMBCTL_WAT == 6)
383#define flash_EBIU_AMBCTL0_WAT B0WAT_6
384#endif
385#if (flash_EBIU_AMBCTL_WAT == 5)
386#define flash_EBIU_AMBCTL0_WAT B0WAT_5
387#endif
388#if (flash_EBIU_AMBCTL_WAT == 4)
389#define flash_EBIU_AMBCTL0_WAT B0WAT_4
390#endif
391#if (flash_EBIU_AMBCTL_WAT == 3)
392#define flash_EBIU_AMBCTL0_WAT B0WAT_3
393#endif
394#if (flash_EBIU_AMBCTL_WAT == 2)
395#define flash_EBIU_AMBCTL0_WAT B0WAT_2
396#endif
397#if (flash_EBIU_AMBCTL_WAT == 1)
398#define flash_EBIU_AMBCTL0_WAT B0WAT_1
399#endif
400
401#if (flash_EBIU_AMBCTL_RAT > 14)
402#define flash_EBIU_AMBCTL0_RAT B0RAT_15
403#endif
404#if (flash_EBIU_AMBCTL_RAT == 14)
405#define flash_EBIU_AMBCTL0_RAT B0RAT_14
406#endif
407#if (flash_EBIU_AMBCTL_RAT == 13)
408#define flash_EBIU_AMBCTL0_RAT B0RAT_13
409#endif
410#if (flash_EBIU_AMBCTL_RAT == 12)
411#define flash_EBIU_AMBCTL0_RAT B0RAT_12
412#endif
413#if (flash_EBIU_AMBCTL_RAT == 11)
414#define flash_EBIU_AMBCTL0_RAT B0RAT_11
415#endif
416#if (flash_EBIU_AMBCTL_RAT == 10)
417#define flash_EBIU_AMBCTL0_RAT B0RAT_10
418#endif
419#if (flash_EBIU_AMBCTL_RAT == 9)
420#define flash_EBIU_AMBCTL0_RAT B0RAT_9
421#endif
422#if (flash_EBIU_AMBCTL_RAT == 8)
423#define flash_EBIU_AMBCTL0_RAT B0RAT_8
424#endif
425#if (flash_EBIU_AMBCTL_RAT == 7)
426#define flash_EBIU_AMBCTL0_RAT B0RAT_7
427#endif
428#if (flash_EBIU_AMBCTL_RAT == 6)
429#define flash_EBIU_AMBCTL0_RAT B0RAT_6
430#endif
431#if (flash_EBIU_AMBCTL_RAT == 5)
432#define flash_EBIU_AMBCTL0_RAT B0RAT_5
433#endif
434#if (flash_EBIU_AMBCTL_RAT == 4)
435#define flash_EBIU_AMBCTL0_RAT B0RAT_4
436#endif
437#if (flash_EBIU_AMBCTL_RAT == 3)
438#define flash_EBIU_AMBCTL0_RAT B0RAT_3
439#endif
440#if (flash_EBIU_AMBCTL_RAT == 2)
441#define flash_EBIU_AMBCTL0_RAT B0RAT_2
442#endif
443#if (flash_EBIU_AMBCTL_RAT == 1)
444#define flash_EBIU_AMBCTL0_RAT B0RAT_1
445#endif
446
447#define flash_EBIU_AMBCTL0 \
448 (flash_EBIU_AMBCTL0_WAT | flash_EBIU_AMBCTL0_RAT | flash_EBIU_AMBCTL0_HT | \
449 flash_EBIU_AMBCTL0_ST | flash_EBIU_AMBCTL0_TT | CONFIG_FLASH_SPEED_RDYEN)
450#endif
diff --git a/arch/blackfin/include/asm/mmu_context.h b/arch/blackfin/include/asm/mmu_context.h
index 4a3be376ad5b..e1a9b4624f91 100644
--- a/arch/blackfin/include/asm/mmu_context.h
+++ b/arch/blackfin/include/asm/mmu_context.h
@@ -7,12 +7,13 @@
7#ifndef __BLACKFIN_MMU_CONTEXT_H__ 7#ifndef __BLACKFIN_MMU_CONTEXT_H__
8#define __BLACKFIN_MMU_CONTEXT_H__ 8#define __BLACKFIN_MMU_CONTEXT_H__
9 9
10#include <linux/gfp.h> 10#include <linux/slab.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <asm/setup.h> 12#include <asm/setup.h>
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
15#include <asm/cplbinit.h> 15#include <asm/cplbinit.h>
16#include <asm/sections.h>
16 17
17/* Note: L1 stacks are CPU-private things, so we bluntly disable this 18/* Note: L1 stacks are CPU-private things, so we bluntly disable this
18 feature in SMP mode, and use the per-CPU scratch SRAM bank only to 19 feature in SMP mode, and use the per-CPU scratch SRAM bank only to
@@ -66,8 +67,8 @@ activate_l1stack(struct mm_struct *mm, unsigned long sp_base)
66 67
67#define activate_mm(prev, next) switch_mm(prev, next, NULL) 68#define activate_mm(prev, next) switch_mm(prev, next, NULL)
68 69
69static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, 70static inline void __switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
70 struct task_struct *tsk) 71 struct task_struct *tsk)
71{ 72{
72#ifdef CONFIG_MPU 73#ifdef CONFIG_MPU
73 unsigned int cpu = smp_processor_id(); 74 unsigned int cpu = smp_processor_id();
@@ -95,14 +96,38 @@ static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_m
95#endif 96#endif
96} 97}
97 98
99#ifdef CONFIG_IPIPE
100#define lock_mm_switch(flags) local_irq_save_hw_cond(flags)
101#define unlock_mm_switch(flags) local_irq_restore_hw_cond(flags)
102#else
103#define lock_mm_switch(flags) do { (void)(flags); } while (0)
104#define unlock_mm_switch(flags) do { (void)(flags); } while (0)
105#endif /* CONFIG_IPIPE */
106
98#ifdef CONFIG_MPU 107#ifdef CONFIG_MPU
108static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
109 struct task_struct *tsk)
110{
111 unsigned long flags;
112 lock_mm_switch(flags);
113 __switch_mm(prev, next, tsk);
114 unlock_mm_switch(flags);
115}
116
99static inline void protect_page(struct mm_struct *mm, unsigned long addr, 117static inline void protect_page(struct mm_struct *mm, unsigned long addr,
100 unsigned long flags) 118 unsigned long flags)
101{ 119{
102 unsigned long *mask = mm->context.page_rwx_mask; 120 unsigned long *mask = mm->context.page_rwx_mask;
103 unsigned long page = addr >> 12; 121 unsigned long page;
104 unsigned long idx = page >> 5; 122 unsigned long idx;
105 unsigned long bit = 1 << (page & 31); 123 unsigned long bit;
124
125 if (unlikely(addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE))
126 page = (addr - (ASYNC_BANK0_BASE - _ramend)) >> 12;
127 else
128 page = addr >> 12;
129 idx = page >> 5;
130 bit = 1 << (page & 31);
106 131
107 if (flags & VM_READ) 132 if (flags & VM_READ)
108 mask[idx] |= bit; 133 mask[idx] |= bit;
@@ -128,6 +153,12 @@ static inline void update_protections(struct mm_struct *mm)
128 set_mask_dcplbs(mm->context.page_rwx_mask, cpu); 153 set_mask_dcplbs(mm->context.page_rwx_mask, cpu);
129 } 154 }
130} 155}
156#else /* !CONFIG_MPU */
157static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
158 struct task_struct *tsk)
159{
160 __switch_mm(prev, next, tsk);
161}
131#endif 162#endif
132 163
133static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 164static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
@@ -173,4 +204,10 @@ static inline void destroy_context(struct mm_struct *mm)
173#endif 204#endif
174} 205}
175 206
207#define ipipe_mm_switch_protect(flags) \
208 local_irq_save_hw_cond(flags)
209
210#define ipipe_mm_switch_unprotect(flags) \
211 local_irq_restore_hw_cond(flags)
212
176#endif 213#endif
diff --git a/arch/blackfin/include/asm/module.h b/arch/blackfin/include/asm/module.h
index 9c1cfffddd9b..4282b169ead9 100644
--- a/arch/blackfin/include/asm/module.h
+++ b/arch/blackfin/include/asm/module.h
@@ -7,8 +7,6 @@
7#ifndef _ASM_BFIN_MODULE_H 7#ifndef _ASM_BFIN_MODULE_H
8#define _ASM_BFIN_MODULE_H 8#define _ASM_BFIN_MODULE_H
9 9
10#define MODULE_SYMBOL_PREFIX "_"
11
12#define Elf_Shdr Elf32_Shdr 10#define Elf_Shdr Elf32_Shdr
13#define Elf_Sym Elf32_Sym 11#define Elf_Sym Elf32_Sym
14#define Elf_Ehdr Elf32_Ehdr 12#define Elf_Ehdr Elf32_Ehdr
diff --git a/arch/blackfin/include/asm/nand.h b/arch/blackfin/include/asm/nand.h
index 3ae8b569edfc..3a1e79dfc8d9 100644
--- a/arch/blackfin/include/asm/nand.h
+++ b/arch/blackfin/include/asm/nand.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * BF5XX - NAND flash controller platfrom_device info 2 * BF5XX - NAND flash controller platform_device info
3 * 3 *
4 * Copyright 2007-2008 Analog Devices, Inc. 4 * Copyright 2007-2008 Analog Devices, Inc.
5 * 5 *
@@ -8,7 +8,7 @@
8 8
9/* struct bf5xx_nand_platform 9/* struct bf5xx_nand_platform
10 * 10 *
11 * define a interface between platfrom board specific code and 11 * define a interface between platform board specific code and
12 * bf54x NFC driver. 12 * bf54x NFC driver.
13 * 13 *
14 * nr_partitions = number of partitions pointed to be partitoons (or zero) 14 * nr_partitions = number of partitions pointed to be partitoons (or zero)
diff --git a/arch/blackfin/include/asm/nmi.h b/arch/blackfin/include/asm/nmi.h
new file mode 100644
index 000000000000..b9caac4fcfd8
--- /dev/null
+++ b/arch/blackfin/include/asm/nmi.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright 2010 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2
5 */
6
7#ifndef _BFIN_NMI_H_
8#define _BFIN_NMI_H_
9
10#include <linux/nmi.h>
11
12#endif
diff --git a/arch/blackfin/include/asm/page.h b/arch/blackfin/include/asm/page.h
index 944a07c6cfd6..d0ce975bcd48 100644
--- a/arch/blackfin/include/asm/page.h
+++ b/arch/blackfin/include/asm/page.h
@@ -10,4 +10,12 @@
10#include <asm-generic/page.h> 10#include <asm-generic/page.h>
11#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 11#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
12 12
13#define VM_DATA_DEFAULT_FLAGS \
14 (VM_READ | VM_WRITE | \
15 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
16 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
17
18#include <asm-generic/memory_model.h>
19#include <asm-generic/getorder.h>
20
13#endif 21#endif
diff --git a/arch/blackfin/include/asm/pci.h b/arch/blackfin/include/asm/pci.h
index 61277358c865..99cae2e3bac7 100644
--- a/arch/blackfin/include/asm/pci.h
+++ b/arch/blackfin/include/asm/pci.h
@@ -4,145 +4,19 @@
4#define _ASM_BFIN_PCI_H 4#define _ASM_BFIN_PCI_H
5 5
6#include <asm/scatterlist.h> 6#include <asm/scatterlist.h>
7#include <asm-generic/pci-dma-compat.h>
8#include <asm-generic/pci.h>
7 9
8/*
9 *
10 * Written by Wout Klaren.
11 */
12
13/* Added by Chang Junxiao */
14#define PCIBIOS_MIN_IO 0x00001000 10#define PCIBIOS_MIN_IO 0x00001000
15#define PCIBIOS_MIN_MEM 0x10000000 11#define PCIBIOS_MIN_MEM 0x10000000
16 12
17#define PCI_DMA_BUS_IS_PHYS (1)
18struct pci_ops;
19
20/*
21 * Structure with hardware dependent information and functions of the
22 * PCI bus.
23 */
24struct pci_bus_info {
25
26 /*
27 * Resources of the PCI bus.
28 */
29 struct resource mem_space;
30 struct resource io_space;
31
32 /*
33 * System dependent functions.
34 */
35 struct pci_ops *bfin_pci_ops;
36 void (*fixup) (int pci_modify);
37 void (*conf_device) (unsigned char bus, unsigned char device_fn);
38};
39
40#define pcibios_assign_all_busses() 0
41static inline void pcibios_set_master(struct pci_dev *dev) 13static inline void pcibios_set_master(struct pci_dev *dev)
42{ 14{
43
44 /* No special bus mastering setup handling */ 15 /* No special bus mastering setup handling */
45} 16}
46static inline void pcibios_penalize_isa_irq(int irq) 17static inline void pcibios_penalize_isa_irq(int irq)
47{ 18{
48
49 /* We don't do dynamic PCI IRQ allocation */ 19 /* We don't do dynamic PCI IRQ allocation */
50} 20}
51static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
52 size_t size, int direction)
53{
54 if (direction == PCI_DMA_NONE)
55 BUG();
56
57 /* return virt_to_bus(ptr); */
58 return (dma_addr_t) ptr;
59}
60
61/* Unmap a single streaming mode DMA translation. The dma_addr and size
62 * must match what was provided for in a previous pci_map_single call. All
63 * other usages are undefined.
64 *
65 * After this call, reads by the cpu to the buffer are guarenteed to see
66 * whatever the device wrote there.
67 */
68static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
69 size_t size, int direction)
70{
71 if (direction == PCI_DMA_NONE)
72 BUG();
73
74 /* Nothing to do */
75}
76
77/* Map a set of buffers described by scatterlist in streaming
78 * mode for DMA. This is the scather-gather version of the
79 * above pci_map_single interface. Here the scatter gather list
80 * elements are each tagged with the appropriate dma address
81 * and length. They are obtained via sg_dma_{address,length}(SG).
82 *
83 * NOTE: An implementation may be able to use a smaller number of
84 * DMA address/length pairs than there are SG table elements.
85 * (for example via virtual mapping capabilities)
86 * The routine returns the number of addr/length pairs actually
87 * used, at most nents.
88 *
89 * Device ownership issues as mentioned above for pci_map_single are
90 * the same here.
91 */
92static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
93 int nents, int direction)
94{
95 if (direction == PCI_DMA_NONE)
96 BUG();
97 return nents;
98}
99
100/* Unmap a set of streaming mode DMA translations.
101 * Again, cpu read rules concerning calls here are the same as for
102 * pci_unmap_single() above.
103 */
104static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
105 int nents, int direction)
106{
107 if (direction == PCI_DMA_NONE)
108 BUG();
109
110 /* Nothing to do */
111}
112
113/* Make physical memory consistent for a single
114 * streaming mode DMA translation after a transfer.
115 *
116 * If you perform a pci_map_single() but wish to interrogate the
117 * buffer using the cpu, yet do not wish to teardown the PCI dma
118 * mapping, you must call this function before doing so. At the
119 * next point you give the PCI dma address back to the card, the
120 * device again owns the buffer.
121 */
122static inline void pci_dma_sync_single(struct pci_dev *hwdev,
123 dma_addr_t dma_handle, size_t size,
124 int direction)
125{
126 if (direction == PCI_DMA_NONE)
127 BUG();
128
129 /* Nothing to do */
130}
131
132/* Make physical memory consistent for a set of streaming
133 * mode DMA translations after a transfer.
134 *
135 * The same as pci_dma_sync_single but for a scatter-gather list,
136 * same rules and usage.
137 */
138static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
139 struct scatterlist *sg, int nelems,
140 int direction)
141{
142 if (direction == PCI_DMA_NONE)
143 BUG();
144
145 /* Nothing to do */
146}
147 21
148#endif /* _ASM_BFIN_PCI_H */ 22#endif /* _ASM_BFIN_PCI_H */
diff --git a/arch/blackfin/include/asm/ptrace.h b/arch/blackfin/include/asm/ptrace.h
index 27290c955a7a..aaa1c6c2bc19 100644
--- a/arch/blackfin/include/asm/ptrace.h
+++ b/arch/blackfin/include/asm/ptrace.h
@@ -24,6 +24,8 @@
24 24
25#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
26 26
27struct task_struct;
28
27/* this struct defines the way the registers are stored on the 29/* this struct defines the way the registers are stored on the
28 stack during a system call. */ 30 stack during a system call. */
29 31
@@ -89,9 +91,9 @@ struct pt_regs {
89#define PTRACE_GETREGS 12 91#define PTRACE_GETREGS 12
90#define PTRACE_SETREGS 13 /* ptrace signal */ 92#define PTRACE_SETREGS 13 /* ptrace signal */
91 93
92#define PTRACE_GETFDPIC 31 94#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
93#define PTRACE_GETFDPIC_EXEC 0 95#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
94#define PTRACE_GETFDPIC_INTERP 1 96#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
95 97
96#define PS_S (0x0002) 98#define PS_S (0x0002)
97 99
@@ -101,9 +103,30 @@ struct pt_regs {
101 master interrupt enable. */ 103 master interrupt enable. */
102#define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1))) 104#define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1)))
103#define instruction_pointer(regs) ((regs)->pc) 105#define instruction_pointer(regs) ((regs)->pc)
106#define user_stack_pointer(regs) ((regs)->usp)
104#define profile_pc(regs) instruction_pointer(regs) 107#define profile_pc(regs) instruction_pointer(regs)
105extern void show_regs(struct pt_regs *); 108extern void show_regs(struct pt_regs *);
106 109
110#define arch_has_single_step() (1)
111extern void user_enable_single_step(struct task_struct *child);
112extern void user_disable_single_step(struct task_struct *child);
113/* common code demands this function */
114#define ptrace_disable(child) user_disable_single_step(child)
115
116/*
117 * Get the address of the live pt_regs for the specified task.
118 * These are saved onto the top kernel stack when the process
119 * is not running.
120 *
121 * Note: if a user thread is execve'd from kernel space, the
122 * kernel stack will not be empty on entry to the kernel, so
123 * ptracing these tasks will fail.
124 */
125#define task_pt_regs(task) \
126 (struct pt_regs *) \
127 ((unsigned long)task_stack_page(task) + \
128 (THREAD_SIZE - sizeof(struct pt_regs)))
129
107#endif /* __KERNEL__ */ 130#endif /* __KERNEL__ */
108 131
109#endif /* __ASSEMBLY__ */ 132#endif /* __ASSEMBLY__ */
@@ -173,4 +196,6 @@ extern void show_regs(struct pt_regs *);
173#define PT_FDPIC_EXEC 232 196#define PT_FDPIC_EXEC 232
174#define PT_FDPIC_INTERP 236 197#define PT_FDPIC_INTERP 236
175 198
199#define PT_LAST_PSEUDO PT_FDPIC_INTERP
200
176#endif /* _BFIN_PTRACE_H */ 201#endif /* _BFIN_PTRACE_H */
diff --git a/arch/blackfin/include/asm/sections.h b/arch/blackfin/include/asm/sections.h
index 1f5381fbb4a7..14a3e66d9167 100644
--- a/arch/blackfin/include/asm/sections.h
+++ b/arch/blackfin/include/asm/sections.h
@@ -13,10 +13,21 @@ extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size;
13extern unsigned long _ramstart, _ramend, _rambase; 13extern unsigned long _ramstart, _ramend, _rambase;
14extern unsigned long memory_start, memory_end, physical_mem_end; 14extern unsigned long memory_start, memory_end, physical_mem_end;
15 15
16extern char _stext_l1[], _etext_l1[], _sdata_l1[], _edata_l1[], _sbss_l1[], 16/*
17 _ebss_l1[], _l1_lma_start[], _sdata_b_l1[], _sbss_b_l1[], _ebss_b_l1[], 17 * The weak markings on the lengths might seem weird, but this is required
18 _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[], 18 * in order to make gcc accept the fact that these may actually have a value
19 _ebss_l2[], _l2_lma_start[]; 19 * of 0 (since they aren't actually addresses, but sizes of sections).
20 */
21extern char _stext_l1[], _etext_l1[], _text_l1_lma[], __weak _text_l1_len[];
22extern char _sdata_l1[], _edata_l1[], _sbss_l1[], _ebss_l1[],
23 _data_l1_lma[], __weak _data_l1_len[];
24#ifdef CONFIG_ROMKERNEL
25extern char _data_lma[], _data_len[], _sinitdata[], _einitdata[], _init_data_lma[], _init_data_len[];
26#endif
27extern char _sdata_b_l1[], _edata_b_l1[], _sbss_b_l1[], _ebss_b_l1[],
28 _data_b_l1_lma[], __weak _data_b_l1_len[];
29extern char _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[],
30 _sbss_l2[], _ebss_l2[], _l2_lma[], __weak _l2_len[];
20 31
21#include <asm/mem_map.h> 32#include <asm/mem_map.h>
22 33
diff --git a/arch/blackfin/include/asm/smp.h b/arch/blackfin/include/asm/smp.h
index 6a0fe94b84a6..f5b537967116 100644
--- a/arch/blackfin/include/asm/smp.h
+++ b/arch/blackfin/include/asm/smp.h
@@ -22,8 +22,23 @@ extern char coreb_trampoline_start, coreb_trampoline_end;
22struct corelock_slot { 22struct corelock_slot {
23 int lock; 23 int lock;
24}; 24};
25extern struct corelock_slot corelock;
26
27#ifdef __ARCH_SYNC_CORE_ICACHE
28extern unsigned long icache_invld_count[NR_CPUS];
29#endif
30#ifdef __ARCH_SYNC_CORE_DCACHE
31extern unsigned long dcache_invld_count[NR_CPUS];
32#endif
25 33
26void smp_icache_flush_range_others(unsigned long start, 34void smp_icache_flush_range_others(unsigned long start,
27 unsigned long end); 35 unsigned long end);
36#ifdef CONFIG_HOTPLUG_CPU
37void coreb_sleep(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
38void cpu_die(void);
39void platform_cpu_die(void);
40int __cpu_disable(void);
41int __cpu_die(unsigned int cpu);
42#endif
28 43
29#endif /* !__ASM_BLACKFIN_SMP_H */ 44#endif /* !__ASM_BLACKFIN_SMP_H */
diff --git a/arch/blackfin/include/asm/spinlock.h b/arch/blackfin/include/asm/spinlock.h
index b0c7f0ee4b03..1942ccfedbe0 100644
--- a/arch/blackfin/include/asm/spinlock.h
+++ b/arch/blackfin/include/asm/spinlock.h
@@ -17,84 +17,84 @@ asmlinkage int __raw_spin_is_locked_asm(volatile int *ptr);
17asmlinkage void __raw_spin_lock_asm(volatile int *ptr); 17asmlinkage void __raw_spin_lock_asm(volatile int *ptr);
18asmlinkage int __raw_spin_trylock_asm(volatile int *ptr); 18asmlinkage int __raw_spin_trylock_asm(volatile int *ptr);
19asmlinkage void __raw_spin_unlock_asm(volatile int *ptr); 19asmlinkage void __raw_spin_unlock_asm(volatile int *ptr);
20asmlinkage void __raw_read_lock_asm(volatile int *ptr); 20asmlinkage void arch_read_lock_asm(volatile int *ptr);
21asmlinkage int __raw_read_trylock_asm(volatile int *ptr); 21asmlinkage int arch_read_trylock_asm(volatile int *ptr);
22asmlinkage void __raw_read_unlock_asm(volatile int *ptr); 22asmlinkage void arch_read_unlock_asm(volatile int *ptr);
23asmlinkage void __raw_write_lock_asm(volatile int *ptr); 23asmlinkage void arch_write_lock_asm(volatile int *ptr);
24asmlinkage int __raw_write_trylock_asm(volatile int *ptr); 24asmlinkage int arch_write_trylock_asm(volatile int *ptr);
25asmlinkage void __raw_write_unlock_asm(volatile int *ptr); 25asmlinkage void arch_write_unlock_asm(volatile int *ptr);
26 26
27static inline int __raw_spin_is_locked(raw_spinlock_t *lock) 27static inline int arch_spin_is_locked(arch_spinlock_t *lock)
28{ 28{
29 return __raw_spin_is_locked_asm(&lock->lock); 29 return __raw_spin_is_locked_asm(&lock->lock);
30} 30}
31 31
32static inline void __raw_spin_lock(raw_spinlock_t *lock) 32static inline void arch_spin_lock(arch_spinlock_t *lock)
33{ 33{
34 __raw_spin_lock_asm(&lock->lock); 34 __raw_spin_lock_asm(&lock->lock);
35} 35}
36 36
37#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 37#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
38 38
39static inline int __raw_spin_trylock(raw_spinlock_t *lock) 39static inline int arch_spin_trylock(arch_spinlock_t *lock)
40{ 40{
41 return __raw_spin_trylock_asm(&lock->lock); 41 return __raw_spin_trylock_asm(&lock->lock);
42} 42}
43 43
44static inline void __raw_spin_unlock(raw_spinlock_t *lock) 44static inline void arch_spin_unlock(arch_spinlock_t *lock)
45{ 45{
46 __raw_spin_unlock_asm(&lock->lock); 46 __raw_spin_unlock_asm(&lock->lock);
47} 47}
48 48
49static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) 49static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
50{ 50{
51 while (__raw_spin_is_locked(lock)) 51 while (arch_spin_is_locked(lock))
52 cpu_relax(); 52 cpu_relax();
53} 53}
54 54
55static inline int __raw_read_can_lock(raw_rwlock_t *rw) 55static inline int arch_read_can_lock(arch_rwlock_t *rw)
56{ 56{
57 return __raw_uncached_fetch_asm(&rw->lock) > 0; 57 return __raw_uncached_fetch_asm(&rw->lock) > 0;
58} 58}
59 59
60static inline int __raw_write_can_lock(raw_rwlock_t *rw) 60static inline int arch_write_can_lock(arch_rwlock_t *rw)
61{ 61{
62 return __raw_uncached_fetch_asm(&rw->lock) == RW_LOCK_BIAS; 62 return __raw_uncached_fetch_asm(&rw->lock) == RW_LOCK_BIAS;
63} 63}
64 64
65static inline void __raw_read_lock(raw_rwlock_t *rw) 65static inline void arch_read_lock(arch_rwlock_t *rw)
66{ 66{
67 __raw_read_lock_asm(&rw->lock); 67 arch_read_lock_asm(&rw->lock);
68} 68}
69 69
70static inline int __raw_read_trylock(raw_rwlock_t *rw) 70static inline int arch_read_trylock(arch_rwlock_t *rw)
71{ 71{
72 return __raw_read_trylock_asm(&rw->lock); 72 return arch_read_trylock_asm(&rw->lock);
73} 73}
74 74
75static inline void __raw_read_unlock(raw_rwlock_t *rw) 75static inline void arch_read_unlock(arch_rwlock_t *rw)
76{ 76{
77 __raw_read_unlock_asm(&rw->lock); 77 arch_read_unlock_asm(&rw->lock);
78} 78}
79 79
80static inline void __raw_write_lock(raw_rwlock_t *rw) 80static inline void arch_write_lock(arch_rwlock_t *rw)
81{ 81{
82 __raw_write_lock_asm(&rw->lock); 82 arch_write_lock_asm(&rw->lock);
83} 83}
84 84
85static inline int __raw_write_trylock(raw_rwlock_t *rw) 85static inline int arch_write_trylock(arch_rwlock_t *rw)
86{ 86{
87 return __raw_write_trylock_asm(&rw->lock); 87 return arch_write_trylock_asm(&rw->lock);
88} 88}
89 89
90static inline void __raw_write_unlock(raw_rwlock_t *rw) 90static inline void arch_write_unlock(arch_rwlock_t *rw)
91{ 91{
92 __raw_write_unlock_asm(&rw->lock); 92 arch_write_unlock_asm(&rw->lock);
93} 93}
94 94
95#define _raw_spin_relax(lock) cpu_relax() 95#define arch_spin_relax(lock) cpu_relax()
96#define _raw_read_relax(lock) cpu_relax() 96#define arch_read_relax(lock) cpu_relax()
97#define _raw_write_relax(lock) cpu_relax() 97#define arch_write_relax(lock) cpu_relax()
98 98
99#endif 99#endif
100 100
diff --git a/arch/blackfin/include/asm/spinlock_types.h b/arch/blackfin/include/asm/spinlock_types.h
index be75762c0610..1a33608c958b 100644
--- a/arch/blackfin/include/asm/spinlock_types.h
+++ b/arch/blackfin/include/asm/spinlock_types.h
@@ -15,14 +15,14 @@
15 15
16typedef struct { 16typedef struct {
17 volatile unsigned int lock; 17 volatile unsigned int lock;
18} raw_spinlock_t; 18} arch_spinlock_t;
19 19
20#define __RAW_SPIN_LOCK_UNLOCKED { 0 } 20#define __ARCH_SPIN_LOCK_UNLOCKED { 0 }
21 21
22typedef struct { 22typedef struct {
23 volatile unsigned int lock; 23 volatile unsigned int lock;
24} raw_rwlock_t; 24} arch_rwlock_t;
25 25
26#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } 26#define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
27 27
28#endif 28#endif
diff --git a/arch/blackfin/include/asm/syscall.h b/arch/blackfin/include/asm/syscall.h
new file mode 100644
index 000000000000..4921a4815cce
--- /dev/null
+++ b/arch/blackfin/include/asm/syscall.h
@@ -0,0 +1,96 @@
1/*
2 * Magic syscall break down functions
3 *
4 * Copyright 2010 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __ASM_BLACKFIN_SYSCALL_H__
10#define __ASM_BLACKFIN_SYSCALL_H__
11
12/*
13 * Blackfin syscalls are simple:
14 * enter:
15 * p0: syscall number
16 * r{0,1,2,3,4,5}: syscall args 0,1,2,3,4,5
17 * exit:
18 * r0: return/error value
19 */
20
21#include <linux/err.h>
22#include <linux/sched.h>
23#include <asm/ptrace.h>
24
25static inline long
26syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
27{
28 return regs->p0;
29}
30
31static inline void
32syscall_rollback(struct task_struct *task, struct pt_regs *regs)
33{
34 regs->p0 = regs->orig_p0;
35}
36
37static inline long
38syscall_get_error(struct task_struct *task, struct pt_regs *regs)
39{
40 return IS_ERR_VALUE(regs->r0) ? regs->r0 : 0;
41}
42
43static inline long
44syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
45{
46 return regs->r0;
47}
48
49static inline void
50syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
51 int error, long val)
52{
53 regs->r0 = error ? -error : val;
54}
55
56/**
57 * syscall_get_arguments()
58 * @task: unused
59 * @regs: the register layout to extract syscall arguments from
60 * @i: first syscall argument to extract
61 * @n: number of syscall arguments to extract
62 * @args: array to return the syscall arguments in
63 *
64 * args[0] gets i'th argument, args[n - 1] gets the i+n-1'th argument
65 */
66static inline void
67syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
68 unsigned int i, unsigned int n, unsigned long *args)
69{
70 /*
71 * Assume the ptrace layout doesn't change -- r5 is first in memory,
72 * then r4, ..., then r0. So we simply reverse the ptrace register
73 * array in memory to store into the args array.
74 */
75 long *aregs = &regs->r0 - i;
76
77 BUG_ON(i > 5 || i + n > 6);
78
79 while (n--)
80 *args++ = *aregs--;
81}
82
83/* See syscall_get_arguments() comments */
84static inline void
85syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
86 unsigned int i, unsigned int n, const unsigned long *args)
87{
88 long *aregs = &regs->r0 - i;
89
90 BUG_ON(i > 5 || i + n > 6);
91
92 while (n--)
93 *aregs-- = *args++;
94}
95
96#endif
diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h
index afb3a8626380..e9a5614cdbb1 100644
--- a/arch/blackfin/include/asm/thread_info.h
+++ b/arch/blackfin/include/asm/thread_info.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2004-2009 Analog Devices Inc. 2 * Copyright 2004-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the GPL-2 or later. 4 * Licensed under the GPL-2 or later.
5 */ 5 */
@@ -17,7 +17,7 @@
17/* Thread Align Mask to reach to the top of the stack 17/* Thread Align Mask to reach to the top of the stack
18 * for any process 18 * for any process
19 */ 19 */
20#define ALIGN_PAGE_MASK 0xffffe000 20#define ALIGN_PAGE_MASK 0xffffe000
21 21
22/* 22/*
23 * Size of kernel stack for each process. This must be a power of 2... 23 * Size of kernel stack for each process. This must be a power of 2...
@@ -57,7 +57,7 @@ struct thread_info {
57 .exec_domain = &default_exec_domain, \ 57 .exec_domain = &default_exec_domain, \
58 .flags = 0, \ 58 .flags = 0, \
59 .cpu = 0, \ 59 .cpu = 0, \
60 .preempt_count = INIT_PREEMPT_COUNT, \ 60 .preempt_count = INIT_PREEMPT_COUNT, \
61 .restart_block = { \ 61 .restart_block = { \
62 .fn = do_no_restart_syscall, \ 62 .fn = do_no_restart_syscall, \
63 }, \ 63 }, \
@@ -73,8 +73,7 @@ __attribute_const__
73static inline struct thread_info *current_thread_info(void) 73static inline struct thread_info *current_thread_info(void)
74{ 74{
75 struct thread_info *ti; 75 struct thread_info *ti;
76 __asm__("%0 = sp;" : "=da"(ti) : 76 __asm__("%0 = sp;" : "=da"(ti));
77 );
78 return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1)); 77 return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1));
79} 78}
80 79
@@ -99,10 +98,12 @@ static inline struct thread_info *current_thread_info(void)
99#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 98#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
100#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling 99#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
101 TIF_NEED_RESCHED */ 100 TIF_NEED_RESCHED */
102#define TIF_MEMDIE 4 101#define TIF_MEMDIE 4
103#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ 102#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
104#define TIF_FREEZE 6 /* is freezing for suspend */ 103#define TIF_FREEZE 6 /* is freezing for suspend */
105#define TIF_IRQ_SYNC 7 /* sync pipeline stage */ 104#define TIF_IRQ_SYNC 7 /* sync pipeline stage */
105#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */
106#define TIF_SINGLESTEP 9
106 107
107/* as above, but as bit values */ 108/* as above, but as bit values */
108#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 109#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -110,8 +111,10 @@ static inline struct thread_info *current_thread_info(void)
110#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 111#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
111#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 112#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
112#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 113#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
113#define _TIF_FREEZE (1<<TIF_FREEZE) 114#define _TIF_FREEZE (1<<TIF_FREEZE)
114#define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC) 115#define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC)
116#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
117#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
115 118
116#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 119#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
117 120
diff --git a/arch/blackfin/include/asm/time.h b/arch/blackfin/include/asm/time.h
index 589e937ed1eb..9ca7db844d10 100644
--- a/arch/blackfin/include/asm/time.h
+++ b/arch/blackfin/include/asm/time.h
@@ -23,9 +23,7 @@
23 */ 23 */
24 24
25#ifndef CONFIG_CPU_FREQ 25#ifndef CONFIG_CPU_FREQ
26#define TIME_SCALE 1 26# define TIME_SCALE 1
27#define __bfin_cycles_off (0)
28#define __bfin_cycles_mod (0)
29#else 27#else
30/* 28/*
31 * Blackfin CPU frequency scaling supports max Core Clock 1, 1/2 and 1/4 . 29 * Blackfin CPU frequency scaling supports max Core Clock 1, 1/2 and 1/4 .
@@ -33,9 +31,16 @@
33 * adjust the Core Timer Presale Register. This way we don't lose time. 31 * adjust the Core Timer Presale Register. This way we don't lose time.
34 */ 32 */
35#define TIME_SCALE 4 33#define TIME_SCALE 4
34
35# ifdef CONFIG_CYCLES_CLOCKSOURCE
36extern unsigned long long __bfin_cycles_off; 36extern unsigned long long __bfin_cycles_off;
37extern unsigned int __bfin_cycles_mod; 37extern unsigned int __bfin_cycles_mod;
38# endif
39#endif
40
41#if defined(CONFIG_TICKSOURCE_CORETMR)
42extern void bfin_coretmr_init(void);
43extern void bfin_coretmr_clockevent_init(void);
38#endif 44#endif
39 45
40extern void __init setup_core_timer(void);
41#endif 46#endif
diff --git a/arch/blackfin/include/asm/trace.h b/arch/blackfin/include/asm/trace.h
index 609ad3c84189..dc0aa55ae773 100644
--- a/arch/blackfin/include/asm/trace.h
+++ b/arch/blackfin/include/asm/trace.h
@@ -28,6 +28,8 @@ extern unsigned long software_trace_buff[];
28 28
29#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON 29#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
30 30
31#define trace_buffer_init() bfin_write_TBUFCTL(BFIN_TRACE_INIT)
32
31#define trace_buffer_save(x) \ 33#define trace_buffer_save(x) \
32 do { \ 34 do { \
33 (x) = bfin_read_TBUFCTL(); \ 35 (x) = bfin_read_TBUFCTL(); \
diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h
index c03b8532aad3..1c0d190adaef 100644
--- a/arch/blackfin/include/asm/uaccess.h
+++ b/arch/blackfin/include/asm/uaccess.h
@@ -17,9 +17,7 @@
17#include <linux/string.h> 17#include <linux/string.h>
18 18
19#include <asm/segment.h> 19#include <asm/segment.h>
20#ifdef CONFIG_ACCESS_CHECK 20#include <asm/sections.h>
21# include <asm/bfin-global.h>
22#endif
23 21
24#define get_ds() (KERNEL_DS) 22#define get_ds() (KERNEL_DS)
25#define get_fs() (current_thread_info()->addr_limit) 23#define get_fs() (current_thread_info()->addr_limit)
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index 779be02a910a..22886cbdae7a 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -388,8 +388,9 @@
388#define __NR_pwritev 367 388#define __NR_pwritev 367
389#define __NR_rt_tgsigqueueinfo 368 389#define __NR_rt_tgsigqueueinfo 368
390#define __NR_perf_event_open 369 390#define __NR_perf_event_open 369
391#define __NR_recvmmsg 370
391 392
392#define __NR_syscall 370 393#define __NR_syscall 371
393#define NR_syscalls __NR_syscall 394#define NR_syscalls __NR_syscall
394 395
395/* Old optional stuff no one actually uses */ 396/* Old optional stuff no one actually uses */