2 * linux/drivers/char/8250_pnp.c
4 * Probe module for 8250/16550-type ISAPNP serial ports.
6 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
8 * Copyright (C) 2001 Russell King, All Rights Reserved.
10 * Ported to the Linux PnP Layer - (C) Adam Belay.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License.
16 * $Id: 8250_pnp.c,v 1.10 2002/07/21 21:32:30 rmk Exp $
18 #include <linux/module.h>
19 #include <linux/init.h>
20 #include <linux/pci.h>
21 #include <linux/pnp.h>
22 #include <linux/string.h>
23 #include <linux/kernel.h>
24 #include <linux/serial.h>
25 #include <linux/serialP.h>
27 #include <asm/bitops.h>
28 #include <asm/byteorder.h>
29 #include <asm/serial.h>
33 #define UNKNOWN_DEV 0x3000
36 static const struct pnp_device_id pnp_dev_table
[] = {
37 /* Archtek America Corp. */
38 /* Archtek SmartLink Modem 3334BT Plug & Play */
40 /* Anchor Datacomm BV */
41 /* SXPro 144 External Data Fax Modem Plug & Play */
43 /* SXPro 288 External Data Fax Modem Plug & Play */
45 /* Actiontec ISA PNP 56K X2 Fax Modem */
47 /* Rockwell 56K ACF II Fax+Data+Voice Modem */
48 { "AKY1021", SPCI_FL_NO_SHIRQ
},
49 /* AZT3005 PnP SOUND DEVICE */
51 /* Best Data Products Inc. Smart One 336F PnP Modem */
54 /* Boca Complete Ofc Communicator 14.4 Data-FAX */
56 /* Boca Research 33,600 ACF Modem */
58 /* Boca 33.6 Kbps Internal FD34FSVD */
60 /* Boca 33.6 Kbps Internal FD34FSVD */
62 /* Best Data Products Inc. Smart One 336F PnP Modem */
64 /* Computer Peripherals Inc */
65 /* EuroViVa CommCenter-33.6 SP PnP */
68 /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */
70 /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */
73 /* Creative Modem Blaster Flash56 DI5601-1 */
75 /* Creative Modem Blaster V.90 DI5660 */
78 /* Fujitsu 33600 PnP-I2 R Plug & Play */
80 /* Fujitsu FMV-FX431 Plug & Play */
82 /* Fujitsu 33600 PnP-I4 R Plug & Play */
84 /* Fujitsu Fax Voice 33600 PNP-I5 R Plug & Play */
86 /* Archtek America Corp. */
87 /* Archtek SmartLink Modem 3334BT Plug & Play */
90 /* Hayes Optima 288 V.34-V.FC + FAX + Voice Plug & Play */
92 /* Hayes Optima 336 V.34 + FAX + Voice PnP */
94 /* Hayes Optima 336B V.34 + FAX + Voice PnP */
96 /* Hayes Accura 56K Ext Fax Modem PnP */
98 /* Hayes Accura 56K Ext Fax Modem PnP */
100 /* Hayes Accura 56K Fax Modem PnP */
102 /* Hayes 288, V.34 + FAX */
104 /* Hayes Optima 288 V.34 + FAX + Voice, Plug & Play */
107 /* IBM Thinkpad 701 Internal Modem Voice */
110 /* Intertex 28k8 33k6 Voice EXT PnP */
112 /* Intertex 33k6 56k Voice EXT PnP */
114 /* Intertex 28k8 33k6 Voice SP EXT PnP */
116 /* Intertex 33k6 56k Voice SP EXT PnP */
118 /* Intertex 28k8 33k6 Voice SP INT PnP */
120 /* Intertex 28k8 33k6 Voice SP EXT PnP */
122 /* Intertex 33k6 56k Voice SP EXT PnP */
124 /* Kortex International */
125 /* KORTEX 28800 Externe PnP */
127 /* KXPro 33.6 Vocal ASVD PnP */
130 /* LASAT Internet 33600 PnP */
132 /* Lasat Safire 560 PnP */
134 /* Lasat Safire 336 PnP */
137 /* Microcom TravelPorte FAST V.34 Plug & Play */
139 /* Microcom DeskPorte V.34 FAST or FAST+ Plug & Play */
141 /* Microcom DeskPorte FAST EP 28.8 Plug & Play */
143 /* Microcom DeskPorte 28.8P Plug & Play */
145 /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
147 /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
149 /* Microcom DeskPorte 28.8S Internal Plug & Play */
152 /* Motorola BitSURFR Plug & Play */
154 /* Motorola TA210 Plug & Play */
156 /* Motorola HMTA 200 (ISDN) Plug & Play */
158 /* Motorola BitSURFR Plug & Play */
160 /* Motorola Lifestyle 28.8 Internal */
162 /* Motorola V.3400 Plug & Play */
164 /* Motorola Lifestyle 28.8 V.34 Plug & Play */
166 /* Motorola Power 28.8 V.34 Plug & Play */
168 /* Motorola ModemSURFR External 28.8 Plug & Play */
170 /* Motorola Premier 33.6 Desktop Plug & Play */
172 /* Motorola VoiceSURFR 56K External PnP */
174 /* Motorola ModemSURFR 56K External PnP */
176 /* Motorola ModemSURFR 56K Internal PnP */
178 /* Motorola ModemSURFR Internal 28.8 Plug & Play */
180 /* Motorola Premier 33.6 Internal Plug & Play */
182 /* Motorola OnlineSURFR 28.8 Internal Plug & Play */
184 /* Motorola VoiceSURFR 56K Internal PnP */
187 /* Deskline K56 Phone System PnP */
189 /* PC Rider K56 Phone System PnP */
191 /* NEC 98NOTE SPEAKER PHONE FAX MODEM(33600bps) */
193 /* Pace 56 Voice Internal Plug & Play Modem */
196 /* Generic standard PC COM port */
198 /* Generic 16550A-compatible COM port */
200 /* Compaq 14400 Modem */
202 /* Compaq 2400/9600 Modem */
204 /* Dial-Up Networking Serial Cable between 2 PCs */
206 /* Dial-Up Networking Parallel Cable between 2 PCs */
208 /* Standard 9600 bps Modem */
210 /* Standard 14400 bps Modem */
212 /* Standard 28800 bps Modem*/
216 /* Standard 9600 bps Modem*/
218 /* Standard 14400 bps Modem*/
220 /* Standard 28800 bps Modem*/
224 /* Standard 9600 bps Modem */
226 /* Standard 14400 bps Modem */
228 /* Standard 28800 bps Modem */
232 /* Standard 9600 bps Modem */
234 /* Standard 14400 bps Modem */
236 /* Standard 28800 bps Modem */
240 /* Standard PCMCIA Card Modem */
243 /* Modular Technology */
244 /* Rockwell 33.6 DPF Internal PnP */
245 /* Modular Technology 33.6 Internal PnP */
247 /* Kortex International */
248 /* KORTEX 14400 Externe PnP */
250 /* Viking Components, Inc */
251 /* Viking 28.8 INTERNAL Fax+Data+Voice PnP */
254 /* British Telecom */
255 /* Modular Technology */
256 /* Rockwell 33.6 DPF External PnP */
257 /* BT Prologue 33.6 External PnP */
258 /* Modular Technology 33.6 External PnP */
260 /* Viking 56K FAX INT */
262 /* SupraExpress 28.8 Data/Fax PnP modem */
264 /* SupraExpress 33.6 Data/Fax PnP modem */
266 /* SupraExpress 33.6 Data/Fax PnP modem */
268 /* SupraExpress 33.6 Data/Fax PnP modem */
271 /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */
273 /* Archtek America Corp. */
274 /* Archtek SmartLink Modem 3334BT Plug & Play */
277 /* Gateway Telepath IIvi 33.6 */
279 /* Sportster Vi 14.4 PnP FAX Voicemail */
281 /* U.S. Robotics 33.6K Voice INT PnP */
283 /* U.S. Robotics 33.6K Voice EXT PnP */
285 /* U.S. Robotics 33.6K Voice INT PnP */
287 /* U.S. Robotics 56K Voice INT PnP */
289 /* U.S. Robotics 56K Voice EXT PnP */
291 /* U.S. Robotics 56K FAX INT */
293 /* U.S. Robotics 56K Voice INT PnP */
295 /* U.S. Robotics 56K Voice EXT PnP */
297 /* U.S. Robotics 56K Voice INT PnP */
299 /* U.S. Robotics 56K Message */
301 /* U.S. Robotics 56K FAX EXT PnP*/
303 /* U.S. Robotics 56K FAX INT PnP*/
305 /* U.S. Robotics 56K Voice EXT PnP*/
307 /* U.S. Robotics 56K Voice INT PnP*/
309 /* Unkown PnP modems */
310 { "PNPCXXX", UNKNOWN_DEV
},
311 /* More unkown PnP modems */
312 { "PNPDXXX", UNKNOWN_DEV
},
316 MODULE_DEVICE_TABLE(pnp
, pnp_dev_table
);
318 static char *modem_names
[] __devinitdata
= {
319 "MODEM", "Modem", "modem", "FAX", "Fax", "fax",
320 "56K", "56k", "K56", "33.6", "28.8", "14.4",
321 "33,600", "28,800", "14,400", "33.600", "28.800", "14.400",
322 "33600", "28800", "14400", "V.90", "V.34", "V.32", 0
325 static int __devinit
check_name(char *name
)
329 for (tmp
= modem_names
; *tmp
; tmp
++)
330 if (strstr(name
, *tmp
))
336 static int __devinit
check_resources(struct pnp_option
*option
)
338 struct pnp_option
*tmp
;
342 for (tmp
= option
; tmp
; tmp
= tmp
->next
) {
343 struct pnp_port
*port
;
344 for (port
= tmp
->port
; port
; port
= port
->next
)
345 if ((port
->size
== 8) &&
346 ((port
->min
== 0x2f8) ||
347 (port
->min
== 0x3f8) ||
348 (port
->min
== 0x2e8) ||
349 #ifdef CONFIG_X86_PC9800
350 (port
->min
== 0x8b0) ||
352 (port
->min
== 0x3e8)))
360 * Given a complete unknown PnP device, try to use some heuristics to
361 * detect modems. Currently use such heuristic set:
362 * - dev->name or dev->bus->name must contain "modem" substring;
363 * - device must have only one IO region (8 byte long) with base address
364 * 0x2e8, 0x3e8, 0x2f8 or 0x3f8.
366 * Such detection looks very ugly, but can detect at least some of numerous
367 * PnP modems, alternatively we must hardcode all modems in pnp_devices[]
370 static int __devinit
serial_pnp_guess_board(struct pnp_dev
*dev
, int *flags
)
372 if (!(check_name(dev
->dev
.name
) || (dev
->card
&& check_name(dev
->card
->dev
.name
))))
375 if (check_resources(dev
->independent
))
378 if (check_resources(dev
->dependent
))
385 serial_pnp_probe(struct pnp_dev
* dev
, const struct pnp_device_id
*dev_id
)
387 struct serial_struct serial_req
;
388 int ret
, line
, flags
= dev_id
->driver_data
;
389 if (flags
& UNKNOWN_DEV
) {
390 ret
= serial_pnp_guess_board(dev
, &flags
);
394 memset(&serial_req
, 0, sizeof(serial_req
));
395 serial_req
.irq
= pnp_irq(dev
,0);
396 serial_req
.port
= pnp_port_start(dev
, 0);
397 if (HIGH_BITS_OFFSET
)
398 serial_req
.port
= pnp_port_start(dev
, 0) >> HIGH_BITS_OFFSET
;
399 #ifdef SERIAL_DEBUG_PNP
400 printk("Setup PNP port: port %x, irq %d, type %d\n",
401 serial_req
.port
, serial_req
.irq
, serial_req
.io_type
);
404 serial_req
.flags
= ASYNC_SKIP_TEST
| ASYNC_AUTOPROBE
;
405 serial_req
.baud_base
= 115200;
406 line
= register_serial(&serial_req
);
409 pnp_set_drvdata(dev
, (void *)(line
+ 1));
410 return line
>= 0 ? 0 : -ENODEV
;
414 static void serial_pnp_remove(struct pnp_dev
* dev
)
419 static struct pnp_driver serial_pnp_driver
= {
421 .id_table
= pnp_dev_table
,
422 .probe
= serial_pnp_probe
,
423 .remove
= serial_pnp_remove
,
426 static int __init
serial8250_pnp_init(void)
428 return pnp_register_driver(&serial_pnp_driver
);
431 static void __exit
serial8250_pnp_exit(void)
436 module_init(serial8250_pnp_init
);
437 module_exit(serial8250_pnp_exit
);
439 MODULE_LICENSE("GPL");
440 MODULE_DESCRIPTION("Generic 8250/16x50 PnP serial driver");