diff options
Diffstat (limited to 'drivers/char')
29 files changed, 95 insertions, 797 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 0bd01f49cfd8..6a06913b01d3 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -1029,10 +1029,6 @@ config CS5535_GPIO | |||
1029 | 1029 | ||
1030 | If compiled as a module, it will be called cs5535_gpio. | 1030 | If compiled as a module, it will be called cs5535_gpio. |
1031 | 1031 | ||
1032 | config GPIO_VR41XX | ||
1033 | tristate "NEC VR4100 series General-purpose I/O Unit support" | ||
1034 | depends on CPU_VR41XX | ||
1035 | |||
1036 | config RAW_DRIVER | 1032 | config RAW_DRIVER |
1037 | tristate "RAW driver (/dev/raw/rawN)" | 1033 | tristate "RAW driver (/dev/raw/rawN)" |
1038 | depends on BLOCK | 1034 | depends on BLOCK |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 189efcff08ce..66f779ad4f4c 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -95,7 +95,6 @@ obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o | |||
95 | obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o | 95 | obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o |
96 | obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o | 96 | obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o |
97 | obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o | 97 | obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o |
98 | obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o | ||
99 | obj-$(CONFIG_GPIO_TB0219) += tb0219.o | 98 | obj-$(CONFIG_GPIO_TB0219) += tb0219.o |
100 | obj-$(CONFIG_TELCLOCK) += tlclk.o | 99 | obj-$(CONFIG_TELCLOCK) += tlclk.o |
101 | 100 | ||
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 72429b6b2fa8..6c32fbf07164 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -81,6 +81,7 @@ static char *serial_version = "4.30"; | |||
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | 82 | #include <linux/seq_file.h> |
83 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
84 | #include <linux/smp_lock.h> | ||
84 | #include <linux/init.h> | 85 | #include <linux/init.h> |
85 | #include <linux/bitops.h> | 86 | #include <linux/bitops.h> |
86 | 87 | ||
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index f3366d3f06cf..2dafc2da0648 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -633,6 +633,7 @@ | |||
633 | #include <linux/tty.h> | 633 | #include <linux/tty.h> |
634 | #include <linux/tty_flip.h> | 634 | #include <linux/tty_flip.h> |
635 | #include <linux/serial.h> | 635 | #include <linux/serial.h> |
636 | #include <linux/smp_lock.h> | ||
636 | #include <linux/major.h> | 637 | #include <linux/major.h> |
637 | #include <linux/string.h> | 638 | #include <linux/string.h> |
638 | #include <linux/fcntl.h> | 639 | #include <linux/fcntl.h> |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index abef1f7d84fe..ff647ca1c489 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/tty.h> | 36 | #include <linux/tty.h> |
37 | #include <linux/tty_flip.h> | 37 | #include <linux/tty_flip.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> | ||
39 | #include <linux/ioport.h> | 40 | #include <linux/ioport.h> |
40 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
41 | #include <linux/uaccess.h> | 42 | #include <linux/uaccess.h> |
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 5dcbe603eca2..91b53eb1c053 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c | |||
@@ -305,10 +305,11 @@ static int __init intel_init_hw_struct(struct intel_rng_hw *intel_rng_hw, | |||
305 | (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)) | 305 | (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)) |
306 | == BIOS_CNTL_LOCK_ENABLE_MASK) { | 306 | == BIOS_CNTL_LOCK_ENABLE_MASK) { |
307 | static __initdata /*const*/ char warning[] = | 307 | static __initdata /*const*/ char warning[] = |
308 | KERN_WARNING PFX "Firmware space is locked read-only. If you can't or\n" | 308 | KERN_WARNING |
309 | KERN_WARNING PFX "don't want to disable this in firmware setup, and if\n" | 309 | PFX "Firmware space is locked read-only. If you can't or\n" |
310 | KERN_WARNING PFX "you are certain that your system has a functional\n" | 310 | PFX "don't want to disable this in firmware setup, and if\n" |
311 | KERN_WARNING PFX "RNG, try using the 'no_fwh_detect' option.\n"; | 311 | PFX "you are certain that your system has a functional\n" |
312 | PFX "RNG, try using the 'no_fwh_detect' option.\n"; | ||
312 | 313 | ||
313 | if (no_fwh_detect) | 314 | if (no_fwh_detect) |
314 | return -ENODEV; | 315 | return -ENODEV; |
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 4159292e35cf..4f1f4cd670da 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -122,6 +122,7 @@ | |||
122 | #include <linux/fs.h> | 122 | #include <linux/fs.h> |
123 | #include <linux/sched.h> | 123 | #include <linux/sched.h> |
124 | #include <linux/serial.h> | 124 | #include <linux/serial.h> |
125 | #include <linux/smp_lock.h> | ||
125 | #include <linux/mm.h> | 126 | #include <linux/mm.h> |
126 | #include <linux/interrupt.h> | 127 | #include <linux/interrupt.h> |
127 | #include <linux/timer.h> | 128 | #include <linux/timer.h> |
@@ -1478,10 +1479,10 @@ static int __devinit load_firmware(struct pci_dev *pdev, | |||
1478 | status = inw(base + 0x4); | 1479 | status = inw(base + 0x4); |
1479 | if (status != 0) { | 1480 | if (status != 0) { |
1480 | dev_warn(&pdev->dev, "Card%d rejected load header:\n" | 1481 | dev_warn(&pdev->dev, "Card%d rejected load header:\n" |
1481 | KERN_WARNING "Address:0x%x\n" | 1482 | "Address:0x%x\n" |
1482 | KERN_WARNING "Count:0x%x\n" | 1483 | "Count:0x%x\n" |
1483 | KERN_WARNING "Status:0x%x\n", | 1484 | "Status:0x%x\n", |
1484 | index + 1, frame->addr, frame->count, status); | 1485 | index + 1, frame->addr, frame->count, status); |
1485 | goto errrelfw; | 1486 | goto errrelfw; |
1486 | } | 1487 | } |
1487 | outsw(base, frame->data, word_count); | 1488 | outsw(base, frame->data, word_count); |
@@ -1526,10 +1527,10 @@ static int __devinit load_firmware(struct pci_dev *pdev, | |||
1526 | status = inw(base + 0x4); | 1527 | status = inw(base + 0x4); |
1527 | if (status != 0) { | 1528 | if (status != 0) { |
1528 | dev_warn(&pdev->dev, "Card%d rejected verify header:\n" | 1529 | dev_warn(&pdev->dev, "Card%d rejected verify header:\n" |
1529 | KERN_WARNING "Address:0x%x\n" | 1530 | "Address:0x%x\n" |
1530 | KERN_WARNING "Count:0x%x\n" | 1531 | "Count:0x%x\n" |
1531 | KERN_WARNING "Status: 0x%x\n", | 1532 | "Status: 0x%x\n", |
1532 | index + 1, frame->addr, frame->count, status); | 1533 | index + 1, frame->addr, frame->count, status); |
1533 | goto errrelfw; | 1534 | goto errrelfw; |
1534 | } | 1535 | } |
1535 | 1536 | ||
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 0c999f5bb3db..ab2f3349c5c4 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/smp_lock.h> | ||
23 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
24 | #include <linux/tty.h> | 25 | #include <linux/tty.h> |
25 | #include <linux/tty_flip.h> | 26 | #include <linux/tty_flip.h> |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 65b6ff2442c6..dd0083bbb64a 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/tty.h> | 34 | #include <linux/tty.h> |
35 | #include <linux/tty_flip.h> | 35 | #include <linux/tty_flip.h> |
36 | #include <linux/major.h> | 36 | #include <linux/major.h> |
37 | #include <linux/smp_lock.h> | ||
37 | #include <linux/string.h> | 38 | #include <linux/string.h> |
38 | #include <linux/fcntl.h> | 39 | #include <linux/fcntl.h> |
39 | #include <linux/ptrace.h> | 40 | #include <linux/ptrace.h> |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 52d953eb30c3..dbf8d52f31d0 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/signal.h> | 24 | #include <linux/signal.h> |
25 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
26 | #include <linux/smp_lock.h> | ||
26 | #include <linux/timer.h> | 27 | #include <linux/timer.h> |
27 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
28 | #include <linux/tty.h> | 29 | #include <linux/tty.h> |
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index 1c43c8cdee25..c68118efad84 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c | |||
@@ -97,6 +97,7 @@ | |||
97 | #include <linux/slab.h> | 97 | #include <linux/slab.h> |
98 | #include <linux/tty.h> | 98 | #include <linux/tty.h> |
99 | #include <linux/errno.h> | 99 | #include <linux/errno.h> |
100 | #include <linux/smp_lock.h> | ||
100 | #include <linux/string.h> /* used in new tty drivers */ | 101 | #include <linux/string.h> /* used in new tty drivers */ |
101 | #include <linux/signal.h> /* used in new tty drivers */ | 102 | #include <linux/signal.h> /* used in new tty drivers */ |
102 | #include <linux/if.h> | 103 | #include <linux/if.h> |
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 2e99158ebb8a..6934025a1ac1 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/ioport.h> | 58 | #include <linux/ioport.h> |
59 | #include <linux/in.h> | 59 | #include <linux/in.h> |
60 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
61 | #include <linux/smp_lock.h> | ||
61 | #include <linux/tty.h> | 62 | #include <linux/tty.h> |
62 | #include <linux/errno.h> | 63 | #include <linux/errno.h> |
63 | #include <linux/string.h> /* used in new tty drivers */ | 64 | #include <linux/string.h> /* used in new tty drivers */ |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index daebe1ba43d4..6e6942c45f5b 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/major.h> | 22 | #include <linux/major.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/smp_lock.h> | ||
25 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
26 | #include <linux/device.h> | 27 | #include <linux/device.h> |
27 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
@@ -75,114 +76,88 @@ static void pty_close(struct tty_struct *tty, struct file *filp) | |||
75 | */ | 76 | */ |
76 | static void pty_unthrottle(struct tty_struct *tty) | 77 | static void pty_unthrottle(struct tty_struct *tty) |
77 | { | 78 | { |
78 | struct tty_struct *o_tty = tty->link; | 79 | tty_wakeup(tty->link); |
79 | |||
80 | if (!o_tty) | ||
81 | return; | ||
82 | |||
83 | tty_wakeup(o_tty); | ||
84 | set_bit(TTY_THROTTLED, &tty->flags); | 80 | set_bit(TTY_THROTTLED, &tty->flags); |
85 | } | 81 | } |
86 | 82 | ||
87 | /* | 83 | /** |
88 | * WSH 05/24/97: modified to | 84 | * pty_space - report space left for writing |
89 | * (1) use space in tty->flip instead of a shared temp buffer | 85 | * @to: tty we are writing into |
90 | * The flip buffers aren't being used for a pty, so there's lots | ||
91 | * of space available. The buffer is protected by a per-pty | ||
92 | * semaphore that should almost never come under contention. | ||
93 | * (2) avoid redundant copying for cases where count >> receive_room | ||
94 | * N.B. Calls from user space may now return an error code instead of | ||
95 | * a count. | ||
96 | * | 86 | * |
97 | * FIXME: Our pty_write method is called with our ldisc lock held but | 87 | * The tty buffers allow 64K but we sneak a peak and clip at 8K this |
98 | * not our partners. We can't just wait on the other one blindly without | 88 | * allows a lot of overspill room for echo and other fun messes to |
99 | * risking deadlocks. At some point when everything has settled down we need | 89 | * be handled properly |
100 | * to look into making pty_write at least able to sleep over an ldisc change. | 90 | */ |
91 | |||
92 | static int pty_space(struct tty_struct *to) | ||
93 | { | ||
94 | int n = 8192 - to->buf.memory_used; | ||
95 | if (n < 0) | ||
96 | return 0; | ||
97 | return n; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * pty_write - write to a pty | ||
102 | * @tty: the tty we write from | ||
103 | * @buf: kernel buffer of data | ||
104 | * @count: bytes to write | ||
101 | * | 105 | * |
102 | * The return on no ldisc is a bit counter intuitive but the logic works | 106 | * Our "hardware" write method. Data is coming from the ldisc which |
103 | * like this. During an ldisc change the other end will flush its buffers. We | 107 | * may be in a non sleeping state. We simply throw this at the other |
104 | * thus return the full length which is identical to the case where we had | 108 | * end of the link as if we were an IRQ handler receiving stuff for |
105 | * proper locking and happened to queue the bytes just before the flush during | 109 | * the other side of the pty/tty pair. |
106 | * the ldisc change. | ||
107 | */ | 110 | */ |
111 | |||
108 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, | 112 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, |
109 | int count) | 113 | int count) |
110 | { | 114 | { |
111 | struct tty_struct *to = tty->link; | 115 | struct tty_struct *to = tty->link; |
112 | struct tty_ldisc *ld; | 116 | int c; |
113 | int c = count; | ||
114 | 117 | ||
115 | if (!to || tty->stopped) | 118 | if (tty->stopped) |
116 | return 0; | 119 | return 0; |
117 | ld = tty_ldisc_ref(to); | 120 | |
118 | 121 | /* This isn't locked but our 8K is quite sloppy so no | |
119 | if (ld) { | 122 | big deal */ |
120 | c = to->receive_room; | 123 | |
121 | if (c > count) | 124 | c = pty_space(to); |
122 | c = count; | 125 | if (c > count) |
123 | ld->ops->receive_buf(to, buf, NULL, c); | 126 | c = count; |
124 | tty_ldisc_deref(ld); | 127 | if (c > 0) { |
128 | /* Stuff the data into the input queue of the other end */ | ||
129 | c = tty_insert_flip_string(to, buf, c); | ||
130 | /* And shovel */ | ||
131 | tty_flip_buffer_push(to); | ||
132 | tty_wakeup(tty); | ||
125 | } | 133 | } |
126 | return c; | 134 | return c; |
127 | } | 135 | } |
128 | 136 | ||
137 | /** | ||
138 | * pty_write_room - write space | ||
139 | * @tty: tty we are writing from | ||
140 | * | ||
141 | * Report how many bytes the ldisc can send into the queue for | ||
142 | * the other device. | ||
143 | */ | ||
144 | |||
129 | static int pty_write_room(struct tty_struct *tty) | 145 | static int pty_write_room(struct tty_struct *tty) |
130 | { | 146 | { |
131 | struct tty_struct *to = tty->link; | 147 | return pty_space(tty->link); |
132 | |||
133 | if (!to || tty->stopped) | ||
134 | return 0; | ||
135 | |||
136 | return to->receive_room; | ||
137 | } | 148 | } |
138 | 149 | ||
139 | /* | 150 | /** |
140 | * WSH 05/24/97: Modified for asymmetric MASTER/SLAVE behavior | 151 | * pty_chars_in_buffer - characters currently in our tx queue |
141 | * The chars_in_buffer() value is used by the ldisc select() function | 152 | * @tty: our tty |
142 | * to hold off writing when chars_in_buffer > WAKEUP_CHARS (== 256). | ||
143 | * The pty driver chars_in_buffer() Master/Slave must behave differently: | ||
144 | * | ||
145 | * The Master side needs to allow typed-ahead commands to accumulate | ||
146 | * while being canonicalized, so we report "our buffer" as empty until | ||
147 | * some threshold is reached, and then report the count. (Any count > | ||
148 | * WAKEUP_CHARS is regarded by select() as "full".) To avoid deadlock | ||
149 | * the count returned must be 0 if no canonical data is available to be | ||
150 | * read. (The N_TTY ldisc.chars_in_buffer now knows this.) | ||
151 | * | 153 | * |
152 | * The Slave side passes all characters in raw mode to the Master side's | 154 | * Report how much we have in the transmit queue. As everything is |
153 | * buffer where they can be read immediately, so in this case we can | 155 | * instantly at the other end this is easy to implement. |
154 | * return the true count in the buffer. | ||
155 | */ | 156 | */ |
157 | |||
156 | static int pty_chars_in_buffer(struct tty_struct *tty) | 158 | static int pty_chars_in_buffer(struct tty_struct *tty) |
157 | { | 159 | { |
158 | struct tty_struct *to = tty->link; | 160 | return 0; |
159 | struct tty_ldisc *ld; | ||
160 | int count = 0; | ||
161 | |||
162 | /* We should get the line discipline lock for "tty->link" */ | ||
163 | if (!to) | ||
164 | return 0; | ||
165 | /* We cannot take a sleeping reference here without deadlocking with | ||
166 | an ldisc change - but it doesn't really matter */ | ||
167 | ld = tty_ldisc_ref(to); | ||
168 | if (ld == NULL) | ||
169 | return 0; | ||
170 | |||
171 | /* The ldisc must report 0 if no characters available to be read */ | ||
172 | if (ld->ops->chars_in_buffer) | ||
173 | count = ld->ops->chars_in_buffer(to); | ||
174 | |||
175 | tty_ldisc_deref(ld); | ||
176 | |||
177 | if (tty->driver->subtype == PTY_TYPE_SLAVE) | ||
178 | return count; | ||
179 | |||
180 | /* Master side driver ... if the other side's read buffer is less than | ||
181 | * half full, return 0 to allow writers to proceed; otherwise return | ||
182 | * the count. This leaves a comfortable margin to avoid overflow, | ||
183 | * and still allows half a buffer's worth of typed-ahead commands. | ||
184 | */ | ||
185 | return (count < N_TTY_BUF_SIZE/2) ? 0 : count; | ||
186 | } | 161 | } |
187 | 162 | ||
188 | /* Set the lock flag on a pty */ | 163 | /* Set the lock flag on a pty */ |
@@ -202,20 +177,10 @@ static void pty_flush_buffer(struct tty_struct *tty) | |||
202 | { | 177 | { |
203 | struct tty_struct *to = tty->link; | 178 | struct tty_struct *to = tty->link; |
204 | unsigned long flags; | 179 | unsigned long flags; |
205 | struct tty_ldisc *ld; | ||
206 | 180 | ||
207 | if (!to) | 181 | if (!to) |
208 | return; | 182 | return; |
209 | ld = tty_ldisc_ref(to); | 183 | /* tty_buffer_flush(to); FIXME */ |
210 | |||
211 | /* The other end is changing discipline */ | ||
212 | if (!ld) | ||
213 | return; | ||
214 | |||
215 | if (ld->ops->flush_buffer) | ||
216 | to->ldisc->ops->flush_buffer(to); | ||
217 | tty_ldisc_deref(ld); | ||
218 | |||
219 | if (to->packet) { | 184 | if (to->packet) { |
220 | spin_lock_irqsave(&tty->ctrl_lock, flags); | 185 | spin_lock_irqsave(&tty->ctrl_lock, flags); |
221 | tty->ctrl_status |= TIOCPKT_FLUSHWRITE; | 186 | tty->ctrl_status |= TIOCPKT_FLUSHWRITE; |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index ce81da5b2da9..d58c2eb07f07 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
45 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/smp_lock.h> | ||
47 | #include <linux/miscdevice.h> | 48 | #include <linux/miscdevice.h> |
48 | #include <linux/init.h> | 49 | #include <linux/init.h> |
49 | 50 | ||
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 217660451237..171711acf5cd 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <linux/tty_flip.h> | 49 | #include <linux/tty_flip.h> |
50 | #include <linux/smp_lock.h> | ||
50 | #include <linux/spinlock.h> | 51 | #include <linux/spinlock.h> |
51 | #include <linux/device.h> | 52 | #include <linux/device.h> |
52 | 53 | ||
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 63d5b628477a..0e29a23ec4c5 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include <linux/tty_driver.h> | 73 | #include <linux/tty_driver.h> |
74 | #include <linux/tty_flip.h> | 74 | #include <linux/tty_flip.h> |
75 | #include <linux/serial.h> | 75 | #include <linux/serial.h> |
76 | #include <linux/smp_lock.h> | ||
76 | #include <linux/string.h> | 77 | #include <linux/string.h> |
77 | #include <linux/fcntl.h> | 78 | #include <linux/fcntl.h> |
78 | #include <linux/ptrace.h> | 79 | #include <linux/ptrace.h> |
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index f1f24f0ee26f..51e7a46787be 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
53 | #include <linux/serial.h> | 53 | #include <linux/serial.h> |
54 | #include <linux/serialP.h> | 54 | #include <linux/serialP.h> |
55 | #include <linux/smp_lock.h> | ||
55 | #include <linux/string.h> | 56 | #include <linux/string.h> |
56 | #include <linux/fcntl.h> | 57 | #include <linux/fcntl.h> |
57 | #include <linux/ptrace.h> | 58 | #include <linux/ptrace.h> |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index e72be4190a44..bfe4cdb2febb 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -87,6 +87,7 @@ | |||
87 | #include <linux/tty_flip.h> | 87 | #include <linux/tty_flip.h> |
88 | #include <linux/mm.h> | 88 | #include <linux/mm.h> |
89 | #include <linux/serial.h> | 89 | #include <linux/serial.h> |
90 | #include <linux/smp_lock.h> | ||
90 | #include <linux/fcntl.h> | 91 | #include <linux/fcntl.h> |
91 | #include <linux/major.h> | 92 | #include <linux/major.h> |
92 | #include <linux/delay.h> | 93 | #include <linux/delay.h> |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 518f2a25d91e..a81ec4fcf6ff 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -216,6 +216,7 @@ | |||
216 | #include <linux/eisa.h> | 216 | #include <linux/eisa.h> |
217 | #include <linux/pci.h> | 217 | #include <linux/pci.h> |
218 | #include <linux/slab.h> | 218 | #include <linux/slab.h> |
219 | #include <linux/smp_lock.h> | ||
219 | #include <linux/init.h> | 220 | #include <linux/init.h> |
220 | #include <linux/miscdevice.h> | 221 | #include <linux/miscdevice.h> |
221 | #include <linux/bitops.h> | 222 | #include <linux/bitops.h> |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index afded3a2379c..813552f14884 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -81,6 +81,7 @@ | |||
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | 82 | #include <linux/seq_file.h> |
83 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
84 | #include <linux/smp_lock.h> | ||
84 | #include <linux/delay.h> | 85 | #include <linux/delay.h> |
85 | #include <linux/netdevice.h> | 86 | #include <linux/netdevice.h> |
86 | #include <linux/vmalloc.h> | 87 | #include <linux/vmalloc.h> |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index a2e67e6df3a1..91f20a92fddf 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/mm.h> | 62 | #include <linux/mm.h> |
63 | #include <linux/seq_file.h> | 63 | #include <linux/seq_file.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
65 | #include <linux/netdevice.h> | 66 | #include <linux/netdevice.h> |
66 | #include <linux/vmalloc.h> | 67 | #include <linux/vmalloc.h> |
67 | #include <linux/init.h> | 68 | #include <linux/init.h> |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 6f727e3c53ad..8d4a2a8a0a70 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
53 | #include <linux/seq_file.h> | 53 | #include <linux/seq_file.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <linux/smp_lock.h> | ||
55 | #include <linux/netdevice.h> | 56 | #include <linux/netdevice.h> |
56 | #include <linux/vmalloc.h> | 57 | #include <linux/vmalloc.h> |
57 | #include <linux/init.h> | 58 | #include <linux/init.h> |
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index 6062b62800fd..b3ec9b10e292 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for TANBAC TB0219 base board. | 2 | * Driver for TANBAC TB0219 base board. |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | 4 | * Copyright (C) 2005 Yoichi Yuasa <yuasa@linux-mips.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/vr41xx/giu.h> | 28 | #include <asm/vr41xx/giu.h> |
29 | #include <asm/vr41xx/tb0219.h> | 29 | #include <asm/vr41xx/tb0219.h> |
30 | 30 | ||
31 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); | 31 | MODULE_AUTHOR("Yoichi Yuasa <yuasa@linux-mips.org>"); |
32 | MODULE_DESCRIPTION("TANBAC TB0219 base board driver"); | 32 | MODULE_DESCRIPTION("TANBAC TB0219 base board driver"); |
33 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
34 | 34 | ||
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index ccdd828adcef..b0603b2e5684 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/poll.h> | 26 | #include <linux/poll.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/smp_lock.h> | ||
30 | 29 | ||
31 | #include "tpm.h" | 30 | #include "tpm.h" |
32 | 31 | ||
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index b24f6c6a1ea3..ad6ba4ed2808 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/smp_lock.h> | ||
25 | 24 | ||
26 | #include <asm/io.h> | 25 | #include <asm/io.h> |
27 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index 913aa8d3f1c5..0ef0dc97ba20 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/proc_fs.h> | 21 | #include <linux/proc_fs.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/device.h> | 24 | #include <linux/device.h> |
26 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
27 | #include <linux/bitops.h> | 26 | #include <linux/bitops.h> |
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index 54c837288d19..e69de29bb2d1 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
@@ -1,680 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for NEC VR4100 series General-purpose I/O Unit. | ||
3 | * | ||
4 | * Copyright (C) 2002 MontaVista Software Inc. | ||
5 | * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> | ||
6 | * Copyright (C) 2003-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/fs.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/interrupt.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | #include <linux/smp_lock.h> | ||
31 | #include <linux/spinlock.h> | ||
32 | #include <linux/types.h> | ||
33 | |||
34 | #include <asm/io.h> | ||
35 | #include <asm/vr41xx/giu.h> | ||
36 | #include <asm/vr41xx/irq.h> | ||
37 | #include <asm/vr41xx/vr41xx.h> | ||
38 | |||
39 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); | ||
40 | MODULE_DESCRIPTION("NEC VR4100 series General-purpose I/O Unit driver"); | ||
41 | MODULE_LICENSE("GPL"); | ||
42 | |||
43 | static int major; /* default is dynamic major device number */ | ||
44 | module_param(major, int, 0); | ||
45 | MODULE_PARM_DESC(major, "Major device number"); | ||
46 | |||
47 | #define GIUIOSELL 0x00 | ||
48 | #define GIUIOSELH 0x02 | ||
49 | #define GIUPIODL 0x04 | ||
50 | #define GIUPIODH 0x06 | ||
51 | #define GIUINTSTATL 0x08 | ||
52 | #define GIUINTSTATH 0x0a | ||
53 | #define GIUINTENL 0x0c | ||
54 | #define GIUINTENH 0x0e | ||
55 | #define GIUINTTYPL 0x10 | ||
56 | #define GIUINTTYPH 0x12 | ||
57 | #define GIUINTALSELL 0x14 | ||
58 | #define GIUINTALSELH 0x16 | ||
59 | #define GIUINTHTSELL 0x18 | ||
60 | #define GIUINTHTSELH 0x1a | ||
61 | #define GIUPODATL 0x1c | ||
62 | #define GIUPODATEN 0x1c | ||
63 | #define GIUPODATH 0x1e | ||
64 | #define PIOEN0 0x0100 | ||
65 | #define PIOEN1 0x0200 | ||
66 | #define GIUPODAT 0x1e | ||
67 | #define GIUFEDGEINHL 0x20 | ||
68 | #define GIUFEDGEINHH 0x22 | ||
69 | #define GIUREDGEINHL 0x24 | ||
70 | #define GIUREDGEINHH 0x26 | ||
71 | |||
72 | #define GIUUSEUPDN 0x1e0 | ||
73 | #define GIUTERMUPDN 0x1e2 | ||
74 | |||
75 | #define GPIO_HAS_PULLUPDOWN_IO 0x0001 | ||
76 | #define GPIO_HAS_OUTPUT_ENABLE 0x0002 | ||
77 | #define GPIO_HAS_INTERRUPT_EDGE_SELECT 0x0100 | ||
78 | |||
79 | static spinlock_t giu_lock; | ||
80 | static unsigned long giu_flags; | ||
81 | static unsigned int giu_nr_pins; | ||
82 | |||
83 | static void __iomem *giu_base; | ||
84 | |||
85 | #define giu_read(offset) readw(giu_base + (offset)) | ||
86 | #define giu_write(offset, value) writew((value), giu_base + (offset)) | ||
87 | |||
88 | #define GPIO_PIN_OF_IRQ(irq) ((irq) - GIU_IRQ_BASE) | ||
89 | #define GIUINT_HIGH_OFFSET 16 | ||
90 | #define GIUINT_HIGH_MAX 32 | ||
91 | |||
92 | static inline uint16_t giu_set(uint16_t offset, uint16_t set) | ||
93 | { | ||
94 | uint16_t data; | ||
95 | |||
96 | data = giu_read(offset); | ||
97 | data |= set; | ||
98 | giu_write(offset, data); | ||
99 | |||
100 | return data; | ||
101 | } | ||
102 | |||
103 | static inline uint16_t giu_clear(uint16_t offset, uint16_t clear) | ||
104 | { | ||
105 | uint16_t data; | ||
106 | |||
107 | data = giu_read(offset); | ||
108 | data &= ~clear; | ||
109 | giu_write(offset, data); | ||
110 | |||
111 | return data; | ||
112 | } | ||
113 | |||
114 | static void ack_giuint_low(unsigned int irq) | ||
115 | { | ||
116 | giu_write(GIUINTSTATL, 1 << GPIO_PIN_OF_IRQ(irq)); | ||
117 | } | ||
118 | |||
119 | static void mask_giuint_low(unsigned int irq) | ||
120 | { | ||
121 | giu_clear(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq)); | ||
122 | } | ||
123 | |||
124 | static void mask_ack_giuint_low(unsigned int irq) | ||
125 | { | ||
126 | unsigned int pin; | ||
127 | |||
128 | pin = GPIO_PIN_OF_IRQ(irq); | ||
129 | giu_clear(GIUINTENL, 1 << pin); | ||
130 | giu_write(GIUINTSTATL, 1 << pin); | ||
131 | } | ||
132 | |||
133 | static void unmask_giuint_low(unsigned int irq) | ||
134 | { | ||
135 | giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq)); | ||
136 | } | ||
137 | |||
138 | static struct irq_chip giuint_low_irq_chip = { | ||
139 | .name = "GIUINTL", | ||
140 | .ack = ack_giuint_low, | ||
141 | .mask = mask_giuint_low, | ||
142 | .mask_ack = mask_ack_giuint_low, | ||
143 | .unmask = unmask_giuint_low, | ||
144 | }; | ||
145 | |||
146 | static void ack_giuint_high(unsigned int irq) | ||
147 | { | ||
148 | giu_write(GIUINTSTATH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); | ||
149 | } | ||
150 | |||
151 | static void mask_giuint_high(unsigned int irq) | ||
152 | { | ||
153 | giu_clear(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); | ||
154 | } | ||
155 | |||
156 | static void mask_ack_giuint_high(unsigned int irq) | ||
157 | { | ||
158 | unsigned int pin; | ||
159 | |||
160 | pin = GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET; | ||
161 | giu_clear(GIUINTENH, 1 << pin); | ||
162 | giu_write(GIUINTSTATH, 1 << pin); | ||
163 | } | ||
164 | |||
165 | static void unmask_giuint_high(unsigned int irq) | ||
166 | { | ||
167 | giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); | ||
168 | } | ||
169 | |||
170 | static struct irq_chip giuint_high_irq_chip = { | ||
171 | .name = "GIUINTH", | ||
172 | .ack = ack_giuint_high, | ||
173 | .mask = mask_giuint_high, | ||
174 | .mask_ack = mask_ack_giuint_high, | ||
175 | .unmask = unmask_giuint_high, | ||
176 | }; | ||
177 | |||
178 | static int giu_get_irq(unsigned int irq) | ||
179 | { | ||
180 | uint16_t pendl, pendh, maskl, maskh; | ||
181 | int i; | ||
182 | |||
183 | pendl = giu_read(GIUINTSTATL); | ||
184 | pendh = giu_read(GIUINTSTATH); | ||
185 | maskl = giu_read(GIUINTENL); | ||
186 | maskh = giu_read(GIUINTENH); | ||
187 | |||
188 | maskl &= pendl; | ||
189 | maskh &= pendh; | ||
190 | |||
191 | if (maskl) { | ||
192 | for (i = 0; i < 16; i++) { | ||
193 | if (maskl & (1 << i)) | ||
194 | return GIU_IRQ(i); | ||
195 | } | ||
196 | } else if (maskh) { | ||
197 | for (i = 0; i < 16; i++) { | ||
198 | if (maskh & (1 << i)) | ||
199 | return GIU_IRQ(i + GIUINT_HIGH_OFFSET); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | printk(KERN_ERR "spurious GIU interrupt: %04x(%04x),%04x(%04x)\n", | ||
204 | maskl, pendl, maskh, pendh); | ||
205 | |||
206 | atomic_inc(&irq_err_count); | ||
207 | |||
208 | return -EINVAL; | ||
209 | } | ||
210 | |||
211 | void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_t signal) | ||
212 | { | ||
213 | uint16_t mask; | ||
214 | |||
215 | if (pin < GIUINT_HIGH_OFFSET) { | ||
216 | mask = 1 << pin; | ||
217 | if (trigger != IRQ_TRIGGER_LEVEL) { | ||
218 | giu_set(GIUINTTYPL, mask); | ||
219 | if (signal == IRQ_SIGNAL_HOLD) | ||
220 | giu_set(GIUINTHTSELL, mask); | ||
221 | else | ||
222 | giu_clear(GIUINTHTSELL, mask); | ||
223 | if (giu_flags & GPIO_HAS_INTERRUPT_EDGE_SELECT) { | ||
224 | switch (trigger) { | ||
225 | case IRQ_TRIGGER_EDGE_FALLING: | ||
226 | giu_set(GIUFEDGEINHL, mask); | ||
227 | giu_clear(GIUREDGEINHL, mask); | ||
228 | break; | ||
229 | case IRQ_TRIGGER_EDGE_RISING: | ||
230 | giu_clear(GIUFEDGEINHL, mask); | ||
231 | giu_set(GIUREDGEINHL, mask); | ||
232 | break; | ||
233 | default: | ||
234 | giu_set(GIUFEDGEINHL, mask); | ||
235 | giu_set(GIUREDGEINHL, mask); | ||
236 | break; | ||
237 | } | ||
238 | } | ||
239 | set_irq_chip_and_handler(GIU_IRQ(pin), | ||
240 | &giuint_low_irq_chip, | ||
241 | handle_edge_irq); | ||
242 | } else { | ||
243 | giu_clear(GIUINTTYPL, mask); | ||
244 | giu_clear(GIUINTHTSELL, mask); | ||
245 | set_irq_chip_and_handler(GIU_IRQ(pin), | ||
246 | &giuint_low_irq_chip, | ||
247 | handle_level_irq); | ||
248 | } | ||
249 | giu_write(GIUINTSTATL, mask); | ||
250 | } else if (pin < GIUINT_HIGH_MAX) { | ||
251 | mask = 1 << (pin - GIUINT_HIGH_OFFSET); | ||
252 | if (trigger != IRQ_TRIGGER_LEVEL) { | ||
253 | giu_set(GIUINTTYPH, mask); | ||
254 | if (signal == IRQ_SIGNAL_HOLD) | ||
255 | giu_set(GIUINTHTSELH, mask); | ||
256 | else | ||
257 | giu_clear(GIUINTHTSELH, mask); | ||
258 | if (giu_flags & GPIO_HAS_INTERRUPT_EDGE_SELECT) { | ||
259 | switch (trigger) { | ||
260 | case IRQ_TRIGGER_EDGE_FALLING: | ||
261 | giu_set(GIUFEDGEINHH, mask); | ||
262 | giu_clear(GIUREDGEINHH, mask); | ||
263 | break; | ||
264 | case IRQ_TRIGGER_EDGE_RISING: | ||
265 | giu_clear(GIUFEDGEINHH, mask); | ||
266 | giu_set(GIUREDGEINHH, mask); | ||
267 | break; | ||
268 | default: | ||
269 | giu_set(GIUFEDGEINHH, mask); | ||
270 | giu_set(GIUREDGEINHH, mask); | ||
271 | break; | ||
272 | } | ||
273 | } | ||
274 | set_irq_chip_and_handler(GIU_IRQ(pin), | ||
275 | &giuint_high_irq_chip, | ||
276 | handle_edge_irq); | ||
277 | } else { | ||
278 | giu_clear(GIUINTTYPH, mask); | ||
279 | giu_clear(GIUINTHTSELH, mask); | ||
280 | set_irq_chip_and_handler(GIU_IRQ(pin), | ||
281 | &giuint_high_irq_chip, | ||
282 | handle_level_irq); | ||
283 | } | ||
284 | giu_write(GIUINTSTATH, mask); | ||
285 | } | ||
286 | } | ||
287 | EXPORT_SYMBOL_GPL(vr41xx_set_irq_trigger); | ||
288 | |||
289 | void vr41xx_set_irq_level(unsigned int pin, irq_level_t level) | ||
290 | { | ||
291 | uint16_t mask; | ||
292 | |||
293 | if (pin < GIUINT_HIGH_OFFSET) { | ||
294 | mask = 1 << pin; | ||
295 | if (level == IRQ_LEVEL_HIGH) | ||
296 | giu_set(GIUINTALSELL, mask); | ||
297 | else | ||
298 | giu_clear(GIUINTALSELL, mask); | ||
299 | giu_write(GIUINTSTATL, mask); | ||
300 | } else if (pin < GIUINT_HIGH_MAX) { | ||
301 | mask = 1 << (pin - GIUINT_HIGH_OFFSET); | ||
302 | if (level == IRQ_LEVEL_HIGH) | ||
303 | giu_set(GIUINTALSELH, mask); | ||
304 | else | ||
305 | giu_clear(GIUINTALSELH, mask); | ||
306 | giu_write(GIUINTSTATH, mask); | ||
307 | } | ||
308 | } | ||
309 | EXPORT_SYMBOL_GPL(vr41xx_set_irq_level); | ||
310 | |||
311 | gpio_data_t vr41xx_gpio_get_pin(unsigned int pin) | ||
312 | { | ||
313 | uint16_t reg, mask; | ||
314 | |||
315 | if (pin >= giu_nr_pins) | ||
316 | return GPIO_DATA_INVAL; | ||
317 | |||
318 | if (pin < 16) { | ||
319 | reg = giu_read(GIUPIODL); | ||
320 | mask = (uint16_t)1 << pin; | ||
321 | } else if (pin < 32) { | ||
322 | reg = giu_read(GIUPIODH); | ||
323 | mask = (uint16_t)1 << (pin - 16); | ||
324 | } else if (pin < 48) { | ||
325 | reg = giu_read(GIUPODATL); | ||
326 | mask = (uint16_t)1 << (pin - 32); | ||
327 | } else { | ||
328 | reg = giu_read(GIUPODATH); | ||
329 | mask = (uint16_t)1 << (pin - 48); | ||
330 | } | ||
331 | |||
332 | if (reg & mask) | ||
333 | return GPIO_DATA_HIGH; | ||
334 | |||
335 | return GPIO_DATA_LOW; | ||
336 | } | ||
337 | EXPORT_SYMBOL_GPL(vr41xx_gpio_get_pin); | ||
338 | |||
339 | int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data) | ||
340 | { | ||
341 | uint16_t offset, mask, reg; | ||
342 | unsigned long flags; | ||
343 | |||
344 | if (pin >= giu_nr_pins) | ||
345 | return -EINVAL; | ||
346 | |||
347 | if (pin < 16) { | ||
348 | offset = GIUPIODL; | ||
349 | mask = (uint16_t)1 << pin; | ||
350 | } else if (pin < 32) { | ||
351 | offset = GIUPIODH; | ||
352 | mask = (uint16_t)1 << (pin - 16); | ||
353 | } else if (pin < 48) { | ||
354 | offset = GIUPODATL; | ||
355 | mask = (uint16_t)1 << (pin - 32); | ||
356 | } else { | ||
357 | offset = GIUPODATH; | ||
358 | mask = (uint16_t)1 << (pin - 48); | ||
359 | } | ||
360 | |||
361 | spin_lock_irqsave(&giu_lock, flags); | ||
362 | |||
363 | reg = giu_read(offset); | ||
364 | if (data == GPIO_DATA_HIGH) | ||
365 | reg |= mask; | ||
366 | else | ||
367 | reg &= ~mask; | ||
368 | giu_write(offset, reg); | ||
369 | |||
370 | spin_unlock_irqrestore(&giu_lock, flags); | ||
371 | |||
372 | return 0; | ||
373 | } | ||
374 | EXPORT_SYMBOL_GPL(vr41xx_gpio_set_pin); | ||
375 | |||
376 | int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir) | ||
377 | { | ||
378 | uint16_t offset, mask, reg; | ||
379 | unsigned long flags; | ||
380 | |||
381 | if (pin >= giu_nr_pins) | ||
382 | return -EINVAL; | ||
383 | |||
384 | if (pin < 16) { | ||
385 | offset = GIUIOSELL; | ||
386 | mask = (uint16_t)1 << pin; | ||
387 | } else if (pin < 32) { | ||
388 | offset = GIUIOSELH; | ||
389 | mask = (uint16_t)1 << (pin - 16); | ||
390 | } else { | ||
391 | if (giu_flags & GPIO_HAS_OUTPUT_ENABLE) { | ||
392 | offset = GIUPODATEN; | ||
393 | mask = (uint16_t)1 << (pin - 32); | ||
394 | } else { | ||
395 | switch (pin) { | ||
396 | case 48: | ||
397 | offset = GIUPODATH; | ||
398 | mask = PIOEN0; | ||
399 | break; | ||
400 | case 49: | ||
401 | offset = GIUPODATH; | ||
402 | mask = PIOEN1; | ||
403 | break; | ||
404 | default: | ||
405 | return -EINVAL; | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | |||
410 | spin_lock_irqsave(&giu_lock, flags); | ||
411 | |||
412 | reg = giu_read(offset); | ||
413 | if (dir == GPIO_OUTPUT) | ||
414 | reg |= mask; | ||
415 | else | ||
416 | reg &= ~mask; | ||
417 | giu_write(offset, reg); | ||
418 | |||
419 | spin_unlock_irqrestore(&giu_lock, flags); | ||
420 | |||
421 | return 0; | ||
422 | } | ||
423 | EXPORT_SYMBOL_GPL(vr41xx_gpio_set_direction); | ||
424 | |||
425 | int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull) | ||
426 | { | ||
427 | uint16_t reg, mask; | ||
428 | unsigned long flags; | ||
429 | |||
430 | if ((giu_flags & GPIO_HAS_PULLUPDOWN_IO) != GPIO_HAS_PULLUPDOWN_IO) | ||
431 | return -EPERM; | ||
432 | |||
433 | if (pin >= 15) | ||
434 | return -EINVAL; | ||
435 | |||
436 | mask = (uint16_t)1 << pin; | ||
437 | |||
438 | spin_lock_irqsave(&giu_lock, flags); | ||
439 | |||
440 | if (pull == GPIO_PULL_UP || pull == GPIO_PULL_DOWN) { | ||
441 | reg = giu_read(GIUTERMUPDN); | ||
442 | if (pull == GPIO_PULL_UP) | ||
443 | reg |= mask; | ||
444 | else | ||
445 | reg &= ~mask; | ||
446 | giu_write(GIUTERMUPDN, reg); | ||
447 | |||
448 | reg = giu_read(GIUUSEUPDN); | ||
449 | reg |= mask; | ||
450 | giu_write(GIUUSEUPDN, reg); | ||
451 | } else { | ||
452 | reg = giu_read(GIUUSEUPDN); | ||
453 | reg &= ~mask; | ||
454 | giu_write(GIUUSEUPDN, reg); | ||
455 | } | ||
456 | |||
457 | spin_unlock_irqrestore(&giu_lock, flags); | ||
458 | |||
459 | return 0; | ||
460 | } | ||
461 | EXPORT_SYMBOL_GPL(vr41xx_gpio_pullupdown); | ||
462 | |||
463 | static ssize_t gpio_read(struct file *file, char __user *buf, size_t len, | ||
464 | loff_t *ppos) | ||
465 | { | ||
466 | unsigned int pin; | ||
467 | char value = '0'; | ||
468 | |||
469 | pin = iminor(file->f_path.dentry->d_inode); | ||
470 | if (pin >= giu_nr_pins) | ||
471 | return -EBADF; | ||
472 | |||
473 | if (vr41xx_gpio_get_pin(pin) == GPIO_DATA_HIGH) | ||
474 | value = '1'; | ||
475 | |||
476 | if (len <= 0) | ||
477 | return -EFAULT; | ||
478 | |||
479 | if (put_user(value, buf)) | ||
480 | return -EFAULT; | ||
481 | |||
482 | return 1; | ||
483 | } | ||
484 | |||
485 | static ssize_t gpio_write(struct file *file, const char __user *data, | ||
486 | size_t len, loff_t *ppos) | ||
487 | { | ||
488 | unsigned int pin; | ||
489 | size_t i; | ||
490 | char c; | ||
491 | int retval = 0; | ||
492 | |||
493 | pin = iminor(file->f_path.dentry->d_inode); | ||
494 | if (pin >= giu_nr_pins) | ||
495 | return -EBADF; | ||
496 | |||
497 | for (i = 0; i < len; i++) { | ||
498 | if (get_user(c, data + i)) | ||
499 | return -EFAULT; | ||
500 | |||
501 | switch (c) { | ||
502 | case '0': | ||
503 | retval = vr41xx_gpio_set_pin(pin, GPIO_DATA_LOW); | ||
504 | break; | ||
505 | case '1': | ||
506 | retval = vr41xx_gpio_set_pin(pin, GPIO_DATA_HIGH); | ||
507 | break; | ||
508 | case 'D': | ||
509 | printk(KERN_INFO "GPIO%d: pull down\n", pin); | ||
510 | retval = vr41xx_gpio_pullupdown(pin, GPIO_PULL_DOWN); | ||
511 | break; | ||
512 | case 'd': | ||
513 | printk(KERN_INFO "GPIO%d: pull up/down disable\n", pin); | ||
514 | retval = vr41xx_gpio_pullupdown(pin, GPIO_PULL_DISABLE); | ||
515 | break; | ||
516 | case 'I': | ||
517 | printk(KERN_INFO "GPIO%d: input\n", pin); | ||
518 | retval = vr41xx_gpio_set_direction(pin, GPIO_INPUT); | ||
519 | break; | ||
520 | case 'O': | ||
521 | printk(KERN_INFO "GPIO%d: output\n", pin); | ||
522 | retval = vr41xx_gpio_set_direction(pin, GPIO_OUTPUT); | ||
523 | break; | ||
524 | case 'o': | ||
525 | printk(KERN_INFO "GPIO%d: output disable\n", pin); | ||
526 | retval = vr41xx_gpio_set_direction(pin, GPIO_OUTPUT_DISABLE); | ||
527 | break; | ||
528 | case 'P': | ||
529 | printk(KERN_INFO "GPIO%d: pull up\n", pin); | ||
530 | retval = vr41xx_gpio_pullupdown(pin, GPIO_PULL_UP); | ||
531 | break; | ||
532 | case 'p': | ||
533 | printk(KERN_INFO "GPIO%d: pull up/down disable\n", pin); | ||
534 | retval = vr41xx_gpio_pullupdown(pin, GPIO_PULL_DISABLE); | ||
535 | break; | ||
536 | default: | ||
537 | break; | ||
538 | } | ||
539 | |||
540 | if (retval < 0) | ||
541 | break; | ||
542 | } | ||
543 | |||
544 | return i; | ||
545 | } | ||
546 | |||
547 | static int gpio_open(struct inode *inode, struct file *file) | ||
548 | { | ||
549 | unsigned int pin; | ||
550 | |||
551 | cycle_kernel_lock(); | ||
552 | pin = iminor(inode); | ||
553 | if (pin >= giu_nr_pins) | ||
554 | return -EBADF; | ||
555 | |||
556 | return nonseekable_open(inode, file); | ||
557 | } | ||
558 | |||
559 | static int gpio_release(struct inode *inode, struct file *file) | ||
560 | { | ||
561 | unsigned int pin; | ||
562 | |||
563 | pin = iminor(inode); | ||
564 | if (pin >= giu_nr_pins) | ||
565 | return -EBADF; | ||
566 | |||
567 | return 0; | ||
568 | } | ||
569 | |||
570 | static const struct file_operations gpio_fops = { | ||
571 | .owner = THIS_MODULE, | ||
572 | .read = gpio_read, | ||
573 | .write = gpio_write, | ||
574 | .open = gpio_open, | ||
575 | .release = gpio_release, | ||
576 | }; | ||
577 | |||
578 | static int __devinit giu_probe(struct platform_device *dev) | ||
579 | { | ||
580 | struct resource *res; | ||
581 | unsigned int trigger, i, pin; | ||
582 | struct irq_chip *chip; | ||
583 | int irq, retval; | ||
584 | |||
585 | switch (dev->id) { | ||
586 | case GPIO_50PINS_PULLUPDOWN: | ||
587 | giu_flags = GPIO_HAS_PULLUPDOWN_IO; | ||
588 | giu_nr_pins = 50; | ||
589 | break; | ||
590 | case GPIO_36PINS: | ||
591 | giu_nr_pins = 36; | ||
592 | break; | ||
593 | case GPIO_48PINS_EDGE_SELECT: | ||
594 | giu_flags = GPIO_HAS_INTERRUPT_EDGE_SELECT; | ||
595 | giu_nr_pins = 48; | ||
596 | break; | ||
597 | default: | ||
598 | printk(KERN_ERR "GIU: unknown ID %d\n", dev->id); | ||
599 | return -ENODEV; | ||
600 | } | ||
601 | |||
602 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
603 | if (!res) | ||
604 | return -EBUSY; | ||
605 | |||
606 | giu_base = ioremap(res->start, res->end - res->start + 1); | ||
607 | if (!giu_base) | ||
608 | return -ENOMEM; | ||
609 | |||
610 | retval = register_chrdev(major, "GIU", &gpio_fops); | ||
611 | if (retval < 0) { | ||
612 | iounmap(giu_base); | ||
613 | giu_base = NULL; | ||
614 | return retval; | ||
615 | } | ||
616 | |||
617 | if (major == 0) { | ||
618 | major = retval; | ||
619 | printk(KERN_INFO "GIU: major number %d\n", major); | ||
620 | } | ||
621 | |||
622 | spin_lock_init(&giu_lock); | ||
623 | |||
624 | giu_write(GIUINTENL, 0); | ||
625 | giu_write(GIUINTENH, 0); | ||
626 | |||
627 | trigger = giu_read(GIUINTTYPH) << 16; | ||
628 | trigger |= giu_read(GIUINTTYPL); | ||
629 | for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) { | ||
630 | pin = GPIO_PIN_OF_IRQ(i); | ||
631 | if (pin < GIUINT_HIGH_OFFSET) | ||
632 | chip = &giuint_low_irq_chip; | ||
633 | else | ||
634 | chip = &giuint_high_irq_chip; | ||
635 | |||
636 | if (trigger & (1 << pin)) | ||
637 | set_irq_chip_and_handler(i, chip, handle_edge_irq); | ||
638 | else | ||
639 | set_irq_chip_and_handler(i, chip, handle_level_irq); | ||
640 | |||
641 | } | ||
642 | |||
643 | irq = platform_get_irq(dev, 0); | ||
644 | if (irq < 0 || irq >= nr_irqs) | ||
645 | return -EBUSY; | ||
646 | |||
647 | return cascade_irq(irq, giu_get_irq); | ||
648 | } | ||
649 | |||
650 | static int __devexit giu_remove(struct platform_device *dev) | ||
651 | { | ||
652 | if (giu_base) { | ||
653 | iounmap(giu_base); | ||
654 | giu_base = NULL; | ||
655 | } | ||
656 | |||
657 | return 0; | ||
658 | } | ||
659 | |||
660 | static struct platform_driver giu_device_driver = { | ||
661 | .probe = giu_probe, | ||
662 | .remove = __devexit_p(giu_remove), | ||
663 | .driver = { | ||
664 | .name = "GIU", | ||
665 | .owner = THIS_MODULE, | ||
666 | }, | ||
667 | }; | ||
668 | |||
669 | static int __init vr41xx_giu_init(void) | ||
670 | { | ||
671 | return platform_driver_register(&giu_device_driver); | ||
672 | } | ||
673 | |||
674 | static void __exit vr41xx_giu_exit(void) | ||
675 | { | ||
676 | platform_driver_unregister(&giu_device_driver); | ||
677 | } | ||
678 | |||
679 | module_init(vr41xx_giu_init); | ||
680 | module_exit(vr41xx_giu_exit); | ||
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index d9113b4c76e3..7947bd1b4cf7 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -89,6 +89,7 @@ | |||
89 | #include <linux/mutex.h> | 89 | #include <linux/mutex.h> |
90 | #include <linux/vt_kern.h> | 90 | #include <linux/vt_kern.h> |
91 | #include <linux/selection.h> | 91 | #include <linux/selection.h> |
92 | #include <linux/smp_lock.h> | ||
92 | #include <linux/tiocl.h> | 93 | #include <linux/tiocl.h> |
93 | #include <linux/kbd_kern.h> | 94 | #include <linux/kbd_kern.h> |
94 | #include <linux/consolemap.h> | 95 | #include <linux/consolemap.h> |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 7539bed0f7e0..95189f288f8c 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/console.h> | 25 | #include <linux/console.h> |
26 | #include <linux/consolemap.h> | 26 | #include <linux/consolemap.h> |
27 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
28 | #include <linux/smp_lock.h> | ||
28 | #include <linux/timex.h> | 29 | #include <linux/timex.h> |
29 | 30 | ||
30 | #include <asm/io.h> | 31 | #include <asm/io.h> |