diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2009-09-19 16:13:14 -0400 |
---|---|---|
committer | Live-CD User <linux@linux.site> | 2009-09-19 16:13:14 -0400 |
commit | ebdb513596c0eb1dcb3bad8f53865964a2207ca9 (patch) | |
tree | fcd3b533f80fbd65483574d35ec84f4c3d59edf6 /drivers/char | |
parent | 23342262964722b41c7d06cfadc215039e48881b (diff) |
cyclades: overall cleanup
- remove changelog from the file. we don't care about ancient
history
- update copyright year
- update version
- constify some stuff
- empty lines removal
- unused variables and macros removal
- remove some asm/ includes, they are sucked by linux/ variants
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/cyclades.c | 598 |
1 files changed, 12 insertions, 586 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 87a40bc75646..3884ea439935 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * Initially written by Randolph Bentson <bentson@grieg.seaslug.org>. | 11 | * Initially written by Randolph Bentson <bentson@grieg.seaslug.org>. |
12 | * Modified and maintained by Marcio Saito <marcio@cyclades.com>. | 12 | * Modified and maintained by Marcio Saito <marcio@cyclades.com>. |
13 | * | 13 | * |
14 | * Copyright (C) 2007 Jiri Slaby <jirislaby@gmail.com> | 14 | * Copyright (C) 2007-2009 Jiri Slaby <jirislaby@gmail.com> |
15 | * | 15 | * |
16 | * Much of the design and some of the code came from serial.c | 16 | * Much of the design and some of the code came from serial.c |
17 | * which was copyright (C) 1991, 1992 Linus Torvalds. It was | 17 | * which was copyright (C) 1991, 1992 Linus Torvalds. It was |
@@ -19,577 +19,9 @@ | |||
19 | * and then fixed as suggested by Michael K. Johnson 12/12/92. | 19 | * and then fixed as suggested by Michael K. Johnson 12/12/92. |
20 | * Converted to pci probing and cleaned up by Jiri Slaby. | 20 | * Converted to pci probing and cleaned up by Jiri Slaby. |
21 | * | 21 | * |
22 | * This version supports shared IRQ's (only for PCI boards). | ||
23 | * | ||
24 | * Prevent users from opening non-existing Z ports. | ||
25 | * | ||
26 | * Revision 2.3.2.8 2000/07/06 18:14:16 ivan | ||
27 | * Fixed the PCI detection function to work properly on Alpha systems. | ||
28 | * Implemented support for TIOCSERGETLSR ioctl. | ||
29 | * Implemented full support for non-standard baud rates. | ||
30 | * | ||
31 | * Revision 2.3.2.7 2000/06/01 18:26:34 ivan | ||
32 | * Request PLX I/O region, although driver doesn't use it, to avoid | ||
33 | * problems with other drivers accessing it. | ||
34 | * Removed count for on-board buffer characters in cy_chars_in_buffer | ||
35 | * (Cyclades-Z only). | ||
36 | * | ||
37 | * Revision 2.3.2.6 2000/05/05 13:56:05 ivan | ||
38 | * Driver now reports physical instead of virtual memory addresses. | ||
39 | * Masks were added to some Cyclades-Z read accesses. | ||
40 | * Implemented workaround for PLX9050 bug that would cause a system lockup | ||
41 | * in certain systems, depending on the MMIO addresses allocated to the | ||
42 | * board. | ||
43 | * Changed the Tx interrupt programming in the CD1400 chips to boost up | ||
44 | * performance (Cyclom-Y only). | ||
45 | * Code is now compliant with the new module interface (module_[init|exit]). | ||
46 | * Make use of the PCI helper functions to access PCI resources. | ||
47 | * Did some code "housekeeping". | ||
48 | * | ||
49 | * Revision 2.3.2.5 2000/01/19 14:35:33 ivan | ||
50 | * Fixed bug in cy_set_termios on CRTSCTS flag turnoff. | ||
51 | * | ||
52 | * Revision 2.3.2.4 2000/01/17 09:19:40 ivan | ||
53 | * Fixed SMP locking in Cyclom-Y interrupt handler. | ||
54 | * | ||
55 | * Revision 2.3.2.3 1999/12/28 12:11:39 ivan | ||
56 | * Added a new cyclades_card field called nports to allow the driver to | ||
57 | * know the exact number of ports found by the Z firmware after its load; | ||
58 | * RX buffer contention prevention logic on interrupt op mode revisited | ||
59 | * (Cyclades-Z only); | ||
60 | * Revisited printk's for Z debug; | ||
61 | * Driver now makes sure that the constant SERIAL_XMIT_SIZE is defined; | ||
62 | * | ||
63 | * Revision 2.3.2.2 1999/10/01 11:27:43 ivan | ||
64 | * Fixed bug in cyz_poll that would make all ports but port 0 | ||
65 | * unable to transmit/receive data (Cyclades-Z only); | ||
66 | * Implemented logic to prevent the RX buffer from being stuck with data | ||
67 | * due to a driver / firmware race condition in interrupt op mode | ||
68 | * (Cyclades-Z only); | ||
69 | * Fixed bug in block_til_ready logic that would lead to a system crash; | ||
70 | * Revisited cy_close spinlock usage; | ||
71 | * | ||
72 | * Revision 2.3.2.1 1999/09/28 11:01:22 ivan | ||
73 | * Revisited CONFIG_PCI conditional compilation for PCI board support; | ||
74 | * Implemented TIOCGICOUNT and TIOCMIWAIT ioctl support; | ||
75 | * _Major_ cleanup on the Cyclades-Z interrupt support code / logic; | ||
76 | * Removed CTS handling from the driver -- this is now completely handled | ||
77 | * by the firmware (Cyclades-Z only); | ||
78 | * Flush RX on-board buffers on a port open (Cyclades-Z only); | ||
79 | * Fixed handling of ASYNC_SPD_* TTY flags; | ||
80 | * Module unload now unmaps all memory area allocated by ioremap; | ||
81 | * | ||
82 | * Revision 2.3.1.1 1999/07/15 16:45:53 ivan | ||
83 | * Removed CY_PROC conditional compilation; | ||
84 | * Implemented SMP-awareness for the driver; | ||
85 | * Implemented a new ISA IRQ autoprobe that uses the irq_probe_[on|off] | ||
86 | * functions; | ||
87 | * The driver now accepts memory addresses (maddr=0xMMMMM) and IRQs | ||
88 | * (irq=NN) as parameters (only for ISA boards); | ||
89 | * Fixed bug in set_line_char that would prevent the Cyclades-Z | ||
90 | * ports from being configured at speeds above 115.2Kbps; | ||
91 | * Fixed bug in cy_set_termios that would prevent XON/XOFF flow control | ||
92 | * switching from working properly; | ||
93 | * The driver now only prints IRQ info for the Cyclades-Z if it's | ||
94 | * configured to work in interrupt mode; | ||
95 | * | ||
96 | * Revision 2.2.2.3 1999/06/28 11:13:29 ivan | ||
97 | * Added support for interrupt mode operation for the Z cards; | ||
98 | * Removed the driver inactivity control for the Z; | ||
99 | * Added a missing MOD_DEC_USE_COUNT in the cy_open function for when | ||
100 | * the Z firmware is not loaded yet; | ||
101 | * Replaced the "manual" Z Tx flush buffer by a call to a FW command of | ||
102 | * same functionality; | ||
103 | * Implemented workaround for IRQ setting loss on the PCI configuration | ||
104 | * registers after a PCI bridge EEPROM reload (affects PLX9060 only); | ||
105 | * | ||
106 | * Revision 2.2.2.2 1999/05/14 17:18:15 ivan | ||
107 | * /proc entry location changed to /proc/tty/driver/cyclades; | ||
108 | * Added support to shared IRQ's (only for PCI boards); | ||
109 | * Added support for Cobalt Qube2 systems; | ||
110 | * IRQ [de]allocation scheme revisited; | ||
111 | * BREAK implementation changed in order to make use of the 'break_ctl' | ||
112 | * TTY facility; | ||
113 | * Fixed typo in TTY structure field 'driver_name'; | ||
114 | * Included a PCI bridge reset and EEPROM reload in the board | ||
115 | * initialization code (for both Y and Z series). | ||
116 | * | ||
117 | * Revision 2.2.2.1 1999/04/08 16:17:43 ivan | ||
118 | * Fixed a bug in cy_wait_until_sent that was preventing the port to be | ||
119 | * closed properly after a SIGINT; | ||
120 | * Module usage counter scheme revisited; | ||
121 | * Added support to the upcoming Y PCI boards (i.e., support to additional | ||
122 | * PCI Device ID's). | ||
123 | * | ||
124 | * Revision 2.2.1.10 1999/01/20 16:14:29 ivan | ||
125 | * Removed all unnecessary page-alignement operations in ioremap calls | ||
126 | * (ioremap is currently safe for these operations). | ||
127 | * | ||
128 | * Revision 2.2.1.9 1998/12/30 18:18:30 ivan | ||
129 | * Changed access to PLX PCI bridge registers from I/O to MMIO, in | ||
130 | * order to make PLX9050-based boards work with certain motherboards. | ||
131 | * | ||
132 | * Revision 2.2.1.8 1998/11/13 12:46:20 ivan | ||
133 | * cy_close function now resets (correctly) the tty->closing flag; | ||
134 | * JIFFIES_DIFF macro fixed. | ||
135 | * | ||
136 | * Revision 2.2.1.7 1998/09/03 12:07:28 ivan | ||
137 | * Fixed bug in cy_close function, which was not informing HW of | ||
138 | * which port should have the reception disabled before doing so; | ||
139 | * fixed Cyclom-8YoP hardware detection bug. | ||
140 | * | ||
141 | * Revision 2.2.1.6 1998/08/20 17:15:39 ivan | ||
142 | * Fixed bug in cy_close function, which causes malfunction | ||
143 | * of one of the first 4 ports when a higher port is closed | ||
144 | * (Cyclom-Y only). | ||
145 | * | ||
146 | * Revision 2.2.1.5 1998/08/10 18:10:28 ivan | ||
147 | * Fixed Cyclom-4Yo hardware detection bug. | ||
148 | * | ||
149 | * Revision 2.2.1.4 1998/08/04 11:02:50 ivan | ||
150 | * /proc/cyclades implementation with great collaboration of | ||
151 | * Marc Lewis <marc@blarg.net>; | ||
152 | * cyy_interrupt was changed to avoid occurrence of kernel oopses | ||
153 | * during PPP operation. | ||
154 | * | ||
155 | * Revision 2.2.1.3 1998/06/01 12:09:10 ivan | ||
156 | * General code review in order to comply with 2.1 kernel standards; | ||
157 | * data loss prevention for slow devices revisited (cy_wait_until_sent | ||
158 | * was created); | ||
159 | * removed conditional compilation for new/old PCI structure support | ||
160 | * (now the driver only supports the new PCI structure). | ||
161 | * | ||
162 | * Revision 2.2.1.1 1998/03/19 16:43:12 ivan | ||
163 | * added conditional compilation for new/old PCI structure support; | ||
164 | * removed kernel series (2.0.x / 2.1.x) conditional compilation. | ||
165 | * | ||
166 | * Revision 2.1.1.3 1998/03/16 18:01:12 ivan | ||
167 | * cleaned up the data loss fix; | ||
168 | * fixed XON/XOFF handling once more (Cyclades-Z); | ||
169 | * general review of the driver routines; | ||
170 | * introduction of a mechanism to prevent data loss with slow | ||
171 | * printers, by forcing a delay before closing the port. | ||
172 | * | ||
173 | * Revision 2.1.1.2 1998/02/17 16:50:00 ivan | ||
174 | * fixed detection/handling of new CD1400 in Ye boards; | ||
175 | * fixed XON/XOFF handling (Cyclades-Z); | ||
176 | * fixed data loss caused by a premature port close; | ||
177 | * introduction of a flag that holds the CD1400 version ID per port | ||
178 | * (used by the CYGETCD1400VER new ioctl). | ||
179 | * | ||
180 | * Revision 2.1.1.1 1997/12/03 17:31:19 ivan | ||
181 | * Code review for the module cleanup routine; | ||
182 | * fixed RTS and DTR status report for new CD1400's in get_modem_info; | ||
183 | * includes anonymous changes regarding signal_pending. | ||
184 | * | ||
185 | * Revision 2.1 1997/11/01 17:42:41 ivan | ||
186 | * Changes in the driver to support Alpha systems (except 8Zo V_1); | ||
187 | * BREAK fix for the Cyclades-Z boards; | ||
188 | * driver inactivity control by FW implemented; | ||
189 | * introduction of flag that allows driver to take advantage of | ||
190 | * a special CD1400 feature related to HW flow control; | ||
191 | * added support for the CD1400 rev. J (Cyclom-Y boards); | ||
192 | * introduction of ioctls to: | ||
193 | * - control the rtsdtr_inv flag (Cyclom-Y); | ||
194 | * - control the rflow flag (Cyclom-Y); | ||
195 | * - adjust the polling interval (Cyclades-Z); | ||
196 | * | ||
197 | * Revision 1.36.4.33 1997/06/27 19:00:00 ivan | ||
198 | * Fixes related to kernel version conditional | ||
199 | * compilation. | ||
200 | * | ||
201 | * Revision 1.36.4.32 1997/06/14 19:30:00 ivan | ||
202 | * Compatibility issues between kernels 2.0.x and | ||
203 | * 2.1.x (mainly related to clear_bit function). | ||
204 | * | ||
205 | * Revision 1.36.4.31 1997/06/03 15:30:00 ivan | ||
206 | * Changes to define the memory window according to the | ||
207 | * board type. | ||
208 | * | ||
209 | * Revision 1.36.4.30 1997/05/16 15:30:00 daniel | ||
210 | * Changes to support new cycladesZ boards. | ||
211 | * | ||
212 | * Revision 1.36.4.29 1997/05/12 11:30:00 daniel | ||
213 | * Merge of Bentson's and Daniel's version 1.36.4.28. | ||
214 | * Corrects bug in cy_detect_pci: check if there are more | ||
215 | * ports than the number of static structs allocated. | ||
216 | * Warning message during initialization if this driver is | ||
217 | * used with the new generation of cycladesZ boards. Those | ||
218 | * will be supported only in next release of the driver. | ||
219 | * Corrects bug in cy_detect_pci and cy_detect_isa that | ||
220 | * returned wrong number of VALID boards, when a cyclomY | ||
221 | * was found with no serial modules connected. | ||
222 | * Changes to use current (2.1.x) kernel subroutine names | ||
223 | * and created macros for compilation with 2.0.x kernel, | ||
224 | * instead of the other way around. | ||
225 | * | ||
226 | * Revision 1.36.4.28 1997/05/?? ??:00:00 bentson | ||
227 | * Change queue_task_irq_off to queue_task_irq. | ||
228 | * The inline function queue_task_irq_off (tqueue.h) | ||
229 | * was removed from latest releases of 2.1.x kernel. | ||
230 | * Use of macro __init to mark the initialization | ||
231 | * routines, so memory can be reused. | ||
232 | * Also incorporate implementation of critical region | ||
233 | * in function cleanup_module() created by anonymous | ||
234 | * linuxer. | ||
235 | * | ||
236 | * Revision 1.36.4.28 1997/04/25 16:00:00 daniel | ||
237 | * Change to support new firmware that solves DCD problem: | ||
238 | * application could fail to receive SIGHUP signal when DCD | ||
239 | * varying too fast. | ||
240 | * | ||
241 | * Revision 1.36.4.27 1997/03/26 10:30:00 daniel | ||
242 | * Changed for support linux versions 2.1.X. | ||
243 | * Backward compatible with linux versions 2.0.X. | ||
244 | * Corrected illegal use of filler field in | ||
245 | * CH_CTRL struct. | ||
246 | * Deleted some debug messages. | ||
247 | * | ||
248 | * Revision 1.36.4.26 1997/02/27 12:00:00 daniel | ||
249 | * Included check for NULL tty pointer in cyz_poll. | ||
250 | * | ||
251 | * Revision 1.36.4.25 1997/02/26 16:28:30 bentson | ||
252 | * Bill Foster at Blarg! Online services noticed that | ||
253 | * some of the switch elements of -Z modem control | ||
254 | * lacked a closing "break;" | ||
255 | * | ||
256 | * Revision 1.36.4.24 1997/02/24 11:00:00 daniel | ||
257 | * Changed low water threshold for buffer xmit_buf | ||
258 | * | ||
259 | * Revision 1.36.4.23 1996/12/02 21:50:16 bentson | ||
260 | * Marcio provided fix to modem status fetch for -Z | ||
261 | * | ||
262 | * Revision 1.36.4.22 1996/10/28 22:41:17 bentson | ||
263 | * improve mapping of -Z control page (thanks to Steve | ||
264 | * Price <stevep@fa.tdktca.com> for help on this) | ||
265 | * | ||
266 | * Revision 1.36.4.21 1996/09/10 17:00:10 bentson | ||
267 | * shift from CPU-bound to memcopy in cyz_polling operation | ||
268 | * | ||
269 | * Revision 1.36.4.20 1996/09/09 18:30:32 Bentson | ||
270 | * Added support to set and report higher speeds. | ||
271 | * | ||
272 | * Revision 1.36.4.19c 1996/08/09 10:00:00 Marcio Saito | ||
273 | * Some fixes in the HW flow control for the BETA release. | ||
274 | * Don't try to register the IRQ. | ||
275 | * | ||
276 | * Revision 1.36.4.19 1996/08/08 16:23:18 Bentson | ||
277 | * make sure "cyc" appears in all kernel messages; all soft interrupts | ||
278 | * handled by same routine; recognize out-of-band reception; comment | ||
279 | * out some diagnostic messages; leave RTS/CTS flow control to hardware; | ||
280 | * fix race condition in -Z buffer management; only -Y needs to explicitly | ||
281 | * flush chars; tidy up some startup messages; | ||
282 | * | ||
283 | * Revision 1.36.4.18 1996/07/25 18:57:31 bentson | ||
284 | * shift MOD_INC_USE_COUNT location to match | ||
285 | * serial.c; purge some diagnostic messages; | ||
286 | * | ||
287 | * Revision 1.36.4.17 1996/07/25 18:01:08 bentson | ||
288 | * enable modem status messages and fetch & process them; note | ||
289 | * time of last activity type for each port; set_line_char now | ||
290 | * supports more than line 0 and treats 0 baud correctly; | ||
291 | * get_modem_info senses rs_status; | ||
292 | * | ||
293 | * Revision 1.36.4.16 1996/07/20 08:43:15 bentson | ||
294 | * barely works--now's time to turn on | ||
295 | * more features 'til it breaks | ||
296 | * | ||
297 | * Revision 1.36.4.15 1996/07/19 22:30:06 bentson | ||
298 | * check more -Z board status; shorten boot message | ||
299 | * | ||
300 | * Revision 1.36.4.14 1996/07/19 22:20:37 bentson | ||
301 | * fix reference to ch_ctrl in startup; verify return | ||
302 | * values from cyz_issue_cmd and cyz_update_channel; | ||
303 | * more stuff to get modem control correct; | ||
304 | * | ||
305 | * Revision 1.36.4.13 1996/07/11 19:53:33 bentson | ||
306 | * more -Z stuff folded in; re-order changes to put -Z stuff | ||
307 | * after -Y stuff (to make changes clearer) | ||
308 | * | ||
309 | * Revision 1.36.4.12 1996/07/11 15:40:55 bentson | ||
310 | * Add code to poll Cyclades-Z. Add code to get & set RS-232 control. | ||
311 | * Add code to send break. Clear firmware ID word at startup (so | ||
312 | * that other code won't talk to inactive board). | ||
313 | * | ||
314 | * Revision 1.36.4.11 1996/07/09 05:28:29 bentson | ||
315 | * add code for -Z in set_line_char | ||
316 | * | ||
317 | * Revision 1.36.4.10 1996/07/08 19:28:37 bentson | ||
318 | * fold more -Z stuff (or in some cases, error messages) | ||
319 | * into driver; add text to "don't know what to do" messages. | ||
320 | * | ||
321 | * Revision 1.36.4.9 1996/07/08 18:38:38 bentson | ||
322 | * moved compile-time flags near top of file; cosmetic changes | ||
323 | * to narrow text (to allow 2-up printing); changed many declarations | ||
324 | * to "static" to limit external symbols; shuffled code order to | ||
325 | * coalesce -Y and -Z specific code, also to put internal functions | ||
326 | * in order of tty_driver structure; added code to recognize -Z | ||
327 | * ports (and for moment, do nothing or report error); add cy_startup | ||
328 | * to parse boot command line for extra base addresses for ISA probes; | ||
329 | * | ||
330 | * Revision 1.36.4.8 1996/06/25 17:40:19 bentson | ||
331 | * reorder some code, fix types of some vars (int vs. long), | ||
332 | * add cy_setup to support user declared ISA addresses | ||
333 | * | ||
334 | * Revision 1.36.4.7 1996/06/21 23:06:18 bentson | ||
335 | * dump ioctl based firmware load (it's now a user level | ||
336 | * program); ensure uninitialzed ports cannot be used | ||
337 | * | ||
338 | * Revision 1.36.4.6 1996/06/20 23:17:19 bentson | ||
339 | * rename vars and restructure some code | ||
340 | * | ||
341 | * Revision 1.36.4.5 1996/06/14 15:09:44 bentson | ||
342 | * get right status back after boot load | ||
343 | * | ||
344 | * Revision 1.36.4.4 1996/06/13 19:51:44 bentson | ||
345 | * successfully loads firmware | ||
346 | * | ||
347 | * Revision 1.36.4.3 1996/06/13 06:08:33 bentson | ||
348 | * add more of the code for the boot/load ioctls | ||
349 | * | ||
350 | * Revision 1.36.4.2 1996/06/11 21:00:51 bentson | ||
351 | * start to add Z functionality--starting with ioctl | ||
352 | * for loading firmware | ||
353 | * | ||
354 | * Revision 1.36.4.1 1996/06/10 18:03:02 bentson | ||
355 | * added code to recognize Z/PCI card at initialization; report | ||
356 | * presence, but card is not initialized (because firmware needs | ||
357 | * to be loaded) | ||
358 | * | ||
359 | * Revision 1.36.3.8 1996/06/07 16:29:00 bentson | ||
360 | * starting minor number at zero; added missing verify_area | ||
361 | * as noted by Heiko Eißfeldt <heiko@colossus.escape.de> | ||
362 | * | ||
363 | * Revision 1.36.3.7 1996/04/19 21:06:18 bentson | ||
364 | * remove unneeded boot message & fix CLOCAL hardware flow | ||
365 | * control (Miquel van Smoorenburg <miquels@Q.cistron.nl>); | ||
366 | * remove unused diagnostic statements; minor 0 is first; | ||
367 | * | ||
368 | * Revision 1.36.3.6 1996/03/13 13:21:17 marcio | ||
369 | * The kernel function vremap (available only in later 1.3.xx kernels) | ||
370 | * allows the access to memory addresses above the RAM. This revision | ||
371 | * of the driver supports PCI boards below 1Mb (device id 0x100) and | ||
372 | * above 1Mb (device id 0x101). | ||
373 | * | ||
374 | * Revision 1.36.3.5 1996/03/07 15:20:17 bentson | ||
375 | * Some global changes to interrupt handling spilled into | ||
376 | * this driver--mostly unused arguments in system function | ||
377 | * calls. Also added change by Marcio Saito which should | ||
378 | * reduce lost interrupts at startup by fast processors. | ||
379 | * | ||
380 | * Revision 1.36.3.4 1995/11/13 20:45:10 bentson | ||
381 | * Changes by Corey Minyard <minyard@wf-rch.cirr.com> distributed | ||
382 | * in 1.3.41 kernel to remove a possible race condition, extend | ||
383 | * some error messages, and let the driver run as a loadable module | ||
384 | * Change by Alan Wendt <alan@ez0.ezlink.com> to remove a | ||
385 | * possible race condition. | ||
386 | * Change by Marcio Saito <marcio@cyclades.com> to fix PCI addressing. | ||
387 | * | ||
388 | * Revision 1.36.3.3 1995/11/13 19:44:48 bentson | ||
389 | * Changes by Linus Torvalds in 1.3.33 kernel distribution | ||
390 | * required due to reordering of driver initialization. | ||
391 | * Drivers are now initialized *after* memory management. | ||
392 | * | ||
393 | * Revision 1.36.3.2 1995/09/08 22:07:14 bentson | ||
394 | * remove printk from ISR; fix typo | ||
395 | * | ||
396 | * Revision 1.36.3.1 1995/09/01 12:00:42 marcio | ||
397 | * Minor fixes in the PCI board support. PCI function calls in | ||
398 | * conditional compilation (CONFIG_PCI). Thanks to Jim Duncan | ||
399 | * <duncan@okay.com>. "bad serial count" message removed. | ||
400 | * | ||
401 | * Revision 1.36.3 1995/08/22 09:19:42 marcio | ||
402 | * Cyclom-Y/PCI support added. Changes in the cy_init routine and | ||
403 | * board initialization. Changes in the boot messages. The driver | ||
404 | * supports up to 4 boards and 64 ports by default. | ||
405 | * | ||
406 | * Revision 1.36.1.4 1995/03/29 06:14:14 bentson | ||
407 | * disambiguate between Cyclom-16Y and Cyclom-32Ye; | ||
408 | * | ||
409 | * Revision 1.36.1.3 1995/03/23 22:15:35 bentson | ||
410 | * add missing break in modem control block in ioctl switch statement | ||
411 | * (discovered by Michael Edward Chastain <mec@jobe.shell.portal.com>); | ||
412 | * | ||
413 | * Revision 1.36.1.2 1995/03/22 19:16:22 bentson | ||
414 | * make sure CTS flow control is set as soon as possible (thanks | ||
415 | * to note from David Lambert <lambert@chesapeake.rps.slb.com>); | ||
416 | * | ||
417 | * Revision 1.36.1.1 1995/03/13 15:44:43 bentson | ||
418 | * initialize defaults for receive threshold and stale data timeout; | ||
419 | * cosmetic changes; | ||
420 | * | ||
421 | * Revision 1.36 1995/03/10 23:33:53 bentson | ||
422 | * added support of chips 4-7 in 32 port Cyclom-Ye; | ||
423 | * fix cy_interrupt pointer dereference problem | ||
424 | * (Joe Portman <baron@aa.net>); | ||
425 | * give better error response if open is attempted on non-existent port | ||
426 | * (Zachariah Vaum <jchryslr@netcom.com>); | ||
427 | * correct command timeout (Kenneth Lerman <lerman@@seltd.newnet.com>); | ||
428 | * conditional compilation for -16Y on systems with fast, noisy bus; | ||
429 | * comment out diagnostic print function; | ||
430 | * cleaned up table of base addresses; | ||
431 | * set receiver time-out period register to correct value, | ||
432 | * set receive threshold to better default values, | ||
433 | * set chip timer to more accurate 200 Hz ticking, | ||
434 | * add code to monitor and modify receive parameters | ||
435 | * (Rik Faith <faith@cs.unc.edu> Nick Simicich | ||
436 | * <njs@scifi.emi.net>); | ||
437 | * | ||
438 | * Revision 1.35 1994/12/16 13:54:18 steffen | ||
439 | * additional patch by Marcio Saito for board detection | ||
440 | * Accidently left out in 1.34 | ||
441 | * | ||
442 | * Revision 1.34 1994/12/10 12:37:12 steffen | ||
443 | * This is the corrected version as suggested by Marcio Saito | ||
444 | * | ||
445 | * Revision 1.33 1994/12/01 22:41:18 bentson | ||
446 | * add hooks to support more high speeds directly; add tytso | ||
447 | * patch regarding CLOCAL wakeups | ||
448 | * | ||
449 | * Revision 1.32 1994/11/23 19:50:04 bentson | ||
450 | * allow direct kernel control of higher signalling rates; | ||
451 | * look for cards at additional locations | ||
452 | * | ||
453 | * Revision 1.31 1994/11/16 04:33:28 bentson | ||
454 | * ANOTHER fix from Corey Minyard, minyard@wf-rch.cirr.com-- | ||
455 | * a problem in chars_in_buffer has been resolved by some | ||
456 | * small changes; this should yield smoother output | ||
457 | * | ||
458 | * Revision 1.30 1994/11/16 04:28:05 bentson | ||
459 | * Fix from Corey Minyard, Internet: minyard@metronet.com, | ||
460 | * UUCP: minyard@wf-rch.cirr.com, WORK: minyardbnr.ca, to | ||
461 | * cy_hangup that appears to clear up much (all?) of the | ||
462 | * DTR glitches; also he's added/cleaned-up diagnostic messages | ||
463 | * | ||
464 | * Revision 1.29 1994/11/16 04:16:07 bentson | ||
465 | * add change proposed by Ralph Sims, ralphs@halcyon.com, to | ||
466 | * operate higher speeds in same way as other serial ports; | ||
467 | * add more serial ports (for up to two 16-port muxes). | ||
468 | * | ||
469 | * Revision 1.28 1994/11/04 00:13:16 root | ||
470 | * turn off diagnostic messages | ||
471 | * | ||
472 | * Revision 1.27 1994/11/03 23:46:37 root | ||
473 | * bunch of changes to bring driver into greater conformance | ||
474 | * with the serial.c driver (looking for missed fixes) | ||
475 | * | ||
476 | * Revision 1.26 1994/11/03 22:40:36 root | ||
477 | * automatic interrupt probing fixed. | ||
478 | * | ||
479 | * Revision 1.25 1994/11/03 20:17:02 root | ||
480 | * start to implement auto-irq | ||
481 | * | ||
482 | * Revision 1.24 1994/11/03 18:01:55 root | ||
483 | * still working on modem signals--trying not to drop DTR | ||
484 | * during the getty/login processes | ||
485 | * | ||
486 | * Revision 1.23 1994/11/03 17:51:36 root | ||
487 | * extend baud rate support; set receive threshold as function | ||
488 | * of baud rate; fix some problems with RTS/CTS; | ||
489 | * | ||
490 | * Revision 1.22 1994/11/02 18:05:35 root | ||
491 | * changed arguments to udelay to type long to get | ||
492 | * delays to be of correct duration | ||
493 | * | ||
494 | * Revision 1.21 1994/11/02 17:37:30 root | ||
495 | * employ udelay (after calibrating loops_per_second earlier | ||
496 | * in init/main.c) instead of using home-grown delay routines | ||
497 | * | ||
498 | * Revision 1.20 1994/11/02 03:11:38 root | ||
499 | * cy_chars_in_buffer forces a return value of 0 to let | ||
500 | * login work (don't know why it does); some functions | ||
501 | * that were returning EFAULT, now executes the code; | ||
502 | * more work on deciding when to disable xmit interrupts; | ||
503 | * | ||
504 | * Revision 1.19 1994/11/01 20:10:14 root | ||
505 | * define routine to start transmission interrupts (by enabling | ||
506 | * transmit interrupts); directly enable/disable modem interrupts; | ||
507 | * | ||
508 | * Revision 1.18 1994/11/01 18:40:45 bentson | ||
509 | * Don't always enable transmit interrupts in startup; interrupt on | ||
510 | * TxMpty instead of TxRdy to help characters get out before shutdown; | ||
511 | * restructure xmit interrupt to check for chars first and quit if | ||
512 | * none are ready to go; modem status (MXVRx) is upright, _not_ inverted | ||
513 | * (to my view); | ||
514 | * | ||
515 | * Revision 1.17 1994/10/30 04:39:45 bentson | ||
516 | * rename serial_driver and callout_driver to cy_serial_driver and | ||
517 | * cy_callout_driver to avoid linkage interference; initialize | ||
518 | * info->type to PORT_CIRRUS; ruggedize paranoia test; elide ->port | ||
519 | * from cyclades_port structure; add paranoia check to cy_close; | ||
520 | * | ||
521 | * Revision 1.16 1994/10/30 01:14:33 bentson | ||
522 | * change major numbers; add some _early_ return statements; | ||
523 | * | ||
524 | * Revision 1.15 1994/10/29 06:43:15 bentson | ||
525 | * final tidying up for clean compile; enable some error reporting | ||
526 | * | ||
527 | * Revision 1.14 1994/10/28 20:30:22 Bentson | ||
528 | * lots of changes to drag the driver towards the new tty_io | ||
529 | * structures and operation. not expected to work, but may | ||
530 | * compile cleanly. | ||
531 | * | ||
532 | * Revision 1.13 1994/07/21 23:08:57 Bentson | ||
533 | * add some diagnostic cruft; support 24 lines (for testing | ||
534 | * both -8Y and -16Y cards; be more thorough in servicing all | ||
535 | * chips during interrupt; add "volatile" a few places to | ||
536 | * circumvent compiler optimizations; fix base & offset | ||
537 | * computations in block_til_ready (was causing chip 0 to | ||
538 | * stop operation) | ||
539 | * | ||
540 | * Revision 1.12 1994/07/19 16:42:11 Bentson | ||
541 | * add some hackery for kernel version 1.1.8; expand | ||
542 | * error messages; refine timing for delay loops and | ||
543 | * declare loop params volatile | ||
544 | * | ||
545 | * Revision 1.11 1994/06/11 21:53:10 bentson | ||
546 | * get use of save_car right in transmit interrupt service | ||
547 | * | ||
548 | * Revision 1.10.1.1 1994/06/11 21:31:18 bentson | ||
549 | * add some diagnostic printing; try to fix save_car stuff | ||
550 | * | ||
551 | * Revision 1.10 1994/06/11 20:36:08 bentson | ||
552 | * clean up compiler warnings | ||
553 | * | ||
554 | * Revision 1.9 1994/06/11 19:42:46 bentson | ||
555 | * added a bunch of code to support modem signalling | ||
556 | * | ||
557 | * Revision 1.8 1994/06/11 17:57:07 bentson | ||
558 | * recognize break & parity error | ||
559 | * | ||
560 | * Revision 1.7 1994/06/05 05:51:34 bentson | ||
561 | * Reorder baud table to be monotonic; add cli to CP; discard | ||
562 | * incoming characters and status if the line isn't open; start to | ||
563 | * fold code into cy_throttle; start to port get_serial_info, | ||
564 | * set_serial_info, get_modem_info, set_modem_info, and send_break | ||
565 | * from serial.c; expand cy_ioctl; relocate and expand config_setup; | ||
566 | * get flow control characters from tty struct; invalidate ports w/o | ||
567 | * hardware; | ||
568 | * | ||
569 | * Revision 1.6 1994/05/31 18:42:21 bentson | ||
570 | * add a loop-breaker in the interrupt service routine; | ||
571 | * note when port is initialized so that it can be shut | ||
572 | * down under the right conditions; receive works without | ||
573 | * any obvious errors | ||
574 | * | ||
575 | * Revision 1.5 1994/05/30 00:55:02 bentson | ||
576 | * transmit works without obvious errors | ||
577 | * | ||
578 | * Revision 1.4 1994/05/27 18:46:27 bentson | ||
579 | * incorporated more code from lib_y.c; can now print short | ||
580 | * strings under interrupt control to port zero; seems to | ||
581 | * select ports/channels/lines correctly | ||
582 | * | ||
583 | * Revision 1.3 1994/05/25 22:12:44 bentson | ||
584 | * shifting from multi-port on a card to proper multiplexor | ||
585 | * data structures; added skeletons of most routines | ||
586 | * | ||
587 | * Revision 1.2 1994/05/19 13:21:43 bentson | ||
588 | * start to crib from other sources | ||
589 | * | ||
590 | */ | 22 | */ |
591 | 23 | ||
592 | #define CY_VERSION "2.5" | 24 | #define CY_VERSION "2.6" |
593 | 25 | ||
594 | /* If you need to install more boards than NR_CARDS, change the constant | 26 | /* If you need to install more boards than NR_CARDS, change the constant |
595 | in the definition below. No other change is necessary to support up to | 27 | in the definition below. No other change is necessary to support up to |
@@ -648,9 +80,7 @@ | |||
648 | #include <linux/firmware.h> | 80 | #include <linux/firmware.h> |
649 | #include <linux/device.h> | 81 | #include <linux/device.h> |
650 | 82 | ||
651 | #include <asm/system.h> | ||
652 | #include <linux/io.h> | 83 | #include <linux/io.h> |
653 | #include <asm/irq.h> | ||
654 | #include <linux/uaccess.h> | 84 | #include <linux/uaccess.h> |
655 | 85 | ||
656 | #include <linux/kernel.h> | 86 | #include <linux/kernel.h> |
@@ -666,7 +96,6 @@ static void cy_send_xchar(struct tty_struct *tty, char ch); | |||
666 | #ifndef SERIAL_XMIT_SIZE | 96 | #ifndef SERIAL_XMIT_SIZE |
667 | #define SERIAL_XMIT_SIZE (min(PAGE_SIZE, 4096)) | 97 | #define SERIAL_XMIT_SIZE (min(PAGE_SIZE, 4096)) |
668 | #endif | 98 | #endif |
669 | #define WAKEUP_CHARS 256 | ||
670 | 99 | ||
671 | #define STD_COM_FLAGS (0) | 100 | #define STD_COM_FLAGS (0) |
672 | 101 | ||
@@ -756,25 +185,25 @@ static int cy_next_channel; /* next minor available */ | |||
756 | * HI VHI | 185 | * HI VHI |
757 | * 20 | 186 | * 20 |
758 | */ | 187 | */ |
759 | static int baud_table[] = { | 188 | static const int baud_table[] = { |
760 | 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, | 189 | 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, |
761 | 1800, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200, 150000, | 190 | 1800, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200, 150000, |
762 | 230400, 0 | 191 | 230400, 0 |
763 | }; | 192 | }; |
764 | 193 | ||
765 | static char baud_co_25[] = { /* 25 MHz clock option table */ | 194 | static const char baud_co_25[] = { /* 25 MHz clock option table */ |
766 | /* value => 00 01 02 03 04 */ | 195 | /* value => 00 01 02 03 04 */ |
767 | /* divide by 8 32 128 512 2048 */ | 196 | /* divide by 8 32 128 512 2048 */ |
768 | 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x02, | 197 | 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x02, |
769 | 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 198 | 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
770 | }; | 199 | }; |
771 | 200 | ||
772 | static char baud_bpr_25[] = { /* 25 MHz baud rate period table */ | 201 | static const char baud_bpr_25[] = { /* 25 MHz baud rate period table */ |
773 | 0x00, 0xf5, 0xa3, 0x6f, 0x5c, 0x51, 0xf5, 0xa3, 0x51, 0xa3, | 202 | 0x00, 0xf5, 0xa3, 0x6f, 0x5c, 0x51, 0xf5, 0xa3, 0x51, 0xa3, |
774 | 0x6d, 0x51, 0xa3, 0x51, 0xa3, 0x51, 0x36, 0x29, 0x1b, 0x15 | 203 | 0x6d, 0x51, 0xa3, 0x51, 0xa3, 0x51, 0x36, 0x29, 0x1b, 0x15 |
775 | }; | 204 | }; |
776 | 205 | ||
777 | static char baud_co_60[] = { /* 60 MHz clock option table (CD1400 J) */ | 206 | static const char baud_co_60[] = { /* 60 MHz clock option table (CD1400 J) */ |
778 | /* value => 00 01 02 03 04 */ | 207 | /* value => 00 01 02 03 04 */ |
779 | /* divide by 8 32 128 512 2048 */ | 208 | /* divide by 8 32 128 512 2048 */ |
780 | 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, | 209 | 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, |
@@ -782,13 +211,13 @@ static char baud_co_60[] = { /* 60 MHz clock option table (CD1400 J) */ | |||
782 | 0x00 | 211 | 0x00 |
783 | }; | 212 | }; |
784 | 213 | ||
785 | static char baud_bpr_60[] = { /* 60 MHz baud rate period table (CD1400 J) */ | 214 | static const char baud_bpr_60[] = { /* 60 MHz baud rate period table (CD1400 J) */ |
786 | 0x00, 0x82, 0x21, 0xff, 0xdb, 0xc3, 0x92, 0x62, 0xc3, 0x62, | 215 | 0x00, 0x82, 0x21, 0xff, 0xdb, 0xc3, 0x92, 0x62, 0xc3, 0x62, |
787 | 0x41, 0xc3, 0x62, 0xc3, 0x62, 0xc3, 0x82, 0x62, 0x41, 0x32, | 216 | 0x41, 0xc3, 0x62, 0xc3, 0x62, 0xc3, 0x82, 0x62, 0x41, 0x32, |
788 | 0x21 | 217 | 0x21 |
789 | }; | 218 | }; |
790 | 219 | ||
791 | static char baud_cor3[] = { /* receive threshold */ | 220 | static const char baud_cor3[] = { /* receive threshold */ |
792 | 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, | 221 | 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, |
793 | 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x07, | 222 | 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x07, |
794 | 0x07 | 223 | 0x07 |
@@ -805,7 +234,7 @@ static char baud_cor3[] = { /* receive threshold */ | |||
805 | * cables. | 234 | * cables. |
806 | */ | 235 | */ |
807 | 236 | ||
808 | static char rflow_thr[] = { /* rflow threshold */ | 237 | static const char rflow_thr[] = { /* rflow threshold */ |
809 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 238 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
810 | 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, | 239 | 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, |
811 | 0x0a | 240 | 0x0a |
@@ -827,7 +256,7 @@ static const unsigned int cy_chip_offset[] = { 0x0000, | |||
827 | /* PCI related definitions */ | 256 | /* PCI related definitions */ |
828 | 257 | ||
829 | #ifdef CONFIG_PCI | 258 | #ifdef CONFIG_PCI |
830 | static struct pci_device_id cy_pci_dev_id[] __devinitdata = { | 259 | static const struct pci_device_id cy_pci_dev_id[] = { |
831 | /* PCI < 1Mb */ | 260 | /* PCI < 1Mb */ |
832 | { PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Y_Lo) }, | 261 | { PCI_DEVICE(PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_Y_Lo) }, |
833 | /* PCI > 1Mb */ | 262 | /* PCI > 1Mb */ |
@@ -893,7 +322,7 @@ static inline bool cyz_is_loaded(struct cyclades_card *card) | |||
893 | } | 322 | } |
894 | 323 | ||
895 | static inline int serial_paranoia_check(struct cyclades_port *info, | 324 | static inline int serial_paranoia_check(struct cyclades_port *info, |
896 | char *name, const char *routine) | 325 | const char *name, const char *routine) |
897 | { | 326 | { |
898 | #ifdef SERIAL_PARANOIA_CHECK | 327 | #ifdef SERIAL_PARANOIA_CHECK |
899 | if (!info) { | 328 | if (!info) { |
@@ -909,7 +338,7 @@ static inline int serial_paranoia_check(struct cyclades_port *info, | |||
909 | } | 338 | } |
910 | #endif | 339 | #endif |
911 | return 0; | 340 | return 0; |
912 | } /* serial_paranoia_check */ | 341 | } |
913 | 342 | ||
914 | /***********************************************************/ | 343 | /***********************************************************/ |
915 | /********* Start of block of Cyclom-Y specific code ********/ | 344 | /********* Start of block of Cyclom-Y specific code ********/ |
@@ -3030,11 +2459,9 @@ cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty, | |||
3030 | struct serial_struct __user *new_info) | 2459 | struct serial_struct __user *new_info) |
3031 | { | 2460 | { |
3032 | struct serial_struct new_serial; | 2461 | struct serial_struct new_serial; |
3033 | struct cyclades_port old_info; | ||
3034 | 2462 | ||
3035 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) | 2463 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) |
3036 | return -EFAULT; | 2464 | return -EFAULT; |
3037 | old_info = *info; | ||
3038 | 2465 | ||
3039 | if (!capable(CAP_SYS_ADMIN)) { | 2466 | if (!capable(CAP_SYS_ADMIN)) { |
3040 | if (new_serial.close_delay != info->port.close_delay || | 2467 | if (new_serial.close_delay != info->port.close_delay || |
@@ -3376,7 +2803,6 @@ static int cy_break(struct tty_struct *tty, int break_state) | |||
3376 | static int get_mon_info(struct cyclades_port *info, | 2803 | static int get_mon_info(struct cyclades_port *info, |
3377 | struct cyclades_monitor __user *mon) | 2804 | struct cyclades_monitor __user *mon) |
3378 | { | 2805 | { |
3379 | |||
3380 | if (copy_to_user(mon, &info->mon, sizeof(struct cyclades_monitor))) | 2806 | if (copy_to_user(mon, &info->mon, sizeof(struct cyclades_monitor))) |
3381 | return -EFAULT; | 2807 | return -EFAULT; |
3382 | info->mon.int_count = 0; | 2808 | info->mon.int_count = 0; |