blob: 1b449b759990475e66189c21334f9d80e0ab0735 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Probe module for 8250/16550-type PCI serial ports.
3 *
4 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
5 *
6 * Copyright (C) 2001 Russell King, All Rights Reserved.
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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/pci.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/string.h>
16#include <linux/kernel.h>
17#include <linux/slab.h>
18#include <linux/delay.h>
19#include <linux/tty.h>
20#include <linux/serial_core.h>
21#include <linux/8250_pci.h>
22#include <linux/bitops.h>
23
24#include <asm/byteorder.h>
25#include <asm/io.h>
26
27#include "8250.h"
28
29#undef SERIAL_DEBUG_PCI
30
31/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 * init function returns:
33 * > 0 - number of ports
34 * = 0 - use board->num_ports
35 * < 0 - error
36 */
37struct pci_serial_quirk {
38 u32 vendor;
39 u32 device;
40 u32 subvendor;
41 u32 subdevice;
Frédéric Brière5bf8f502011-05-29 15:08:03 -040042 int (*probe)(struct pci_dev *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 int (*init)(struct pci_dev *dev);
Russell King975a1a7d2009-01-02 13:44:27 +000044 int (*setup)(struct serial_private *,
45 const struct pciserial_board *,
Russell King05caac52005-07-27 11:41:18 +010046 struct uart_port *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 void (*exit)(struct pci_dev *dev);
48};
49
50#define PCI_NUM_BAR_RESOURCES 6
51
52struct serial_private {
Russell King70db3d92005-07-27 11:34:27 +010053 struct pci_dev *dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 unsigned int nr;
55 void __iomem *remapped_bar[PCI_NUM_BAR_RESOURCES];
56 struct pci_serial_quirk *quirk;
57 int line[0];
58};
59
Nicos Gollan7808edc2011-05-05 21:00:37 +020060static int pci_default_setup(struct serial_private*,
61 const struct pciserial_board*, struct uart_port*, int);
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063static void moan_device(const char *str, struct pci_dev *dev)
64{
Joe Perchesad361c92009-07-06 13:05:40 -070065 printk(KERN_WARNING
66 "%s: %s\n"
67 "Please send the output of lspci -vv, this\n"
68 "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n"
69 "manufacturer and name of serial board or\n"
70 "modem board to rmk+serial@arm.linux.org.uk.\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 pci_name(dev), str, dev->vendor, dev->device,
72 dev->subsystem_vendor, dev->subsystem_device);
73}
74
75static int
Russell King70db3d92005-07-27 11:34:27 +010076setup_port(struct serial_private *priv, struct uart_port *port,
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 int bar, int offset, int regshift)
78{
Russell King70db3d92005-07-27 11:34:27 +010079 struct pci_dev *dev = priv->dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 unsigned long base, len;
81
82 if (bar >= PCI_NUM_BAR_RESOURCES)
83 return -EINVAL;
84
Russell King72ce9a82005-07-27 11:32:04 +010085 base = pci_resource_start(dev, bar);
86
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 len = pci_resource_len(dev, bar);
89
90 if (!priv->remapped_bar[bar])
Alan Cox6f441fe2008-05-01 04:34:59 -070091 priv->remapped_bar[bar] = ioremap_nocache(base, len);
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 if (!priv->remapped_bar[bar])
93 return -ENOMEM;
94
95 port->iotype = UPIO_MEM;
Russell King72ce9a82005-07-27 11:32:04 +010096 port->iobase = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 port->mapbase = base + offset;
98 port->membase = priv->remapped_bar[bar] + offset;
99 port->regshift = regshift;
100 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 port->iotype = UPIO_PORT;
Russell King72ce9a82005-07-27 11:32:04 +0100102 port->iobase = base + offset;
103 port->mapbase = 0;
104 port->membase = NULL;
105 port->regshift = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 }
107 return 0;
108}
109
110/*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -0800111 * ADDI-DATA GmbH communication cards <info@addi-data.com>
112 */
113static int addidata_apci7800_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000114 const struct pciserial_board *board,
Krauth.Julien02c9b5c2008-02-04 22:27:49 -0800115 struct uart_port *port, int idx)
116{
117 unsigned int bar = 0, offset = board->first_offset;
118 bar = FL_GET_BASE(board->flags);
119
120 if (idx < 2) {
121 offset += idx * board->uart_offset;
122 } else if ((idx >= 2) && (idx < 4)) {
123 bar += 1;
124 offset += ((idx - 2) * board->uart_offset);
125 } else if ((idx >= 4) && (idx < 6)) {
126 bar += 2;
127 offset += ((idx - 4) * board->uart_offset);
128 } else if (idx >= 6) {
129 bar += 3;
130 offset += ((idx - 6) * board->uart_offset);
131 }
132
133 return setup_port(priv, port, bar, offset, board->reg_shift);
134}
135
136/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 * AFAVLAB uses a different mixture of BARs and offsets
138 * Not that ugly ;) -- HW
139 */
140static int
Russell King975a1a7d2009-01-02 13:44:27 +0000141afavlab_setup(struct serial_private *priv, const struct pciserial_board *board,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 struct uart_port *port, int idx)
143{
144 unsigned int bar, offset = board->first_offset;
Alan Cox5756ee92008-02-08 04:18:51 -0800145
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 bar = FL_GET_BASE(board->flags);
147 if (idx < 4)
148 bar += idx;
149 else {
150 bar = 4;
151 offset += (idx - 4) * board->uart_offset;
152 }
153
Russell King70db3d92005-07-27 11:34:27 +0100154 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155}
156
157/*
158 * HP's Remote Management Console. The Diva chip came in several
159 * different versions. N-class, L2000 and A500 have two Diva chips, each
160 * with 3 UARTs (the third UART on the second chip is unused). Superdome
161 * and Keystone have one Diva chip with 3 UARTs. Some later machines have
162 * one Diva chip, but it has been expanded to 5 UARTs.
163 */
Russell King61a116e2006-07-03 15:22:35 +0100164static int pci_hp_diva_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165{
166 int rc = 0;
167
168 switch (dev->subsystem_device) {
169 case PCI_DEVICE_ID_HP_DIVA_TOSCA1:
170 case PCI_DEVICE_ID_HP_DIVA_HALFDOME:
171 case PCI_DEVICE_ID_HP_DIVA_KEYSTONE:
172 case PCI_DEVICE_ID_HP_DIVA_EVEREST:
173 rc = 3;
174 break;
175 case PCI_DEVICE_ID_HP_DIVA_TOSCA2:
176 rc = 2;
177 break;
178 case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
179 rc = 4;
180 break;
181 case PCI_DEVICE_ID_HP_DIVA_POWERBAR:
Justin Chen551f8f02005-10-24 22:16:38 +0100182 case PCI_DEVICE_ID_HP_DIVA_HURRICANE:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 rc = 1;
184 break;
185 }
186
187 return rc;
188}
189
190/*
191 * HP's Diva chip puts the 4th/5th serial port further out, and
192 * some serial ports are supposed to be hidden on certain models.
193 */
194static int
Russell King975a1a7d2009-01-02 13:44:27 +0000195pci_hp_diva_setup(struct serial_private *priv,
196 const struct pciserial_board *board,
197 struct uart_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198{
199 unsigned int offset = board->first_offset;
200 unsigned int bar = FL_GET_BASE(board->flags);
201
Russell King70db3d92005-07-27 11:34:27 +0100202 switch (priv->dev->subsystem_device) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
204 if (idx == 3)
205 idx++;
206 break;
207 case PCI_DEVICE_ID_HP_DIVA_EVEREST:
208 if (idx > 0)
209 idx++;
210 if (idx > 2)
211 idx++;
212 break;
213 }
214 if (idx > 2)
215 offset = 0x18;
216
217 offset += idx * board->uart_offset;
218
Russell King70db3d92005-07-27 11:34:27 +0100219 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220}
221
222/*
223 * Added for EKF Intel i960 serial boards
224 */
Russell King61a116e2006-07-03 15:22:35 +0100225static int pci_inteli960ni_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226{
227 unsigned long oldval;
228
229 if (!(dev->subsystem_device & 0x1000))
230 return -ENODEV;
231
232 /* is firmware started? */
Alan Cox5756ee92008-02-08 04:18:51 -0800233 pci_read_config_dword(dev, 0x44, (void *)&oldval);
234 if (oldval == 0x00001000L) { /* RESET value */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 printk(KERN_DEBUG "Local i960 firmware missing");
236 return -ENODEV;
237 }
238 return 0;
239}
240
241/*
242 * Some PCI serial cards using the PLX 9050 PCI interface chip require
243 * that the card interrupt be explicitly enabled or disabled. This
244 * seems to be mainly needed on card using the PLX which also use I/O
245 * mapped memory.
246 */
Russell King61a116e2006-07-03 15:22:35 +0100247static int pci_plx9050_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248{
249 u8 irq_config;
250 void __iomem *p;
251
252 if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0) {
253 moan_device("no memory in bar 0", dev);
254 return 0;
255 }
256
257 irq_config = 0x41;
Bjorn Helgaasadd7b582005-10-24 22:11:57 +0100258 if (dev->vendor == PCI_VENDOR_ID_PANACOM ||
Alan Cox5756ee92008-02-08 04:18:51 -0800259 dev->subsystem_vendor == PCI_SUBVENDOR_ID_EXSYS)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 irq_config = 0x43;
Alan Cox5756ee92008-02-08 04:18:51 -0800261
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 if ((dev->vendor == PCI_VENDOR_ID_PLX) &&
Alan Cox5756ee92008-02-08 04:18:51 -0800263 (dev->device == PCI_DEVICE_ID_PLX_ROMULUS))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 /*
265 * As the megawolf cards have the int pins active
266 * high, and have 2 UART chips, both ints must be
267 * enabled on the 9050. Also, the UARTS are set in
268 * 16450 mode by default, so we have to enable the
269 * 16C950 'enhanced' mode so that we can use the
270 * deep FIFOs
271 */
272 irq_config = 0x5b;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 /*
274 * enable/disable interrupts
275 */
Alan Cox6f441fe2008-05-01 04:34:59 -0700276 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 if (p == NULL)
278 return -ENOMEM;
279 writel(irq_config, p + 0x4c);
280
281 /*
282 * Read the register back to ensure that it took effect.
283 */
284 readl(p + 0x4c);
285 iounmap(p);
286
287 return 0;
288}
289
290static void __devexit pci_plx9050_exit(struct pci_dev *dev)
291{
292 u8 __iomem *p;
293
294 if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0)
295 return;
296
297 /*
298 * disable interrupts
299 */
Alan Cox6f441fe2008-05-01 04:34:59 -0700300 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 if (p != NULL) {
302 writel(0, p + 0x4c);
303
304 /*
305 * Read the register back to ensure that it took effect.
306 */
307 readl(p + 0x4c);
308 iounmap(p);
309 }
310}
311
Will Page04bf7e72009-04-06 17:32:15 +0100312#define NI8420_INT_ENABLE_REG 0x38
313#define NI8420_INT_ENABLE_BIT 0x2000
314
315static void __devexit pci_ni8420_exit(struct pci_dev *dev)
316{
317 void __iomem *p;
318 unsigned long base, len;
319 unsigned int bar = 0;
320
321 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
322 moan_device("no memory in bar", dev);
323 return;
324 }
325
326 base = pci_resource_start(dev, bar);
327 len = pci_resource_len(dev, bar);
328 p = ioremap_nocache(base, len);
329 if (p == NULL)
330 return;
331
332 /* Disable the CPU Interrupt */
333 writel(readl(p + NI8420_INT_ENABLE_REG) & ~(NI8420_INT_ENABLE_BIT),
334 p + NI8420_INT_ENABLE_REG);
335 iounmap(p);
336}
337
338
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100339/* MITE registers */
340#define MITE_IOWBSR1 0xc4
341#define MITE_IOWCR1 0xf4
342#define MITE_LCIMR1 0x08
343#define MITE_LCIMR2 0x10
344
345#define MITE_LCIMR2_CLR_CPU_IE (1 << 30)
346
347static void __devexit pci_ni8430_exit(struct pci_dev *dev)
348{
349 void __iomem *p;
350 unsigned long base, len;
351 unsigned int bar = 0;
352
353 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
354 moan_device("no memory in bar", dev);
355 return;
356 }
357
358 base = pci_resource_start(dev, bar);
359 len = pci_resource_len(dev, bar);
360 p = ioremap_nocache(base, len);
361 if (p == NULL)
362 return;
363
364 /* Disable the CPU Interrupt */
365 writel(MITE_LCIMR2_CLR_CPU_IE, p + MITE_LCIMR2);
366 iounmap(p);
367}
368
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369/* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */
370static int
Russell King975a1a7d2009-01-02 13:44:27 +0000371sbs_setup(struct serial_private *priv, const struct pciserial_board *board,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 struct uart_port *port, int idx)
373{
374 unsigned int bar, offset = board->first_offset;
375
376 bar = 0;
377
378 if (idx < 4) {
379 /* first four channels map to 0, 0x100, 0x200, 0x300 */
380 offset += idx * board->uart_offset;
381 } else if (idx < 8) {
382 /* last four channels map to 0x1000, 0x1100, 0x1200, 0x1300 */
383 offset += idx * board->uart_offset + 0xC00;
384 } else /* we have only 8 ports on PMC-OCTALPRO */
385 return 1;
386
Russell King70db3d92005-07-27 11:34:27 +0100387 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388}
389
390/*
391* This does initialization for PMC OCTALPRO cards:
392* maps the device memory, resets the UARTs (needed, bc
393* if the module is removed and inserted again, the card
394* is in the sleep mode) and enables global interrupt.
395*/
396
397/* global control register offset for SBS PMC-OctalPro */
398#define OCT_REG_CR_OFF 0x500
399
Russell King61a116e2006-07-03 15:22:35 +0100400static int sbs_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401{
402 u8 __iomem *p;
403
Arjan van de Ven24ed3ab2009-06-24 18:34:58 +0100404 p = pci_ioremap_bar(dev, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405
406 if (p == NULL)
407 return -ENOMEM;
408 /* Set bit-4 Control Register (UART RESET) in to reset the uarts */
Alan Cox5756ee92008-02-08 04:18:51 -0800409 writeb(0x10, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410 udelay(50);
Alan Cox5756ee92008-02-08 04:18:51 -0800411 writeb(0x0, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412
413 /* Set bit-2 (INTENABLE) of Control Register */
414 writeb(0x4, p + OCT_REG_CR_OFF);
415 iounmap(p);
416
417 return 0;
418}
419
420/*
421 * Disables the global interrupt of PMC-OctalPro
422 */
423
424static void __devexit sbs_exit(struct pci_dev *dev)
425{
426 u8 __iomem *p;
427
Arjan van de Ven24ed3ab2009-06-24 18:34:58 +0100428 p = pci_ioremap_bar(dev, 0);
Alan Cox5756ee92008-02-08 04:18:51 -0800429 /* FIXME: What if resource_len < OCT_REG_CR_OFF */
430 if (p != NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 writeb(0, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 iounmap(p);
433}
434
435/*
436 * SIIG serial cards have an PCI interface chip which also controls
437 * the UART clocking frequency. Each UART can be clocked independently
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300438 * (except cards equipped with 4 UARTs) and initial clocking settings
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 * are stored in the EEPROM chip. It can cause problems because this
440 * version of serial driver doesn't support differently clocked UART's
441 * on single PCI card. To prevent this, initialization functions set
442 * high frequency clocking for all UART's on given card. It is safe (I
443 * hope) because it doesn't touch EEPROM settings to prevent conflicts
444 * with other OSes (like M$ DOS).
445 *
446 * SIIG support added by Andrey Panin <pazke@donpac.ru>, 10/1999
Alan Cox5756ee92008-02-08 04:18:51 -0800447 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448 * There is two family of SIIG serial cards with different PCI
449 * interface chip and different configuration methods:
450 * - 10x cards have control registers in IO and/or memory space;
451 * - 20x cards have control registers in standard PCI configuration space.
452 *
Russell King67d74b82005-07-27 11:33:03 +0100453 * Note: all 10x cards have PCI device ids 0x10..
454 * all 20x cards have PCI device ids 0x20..
455 *
Andrey Paninfbc0dc02005-07-18 11:38:09 +0100456 * There are also Quartet Serial cards which use Oxford Semiconductor
457 * 16954 quad UART PCI chip clocked by 18.432 MHz quartz.
458 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 * Note: some SIIG cards are probed by the parport_serial object.
460 */
461
462#define PCI_DEVICE_ID_SIIG_1S_10x (PCI_DEVICE_ID_SIIG_1S_10x_550 & 0xfffc)
463#define PCI_DEVICE_ID_SIIG_2S_10x (PCI_DEVICE_ID_SIIG_2S_10x_550 & 0xfff8)
464
465static int pci_siig10x_init(struct pci_dev *dev)
466{
467 u16 data;
468 void __iomem *p;
469
470 switch (dev->device & 0xfff8) {
471 case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */
472 data = 0xffdf;
473 break;
474 case PCI_DEVICE_ID_SIIG_2S_10x: /* 2S, 2S1P */
475 data = 0xf7ff;
476 break;
477 default: /* 1S1P, 4S */
478 data = 0xfffb;
479 break;
480 }
481
Alan Cox6f441fe2008-05-01 04:34:59 -0700482 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 if (p == NULL)
484 return -ENOMEM;
485
486 writew(readw(p + 0x28) & data, p + 0x28);
487 readw(p + 0x28);
488 iounmap(p);
489 return 0;
490}
491
492#define PCI_DEVICE_ID_SIIG_2S_20x (PCI_DEVICE_ID_SIIG_2S_20x_550 & 0xfffc)
493#define PCI_DEVICE_ID_SIIG_2S1P_20x (PCI_DEVICE_ID_SIIG_2S1P_20x_550 & 0xfffc)
494
495static int pci_siig20x_init(struct pci_dev *dev)
496{
497 u8 data;
498
499 /* Change clock frequency for the first UART. */
500 pci_read_config_byte(dev, 0x6f, &data);
501 pci_write_config_byte(dev, 0x6f, data & 0xef);
502
503 /* If this card has 2 UART, we have to do the same with second UART. */
504 if (((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S_20x) ||
505 ((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S1P_20x)) {
506 pci_read_config_byte(dev, 0x73, &data);
507 pci_write_config_byte(dev, 0x73, data & 0xef);
508 }
509 return 0;
510}
511
Russell King67d74b82005-07-27 11:33:03 +0100512static int pci_siig_init(struct pci_dev *dev)
513{
514 unsigned int type = dev->device & 0xff00;
515
516 if (type == 0x1000)
517 return pci_siig10x_init(dev);
518 else if (type == 0x2000)
519 return pci_siig20x_init(dev);
520
521 moan_device("Unknown SIIG card", dev);
522 return -ENODEV;
523}
524
Andrey Panin3ec9c592006-02-02 20:15:09 +0000525static int pci_siig_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000526 const struct pciserial_board *board,
Andrey Panin3ec9c592006-02-02 20:15:09 +0000527 struct uart_port *port, int idx)
528{
529 unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0;
530
531 if (idx > 3) {
532 bar = 4;
533 offset = (idx - 4) * 8;
534 }
535
536 return setup_port(priv, port, bar, offset, 0);
537}
538
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539/*
540 * Timedia has an explosion of boards, and to avoid the PCI table from
541 * growing *huge*, we use this function to collapse some 70 entries
542 * in the PCI table into one, for sanity's and compactness's sake.
543 */
Helge Dellere9422e02006-08-29 21:57:29 +0200544static const unsigned short timedia_single_port[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 0x4025, 0x4027, 0x4028, 0x5025, 0x5027, 0
546};
547
Helge Dellere9422e02006-08-29 21:57:29 +0200548static const unsigned short timedia_dual_port[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
Alan Cox5756ee92008-02-08 04:18:51 -0800550 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079,
551 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079,
553 0xD079, 0
554};
555
Helge Dellere9422e02006-08-29 21:57:29 +0200556static const unsigned short timedia_quad_port[] = {
Alan Cox5756ee92008-02-08 04:18:51 -0800557 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157,
558 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
560 0xB157, 0
561};
562
Helge Dellere9422e02006-08-29 21:57:29 +0200563static const unsigned short timedia_eight_port[] = {
Alan Cox5756ee92008-02-08 04:18:51 -0800564 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
566};
567
Arjan van de Vencb3592b2005-11-28 21:04:11 +0000568static const struct timedia_struct {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 int num;
Helge Dellere9422e02006-08-29 21:57:29 +0200570 const unsigned short *ids;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571} timedia_data[] = {
572 { 1, timedia_single_port },
573 { 2, timedia_dual_port },
574 { 4, timedia_quad_port },
Helge Dellere9422e02006-08-29 21:57:29 +0200575 { 8, timedia_eight_port }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576};
577
Frédéric Brièreb9b24552011-05-29 15:08:04 -0400578/*
579 * There are nearly 70 different Timedia/SUNIX PCI serial devices. Instead of
580 * listing them individually, this driver merely grabs them all with
581 * PCI_ANY_ID. Some of these devices, however, also feature a parallel port,
582 * and should be left free to be claimed by parport_serial instead.
583 */
584static int pci_timedia_probe(struct pci_dev *dev)
585{
586 /*
587 * Check the third digit of the subdevice ID
588 * (0,2,3,5,6: serial only -- 7,8,9: serial + parallel)
589 */
590 if ((dev->subsystem_device & 0x00f0) >= 0x70) {
591 dev_info(&dev->dev,
592 "ignoring Timedia subdevice %04x for parport_serial\n",
593 dev->subsystem_device);
594 return -ENODEV;
595 }
596
597 return 0;
598}
599
Russell King61a116e2006-07-03 15:22:35 +0100600static int pci_timedia_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601{
Helge Dellere9422e02006-08-29 21:57:29 +0200602 const unsigned short *ids;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 int i, j;
604
Helge Dellere9422e02006-08-29 21:57:29 +0200605 for (i = 0; i < ARRAY_SIZE(timedia_data); i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 ids = timedia_data[i].ids;
607 for (j = 0; ids[j]; j++)
608 if (dev->subsystem_device == ids[j])
609 return timedia_data[i].num;
610 }
611 return 0;
612}
613
614/*
615 * Timedia/SUNIX uses a mixture of BARs and offsets
616 * Ugh, this is ugly as all hell --- TYT
617 */
618static int
Russell King975a1a7d2009-01-02 13:44:27 +0000619pci_timedia_setup(struct serial_private *priv,
620 const struct pciserial_board *board,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 struct uart_port *port, int idx)
622{
623 unsigned int bar = 0, offset = board->first_offset;
624
625 switch (idx) {
626 case 0:
627 bar = 0;
628 break;
629 case 1:
630 offset = board->uart_offset;
631 bar = 0;
632 break;
633 case 2:
634 bar = 1;
635 break;
636 case 3:
637 offset = board->uart_offset;
Dave Jonesc2cd6d32005-12-07 18:11:26 +0000638 /* FALLTHROUGH */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 case 4: /* BAR 2 */
640 case 5: /* BAR 3 */
641 case 6: /* BAR 4 */
642 case 7: /* BAR 5 */
643 bar = idx - 2;
644 }
645
Russell King70db3d92005-07-27 11:34:27 +0100646 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647}
648
649/*
650 * Some Titan cards are also a little weird
651 */
652static int
Russell King70db3d92005-07-27 11:34:27 +0100653titan_400l_800l_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000654 const struct pciserial_board *board,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 struct uart_port *port, int idx)
656{
657 unsigned int bar, offset = board->first_offset;
658
659 switch (idx) {
660 case 0:
661 bar = 1;
662 break;
663 case 1:
664 bar = 2;
665 break;
666 default:
667 bar = 4;
668 offset = (idx - 2) * board->uart_offset;
669 }
670
Russell King70db3d92005-07-27 11:34:27 +0100671 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672}
673
Russell King61a116e2006-07-03 15:22:35 +0100674static int pci_xircom_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675{
676 msleep(100);
677 return 0;
678}
679
Will Page04bf7e72009-04-06 17:32:15 +0100680static int pci_ni8420_init(struct pci_dev *dev)
681{
682 void __iomem *p;
683 unsigned long base, len;
684 unsigned int bar = 0;
685
686 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
687 moan_device("no memory in bar", dev);
688 return 0;
689 }
690
691 base = pci_resource_start(dev, bar);
692 len = pci_resource_len(dev, bar);
693 p = ioremap_nocache(base, len);
694 if (p == NULL)
695 return -ENOMEM;
696
697 /* Enable CPU Interrupt */
698 writel(readl(p + NI8420_INT_ENABLE_REG) | NI8420_INT_ENABLE_BIT,
699 p + NI8420_INT_ENABLE_REG);
700
701 iounmap(p);
702 return 0;
703}
704
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100705#define MITE_IOWBSR1_WSIZE 0xa
706#define MITE_IOWBSR1_WIN_OFFSET 0x800
707#define MITE_IOWBSR1_WENAB (1 << 7)
708#define MITE_LCIMR1_IO_IE_0 (1 << 24)
709#define MITE_LCIMR2_SET_CPU_IE (1 << 31)
710#define MITE_IOWCR1_RAMSEL_MASK 0xfffffffe
711
712static int pci_ni8430_init(struct pci_dev *dev)
713{
714 void __iomem *p;
715 unsigned long base, len;
716 u32 device_window;
717 unsigned int bar = 0;
718
719 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
720 moan_device("no memory in bar", dev);
721 return 0;
722 }
723
724 base = pci_resource_start(dev, bar);
725 len = pci_resource_len(dev, bar);
726 p = ioremap_nocache(base, len);
727 if (p == NULL)
728 return -ENOMEM;
729
730 /* Set device window address and size in BAR0 */
731 device_window = ((base + MITE_IOWBSR1_WIN_OFFSET) & 0xffffff00)
732 | MITE_IOWBSR1_WENAB | MITE_IOWBSR1_WSIZE;
733 writel(device_window, p + MITE_IOWBSR1);
734
735 /* Set window access to go to RAMSEL IO address space */
736 writel((readl(p + MITE_IOWCR1) & MITE_IOWCR1_RAMSEL_MASK),
737 p + MITE_IOWCR1);
738
739 /* Enable IO Bus Interrupt 0 */
740 writel(MITE_LCIMR1_IO_IE_0, p + MITE_LCIMR1);
741
742 /* Enable CPU Interrupt */
743 writel(MITE_LCIMR2_SET_CPU_IE, p + MITE_LCIMR2);
744
745 iounmap(p);
746 return 0;
747}
748
749/* UART Port Control Register */
750#define NI8430_PORTCON 0x0f
751#define NI8430_PORTCON_TXVR_ENABLE (1 << 3)
752
753static int
Alan Coxbf538fe2009-04-06 17:35:42 +0100754pci_ni8430_setup(struct serial_private *priv,
755 const struct pciserial_board *board,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100756 struct uart_port *port, int idx)
757{
758 void __iomem *p;
759 unsigned long base, len;
760 unsigned int bar, offset = board->first_offset;
761
762 if (idx >= board->num_ports)
763 return 1;
764
765 bar = FL_GET_BASE(board->flags);
766 offset += idx * board->uart_offset;
767
768 base = pci_resource_start(priv->dev, bar);
769 len = pci_resource_len(priv->dev, bar);
770 p = ioremap_nocache(base, len);
771
Joe Perches7c9d4402011-06-23 11:39:20 -0700772 /* enable the transceiver */
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100773 writeb(readb(p + offset + NI8430_PORTCON) | NI8430_PORTCON_TXVR_ENABLE,
774 p + offset + NI8430_PORTCON);
775
776 iounmap(p);
777
778 return setup_port(priv, port, bar, offset, board->reg_shift);
779}
780
Nicos Gollan7808edc2011-05-05 21:00:37 +0200781static int pci_netmos_9900_setup(struct serial_private *priv,
782 const struct pciserial_board *board,
783 struct uart_port *port, int idx)
784{
785 unsigned int bar;
786
787 if ((priv->dev->subsystem_device & 0xff00) == 0x3000) {
788 /* netmos apparently orders BARs by datasheet layout, so serial
789 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
790 */
791 bar = 3 * idx;
792
793 return setup_port(priv, port, bar, 0, board->reg_shift);
794 } else {
795 return pci_default_setup(priv, board, port, idx);
796 }
797}
798
799/* the 99xx series comes with a range of device IDs and a variety
800 * of capabilities:
801 *
802 * 9900 has varying capabilities and can cascade to sub-controllers
803 * (cascading should be purely internal)
804 * 9904 is hardwired with 4 serial ports
805 * 9912 and 9922 are hardwired with 2 serial ports
806 */
807static int pci_netmos_9900_numports(struct pci_dev *dev)
808{
809 unsigned int c = dev->class;
810 unsigned int pi;
811 unsigned short sub_serports;
812
813 pi = (c & 0xff);
814
815 if (pi == 2) {
816 return 1;
817 } else if ((pi == 0) &&
818 (dev->device == PCI_DEVICE_ID_NETMOS_9900)) {
819 /* two possibilities: 0x30ps encodes number of parallel and
820 * serial ports, or 0x1000 indicates *something*. This is not
821 * immediately obvious, since the 2s1p+4s configuration seems
822 * to offer all functionality on functions 0..2, while still
823 * advertising the same function 3 as the 4s+2s1p config.
824 */
825 sub_serports = dev->subsystem_device & 0xf;
826 if (sub_serports > 0) {
827 return sub_serports;
828 } else {
829 printk(KERN_NOTICE "NetMos/Mostech serial driver ignoring port on ambiguous config.\n");
830 return 0;
831 }
832 }
833
834 moan_device("unknown NetMos/Mostech program interface", dev);
835 return 0;
836}
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100837
Russell King61a116e2006-07-03 15:22:35 +0100838static int pci_netmos_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839{
840 /* subdevice 0x00PS means <P> parallel, <S> serial */
841 unsigned int num_serial = dev->subsystem_device & 0xf;
842
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -0800843 if ((dev->device == PCI_DEVICE_ID_NETMOS_9901) ||
844 (dev->device == PCI_DEVICE_ID_NETMOS_9865))
Michael Bueschc4285b42009-06-30 11:41:21 -0700845 return 0;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200846
Jiri Slaby25cf9bc2009-01-15 13:30:34 +0000847 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
848 dev->subsystem_device == 0x0299)
849 return 0;
850
Nicos Gollan7808edc2011-05-05 21:00:37 +0200851 switch (dev->device) { /* FALLTHROUGH on all */
852 case PCI_DEVICE_ID_NETMOS_9904:
853 case PCI_DEVICE_ID_NETMOS_9912:
854 case PCI_DEVICE_ID_NETMOS_9922:
855 case PCI_DEVICE_ID_NETMOS_9900:
856 num_serial = pci_netmos_9900_numports(dev);
857 break;
858
859 default:
860 if (num_serial == 0 ) {
861 moan_device("unknown NetMos/Mostech device", dev);
862 }
863 }
864
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865 if (num_serial == 0)
866 return -ENODEV;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200867
Linus Torvalds1da177e2005-04-16 15:20:36 -0700868 return num_serial;
869}
870
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700871/*
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700872 * These chips are available with optionally one parallel port and up to
873 * two serial ports. Unfortunately they all have the same product id.
874 *
875 * Basic configuration is done over a region of 32 I/O ports. The base
876 * ioport is called INTA or INTC, depending on docs/other drivers.
877 *
878 * The region of the 32 I/O ports is configured in POSIO0R...
879 */
880
881/* registers */
882#define ITE_887x_MISCR 0x9c
883#define ITE_887x_INTCBAR 0x78
884#define ITE_887x_UARTBAR 0x7c
885#define ITE_887x_PS0BAR 0x10
886#define ITE_887x_POSIO0 0x60
887
888/* I/O space size */
889#define ITE_887x_IOSIZE 32
890/* I/O space size (bits 26-24; 8 bytes = 011b) */
891#define ITE_887x_POSIO_IOSIZE_8 (3 << 24)
892/* I/O space size (bits 26-24; 32 bytes = 101b) */
893#define ITE_887x_POSIO_IOSIZE_32 (5 << 24)
894/* Decoding speed (1 = slow, 2 = medium, 3 = fast) */
895#define ITE_887x_POSIO_SPEED (3 << 29)
896/* enable IO_Space bit */
897#define ITE_887x_POSIO_ENABLE (1 << 31)
898
Ralf Baechlef79abb82007-08-30 23:56:31 -0700899static int pci_ite887x_init(struct pci_dev *dev)
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700900{
901 /* inta_addr are the configuration addresses of the ITE */
902 static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0,
903 0x200, 0x280, 0 };
904 int ret, i, type;
905 struct resource *iobase = NULL;
906 u32 miscr, uartbar, ioport;
907
908 /* search for the base-ioport */
909 i = 0;
910 while (inta_addr[i] && iobase == NULL) {
911 iobase = request_region(inta_addr[i], ITE_887x_IOSIZE,
912 "ite887x");
913 if (iobase != NULL) {
914 /* write POSIO0R - speed | size | ioport */
915 pci_write_config_dword(dev, ITE_887x_POSIO0,
916 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
917 ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
918 /* write INTCBAR - ioport */
Alan Cox5756ee92008-02-08 04:18:51 -0800919 pci_write_config_dword(dev, ITE_887x_INTCBAR,
920 inta_addr[i]);
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700921 ret = inb(inta_addr[i]);
922 if (ret != 0xff) {
923 /* ioport connected */
924 break;
925 }
926 release_region(iobase->start, ITE_887x_IOSIZE);
927 iobase = NULL;
928 }
929 i++;
930 }
931
932 if (!inta_addr[i]) {
933 printk(KERN_ERR "ite887x: could not find iobase\n");
934 return -ENODEV;
935 }
936
937 /* start of undocumented type checking (see parport_pc.c) */
938 type = inb(iobase->start + 0x18) & 0x0f;
939
940 switch (type) {
941 case 0x2: /* ITE8871 (1P) */
942 case 0xa: /* ITE8875 (1P) */
943 ret = 0;
944 break;
945 case 0xe: /* ITE8872 (2S1P) */
946 ret = 2;
947 break;
948 case 0x6: /* ITE8873 (1S) */
949 ret = 1;
950 break;
951 case 0x8: /* ITE8874 (2S) */
952 ret = 2;
953 break;
954 default:
955 moan_device("Unknown ITE887x", dev);
956 ret = -ENODEV;
957 }
958
959 /* configure all serial ports */
960 for (i = 0; i < ret; i++) {
961 /* read the I/O port from the device */
962 pci_read_config_dword(dev, ITE_887x_PS0BAR + (0x4 * (i + 1)),
963 &ioport);
964 ioport &= 0x0000FF00; /* the actual base address */
965 pci_write_config_dword(dev, ITE_887x_POSIO0 + (0x4 * (i + 1)),
966 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
967 ITE_887x_POSIO_IOSIZE_8 | ioport);
968
969 /* write the ioport to the UARTBAR */
970 pci_read_config_dword(dev, ITE_887x_UARTBAR, &uartbar);
971 uartbar &= ~(0xffff << (16 * i)); /* clear half the reg */
972 uartbar |= (ioport << (16 * i)); /* set the ioport */
973 pci_write_config_dword(dev, ITE_887x_UARTBAR, uartbar);
974
975 /* get current config */
976 pci_read_config_dword(dev, ITE_887x_MISCR, &miscr);
977 /* disable interrupts (UARTx_Routing[3:0]) */
978 miscr &= ~(0xf << (12 - 4 * i));
979 /* activate the UART (UARTx_En) */
980 miscr |= 1 << (23 - i);
981 /* write new config with activated UART */
982 pci_write_config_dword(dev, ITE_887x_MISCR, miscr);
983 }
984
985 if (ret <= 0) {
986 /* the device has no UARTs if we get here */
987 release_region(iobase->start, ITE_887x_IOSIZE);
988 }
989
990 return ret;
991}
992
993static void __devexit pci_ite887x_exit(struct pci_dev *dev)
994{
995 u32 ioport;
996 /* the ioport is bit 0-15 in POSIO0R */
997 pci_read_config_dword(dev, ITE_887x_POSIO0, &ioport);
998 ioport &= 0xffff;
999 release_region(ioport, ITE_887x_IOSIZE);
1000}
1001
Russell King9f2a0362009-01-02 13:44:20 +00001002/*
1003 * Oxford Semiconductor Inc.
1004 * Check that device is part of the Tornado range of devices, then determine
1005 * the number of ports available on the device.
1006 */
1007static int pci_oxsemi_tornado_init(struct pci_dev *dev)
1008{
1009 u8 __iomem *p;
1010 unsigned long deviceID;
1011 unsigned int number_uarts = 0;
1012
1013 /* OxSemi Tornado devices are all 0xCxxx */
1014 if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
1015 (dev->device & 0xF000) != 0xC000)
1016 return 0;
1017
1018 p = pci_iomap(dev, 0, 5);
1019 if (p == NULL)
1020 return -ENOMEM;
1021
1022 deviceID = ioread32(p);
1023 /* Tornado device */
1024 if (deviceID == 0x07000200) {
1025 number_uarts = ioread8(p + 4);
1026 printk(KERN_DEBUG
1027 "%d ports detected on Oxford PCI Express device\n",
1028 number_uarts);
1029 }
1030 pci_iounmap(dev, p);
1031 return number_uarts;
1032}
1033
Linus Torvalds1da177e2005-04-16 15:20:36 -07001034static int
Russell King975a1a7d2009-01-02 13:44:27 +00001035pci_default_setup(struct serial_private *priv,
1036 const struct pciserial_board *board,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001037 struct uart_port *port, int idx)
1038{
1039 unsigned int bar, offset = board->first_offset, maxnr;
1040
1041 bar = FL_GET_BASE(board->flags);
1042 if (board->flags & FL_BASE_BARS)
1043 bar += idx;
1044 else
1045 offset += idx * board->uart_offset;
1046
Greg Kroah-Hartman2427ddd2006-06-12 17:07:52 -07001047 maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >>
1048 (board->reg_shift + 3);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001049
1050 if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
1051 return 1;
Alan Cox5756ee92008-02-08 04:18:51 -08001052
Russell King70db3d92005-07-27 11:34:27 +01001053 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001054}
1055
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001056static int
1057ce4100_serial_setup(struct serial_private *priv,
1058 const struct pciserial_board *board,
1059 struct uart_port *port, int idx)
1060{
1061 int ret;
1062
1063 ret = setup_port(priv, port, 0, 0, board->reg_shift);
1064 port->iotype = UPIO_MEM32;
1065 port->type = PORT_XSCALE;
1066 port->flags = (port->flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1067 port->regshift = 2;
1068
1069 return ret;
1070}
1071
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001072static int
1073pci_omegapci_setup(struct serial_private *priv,
Alan Cox1798ca12011-05-24 12:35:48 +01001074 const struct pciserial_board *board,
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001075 struct uart_port *port, int idx)
1076{
1077 return setup_port(priv, port, 2, idx * 8, 0);
1078}
1079
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001080static int skip_tx_en_setup(struct serial_private *priv,
1081 const struct pciserial_board *board,
1082 struct uart_port *port, int idx)
1083{
1084 port->flags |= UPF_NO_TXEN_TEST;
1085 printk(KERN_DEBUG "serial8250: skipping TxEn test for device "
1086 "[%04x:%04x] subsystem [%04x:%04x]\n",
1087 priv->dev->vendor,
1088 priv->dev->device,
1089 priv->dev->subsystem_vendor,
1090 priv->dev->subsystem_device);
1091
1092 return pci_default_setup(priv, board, port, idx);
1093}
1094
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001095static int pci_eg20t_init(struct pci_dev *dev)
1096{
1097#if defined(CONFIG_SERIAL_PCH_UART) || defined(CONFIG_SERIAL_PCH_UART_MODULE)
1098 return -ENODEV;
1099#else
1100 return 0;
1101#endif
1102}
1103
Søren Holm06315342011-09-02 22:55:37 +02001104static int
1105pci_xr17c154_setup(struct serial_private *priv,
1106 const struct pciserial_board *board,
1107 struct uart_port *port, int idx)
1108{
1109 port->flags |= UPF_EXAR_EFR;
1110 return pci_default_setup(priv, board, port, idx);
1111}
1112
Linus Torvalds1da177e2005-04-16 15:20:36 -07001113/* This should be in linux/pci_ids.h */
1114#define PCI_VENDOR_ID_SBSMODULARIO 0x124B
1115#define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B
1116#define PCI_DEVICE_ID_OCTPRO 0x0001
1117#define PCI_SUBDEVICE_ID_OCTPRO232 0x0108
1118#define PCI_SUBDEVICE_ID_OCTPRO422 0x0208
1119#define PCI_SUBDEVICE_ID_POCTAL232 0x0308
1120#define PCI_SUBDEVICE_ID_POCTAL422 0x0408
Michael Bramer78d70d42009-01-27 11:51:16 +00001121#define PCI_VENDOR_ID_ADVANTECH 0x13fe
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001122#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66
Michael Bramer78d70d42009-01-27 11:51:16 +00001123#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620
Yegor Yefremov66169ad2010-06-04 09:58:18 +02001124#define PCI_DEVICE_ID_TITAN_200I 0x8028
1125#define PCI_DEVICE_ID_TITAN_400I 0x8048
1126#define PCI_DEVICE_ID_TITAN_800I 0x8088
1127#define PCI_DEVICE_ID_TITAN_800EH 0xA007
1128#define PCI_DEVICE_ID_TITAN_800EHB 0xA008
1129#define PCI_DEVICE_ID_TITAN_400EH 0xA009
1130#define PCI_DEVICE_ID_TITAN_100E 0xA010
1131#define PCI_DEVICE_ID_TITAN_200E 0xA012
1132#define PCI_DEVICE_ID_TITAN_400E 0xA013
1133#define PCI_DEVICE_ID_TITAN_800E 0xA014
1134#define PCI_DEVICE_ID_TITAN_200EI 0xA016
1135#define PCI_DEVICE_ID_TITAN_200EISI 0xA017
Lytochkin Borise8470032010-07-26 10:02:26 +04001136#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538
Scott Kilauaa273ae2011-05-11 15:41:59 -05001137#define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001138#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001
Linus Torvalds1da177e2005-04-16 15:20:36 -07001139
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001140/* Unknown vendors/cards - this should not be in linux/pci_ids.h */
1141#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
1142
Linus Torvalds1da177e2005-04-16 15:20:36 -07001143/*
1144 * Master list of serial port init/setup/exit quirks.
1145 * This does not describe the general nature of the port.
1146 * (ie, baud base, number and location of ports, etc)
1147 *
1148 * This list is ordered alphabetically by vendor then device.
1149 * Specific entries must come before more generic entries.
1150 */
Sam Ravnborg7a63ce52008-04-28 02:14:02 -07001151static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001152 /*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08001153 * ADDI-DATA GmbH communication cards <info@addi-data.com>
1154 */
1155 {
1156 .vendor = PCI_VENDOR_ID_ADDIDATA_OLD,
1157 .device = PCI_DEVICE_ID_ADDIDATA_APCI7800,
1158 .subvendor = PCI_ANY_ID,
1159 .subdevice = PCI_ANY_ID,
1160 .setup = addidata_apci7800_setup,
1161 },
1162 /*
Russell King61a116e2006-07-03 15:22:35 +01001163 * AFAVLAB cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164 * It is not clear whether this applies to all products.
1165 */
1166 {
1167 .vendor = PCI_VENDOR_ID_AFAVLAB,
1168 .device = PCI_ANY_ID,
1169 .subvendor = PCI_ANY_ID,
1170 .subdevice = PCI_ANY_ID,
1171 .setup = afavlab_setup,
1172 },
1173 /*
1174 * HP Diva
1175 */
1176 {
1177 .vendor = PCI_VENDOR_ID_HP,
1178 .device = PCI_DEVICE_ID_HP_DIVA,
1179 .subvendor = PCI_ANY_ID,
1180 .subdevice = PCI_ANY_ID,
1181 .init = pci_hp_diva_init,
1182 .setup = pci_hp_diva_setup,
1183 },
1184 /*
1185 * Intel
1186 */
1187 {
1188 .vendor = PCI_VENDOR_ID_INTEL,
1189 .device = PCI_DEVICE_ID_INTEL_80960_RP,
1190 .subvendor = 0xe4bf,
1191 .subdevice = PCI_ANY_ID,
1192 .init = pci_inteli960ni_init,
1193 .setup = pci_default_setup,
1194 },
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001195 {
1196 .vendor = PCI_VENDOR_ID_INTEL,
1197 .device = PCI_DEVICE_ID_INTEL_8257X_SOL,
1198 .subvendor = PCI_ANY_ID,
1199 .subdevice = PCI_ANY_ID,
1200 .setup = skip_tx_en_setup,
1201 },
1202 {
1203 .vendor = PCI_VENDOR_ID_INTEL,
1204 .device = PCI_DEVICE_ID_INTEL_82573L_SOL,
1205 .subvendor = PCI_ANY_ID,
1206 .subdevice = PCI_ANY_ID,
1207 .setup = skip_tx_en_setup,
1208 },
1209 {
1210 .vendor = PCI_VENDOR_ID_INTEL,
1211 .device = PCI_DEVICE_ID_INTEL_82573E_SOL,
1212 .subvendor = PCI_ANY_ID,
1213 .subdevice = PCI_ANY_ID,
1214 .setup = skip_tx_en_setup,
1215 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001216 {
1217 .vendor = PCI_VENDOR_ID_INTEL,
1218 .device = PCI_DEVICE_ID_INTEL_CE4100_UART,
1219 .subvendor = PCI_ANY_ID,
1220 .subdevice = PCI_ANY_ID,
1221 .setup = ce4100_serial_setup,
1222 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001223 /*
Niels de Vos84f8c6f2007-08-22 14:01:14 -07001224 * ITE
1225 */
1226 {
1227 .vendor = PCI_VENDOR_ID_ITE,
1228 .device = PCI_DEVICE_ID_ITE_8872,
1229 .subvendor = PCI_ANY_ID,
1230 .subdevice = PCI_ANY_ID,
1231 .init = pci_ite887x_init,
1232 .setup = pci_default_setup,
1233 .exit = __devexit_p(pci_ite887x_exit),
1234 },
1235 /*
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01001236 * National Instruments
1237 */
1238 {
1239 .vendor = PCI_VENDOR_ID_NI,
Will Page04bf7e72009-04-06 17:32:15 +01001240 .device = PCI_DEVICE_ID_NI_PCI23216,
1241 .subvendor = PCI_ANY_ID,
1242 .subdevice = PCI_ANY_ID,
1243 .init = pci_ni8420_init,
1244 .setup = pci_default_setup,
1245 .exit = __devexit_p(pci_ni8420_exit),
1246 },
1247 {
1248 .vendor = PCI_VENDOR_ID_NI,
1249 .device = PCI_DEVICE_ID_NI_PCI2328,
1250 .subvendor = PCI_ANY_ID,
1251 .subdevice = PCI_ANY_ID,
1252 .init = pci_ni8420_init,
1253 .setup = pci_default_setup,
1254 .exit = __devexit_p(pci_ni8420_exit),
1255 },
1256 {
1257 .vendor = PCI_VENDOR_ID_NI,
1258 .device = PCI_DEVICE_ID_NI_PCI2324,
1259 .subvendor = PCI_ANY_ID,
1260 .subdevice = PCI_ANY_ID,
1261 .init = pci_ni8420_init,
1262 .setup = pci_default_setup,
1263 .exit = __devexit_p(pci_ni8420_exit),
1264 },
1265 {
1266 .vendor = PCI_VENDOR_ID_NI,
1267 .device = PCI_DEVICE_ID_NI_PCI2322,
1268 .subvendor = PCI_ANY_ID,
1269 .subdevice = PCI_ANY_ID,
1270 .init = pci_ni8420_init,
1271 .setup = pci_default_setup,
1272 .exit = __devexit_p(pci_ni8420_exit),
1273 },
1274 {
1275 .vendor = PCI_VENDOR_ID_NI,
1276 .device = PCI_DEVICE_ID_NI_PCI2324I,
1277 .subvendor = PCI_ANY_ID,
1278 .subdevice = PCI_ANY_ID,
1279 .init = pci_ni8420_init,
1280 .setup = pci_default_setup,
1281 .exit = __devexit_p(pci_ni8420_exit),
1282 },
1283 {
1284 .vendor = PCI_VENDOR_ID_NI,
1285 .device = PCI_DEVICE_ID_NI_PCI2322I,
1286 .subvendor = PCI_ANY_ID,
1287 .subdevice = PCI_ANY_ID,
1288 .init = pci_ni8420_init,
1289 .setup = pci_default_setup,
1290 .exit = __devexit_p(pci_ni8420_exit),
1291 },
1292 {
1293 .vendor = PCI_VENDOR_ID_NI,
1294 .device = PCI_DEVICE_ID_NI_PXI8420_23216,
1295 .subvendor = PCI_ANY_ID,
1296 .subdevice = PCI_ANY_ID,
1297 .init = pci_ni8420_init,
1298 .setup = pci_default_setup,
1299 .exit = __devexit_p(pci_ni8420_exit),
1300 },
1301 {
1302 .vendor = PCI_VENDOR_ID_NI,
1303 .device = PCI_DEVICE_ID_NI_PXI8420_2328,
1304 .subvendor = PCI_ANY_ID,
1305 .subdevice = PCI_ANY_ID,
1306 .init = pci_ni8420_init,
1307 .setup = pci_default_setup,
1308 .exit = __devexit_p(pci_ni8420_exit),
1309 },
1310 {
1311 .vendor = PCI_VENDOR_ID_NI,
1312 .device = PCI_DEVICE_ID_NI_PXI8420_2324,
1313 .subvendor = PCI_ANY_ID,
1314 .subdevice = PCI_ANY_ID,
1315 .init = pci_ni8420_init,
1316 .setup = pci_default_setup,
1317 .exit = __devexit_p(pci_ni8420_exit),
1318 },
1319 {
1320 .vendor = PCI_VENDOR_ID_NI,
1321 .device = PCI_DEVICE_ID_NI_PXI8420_2322,
1322 .subvendor = PCI_ANY_ID,
1323 .subdevice = PCI_ANY_ID,
1324 .init = pci_ni8420_init,
1325 .setup = pci_default_setup,
1326 .exit = __devexit_p(pci_ni8420_exit),
1327 },
1328 {
1329 .vendor = PCI_VENDOR_ID_NI,
1330 .device = PCI_DEVICE_ID_NI_PXI8422_2324,
1331 .subvendor = PCI_ANY_ID,
1332 .subdevice = PCI_ANY_ID,
1333 .init = pci_ni8420_init,
1334 .setup = pci_default_setup,
1335 .exit = __devexit_p(pci_ni8420_exit),
1336 },
1337 {
1338 .vendor = PCI_VENDOR_ID_NI,
1339 .device = PCI_DEVICE_ID_NI_PXI8422_2322,
1340 .subvendor = PCI_ANY_ID,
1341 .subdevice = PCI_ANY_ID,
1342 .init = pci_ni8420_init,
1343 .setup = pci_default_setup,
1344 .exit = __devexit_p(pci_ni8420_exit),
1345 },
1346 {
1347 .vendor = PCI_VENDOR_ID_NI,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01001348 .device = PCI_ANY_ID,
1349 .subvendor = PCI_ANY_ID,
1350 .subdevice = PCI_ANY_ID,
1351 .init = pci_ni8430_init,
1352 .setup = pci_ni8430_setup,
1353 .exit = __devexit_p(pci_ni8430_exit),
1354 },
1355 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07001356 * Panacom
1357 */
1358 {
1359 .vendor = PCI_VENDOR_ID_PANACOM,
1360 .device = PCI_DEVICE_ID_PANACOM_QUADMODEM,
1361 .subvendor = PCI_ANY_ID,
1362 .subdevice = PCI_ANY_ID,
1363 .init = pci_plx9050_init,
1364 .setup = pci_default_setup,
1365 .exit = __devexit_p(pci_plx9050_exit),
Alan Cox5756ee92008-02-08 04:18:51 -08001366 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001367 {
1368 .vendor = PCI_VENDOR_ID_PANACOM,
1369 .device = PCI_DEVICE_ID_PANACOM_DUALMODEM,
1370 .subvendor = PCI_ANY_ID,
1371 .subdevice = PCI_ANY_ID,
1372 .init = pci_plx9050_init,
1373 .setup = pci_default_setup,
1374 .exit = __devexit_p(pci_plx9050_exit),
1375 },
1376 /*
1377 * PLX
1378 */
1379 {
1380 .vendor = PCI_VENDOR_ID_PLX,
Thomas Hoehn48212002007-02-10 01:46:05 -08001381 .device = PCI_DEVICE_ID_PLX_9030,
1382 .subvendor = PCI_SUBVENDOR_ID_PERLE,
1383 .subdevice = PCI_ANY_ID,
1384 .setup = pci_default_setup,
1385 },
1386 {
1387 .vendor = PCI_VENDOR_ID_PLX,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001388 .device = PCI_DEVICE_ID_PLX_9050,
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01001389 .subvendor = PCI_SUBVENDOR_ID_EXSYS,
1390 .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055,
1391 .init = pci_plx9050_init,
1392 .setup = pci_default_setup,
1393 .exit = __devexit_p(pci_plx9050_exit),
1394 },
1395 {
1396 .vendor = PCI_VENDOR_ID_PLX,
1397 .device = PCI_DEVICE_ID_PLX_9050,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001398 .subvendor = PCI_SUBVENDOR_ID_KEYSPAN,
1399 .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2,
1400 .init = pci_plx9050_init,
1401 .setup = pci_default_setup,
1402 .exit = __devexit_p(pci_plx9050_exit),
1403 },
1404 {
1405 .vendor = PCI_VENDOR_ID_PLX,
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001406 .device = PCI_DEVICE_ID_PLX_9050,
1407 .subvendor = PCI_VENDOR_ID_PLX,
1408 .subdevice = PCI_SUBDEVICE_ID_UNKNOWN_0x1584,
1409 .init = pci_plx9050_init,
1410 .setup = pci_default_setup,
1411 .exit = __devexit_p(pci_plx9050_exit),
1412 },
1413 {
1414 .vendor = PCI_VENDOR_ID_PLX,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001415 .device = PCI_DEVICE_ID_PLX_ROMULUS,
1416 .subvendor = PCI_VENDOR_ID_PLX,
1417 .subdevice = PCI_DEVICE_ID_PLX_ROMULUS,
1418 .init = pci_plx9050_init,
1419 .setup = pci_default_setup,
1420 .exit = __devexit_p(pci_plx9050_exit),
1421 },
1422 /*
1423 * SBS Technologies, Inc., PMC-OCTALPRO 232
1424 */
1425 {
1426 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
1427 .device = PCI_DEVICE_ID_OCTPRO,
1428 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
1429 .subdevice = PCI_SUBDEVICE_ID_OCTPRO232,
1430 .init = sbs_init,
1431 .setup = sbs_setup,
1432 .exit = __devexit_p(sbs_exit),
1433 },
1434 /*
1435 * SBS Technologies, Inc., PMC-OCTALPRO 422
1436 */
1437 {
1438 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
1439 .device = PCI_DEVICE_ID_OCTPRO,
1440 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
1441 .subdevice = PCI_SUBDEVICE_ID_OCTPRO422,
1442 .init = sbs_init,
1443 .setup = sbs_setup,
1444 .exit = __devexit_p(sbs_exit),
1445 },
1446 /*
1447 * SBS Technologies, Inc., P-Octal 232
1448 */
1449 {
1450 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
1451 .device = PCI_DEVICE_ID_OCTPRO,
1452 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
1453 .subdevice = PCI_SUBDEVICE_ID_POCTAL232,
1454 .init = sbs_init,
1455 .setup = sbs_setup,
1456 .exit = __devexit_p(sbs_exit),
1457 },
1458 /*
1459 * SBS Technologies, Inc., P-Octal 422
1460 */
1461 {
1462 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
1463 .device = PCI_DEVICE_ID_OCTPRO,
1464 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
1465 .subdevice = PCI_SUBDEVICE_ID_POCTAL422,
1466 .init = sbs_init,
1467 .setup = sbs_setup,
1468 .exit = __devexit_p(sbs_exit),
1469 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001470 /*
Russell King61a116e2006-07-03 15:22:35 +01001471 * SIIG cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 */
1473 {
1474 .vendor = PCI_VENDOR_ID_SIIG,
Russell King67d74b82005-07-27 11:33:03 +01001475 .device = PCI_ANY_ID,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001476 .subvendor = PCI_ANY_ID,
1477 .subdevice = PCI_ANY_ID,
Russell King67d74b82005-07-27 11:33:03 +01001478 .init = pci_siig_init,
Andrey Panin3ec9c592006-02-02 20:15:09 +00001479 .setup = pci_siig_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001480 },
1481 /*
1482 * Titan cards
1483 */
1484 {
1485 .vendor = PCI_VENDOR_ID_TITAN,
1486 .device = PCI_DEVICE_ID_TITAN_400L,
1487 .subvendor = PCI_ANY_ID,
1488 .subdevice = PCI_ANY_ID,
1489 .setup = titan_400l_800l_setup,
1490 },
1491 {
1492 .vendor = PCI_VENDOR_ID_TITAN,
1493 .device = PCI_DEVICE_ID_TITAN_800L,
1494 .subvendor = PCI_ANY_ID,
1495 .subdevice = PCI_ANY_ID,
1496 .setup = titan_400l_800l_setup,
1497 },
1498 /*
1499 * Timedia cards
1500 */
1501 {
1502 .vendor = PCI_VENDOR_ID_TIMEDIA,
1503 .device = PCI_DEVICE_ID_TIMEDIA_1889,
1504 .subvendor = PCI_VENDOR_ID_TIMEDIA,
1505 .subdevice = PCI_ANY_ID,
Frédéric Brièreb9b24552011-05-29 15:08:04 -04001506 .probe = pci_timedia_probe,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001507 .init = pci_timedia_init,
1508 .setup = pci_timedia_setup,
1509 },
1510 {
1511 .vendor = PCI_VENDOR_ID_TIMEDIA,
1512 .device = PCI_ANY_ID,
1513 .subvendor = PCI_ANY_ID,
1514 .subdevice = PCI_ANY_ID,
1515 .setup = pci_timedia_setup,
1516 },
1517 /*
Søren Holm06315342011-09-02 22:55:37 +02001518 * Exar cards
1519 */
1520 {
1521 .vendor = PCI_VENDOR_ID_EXAR,
1522 .device = PCI_DEVICE_ID_EXAR_XR17C152,
1523 .subvendor = PCI_ANY_ID,
1524 .subdevice = PCI_ANY_ID,
1525 .setup = pci_xr17c154_setup,
1526 },
1527 {
1528 .vendor = PCI_VENDOR_ID_EXAR,
1529 .device = PCI_DEVICE_ID_EXAR_XR17C154,
1530 .subvendor = PCI_ANY_ID,
1531 .subdevice = PCI_ANY_ID,
1532 .setup = pci_xr17c154_setup,
1533 },
1534 {
1535 .vendor = PCI_VENDOR_ID_EXAR,
1536 .device = PCI_DEVICE_ID_EXAR_XR17C158,
1537 .subvendor = PCI_ANY_ID,
1538 .subdevice = PCI_ANY_ID,
1539 .setup = pci_xr17c154_setup,
1540 },
1541 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07001542 * Xircom cards
1543 */
1544 {
1545 .vendor = PCI_VENDOR_ID_XIRCOM,
1546 .device = PCI_DEVICE_ID_XIRCOM_X3201_MDM,
1547 .subvendor = PCI_ANY_ID,
1548 .subdevice = PCI_ANY_ID,
1549 .init = pci_xircom_init,
1550 .setup = pci_default_setup,
1551 },
1552 /*
Russell King61a116e2006-07-03 15:22:35 +01001553 * Netmos cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07001554 */
1555 {
1556 .vendor = PCI_VENDOR_ID_NETMOS,
1557 .device = PCI_ANY_ID,
1558 .subvendor = PCI_ANY_ID,
1559 .subdevice = PCI_ANY_ID,
1560 .init = pci_netmos_init,
Nicos Gollan7808edc2011-05-05 21:00:37 +02001561 .setup = pci_netmos_9900_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001562 },
1563 /*
Scott Kilauaa273ae2011-05-11 15:41:59 -05001564 * For Oxford Semiconductor Tornado based devices
Russell King9f2a0362009-01-02 13:44:20 +00001565 */
1566 {
1567 .vendor = PCI_VENDOR_ID_OXSEMI,
1568 .device = PCI_ANY_ID,
1569 .subvendor = PCI_ANY_ID,
1570 .subdevice = PCI_ANY_ID,
1571 .init = pci_oxsemi_tornado_init,
1572 .setup = pci_default_setup,
1573 },
1574 {
1575 .vendor = PCI_VENDOR_ID_MAINPINE,
1576 .device = PCI_ANY_ID,
1577 .subvendor = PCI_ANY_ID,
1578 .subdevice = PCI_ANY_ID,
1579 .init = pci_oxsemi_tornado_init,
1580 .setup = pci_default_setup,
1581 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05001582 {
1583 .vendor = PCI_VENDOR_ID_DIGI,
1584 .device = PCIE_DEVICE_ID_NEO_2_OX_IBM,
1585 .subvendor = PCI_SUBVENDOR_ID_IBM,
1586 .subdevice = PCI_ANY_ID,
1587 .init = pci_oxsemi_tornado_init,
1588 .setup = pci_default_setup,
1589 },
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001590 {
1591 .vendor = PCI_VENDOR_ID_INTEL,
1592 .device = 0x8811,
1593 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001594 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001595 },
1596 {
1597 .vendor = PCI_VENDOR_ID_INTEL,
1598 .device = 0x8812,
1599 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001600 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001601 },
1602 {
1603 .vendor = PCI_VENDOR_ID_INTEL,
1604 .device = 0x8813,
1605 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001606 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001607 },
1608 {
1609 .vendor = PCI_VENDOR_ID_INTEL,
1610 .device = 0x8814,
1611 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001612 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001613 },
1614 {
1615 .vendor = 0x10DB,
1616 .device = 0x8027,
1617 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001618 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001619 },
1620 {
1621 .vendor = 0x10DB,
1622 .device = 0x8028,
1623 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001624 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001625 },
1626 {
1627 .vendor = 0x10DB,
1628 .device = 0x8029,
1629 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001630 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001631 },
1632 {
1633 .vendor = 0x10DB,
1634 .device = 0x800C,
1635 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001636 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001637 },
1638 {
1639 .vendor = 0x10DB,
1640 .device = 0x800D,
1641 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001642 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001643 },
1644 {
1645 .vendor = 0x10DB,
1646 .device = 0x800D,
1647 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001648 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001649 },
Russell King9f2a0362009-01-02 13:44:20 +00001650 /*
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001651 * Cronyx Omega PCI (PLX-chip based)
1652 */
1653 {
1654 .vendor = PCI_VENDOR_ID_PLX,
1655 .device = PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
1656 .subvendor = PCI_ANY_ID,
1657 .subdevice = PCI_ANY_ID,
1658 .setup = pci_omegapci_setup,
1659 },
1660 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07001661 * Default "match everything" terminator entry
1662 */
1663 {
1664 .vendor = PCI_ANY_ID,
1665 .device = PCI_ANY_ID,
1666 .subvendor = PCI_ANY_ID,
1667 .subdevice = PCI_ANY_ID,
1668 .setup = pci_default_setup,
1669 }
1670};
1671
1672static inline int quirk_id_matches(u32 quirk_id, u32 dev_id)
1673{
1674 return quirk_id == PCI_ANY_ID || quirk_id == dev_id;
1675}
1676
1677static struct pci_serial_quirk *find_quirk(struct pci_dev *dev)
1678{
1679 struct pci_serial_quirk *quirk;
1680
1681 for (quirk = pci_serial_quirks; ; quirk++)
1682 if (quirk_id_matches(quirk->vendor, dev->vendor) &&
1683 quirk_id_matches(quirk->device, dev->device) &&
1684 quirk_id_matches(quirk->subvendor, dev->subsystem_vendor) &&
1685 quirk_id_matches(quirk->subdevice, dev->subsystem_device))
Alan Cox5756ee92008-02-08 04:18:51 -08001686 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001687 return quirk;
1688}
1689
Andrew Mortondd68e882006-01-05 10:55:26 +00001690static inline int get_pci_irq(struct pci_dev *dev,
Russell King975a1a7d2009-01-02 13:44:27 +00001691 const struct pciserial_board *board)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001692{
1693 if (board->flags & FL_NOIRQ)
1694 return 0;
1695 else
1696 return dev->irq;
1697}
1698
1699/*
1700 * This is the configuration table for all of the PCI serial boards
1701 * which we support. It is directly indexed by the pci_board_num_t enum
1702 * value, which is encoded in the pci_device_id PCI probe table's
1703 * driver_data member.
1704 *
1705 * The makeup of these names are:
Gareth Howlett26e92862006-01-04 17:00:42 +00001706 * pbn_bn{_bt}_n_baud{_offsetinhex}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001707 *
Gareth Howlett26e92862006-01-04 17:00:42 +00001708 * bn = PCI BAR number
1709 * bt = Index using PCI BARs
1710 * n = number of serial ports
1711 * baud = baud rate
1712 * offsetinhex = offset for each sequential port (in hex)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001713 *
Gareth Howlett26e92862006-01-04 17:00:42 +00001714 * This table is sorted by (in order): bn, bt, baud, offsetindex, n.
Russell Kingf1690f32005-05-06 10:19:09 +01001715 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07001716 * Please note: in theory if n = 1, _bt infix should make no difference.
1717 * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200
1718 */
1719enum pci_board_num_t {
1720 pbn_default = 0,
1721
1722 pbn_b0_1_115200,
1723 pbn_b0_2_115200,
1724 pbn_b0_4_115200,
1725 pbn_b0_5_115200,
Alan Coxbf0df632007-10-16 01:24:00 -07001726 pbn_b0_8_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001727
1728 pbn_b0_1_921600,
1729 pbn_b0_2_921600,
1730 pbn_b0_4_921600,
1731
David Ransondb1de152005-07-27 11:43:55 -07001732 pbn_b0_2_1130000,
1733
Andrey Paninfbc0dc02005-07-18 11:38:09 +01001734 pbn_b0_4_1152000,
1735
Gareth Howlett26e92862006-01-04 17:00:42 +00001736 pbn_b0_2_1843200,
1737 pbn_b0_4_1843200,
1738
1739 pbn_b0_2_1843200_200,
1740 pbn_b0_4_1843200_200,
1741 pbn_b0_8_1843200_200,
1742
Lee Howard7106b4e2008-10-21 13:48:58 +01001743 pbn_b0_1_4000000,
1744
Linus Torvalds1da177e2005-04-16 15:20:36 -07001745 pbn_b0_bt_1_115200,
1746 pbn_b0_bt_2_115200,
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08001747 pbn_b0_bt_4_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001748 pbn_b0_bt_8_115200,
1749
1750 pbn_b0_bt_1_460800,
1751 pbn_b0_bt_2_460800,
1752 pbn_b0_bt_4_460800,
1753
1754 pbn_b0_bt_1_921600,
1755 pbn_b0_bt_2_921600,
1756 pbn_b0_bt_4_921600,
1757 pbn_b0_bt_8_921600,
1758
1759 pbn_b1_1_115200,
1760 pbn_b1_2_115200,
1761 pbn_b1_4_115200,
1762 pbn_b1_8_115200,
Will Page04bf7e72009-04-06 17:32:15 +01001763 pbn_b1_16_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001764
1765 pbn_b1_1_921600,
1766 pbn_b1_2_921600,
1767 pbn_b1_4_921600,
1768 pbn_b1_8_921600,
1769
Gareth Howlett26e92862006-01-04 17:00:42 +00001770 pbn_b1_2_1250000,
1771
Niels de Vos84f8c6f2007-08-22 14:01:14 -07001772 pbn_b1_bt_1_115200,
Will Page04bf7e72009-04-06 17:32:15 +01001773 pbn_b1_bt_2_115200,
1774 pbn_b1_bt_4_115200,
1775
Linus Torvalds1da177e2005-04-16 15:20:36 -07001776 pbn_b1_bt_2_921600,
1777
1778 pbn_b1_1_1382400,
1779 pbn_b1_2_1382400,
1780 pbn_b1_4_1382400,
1781 pbn_b1_8_1382400,
1782
1783 pbn_b2_1_115200,
Peter Horton737c1752006-08-26 09:07:36 +01001784 pbn_b2_2_115200,
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08001785 pbn_b2_4_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001786 pbn_b2_8_115200,
1787
1788 pbn_b2_1_460800,
1789 pbn_b2_4_460800,
1790 pbn_b2_8_460800,
1791 pbn_b2_16_460800,
1792
1793 pbn_b2_1_921600,
1794 pbn_b2_4_921600,
1795 pbn_b2_8_921600,
1796
Lytochkin Borise8470032010-07-26 10:02:26 +04001797 pbn_b2_8_1152000,
1798
Linus Torvalds1da177e2005-04-16 15:20:36 -07001799 pbn_b2_bt_1_115200,
1800 pbn_b2_bt_2_115200,
1801 pbn_b2_bt_4_115200,
1802
1803 pbn_b2_bt_2_921600,
1804 pbn_b2_bt_4_921600,
1805
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00001806 pbn_b3_2_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001807 pbn_b3_4_115200,
1808 pbn_b3_8_115200,
1809
Yegor Yefremov66169ad2010-06-04 09:58:18 +02001810 pbn_b4_bt_2_921600,
1811 pbn_b4_bt_4_921600,
1812 pbn_b4_bt_8_921600,
1813
Linus Torvalds1da177e2005-04-16 15:20:36 -07001814 /*
1815 * Board-specific versions.
1816 */
1817 pbn_panacom,
1818 pbn_panacom2,
1819 pbn_panacom4,
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01001820 pbn_exsys_4055,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001821 pbn_plx_romulus,
1822 pbn_oxsemi,
Lee Howard7106b4e2008-10-21 13:48:58 +01001823 pbn_oxsemi_1_4000000,
1824 pbn_oxsemi_2_4000000,
1825 pbn_oxsemi_4_4000000,
1826 pbn_oxsemi_8_4000000,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001827 pbn_intel_i960,
1828 pbn_sgi_ioc3,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001829 pbn_computone_4,
1830 pbn_computone_6,
1831 pbn_computone_8,
1832 pbn_sbsxrsio,
1833 pbn_exar_XR17C152,
1834 pbn_exar_XR17C154,
1835 pbn_exar_XR17C158,
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07001836 pbn_exar_ibm_saturn,
Olof Johanssonaa798502007-08-22 14:01:55 -07001837 pbn_pasemi_1682M,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01001838 pbn_ni8430_2,
1839 pbn_ni8430_4,
1840 pbn_ni8430_8,
1841 pbn_ni8430_16,
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07001842 pbn_ADDIDATA_PCIe_1_3906250,
1843 pbn_ADDIDATA_PCIe_2_3906250,
1844 pbn_ADDIDATA_PCIe_4_3906250,
1845 pbn_ADDIDATA_PCIe_8_3906250,
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001846 pbn_ce4100_1_115200,
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001847 pbn_omegapci,
Nicos Gollan7808edc2011-05-05 21:00:37 +02001848 pbn_NETMOS9900_2s_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001849};
1850
1851/*
1852 * uart_offset - the space between channels
1853 * reg_shift - describes how the UART registers are mapped
1854 * to PCI memory by the card.
1855 * For example IER register on SBS, Inc. PMC-OctPro is located at
1856 * offset 0x10 from the UART base, while UART_IER is defined as 1
1857 * in include/linux/serial_reg.h,
1858 * see first lines of serial_in() and serial_out() in 8250.c
1859*/
1860
Russell King1c7c1fe2005-07-27 11:31:19 +01001861static struct pciserial_board pci_boards[] __devinitdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001862 [pbn_default] = {
1863 .flags = FL_BASE0,
1864 .num_ports = 1,
1865 .base_baud = 115200,
1866 .uart_offset = 8,
1867 },
1868 [pbn_b0_1_115200] = {
1869 .flags = FL_BASE0,
1870 .num_ports = 1,
1871 .base_baud = 115200,
1872 .uart_offset = 8,
1873 },
1874 [pbn_b0_2_115200] = {
1875 .flags = FL_BASE0,
1876 .num_ports = 2,
1877 .base_baud = 115200,
1878 .uart_offset = 8,
1879 },
1880 [pbn_b0_4_115200] = {
1881 .flags = FL_BASE0,
1882 .num_ports = 4,
1883 .base_baud = 115200,
1884 .uart_offset = 8,
1885 },
1886 [pbn_b0_5_115200] = {
1887 .flags = FL_BASE0,
1888 .num_ports = 5,
1889 .base_baud = 115200,
1890 .uart_offset = 8,
1891 },
Alan Coxbf0df632007-10-16 01:24:00 -07001892 [pbn_b0_8_115200] = {
1893 .flags = FL_BASE0,
1894 .num_ports = 8,
1895 .base_baud = 115200,
1896 .uart_offset = 8,
1897 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001898 [pbn_b0_1_921600] = {
1899 .flags = FL_BASE0,
1900 .num_ports = 1,
1901 .base_baud = 921600,
1902 .uart_offset = 8,
1903 },
1904 [pbn_b0_2_921600] = {
1905 .flags = FL_BASE0,
1906 .num_ports = 2,
1907 .base_baud = 921600,
1908 .uart_offset = 8,
1909 },
1910 [pbn_b0_4_921600] = {
1911 .flags = FL_BASE0,
1912 .num_ports = 4,
1913 .base_baud = 921600,
1914 .uart_offset = 8,
1915 },
David Ransondb1de152005-07-27 11:43:55 -07001916
1917 [pbn_b0_2_1130000] = {
1918 .flags = FL_BASE0,
1919 .num_ports = 2,
1920 .base_baud = 1130000,
1921 .uart_offset = 8,
1922 },
1923
Andrey Paninfbc0dc02005-07-18 11:38:09 +01001924 [pbn_b0_4_1152000] = {
1925 .flags = FL_BASE0,
1926 .num_ports = 4,
1927 .base_baud = 1152000,
1928 .uart_offset = 8,
1929 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001930
Gareth Howlett26e92862006-01-04 17:00:42 +00001931 [pbn_b0_2_1843200] = {
1932 .flags = FL_BASE0,
1933 .num_ports = 2,
1934 .base_baud = 1843200,
1935 .uart_offset = 8,
1936 },
1937 [pbn_b0_4_1843200] = {
1938 .flags = FL_BASE0,
1939 .num_ports = 4,
1940 .base_baud = 1843200,
1941 .uart_offset = 8,
1942 },
1943
1944 [pbn_b0_2_1843200_200] = {
1945 .flags = FL_BASE0,
1946 .num_ports = 2,
1947 .base_baud = 1843200,
1948 .uart_offset = 0x200,
1949 },
1950 [pbn_b0_4_1843200_200] = {
1951 .flags = FL_BASE0,
1952 .num_ports = 4,
1953 .base_baud = 1843200,
1954 .uart_offset = 0x200,
1955 },
1956 [pbn_b0_8_1843200_200] = {
1957 .flags = FL_BASE0,
1958 .num_ports = 8,
1959 .base_baud = 1843200,
1960 .uart_offset = 0x200,
1961 },
Lee Howard7106b4e2008-10-21 13:48:58 +01001962 [pbn_b0_1_4000000] = {
1963 .flags = FL_BASE0,
1964 .num_ports = 1,
1965 .base_baud = 4000000,
1966 .uart_offset = 8,
1967 },
Gareth Howlett26e92862006-01-04 17:00:42 +00001968
Linus Torvalds1da177e2005-04-16 15:20:36 -07001969 [pbn_b0_bt_1_115200] = {
1970 .flags = FL_BASE0|FL_BASE_BARS,
1971 .num_ports = 1,
1972 .base_baud = 115200,
1973 .uart_offset = 8,
1974 },
1975 [pbn_b0_bt_2_115200] = {
1976 .flags = FL_BASE0|FL_BASE_BARS,
1977 .num_ports = 2,
1978 .base_baud = 115200,
1979 .uart_offset = 8,
1980 },
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08001981 [pbn_b0_bt_4_115200] = {
1982 .flags = FL_BASE0|FL_BASE_BARS,
1983 .num_ports = 4,
1984 .base_baud = 115200,
1985 .uart_offset = 8,
1986 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001987 [pbn_b0_bt_8_115200] = {
1988 .flags = FL_BASE0|FL_BASE_BARS,
1989 .num_ports = 8,
1990 .base_baud = 115200,
1991 .uart_offset = 8,
1992 },
1993
1994 [pbn_b0_bt_1_460800] = {
1995 .flags = FL_BASE0|FL_BASE_BARS,
1996 .num_ports = 1,
1997 .base_baud = 460800,
1998 .uart_offset = 8,
1999 },
2000 [pbn_b0_bt_2_460800] = {
2001 .flags = FL_BASE0|FL_BASE_BARS,
2002 .num_ports = 2,
2003 .base_baud = 460800,
2004 .uart_offset = 8,
2005 },
2006 [pbn_b0_bt_4_460800] = {
2007 .flags = FL_BASE0|FL_BASE_BARS,
2008 .num_ports = 4,
2009 .base_baud = 460800,
2010 .uart_offset = 8,
2011 },
2012
2013 [pbn_b0_bt_1_921600] = {
2014 .flags = FL_BASE0|FL_BASE_BARS,
2015 .num_ports = 1,
2016 .base_baud = 921600,
2017 .uart_offset = 8,
2018 },
2019 [pbn_b0_bt_2_921600] = {
2020 .flags = FL_BASE0|FL_BASE_BARS,
2021 .num_ports = 2,
2022 .base_baud = 921600,
2023 .uart_offset = 8,
2024 },
2025 [pbn_b0_bt_4_921600] = {
2026 .flags = FL_BASE0|FL_BASE_BARS,
2027 .num_ports = 4,
2028 .base_baud = 921600,
2029 .uart_offset = 8,
2030 },
2031 [pbn_b0_bt_8_921600] = {
2032 .flags = FL_BASE0|FL_BASE_BARS,
2033 .num_ports = 8,
2034 .base_baud = 921600,
2035 .uart_offset = 8,
2036 },
2037
2038 [pbn_b1_1_115200] = {
2039 .flags = FL_BASE1,
2040 .num_ports = 1,
2041 .base_baud = 115200,
2042 .uart_offset = 8,
2043 },
2044 [pbn_b1_2_115200] = {
2045 .flags = FL_BASE1,
2046 .num_ports = 2,
2047 .base_baud = 115200,
2048 .uart_offset = 8,
2049 },
2050 [pbn_b1_4_115200] = {
2051 .flags = FL_BASE1,
2052 .num_ports = 4,
2053 .base_baud = 115200,
2054 .uart_offset = 8,
2055 },
2056 [pbn_b1_8_115200] = {
2057 .flags = FL_BASE1,
2058 .num_ports = 8,
2059 .base_baud = 115200,
2060 .uart_offset = 8,
2061 },
Will Page04bf7e72009-04-06 17:32:15 +01002062 [pbn_b1_16_115200] = {
2063 .flags = FL_BASE1,
2064 .num_ports = 16,
2065 .base_baud = 115200,
2066 .uart_offset = 8,
2067 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002068
2069 [pbn_b1_1_921600] = {
2070 .flags = FL_BASE1,
2071 .num_ports = 1,
2072 .base_baud = 921600,
2073 .uart_offset = 8,
2074 },
2075 [pbn_b1_2_921600] = {
2076 .flags = FL_BASE1,
2077 .num_ports = 2,
2078 .base_baud = 921600,
2079 .uart_offset = 8,
2080 },
2081 [pbn_b1_4_921600] = {
2082 .flags = FL_BASE1,
2083 .num_ports = 4,
2084 .base_baud = 921600,
2085 .uart_offset = 8,
2086 },
2087 [pbn_b1_8_921600] = {
2088 .flags = FL_BASE1,
2089 .num_ports = 8,
2090 .base_baud = 921600,
2091 .uart_offset = 8,
2092 },
Gareth Howlett26e92862006-01-04 17:00:42 +00002093 [pbn_b1_2_1250000] = {
2094 .flags = FL_BASE1,
2095 .num_ports = 2,
2096 .base_baud = 1250000,
2097 .uart_offset = 8,
2098 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002099
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002100 [pbn_b1_bt_1_115200] = {
2101 .flags = FL_BASE1|FL_BASE_BARS,
2102 .num_ports = 1,
2103 .base_baud = 115200,
2104 .uart_offset = 8,
2105 },
Will Page04bf7e72009-04-06 17:32:15 +01002106 [pbn_b1_bt_2_115200] = {
2107 .flags = FL_BASE1|FL_BASE_BARS,
2108 .num_ports = 2,
2109 .base_baud = 115200,
2110 .uart_offset = 8,
2111 },
2112 [pbn_b1_bt_4_115200] = {
2113 .flags = FL_BASE1|FL_BASE_BARS,
2114 .num_ports = 4,
2115 .base_baud = 115200,
2116 .uart_offset = 8,
2117 },
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002118
Linus Torvalds1da177e2005-04-16 15:20:36 -07002119 [pbn_b1_bt_2_921600] = {
2120 .flags = FL_BASE1|FL_BASE_BARS,
2121 .num_ports = 2,
2122 .base_baud = 921600,
2123 .uart_offset = 8,
2124 },
2125
2126 [pbn_b1_1_1382400] = {
2127 .flags = FL_BASE1,
2128 .num_ports = 1,
2129 .base_baud = 1382400,
2130 .uart_offset = 8,
2131 },
2132 [pbn_b1_2_1382400] = {
2133 .flags = FL_BASE1,
2134 .num_ports = 2,
2135 .base_baud = 1382400,
2136 .uart_offset = 8,
2137 },
2138 [pbn_b1_4_1382400] = {
2139 .flags = FL_BASE1,
2140 .num_ports = 4,
2141 .base_baud = 1382400,
2142 .uart_offset = 8,
2143 },
2144 [pbn_b1_8_1382400] = {
2145 .flags = FL_BASE1,
2146 .num_ports = 8,
2147 .base_baud = 1382400,
2148 .uart_offset = 8,
2149 },
2150
2151 [pbn_b2_1_115200] = {
2152 .flags = FL_BASE2,
2153 .num_ports = 1,
2154 .base_baud = 115200,
2155 .uart_offset = 8,
2156 },
Peter Horton737c1752006-08-26 09:07:36 +01002157 [pbn_b2_2_115200] = {
2158 .flags = FL_BASE2,
2159 .num_ports = 2,
2160 .base_baud = 115200,
2161 .uart_offset = 8,
2162 },
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08002163 [pbn_b2_4_115200] = {
2164 .flags = FL_BASE2,
2165 .num_ports = 4,
2166 .base_baud = 115200,
2167 .uart_offset = 8,
2168 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002169 [pbn_b2_8_115200] = {
2170 .flags = FL_BASE2,
2171 .num_ports = 8,
2172 .base_baud = 115200,
2173 .uart_offset = 8,
2174 },
2175
2176 [pbn_b2_1_460800] = {
2177 .flags = FL_BASE2,
2178 .num_ports = 1,
2179 .base_baud = 460800,
2180 .uart_offset = 8,
2181 },
2182 [pbn_b2_4_460800] = {
2183 .flags = FL_BASE2,
2184 .num_ports = 4,
2185 .base_baud = 460800,
2186 .uart_offset = 8,
2187 },
2188 [pbn_b2_8_460800] = {
2189 .flags = FL_BASE2,
2190 .num_ports = 8,
2191 .base_baud = 460800,
2192 .uart_offset = 8,
2193 },
2194 [pbn_b2_16_460800] = {
2195 .flags = FL_BASE2,
2196 .num_ports = 16,
2197 .base_baud = 460800,
2198 .uart_offset = 8,
2199 },
2200
2201 [pbn_b2_1_921600] = {
2202 .flags = FL_BASE2,
2203 .num_ports = 1,
2204 .base_baud = 921600,
2205 .uart_offset = 8,
2206 },
2207 [pbn_b2_4_921600] = {
2208 .flags = FL_BASE2,
2209 .num_ports = 4,
2210 .base_baud = 921600,
2211 .uart_offset = 8,
2212 },
2213 [pbn_b2_8_921600] = {
2214 .flags = FL_BASE2,
2215 .num_ports = 8,
2216 .base_baud = 921600,
2217 .uart_offset = 8,
2218 },
2219
Lytochkin Borise8470032010-07-26 10:02:26 +04002220 [pbn_b2_8_1152000] = {
2221 .flags = FL_BASE2,
2222 .num_ports = 8,
2223 .base_baud = 1152000,
2224 .uart_offset = 8,
2225 },
2226
Linus Torvalds1da177e2005-04-16 15:20:36 -07002227 [pbn_b2_bt_1_115200] = {
2228 .flags = FL_BASE2|FL_BASE_BARS,
2229 .num_ports = 1,
2230 .base_baud = 115200,
2231 .uart_offset = 8,
2232 },
2233 [pbn_b2_bt_2_115200] = {
2234 .flags = FL_BASE2|FL_BASE_BARS,
2235 .num_ports = 2,
2236 .base_baud = 115200,
2237 .uart_offset = 8,
2238 },
2239 [pbn_b2_bt_4_115200] = {
2240 .flags = FL_BASE2|FL_BASE_BARS,
2241 .num_ports = 4,
2242 .base_baud = 115200,
2243 .uart_offset = 8,
2244 },
2245
2246 [pbn_b2_bt_2_921600] = {
2247 .flags = FL_BASE2|FL_BASE_BARS,
2248 .num_ports = 2,
2249 .base_baud = 921600,
2250 .uart_offset = 8,
2251 },
2252 [pbn_b2_bt_4_921600] = {
2253 .flags = FL_BASE2|FL_BASE_BARS,
2254 .num_ports = 4,
2255 .base_baud = 921600,
2256 .uart_offset = 8,
2257 },
2258
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00002259 [pbn_b3_2_115200] = {
2260 .flags = FL_BASE3,
2261 .num_ports = 2,
2262 .base_baud = 115200,
2263 .uart_offset = 8,
2264 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002265 [pbn_b3_4_115200] = {
2266 .flags = FL_BASE3,
2267 .num_ports = 4,
2268 .base_baud = 115200,
2269 .uart_offset = 8,
2270 },
2271 [pbn_b3_8_115200] = {
2272 .flags = FL_BASE3,
2273 .num_ports = 8,
2274 .base_baud = 115200,
2275 .uart_offset = 8,
2276 },
2277
Yegor Yefremov66169ad2010-06-04 09:58:18 +02002278 [pbn_b4_bt_2_921600] = {
2279 .flags = FL_BASE4,
2280 .num_ports = 2,
2281 .base_baud = 921600,
2282 .uart_offset = 8,
2283 },
2284 [pbn_b4_bt_4_921600] = {
2285 .flags = FL_BASE4,
2286 .num_ports = 4,
2287 .base_baud = 921600,
2288 .uart_offset = 8,
2289 },
2290 [pbn_b4_bt_8_921600] = {
2291 .flags = FL_BASE4,
2292 .num_ports = 8,
2293 .base_baud = 921600,
2294 .uart_offset = 8,
2295 },
2296
Linus Torvalds1da177e2005-04-16 15:20:36 -07002297 /*
2298 * Entries following this are board-specific.
2299 */
2300
2301 /*
2302 * Panacom - IOMEM
2303 */
2304 [pbn_panacom] = {
2305 .flags = FL_BASE2,
2306 .num_ports = 2,
2307 .base_baud = 921600,
2308 .uart_offset = 0x400,
2309 .reg_shift = 7,
2310 },
2311 [pbn_panacom2] = {
2312 .flags = FL_BASE2|FL_BASE_BARS,
2313 .num_ports = 2,
2314 .base_baud = 921600,
2315 .uart_offset = 0x400,
2316 .reg_shift = 7,
2317 },
2318 [pbn_panacom4] = {
2319 .flags = FL_BASE2|FL_BASE_BARS,
2320 .num_ports = 4,
2321 .base_baud = 921600,
2322 .uart_offset = 0x400,
2323 .reg_shift = 7,
2324 },
2325
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01002326 [pbn_exsys_4055] = {
2327 .flags = FL_BASE2,
2328 .num_ports = 4,
2329 .base_baud = 115200,
2330 .uart_offset = 8,
2331 },
2332
Linus Torvalds1da177e2005-04-16 15:20:36 -07002333 /* I think this entry is broken - the first_offset looks wrong --rmk */
2334 [pbn_plx_romulus] = {
2335 .flags = FL_BASE2,
2336 .num_ports = 4,
2337 .base_baud = 921600,
2338 .uart_offset = 8 << 2,
2339 .reg_shift = 2,
2340 .first_offset = 0x03,
2341 },
2342
2343 /*
2344 * This board uses the size of PCI Base region 0 to
2345 * signal now many ports are available
2346 */
2347 [pbn_oxsemi] = {
2348 .flags = FL_BASE0|FL_REGION_SZ_CAP,
2349 .num_ports = 32,
2350 .base_baud = 115200,
2351 .uart_offset = 8,
2352 },
Lee Howard7106b4e2008-10-21 13:48:58 +01002353 [pbn_oxsemi_1_4000000] = {
2354 .flags = FL_BASE0,
2355 .num_ports = 1,
2356 .base_baud = 4000000,
2357 .uart_offset = 0x200,
2358 .first_offset = 0x1000,
2359 },
2360 [pbn_oxsemi_2_4000000] = {
2361 .flags = FL_BASE0,
2362 .num_ports = 2,
2363 .base_baud = 4000000,
2364 .uart_offset = 0x200,
2365 .first_offset = 0x1000,
2366 },
2367 [pbn_oxsemi_4_4000000] = {
2368 .flags = FL_BASE0,
2369 .num_ports = 4,
2370 .base_baud = 4000000,
2371 .uart_offset = 0x200,
2372 .first_offset = 0x1000,
2373 },
2374 [pbn_oxsemi_8_4000000] = {
2375 .flags = FL_BASE0,
2376 .num_ports = 8,
2377 .base_baud = 4000000,
2378 .uart_offset = 0x200,
2379 .first_offset = 0x1000,
2380 },
2381
Linus Torvalds1da177e2005-04-16 15:20:36 -07002382
2383 /*
2384 * EKF addition for i960 Boards form EKF with serial port.
2385 * Max 256 ports.
2386 */
2387 [pbn_intel_i960] = {
2388 .flags = FL_BASE0,
2389 .num_ports = 32,
2390 .base_baud = 921600,
2391 .uart_offset = 8 << 2,
2392 .reg_shift = 2,
2393 .first_offset = 0x10000,
2394 },
2395 [pbn_sgi_ioc3] = {
2396 .flags = FL_BASE0|FL_NOIRQ,
2397 .num_ports = 1,
2398 .base_baud = 458333,
2399 .uart_offset = 8,
2400 .reg_shift = 0,
2401 .first_offset = 0x20178,
2402 },
2403
2404 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002405 * Computone - uses IOMEM.
2406 */
2407 [pbn_computone_4] = {
2408 .flags = FL_BASE0,
2409 .num_ports = 4,
2410 .base_baud = 921600,
2411 .uart_offset = 0x40,
2412 .reg_shift = 2,
2413 .first_offset = 0x200,
2414 },
2415 [pbn_computone_6] = {
2416 .flags = FL_BASE0,
2417 .num_ports = 6,
2418 .base_baud = 921600,
2419 .uart_offset = 0x40,
2420 .reg_shift = 2,
2421 .first_offset = 0x200,
2422 },
2423 [pbn_computone_8] = {
2424 .flags = FL_BASE0,
2425 .num_ports = 8,
2426 .base_baud = 921600,
2427 .uart_offset = 0x40,
2428 .reg_shift = 2,
2429 .first_offset = 0x200,
2430 },
2431 [pbn_sbsxrsio] = {
2432 .flags = FL_BASE0,
2433 .num_ports = 8,
2434 .base_baud = 460800,
2435 .uart_offset = 256,
2436 .reg_shift = 4,
2437 },
2438 /*
2439 * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
2440 * Only basic 16550A support.
2441 * XR17C15[24] are not tested, but they should work.
2442 */
2443 [pbn_exar_XR17C152] = {
2444 .flags = FL_BASE0,
2445 .num_ports = 2,
2446 .base_baud = 921600,
2447 .uart_offset = 0x200,
2448 },
2449 [pbn_exar_XR17C154] = {
2450 .flags = FL_BASE0,
2451 .num_ports = 4,
2452 .base_baud = 921600,
2453 .uart_offset = 0x200,
2454 },
2455 [pbn_exar_XR17C158] = {
2456 .flags = FL_BASE0,
2457 .num_ports = 8,
2458 .base_baud = 921600,
2459 .uart_offset = 0x200,
2460 },
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07002461 [pbn_exar_ibm_saturn] = {
2462 .flags = FL_BASE0,
2463 .num_ports = 1,
2464 .base_baud = 921600,
2465 .uart_offset = 0x200,
2466 },
2467
Olof Johanssonaa798502007-08-22 14:01:55 -07002468 /*
2469 * PA Semi PWRficient PA6T-1682M on-chip UART
2470 */
2471 [pbn_pasemi_1682M] = {
2472 .flags = FL_BASE0,
2473 .num_ports = 1,
2474 .base_baud = 8333333,
2475 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002476 /*
2477 * National Instruments 843x
2478 */
2479 [pbn_ni8430_16] = {
2480 .flags = FL_BASE0,
2481 .num_ports = 16,
2482 .base_baud = 3686400,
2483 .uart_offset = 0x10,
2484 .first_offset = 0x800,
2485 },
2486 [pbn_ni8430_8] = {
2487 .flags = FL_BASE0,
2488 .num_ports = 8,
2489 .base_baud = 3686400,
2490 .uart_offset = 0x10,
2491 .first_offset = 0x800,
2492 },
2493 [pbn_ni8430_4] = {
2494 .flags = FL_BASE0,
2495 .num_ports = 4,
2496 .base_baud = 3686400,
2497 .uart_offset = 0x10,
2498 .first_offset = 0x800,
2499 },
2500 [pbn_ni8430_2] = {
2501 .flags = FL_BASE0,
2502 .num_ports = 2,
2503 .base_baud = 3686400,
2504 .uart_offset = 0x10,
2505 .first_offset = 0x800,
2506 },
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07002507 /*
2508 * ADDI-DATA GmbH PCI-Express communication cards <info@addi-data.com>
2509 */
2510 [pbn_ADDIDATA_PCIe_1_3906250] = {
2511 .flags = FL_BASE0,
2512 .num_ports = 1,
2513 .base_baud = 3906250,
2514 .uart_offset = 0x200,
2515 .first_offset = 0x1000,
2516 },
2517 [pbn_ADDIDATA_PCIe_2_3906250] = {
2518 .flags = FL_BASE0,
2519 .num_ports = 2,
2520 .base_baud = 3906250,
2521 .uart_offset = 0x200,
2522 .first_offset = 0x1000,
2523 },
2524 [pbn_ADDIDATA_PCIe_4_3906250] = {
2525 .flags = FL_BASE0,
2526 .num_ports = 4,
2527 .base_baud = 3906250,
2528 .uart_offset = 0x200,
2529 .first_offset = 0x1000,
2530 },
2531 [pbn_ADDIDATA_PCIe_8_3906250] = {
2532 .flags = FL_BASE0,
2533 .num_ports = 8,
2534 .base_baud = 3906250,
2535 .uart_offset = 0x200,
2536 .first_offset = 0x1000,
2537 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08002538 [pbn_ce4100_1_115200] = {
2539 .flags = FL_BASE0,
2540 .num_ports = 1,
2541 .base_baud = 921600,
2542 .reg_shift = 2,
2543 },
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002544 [pbn_omegapci] = {
2545 .flags = FL_BASE0,
2546 .num_ports = 8,
2547 .base_baud = 115200,
2548 .uart_offset = 0x200,
2549 },
Nicos Gollan7808edc2011-05-05 21:00:37 +02002550 [pbn_NETMOS9900_2s_115200] = {
2551 .flags = FL_BASE0,
2552 .num_ports = 2,
2553 .base_baud = 115200,
2554 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002555};
2556
Christian Schmidt436bbd42007-08-22 14:01:19 -07002557static const struct pci_device_id softmodem_blacklist[] = {
Alan Cox5756ee92008-02-08 04:18:51 -08002558 { PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */
Maciej Szmigieroebf7c062010-10-26 21:48:21 +02002559 { PCI_VDEVICE(MOTOROLA, 0x3052), }, /* Motorola Si3052-based modem */
2560 { PCI_DEVICE(0x1543, 0x3052), }, /* Si3052-based modem, default IDs */
Christian Schmidt436bbd42007-08-22 14:01:19 -07002561};
2562
Linus Torvalds1da177e2005-04-16 15:20:36 -07002563/*
2564 * Given a complete unknown PCI device, try to use some heuristics to
2565 * guess what the configuration might be, based on the pitiful PCI
2566 * serial specs. Returns 0 on success, 1 on failure.
2567 */
2568static int __devinit
Russell King1c7c1fe2005-07-27 11:31:19 +01002569serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002570{
Christian Schmidt436bbd42007-08-22 14:01:19 -07002571 const struct pci_device_id *blacklist;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002572 int num_iomem, num_port, first_port = -1, i;
Alan Cox5756ee92008-02-08 04:18:51 -08002573
Linus Torvalds1da177e2005-04-16 15:20:36 -07002574 /*
2575 * If it is not a communications device or the programming
2576 * interface is greater than 6, give up.
2577 *
2578 * (Should we try to make guesses for multiport serial devices
Alan Cox5756ee92008-02-08 04:18:51 -08002579 * later?)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002580 */
2581 if ((((dev->class >> 8) != PCI_CLASS_COMMUNICATION_SERIAL) &&
2582 ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) ||
2583 (dev->class & 0xff) > 6)
2584 return -ENODEV;
2585
Christian Schmidt436bbd42007-08-22 14:01:19 -07002586 /*
2587 * Do not access blacklisted devices that are known not to
2588 * feature serial ports.
2589 */
2590 for (blacklist = softmodem_blacklist;
2591 blacklist < softmodem_blacklist + ARRAY_SIZE(softmodem_blacklist);
2592 blacklist++) {
2593 if (dev->vendor == blacklist->vendor &&
2594 dev->device == blacklist->device)
2595 return -ENODEV;
2596 }
2597
Linus Torvalds1da177e2005-04-16 15:20:36 -07002598 num_iomem = num_port = 0;
2599 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
2600 if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
2601 num_port++;
2602 if (first_port == -1)
2603 first_port = i;
2604 }
2605 if (pci_resource_flags(dev, i) & IORESOURCE_MEM)
2606 num_iomem++;
2607 }
2608
2609 /*
2610 * If there is 1 or 0 iomem regions, and exactly one port,
2611 * use it. We guess the number of ports based on the IO
2612 * region size.
2613 */
2614 if (num_iomem <= 1 && num_port == 1) {
2615 board->flags = first_port;
2616 board->num_ports = pci_resource_len(dev, first_port) / 8;
2617 return 0;
2618 }
2619
2620 /*
2621 * Now guess if we've got a board which indexes by BARs.
2622 * Each IO BAR should be 8 bytes, and they should follow
2623 * consecutively.
2624 */
2625 first_port = -1;
2626 num_port = 0;
2627 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
2628 if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
2629 pci_resource_len(dev, i) == 8 &&
2630 (first_port == -1 || (first_port + num_port) == i)) {
2631 num_port++;
2632 if (first_port == -1)
2633 first_port = i;
2634 }
2635 }
2636
2637 if (num_port > 1) {
2638 board->flags = first_port | FL_BASE_BARS;
2639 board->num_ports = num_port;
2640 return 0;
2641 }
2642
2643 return -ENODEV;
2644}
2645
2646static inline int
Russell King975a1a7d2009-01-02 13:44:27 +00002647serial_pci_matches(const struct pciserial_board *board,
2648 const struct pciserial_board *guessed)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002649{
2650 return
2651 board->num_ports == guessed->num_ports &&
2652 board->base_baud == guessed->base_baud &&
2653 board->uart_offset == guessed->uart_offset &&
2654 board->reg_shift == guessed->reg_shift &&
2655 board->first_offset == guessed->first_offset;
2656}
2657
Russell King241fc432005-07-27 11:35:54 +01002658struct serial_private *
Russell King975a1a7d2009-01-02 13:44:27 +00002659pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
Russell King241fc432005-07-27 11:35:54 +01002660{
2661 struct uart_port serial_port;
2662 struct serial_private *priv;
2663 struct pci_serial_quirk *quirk;
2664 int rc, nr_ports, i;
2665
2666 nr_ports = board->num_ports;
2667
2668 /*
2669 * Find an init and setup quirks.
2670 */
2671 quirk = find_quirk(dev);
2672
2673 /*
2674 * Run the new-style initialization function.
2675 * The initialization function returns:
2676 * <0 - error
2677 * 0 - use board->num_ports
2678 * >0 - number of ports
2679 */
2680 if (quirk->init) {
2681 rc = quirk->init(dev);
2682 if (rc < 0) {
2683 priv = ERR_PTR(rc);
2684 goto err_out;
2685 }
2686 if (rc)
2687 nr_ports = rc;
2688 }
2689
Burman Yan8f31bb32007-02-14 00:33:07 -08002690 priv = kzalloc(sizeof(struct serial_private) +
Russell King241fc432005-07-27 11:35:54 +01002691 sizeof(unsigned int) * nr_ports,
2692 GFP_KERNEL);
2693 if (!priv) {
2694 priv = ERR_PTR(-ENOMEM);
2695 goto err_deinit;
2696 }
2697
Russell King241fc432005-07-27 11:35:54 +01002698 priv->dev = dev;
2699 priv->quirk = quirk;
2700
2701 memset(&serial_port, 0, sizeof(struct uart_port));
2702 serial_port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
2703 serial_port.uartclk = board->base_baud * 16;
2704 serial_port.irq = get_pci_irq(dev, board);
2705 serial_port.dev = &dev->dev;
2706
2707 for (i = 0; i < nr_ports; i++) {
2708 if (quirk->setup(priv, board, &serial_port, i))
2709 break;
2710
2711#ifdef SERIAL_DEBUG_PCI
Lennert Buytenhek80647b92009-11-11 14:26:41 -08002712 printk(KERN_DEBUG "Setup PCI port: port %lx, irq %d, type %d\n",
Russell King241fc432005-07-27 11:35:54 +01002713 serial_port.iobase, serial_port.irq, serial_port.iotype);
2714#endif
Alan Cox5756ee92008-02-08 04:18:51 -08002715
Russell King241fc432005-07-27 11:35:54 +01002716 priv->line[i] = serial8250_register_port(&serial_port);
2717 if (priv->line[i] < 0) {
2718 printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), priv->line[i]);
2719 break;
2720 }
2721 }
Russell King241fc432005-07-27 11:35:54 +01002722 priv->nr = i;
Russell King241fc432005-07-27 11:35:54 +01002723 return priv;
2724
Alan Cox5756ee92008-02-08 04:18:51 -08002725err_deinit:
Russell King241fc432005-07-27 11:35:54 +01002726 if (quirk->exit)
2727 quirk->exit(dev);
Alan Cox5756ee92008-02-08 04:18:51 -08002728err_out:
Russell King241fc432005-07-27 11:35:54 +01002729 return priv;
2730}
2731EXPORT_SYMBOL_GPL(pciserial_init_ports);
2732
2733void pciserial_remove_ports(struct serial_private *priv)
2734{
2735 struct pci_serial_quirk *quirk;
2736 int i;
2737
2738 for (i = 0; i < priv->nr; i++)
2739 serial8250_unregister_port(priv->line[i]);
2740
2741 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
2742 if (priv->remapped_bar[i])
2743 iounmap(priv->remapped_bar[i]);
2744 priv->remapped_bar[i] = NULL;
2745 }
2746
2747 /*
2748 * Find the exit quirks.
2749 */
2750 quirk = find_quirk(priv->dev);
2751 if (quirk->exit)
2752 quirk->exit(priv->dev);
2753
2754 kfree(priv);
2755}
2756EXPORT_SYMBOL_GPL(pciserial_remove_ports);
2757
2758void pciserial_suspend_ports(struct serial_private *priv)
2759{
2760 int i;
2761
2762 for (i = 0; i < priv->nr; i++)
2763 if (priv->line[i] >= 0)
2764 serial8250_suspend_port(priv->line[i]);
2765}
2766EXPORT_SYMBOL_GPL(pciserial_suspend_ports);
2767
2768void pciserial_resume_ports(struct serial_private *priv)
2769{
2770 int i;
2771
2772 /*
2773 * Ensure that the board is correctly configured.
2774 */
2775 if (priv->quirk->init)
2776 priv->quirk->init(priv->dev);
2777
2778 for (i = 0; i < priv->nr; i++)
2779 if (priv->line[i] >= 0)
2780 serial8250_resume_port(priv->line[i]);
2781}
2782EXPORT_SYMBOL_GPL(pciserial_resume_ports);
2783
Linus Torvalds1da177e2005-04-16 15:20:36 -07002784/*
2785 * Probe one serial board. Unfortunately, there is no rhyme nor reason
2786 * to the arrangement of serial ports on a PCI card.
2787 */
2788static int __devinit
2789pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
2790{
Frédéric Brière5bf8f502011-05-29 15:08:03 -04002791 struct pci_serial_quirk *quirk;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002792 struct serial_private *priv;
Russell King975a1a7d2009-01-02 13:44:27 +00002793 const struct pciserial_board *board;
2794 struct pciserial_board tmp;
Russell King241fc432005-07-27 11:35:54 +01002795 int rc;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002796
Frédéric Brière5bf8f502011-05-29 15:08:03 -04002797 quirk = find_quirk(dev);
2798 if (quirk->probe) {
2799 rc = quirk->probe(dev);
2800 if (rc)
2801 return rc;
2802 }
2803
Linus Torvalds1da177e2005-04-16 15:20:36 -07002804 if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
2805 printk(KERN_ERR "pci_init_one: invalid driver_data: %ld\n",
2806 ent->driver_data);
2807 return -EINVAL;
2808 }
2809
2810 board = &pci_boards[ent->driver_data];
2811
2812 rc = pci_enable_device(dev);
Michael Reed28071902011-05-31 12:06:28 -05002813 pci_save_state(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002814 if (rc)
2815 return rc;
2816
2817 if (ent->driver_data == pbn_default) {
2818 /*
2819 * Use a copy of the pci_board entry for this;
2820 * avoid changing entries in the table.
2821 */
Russell King1c7c1fe2005-07-27 11:31:19 +01002822 memcpy(&tmp, board, sizeof(struct pciserial_board));
Linus Torvalds1da177e2005-04-16 15:20:36 -07002823 board = &tmp;
2824
2825 /*
2826 * We matched one of our class entries. Try to
2827 * determine the parameters of this board.
2828 */
Russell King975a1a7d2009-01-02 13:44:27 +00002829 rc = serial_pci_guess_board(dev, &tmp);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002830 if (rc)
2831 goto disable;
2832 } else {
2833 /*
2834 * We matched an explicit entry. If we are able to
2835 * detect this boards settings with our heuristic,
2836 * then we no longer need this entry.
2837 */
Russell King1c7c1fe2005-07-27 11:31:19 +01002838 memcpy(&tmp, &pci_boards[pbn_default],
2839 sizeof(struct pciserial_board));
Linus Torvalds1da177e2005-04-16 15:20:36 -07002840 rc = serial_pci_guess_board(dev, &tmp);
2841 if (rc == 0 && serial_pci_matches(board, &tmp))
2842 moan_device("Redundant entry in serial pci_table.",
2843 dev);
2844 }
2845
Russell King241fc432005-07-27 11:35:54 +01002846 priv = pciserial_init_ports(dev, board);
2847 if (!IS_ERR(priv)) {
2848 pci_set_drvdata(dev, priv);
2849 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002850 }
2851
Russell King241fc432005-07-27 11:35:54 +01002852 rc = PTR_ERR(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002853
Linus Torvalds1da177e2005-04-16 15:20:36 -07002854 disable:
2855 pci_disable_device(dev);
2856 return rc;
2857}
2858
2859static void __devexit pciserial_remove_one(struct pci_dev *dev)
2860{
2861 struct serial_private *priv = pci_get_drvdata(dev);
2862
2863 pci_set_drvdata(dev, NULL);
2864
Russell King241fc432005-07-27 11:35:54 +01002865 pciserial_remove_ports(priv);
Russell King056a8762005-07-22 10:15:04 +01002866
2867 pci_disable_device(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002868}
2869
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07002870#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -07002871static int pciserial_suspend_one(struct pci_dev *dev, pm_message_t state)
2872{
2873 struct serial_private *priv = pci_get_drvdata(dev);
2874
Russell King241fc432005-07-27 11:35:54 +01002875 if (priv)
2876 pciserial_suspend_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002877
Linus Torvalds1da177e2005-04-16 15:20:36 -07002878 pci_save_state(dev);
2879 pci_set_power_state(dev, pci_choose_state(dev, state));
2880 return 0;
2881}
2882
2883static int pciserial_resume_one(struct pci_dev *dev)
2884{
Dirk Hohndelccb9d592007-10-29 06:28:17 -07002885 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002886 struct serial_private *priv = pci_get_drvdata(dev);
2887
2888 pci_set_power_state(dev, PCI_D0);
2889 pci_restore_state(dev);
2890
2891 if (priv) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002892 /*
2893 * The device may have been disabled. Re-enable it.
2894 */
Dirk Hohndelccb9d592007-10-29 06:28:17 -07002895 err = pci_enable_device(dev);
Alan Cox40836c42008-10-13 10:36:11 +01002896 /* FIXME: We cannot simply error out here */
Dirk Hohndelccb9d592007-10-29 06:28:17 -07002897 if (err)
Alan Cox40836c42008-10-13 10:36:11 +01002898 printk(KERN_ERR "pciserial: Unable to re-enable ports, trying to continue.\n");
Russell King241fc432005-07-27 11:35:54 +01002899 pciserial_resume_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002900 }
2901 return 0;
2902}
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07002903#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07002904
2905static struct pci_device_id serial_pci_tbl[] = {
Michael Bramer78d70d42009-01-27 11:51:16 +00002906 /* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */
2907 { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620,
2908 PCI_DEVICE_ID_ADVANTECH_PCI3620, 0x0001, 0, 0,
2909 pbn_b2_8_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002910 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
2911 PCI_SUBVENDOR_ID_CONNECT_TECH,
2912 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
2913 pbn_b1_8_1382400 },
2914 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
2915 PCI_SUBVENDOR_ID_CONNECT_TECH,
2916 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
2917 pbn_b1_4_1382400 },
2918 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
2919 PCI_SUBVENDOR_ID_CONNECT_TECH,
2920 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
2921 pbn_b1_2_1382400 },
2922 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2923 PCI_SUBVENDOR_ID_CONNECT_TECH,
2924 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
2925 pbn_b1_8_1382400 },
2926 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2927 PCI_SUBVENDOR_ID_CONNECT_TECH,
2928 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
2929 pbn_b1_4_1382400 },
2930 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2931 PCI_SUBVENDOR_ID_CONNECT_TECH,
2932 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
2933 pbn_b1_2_1382400 },
2934 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2935 PCI_SUBVENDOR_ID_CONNECT_TECH,
2936 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485, 0, 0,
2937 pbn_b1_8_921600 },
2938 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2939 PCI_SUBVENDOR_ID_CONNECT_TECH,
2940 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4, 0, 0,
2941 pbn_b1_8_921600 },
2942 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2943 PCI_SUBVENDOR_ID_CONNECT_TECH,
2944 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485, 0, 0,
2945 pbn_b1_4_921600 },
2946 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2947 PCI_SUBVENDOR_ID_CONNECT_TECH,
2948 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2, 0, 0,
2949 pbn_b1_4_921600 },
2950 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2951 PCI_SUBVENDOR_ID_CONNECT_TECH,
2952 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485, 0, 0,
2953 pbn_b1_2_921600 },
2954 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2955 PCI_SUBVENDOR_ID_CONNECT_TECH,
2956 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6, 0, 0,
2957 pbn_b1_8_921600 },
2958 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2959 PCI_SUBVENDOR_ID_CONNECT_TECH,
2960 PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1, 0, 0,
2961 pbn_b1_8_921600 },
2962 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2963 PCI_SUBVENDOR_ID_CONNECT_TECH,
2964 PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1, 0, 0,
2965 pbn_b1_4_921600 },
Gareth Howlett26e92862006-01-04 17:00:42 +00002966 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
2967 PCI_SUBVENDOR_ID_CONNECT_TECH,
2968 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ, 0, 0,
2969 pbn_b1_2_1250000 },
2970 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
2971 PCI_SUBVENDOR_ID_CONNECT_TECH,
2972 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2, 0, 0,
2973 pbn_b0_2_1843200 },
2974 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
2975 PCI_SUBVENDOR_ID_CONNECT_TECH,
2976 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0,
2977 pbn_b0_4_1843200 },
Yoichi Yuasa85d14942006-02-08 21:46:24 +00002978 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
2979 PCI_VENDOR_ID_AFAVLAB,
2980 PCI_SUBDEVICE_ID_AFAVLAB_P061, 0, 0,
2981 pbn_b0_4_1152000 },
Gareth Howlett26e92862006-01-04 17:00:42 +00002982 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
2983 PCI_SUBVENDOR_ID_CONNECT_TECH,
2984 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0,
2985 pbn_b0_2_1843200_200 },
2986 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
2987 PCI_SUBVENDOR_ID_CONNECT_TECH,
2988 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232, 0, 0,
2989 pbn_b0_4_1843200_200 },
2990 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
2991 PCI_SUBVENDOR_ID_CONNECT_TECH,
2992 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232, 0, 0,
2993 pbn_b0_8_1843200_200 },
2994 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
2995 PCI_SUBVENDOR_ID_CONNECT_TECH,
2996 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1, 0, 0,
2997 pbn_b0_2_1843200_200 },
2998 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
2999 PCI_SUBVENDOR_ID_CONNECT_TECH,
3000 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2, 0, 0,
3001 pbn_b0_4_1843200_200 },
3002 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3003 PCI_SUBVENDOR_ID_CONNECT_TECH,
3004 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4, 0, 0,
3005 pbn_b0_8_1843200_200 },
3006 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3007 PCI_SUBVENDOR_ID_CONNECT_TECH,
3008 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2, 0, 0,
3009 pbn_b0_2_1843200_200 },
3010 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
3011 PCI_SUBVENDOR_ID_CONNECT_TECH,
3012 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4, 0, 0,
3013 pbn_b0_4_1843200_200 },
3014 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3015 PCI_SUBVENDOR_ID_CONNECT_TECH,
3016 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8, 0, 0,
3017 pbn_b0_8_1843200_200 },
3018 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3019 PCI_SUBVENDOR_ID_CONNECT_TECH,
3020 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485, 0, 0,
3021 pbn_b0_2_1843200_200 },
3022 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
3023 PCI_SUBVENDOR_ID_CONNECT_TECH,
3024 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485, 0, 0,
3025 pbn_b0_4_1843200_200 },
3026 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3027 PCI_SUBVENDOR_ID_CONNECT_TECH,
3028 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0,
3029 pbn_b0_8_1843200_200 },
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07003030 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3031 PCI_VENDOR_ID_IBM, PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT,
3032 0, 0, pbn_exar_ibm_saturn },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003033
3034 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
Alan Cox5756ee92008-02-08 04:18:51 -08003035 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003036 pbn_b2_bt_1_115200 },
3037 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM2,
Alan Cox5756ee92008-02-08 04:18:51 -08003038 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003039 pbn_b2_bt_2_115200 },
3040 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM422,
Alan Cox5756ee92008-02-08 04:18:51 -08003041 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003042 pbn_b2_bt_4_115200 },
3043 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM232,
Alan Cox5756ee92008-02-08 04:18:51 -08003044 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003045 pbn_b2_bt_2_115200 },
3046 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM4,
Alan Cox5756ee92008-02-08 04:18:51 -08003047 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003048 pbn_b2_bt_4_115200 },
3049 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8,
Alan Cox5756ee92008-02-08 04:18:51 -08003050 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003051 pbn_b2_8_115200 },
Flavio Leitnere65f0f82009-01-02 13:50:43 +00003052 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_7803,
3053 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3054 pbn_b2_8_460800 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003055 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM8,
3056 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3057 pbn_b2_8_115200 },
3058
3059 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_GTEK_SERIAL2,
3060 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3061 pbn_b2_bt_2_115200 },
3062 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM200,
3063 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3064 pbn_b2_bt_2_921600 },
3065 /*
3066 * VScom SPCOM800, from sl@s.pl
3067 */
Alan Cox5756ee92008-02-08 04:18:51 -08003068 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM800,
3069 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003070 pbn_b2_8_921600 },
3071 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_1077,
Alan Cox5756ee92008-02-08 04:18:51 -08003072 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003073 pbn_b2_4_921600 },
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07003074 /* Unknown card - subdevice 0x1584 */
3075 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3076 PCI_VENDOR_ID_PLX,
3077 PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0,
3078 pbn_b0_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003079 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3080 PCI_SUBVENDOR_ID_KEYSPAN,
3081 PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0,
3082 pbn_panacom },
3083 { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_QUADMODEM,
3084 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3085 pbn_panacom4 },
3086 { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_DUALMODEM,
3087 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3088 pbn_panacom2 },
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08003089 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
3090 PCI_VENDOR_ID_ESDGMBH,
3091 PCI_DEVICE_ID_ESDGMBH_CPCIASIO4, 0, 0,
3092 pbn_b2_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003093 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3094 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08003095 PCI_SUBDEVICE_ID_CHASE_PCIFAST4, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003096 pbn_b2_4_460800 },
3097 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3098 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08003099 PCI_SUBDEVICE_ID_CHASE_PCIFAST8, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003100 pbn_b2_8_460800 },
3101 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3102 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08003103 PCI_SUBDEVICE_ID_CHASE_PCIFAST16, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003104 pbn_b2_16_460800 },
3105 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3106 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08003107 PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003108 pbn_b2_16_460800 },
3109 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3110 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
Alan Cox5756ee92008-02-08 04:18:51 -08003111 PCI_SUBDEVICE_ID_CHASE_PCIRAS4, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003112 pbn_b2_4_460800 },
3113 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3114 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
Alan Cox5756ee92008-02-08 04:18:51 -08003115 PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003116 pbn_b2_8_460800 },
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01003117 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3118 PCI_SUBVENDOR_ID_EXSYS,
3119 PCI_SUBDEVICE_ID_EXSYS_4055, 0, 0,
3120 pbn_exsys_4055 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003121 /*
3122 * Megawolf Romulus PCI Serial Card, from Mike Hudson
3123 * (Exoray@isys.ca)
3124 */
3125 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_ROMULUS,
3126 0x10b5, 0x106a, 0, 0,
3127 pbn_plx_romulus },
3128 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC100,
3129 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3130 pbn_b1_4_115200 },
3131 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100,
3132 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3133 pbn_b1_2_115200 },
3134 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100D,
3135 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3136 pbn_b1_8_115200 },
3137 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100M,
3138 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3139 pbn_b1_8_115200 },
3140 { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_OXSEMI_16PCI954,
Alan Cox5756ee92008-02-08 04:18:51 -08003141 PCI_VENDOR_ID_SPECIALIX, PCI_SUBDEVICE_ID_SPECIALIX_SPEED4,
3142 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003143 pbn_b0_4_921600 },
3144 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
Alan Cox5756ee92008-02-08 04:18:51 -08003145 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL,
3146 0, 0,
Andrey Paninfbc0dc02005-07-18 11:38:09 +01003147 pbn_b0_4_1152000 },
Mikulas Patockac9bd9d02010-10-26 14:20:48 -04003148 { PCI_VENDOR_ID_OXSEMI, 0x9505,
3149 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3150 pbn_b0_bt_2_921600 },
David Ransondb1de152005-07-27 11:43:55 -07003151
3152 /*
3153 * The below card is a little controversial since it is the
3154 * subject of a PCI vendor/device ID clash. (See
3155 * www.ussg.iu.edu/hypermail/linux/kernel/0303.1/0516.html).
3156 * For now just used the hex ID 0x950a.
3157 */
3158 { PCI_VENDOR_ID_OXSEMI, 0x950a,
Niels de Vos39aced62009-01-02 13:46:58 +00003159 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL, 0, 0,
3160 pbn_b0_2_115200 },
3161 { PCI_VENDOR_ID_OXSEMI, 0x950a,
David Ransondb1de152005-07-27 11:43:55 -07003162 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3163 pbn_b0_2_1130000 },
Andre Przywara70fd8fd2009-06-11 12:41:57 +01003164 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_C950,
3165 PCI_VENDOR_ID_OXSEMI, PCI_SUBDEVICE_ID_OXSEMI_C950, 0, 0,
3166 pbn_b0_1_921600 },
Andrey Paninfbc0dc02005-07-18 11:38:09 +01003167 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003168 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3169 pbn_b0_4_115200 },
3170 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952,
3171 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3172 pbn_b0_bt_2_921600 },
Lytochkin Borise8470032010-07-26 10:02:26 +04003173 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI958,
3174 PCI_ANY_ID , PCI_ANY_ID, 0, 0,
3175 pbn_b2_8_1152000 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003176
3177 /*
Lee Howard7106b4e2008-10-21 13:48:58 +01003178 * Oxford Semiconductor Inc. Tornado PCI express device range.
3179 */
3180 { PCI_VENDOR_ID_OXSEMI, 0xc101, /* OXPCIe952 1 Legacy UART */
3181 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3182 pbn_b0_1_4000000 },
3183 { PCI_VENDOR_ID_OXSEMI, 0xc105, /* OXPCIe952 1 Legacy UART */
3184 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3185 pbn_b0_1_4000000 },
3186 { PCI_VENDOR_ID_OXSEMI, 0xc11b, /* OXPCIe952 1 Native UART */
3187 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3188 pbn_oxsemi_1_4000000 },
3189 { PCI_VENDOR_ID_OXSEMI, 0xc11f, /* OXPCIe952 1 Native UART */
3190 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3191 pbn_oxsemi_1_4000000 },
3192 { PCI_VENDOR_ID_OXSEMI, 0xc120, /* OXPCIe952 1 Legacy UART */
3193 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3194 pbn_b0_1_4000000 },
3195 { PCI_VENDOR_ID_OXSEMI, 0xc124, /* OXPCIe952 1 Legacy UART */
3196 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3197 pbn_b0_1_4000000 },
3198 { PCI_VENDOR_ID_OXSEMI, 0xc138, /* OXPCIe952 1 Native UART */
3199 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3200 pbn_oxsemi_1_4000000 },
3201 { PCI_VENDOR_ID_OXSEMI, 0xc13d, /* OXPCIe952 1 Native UART */
3202 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3203 pbn_oxsemi_1_4000000 },
3204 { PCI_VENDOR_ID_OXSEMI, 0xc140, /* OXPCIe952 1 Legacy UART */
3205 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3206 pbn_b0_1_4000000 },
3207 { PCI_VENDOR_ID_OXSEMI, 0xc141, /* OXPCIe952 1 Legacy UART */
3208 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3209 pbn_b0_1_4000000 },
3210 { PCI_VENDOR_ID_OXSEMI, 0xc144, /* OXPCIe952 1 Legacy UART */
3211 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3212 pbn_b0_1_4000000 },
3213 { PCI_VENDOR_ID_OXSEMI, 0xc145, /* OXPCIe952 1 Legacy UART */
3214 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3215 pbn_b0_1_4000000 },
3216 { PCI_VENDOR_ID_OXSEMI, 0xc158, /* OXPCIe952 2 Native UART */
3217 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3218 pbn_oxsemi_2_4000000 },
3219 { PCI_VENDOR_ID_OXSEMI, 0xc15d, /* OXPCIe952 2 Native UART */
3220 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3221 pbn_oxsemi_2_4000000 },
3222 { PCI_VENDOR_ID_OXSEMI, 0xc208, /* OXPCIe954 4 Native UART */
3223 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3224 pbn_oxsemi_4_4000000 },
3225 { PCI_VENDOR_ID_OXSEMI, 0xc20d, /* OXPCIe954 4 Native UART */
3226 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3227 pbn_oxsemi_4_4000000 },
3228 { PCI_VENDOR_ID_OXSEMI, 0xc308, /* OXPCIe958 8 Native UART */
3229 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3230 pbn_oxsemi_8_4000000 },
3231 { PCI_VENDOR_ID_OXSEMI, 0xc30d, /* OXPCIe958 8 Native UART */
3232 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3233 pbn_oxsemi_8_4000000 },
3234 { PCI_VENDOR_ID_OXSEMI, 0xc40b, /* OXPCIe200 1 Native UART */
3235 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3236 pbn_oxsemi_1_4000000 },
3237 { PCI_VENDOR_ID_OXSEMI, 0xc40f, /* OXPCIe200 1 Native UART */
3238 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3239 pbn_oxsemi_1_4000000 },
3240 { PCI_VENDOR_ID_OXSEMI, 0xc41b, /* OXPCIe200 1 Native UART */
3241 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3242 pbn_oxsemi_1_4000000 },
3243 { PCI_VENDOR_ID_OXSEMI, 0xc41f, /* OXPCIe200 1 Native UART */
3244 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3245 pbn_oxsemi_1_4000000 },
3246 { PCI_VENDOR_ID_OXSEMI, 0xc42b, /* OXPCIe200 1 Native UART */
3247 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3248 pbn_oxsemi_1_4000000 },
3249 { PCI_VENDOR_ID_OXSEMI, 0xc42f, /* OXPCIe200 1 Native UART */
3250 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3251 pbn_oxsemi_1_4000000 },
3252 { PCI_VENDOR_ID_OXSEMI, 0xc43b, /* OXPCIe200 1 Native UART */
3253 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3254 pbn_oxsemi_1_4000000 },
3255 { PCI_VENDOR_ID_OXSEMI, 0xc43f, /* OXPCIe200 1 Native UART */
3256 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3257 pbn_oxsemi_1_4000000 },
3258 { PCI_VENDOR_ID_OXSEMI, 0xc44b, /* OXPCIe200 1 Native UART */
3259 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3260 pbn_oxsemi_1_4000000 },
3261 { PCI_VENDOR_ID_OXSEMI, 0xc44f, /* OXPCIe200 1 Native UART */
3262 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3263 pbn_oxsemi_1_4000000 },
3264 { PCI_VENDOR_ID_OXSEMI, 0xc45b, /* OXPCIe200 1 Native UART */
3265 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3266 pbn_oxsemi_1_4000000 },
3267 { PCI_VENDOR_ID_OXSEMI, 0xc45f, /* OXPCIe200 1 Native UART */
3268 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3269 pbn_oxsemi_1_4000000 },
3270 { PCI_VENDOR_ID_OXSEMI, 0xc46b, /* OXPCIe200 1 Native UART */
3271 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3272 pbn_oxsemi_1_4000000 },
3273 { PCI_VENDOR_ID_OXSEMI, 0xc46f, /* OXPCIe200 1 Native UART */
3274 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3275 pbn_oxsemi_1_4000000 },
3276 { PCI_VENDOR_ID_OXSEMI, 0xc47b, /* OXPCIe200 1 Native UART */
3277 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3278 pbn_oxsemi_1_4000000 },
3279 { PCI_VENDOR_ID_OXSEMI, 0xc47f, /* OXPCIe200 1 Native UART */
3280 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3281 pbn_oxsemi_1_4000000 },
3282 { PCI_VENDOR_ID_OXSEMI, 0xc48b, /* OXPCIe200 1 Native UART */
3283 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3284 pbn_oxsemi_1_4000000 },
3285 { PCI_VENDOR_ID_OXSEMI, 0xc48f, /* OXPCIe200 1 Native UART */
3286 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3287 pbn_oxsemi_1_4000000 },
3288 { PCI_VENDOR_ID_OXSEMI, 0xc49b, /* OXPCIe200 1 Native UART */
3289 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3290 pbn_oxsemi_1_4000000 },
3291 { PCI_VENDOR_ID_OXSEMI, 0xc49f, /* OXPCIe200 1 Native UART */
3292 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3293 pbn_oxsemi_1_4000000 },
3294 { PCI_VENDOR_ID_OXSEMI, 0xc4ab, /* OXPCIe200 1 Native UART */
3295 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3296 pbn_oxsemi_1_4000000 },
3297 { PCI_VENDOR_ID_OXSEMI, 0xc4af, /* OXPCIe200 1 Native UART */
3298 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3299 pbn_oxsemi_1_4000000 },
3300 { PCI_VENDOR_ID_OXSEMI, 0xc4bb, /* OXPCIe200 1 Native UART */
3301 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3302 pbn_oxsemi_1_4000000 },
3303 { PCI_VENDOR_ID_OXSEMI, 0xc4bf, /* OXPCIe200 1 Native UART */
3304 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3305 pbn_oxsemi_1_4000000 },
3306 { PCI_VENDOR_ID_OXSEMI, 0xc4cb, /* OXPCIe200 1 Native UART */
3307 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3308 pbn_oxsemi_1_4000000 },
3309 { PCI_VENDOR_ID_OXSEMI, 0xc4cf, /* OXPCIe200 1 Native UART */
3310 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3311 pbn_oxsemi_1_4000000 },
Lee Howardb80de362008-10-21 13:50:14 +01003312 /*
3313 * Mainpine Inc. IQ Express "Rev3" utilizing OxSemi Tornado
3314 */
3315 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 1 Port V.34 Super-G3 Fax */
3316 PCI_VENDOR_ID_MAINPINE, 0x4001, 0, 0,
3317 pbn_oxsemi_1_4000000 },
3318 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 2 Port V.34 Super-G3 Fax */
3319 PCI_VENDOR_ID_MAINPINE, 0x4002, 0, 0,
3320 pbn_oxsemi_2_4000000 },
3321 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 4 Port V.34 Super-G3 Fax */
3322 PCI_VENDOR_ID_MAINPINE, 0x4004, 0, 0,
3323 pbn_oxsemi_4_4000000 },
3324 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 8 Port V.34 Super-G3 Fax */
3325 PCI_VENDOR_ID_MAINPINE, 0x4008, 0, 0,
3326 pbn_oxsemi_8_4000000 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05003327
3328 /*
3329 * Digi/IBM PCIe 2-port Async EIA-232 Adapter utilizing OxSemi Tornado
3330 */
3331 { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM,
3332 PCI_SUBVENDOR_ID_IBM, PCI_ANY_ID, 0, 0,
3333 pbn_oxsemi_2_4000000 },
3334
Lee Howard7106b4e2008-10-21 13:48:58 +01003335 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003336 * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards,
3337 * from skokodyn@yahoo.com
3338 */
3339 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
3340 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO232, 0, 0,
3341 pbn_sbsxrsio },
3342 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
3343 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO422, 0, 0,
3344 pbn_sbsxrsio },
3345 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
3346 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL232, 0, 0,
3347 pbn_sbsxrsio },
3348 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
3349 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL422, 0, 0,
3350 pbn_sbsxrsio },
3351
3352 /*
3353 * Digitan DS560-558, from jimd@esoft.com
3354 */
3355 { PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_ATT_VENUS_MODEM,
Alan Cox5756ee92008-02-08 04:18:51 -08003356 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003357 pbn_b1_1_115200 },
3358
3359 /*
3360 * Titan Electronic cards
3361 * The 400L and 800L have a custom setup quirk.
3362 */
3363 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100,
Alan Cox5756ee92008-02-08 04:18:51 -08003364 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003365 pbn_b0_1_921600 },
3366 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200,
Alan Cox5756ee92008-02-08 04:18:51 -08003367 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003368 pbn_b0_2_921600 },
3369 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400,
Alan Cox5756ee92008-02-08 04:18:51 -08003370 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003371 pbn_b0_4_921600 },
3372 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800B,
Alan Cox5756ee92008-02-08 04:18:51 -08003373 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003374 pbn_b0_4_921600 },
3375 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100L,
3376 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3377 pbn_b1_1_921600 },
3378 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200L,
3379 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3380 pbn_b1_bt_2_921600 },
3381 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400L,
3382 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3383 pbn_b0_bt_4_921600 },
3384 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800L,
3385 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3386 pbn_b0_bt_8_921600 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02003387 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200I,
3388 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3389 pbn_b4_bt_2_921600 },
3390 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400I,
3391 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3392 pbn_b4_bt_4_921600 },
3393 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800I,
3394 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3395 pbn_b4_bt_8_921600 },
3396 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400EH,
3397 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3398 pbn_b0_4_921600 },
3399 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EH,
3400 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3401 pbn_b0_4_921600 },
3402 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EHB,
3403 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3404 pbn_b0_4_921600 },
3405 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100E,
3406 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3407 pbn_oxsemi_1_4000000 },
3408 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200E,
3409 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3410 pbn_oxsemi_2_4000000 },
3411 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400E,
3412 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3413 pbn_oxsemi_4_4000000 },
3414 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800E,
3415 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3416 pbn_oxsemi_8_4000000 },
3417 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EI,
3418 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3419 pbn_oxsemi_2_4000000 },
3420 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EISI,
3421 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3422 pbn_oxsemi_2_4000000 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003423
3424 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550,
3425 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3426 pbn_b2_1_460800 },
3427 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_650,
3428 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3429 pbn_b2_1_460800 },
3430 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_850,
3431 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3432 pbn_b2_1_460800 },
3433 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_550,
3434 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3435 pbn_b2_bt_2_921600 },
3436 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_650,
3437 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3438 pbn_b2_bt_2_921600 },
3439 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_850,
3440 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3441 pbn_b2_bt_2_921600 },
3442 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_550,
3443 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3444 pbn_b2_bt_4_921600 },
3445 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_650,
3446 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3447 pbn_b2_bt_4_921600 },
3448 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_850,
3449 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3450 pbn_b2_bt_4_921600 },
3451 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_550,
3452 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3453 pbn_b0_1_921600 },
3454 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_650,
3455 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3456 pbn_b0_1_921600 },
3457 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_850,
3458 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3459 pbn_b0_1_921600 },
3460 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_550,
3461 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3462 pbn_b0_bt_2_921600 },
3463 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_650,
3464 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3465 pbn_b0_bt_2_921600 },
3466 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_850,
3467 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3468 pbn_b0_bt_2_921600 },
3469 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_550,
3470 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3471 pbn_b0_bt_4_921600 },
3472 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_650,
3473 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3474 pbn_b0_bt_4_921600 },
3475 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850,
3476 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3477 pbn_b0_bt_4_921600 },
Andrey Panin3ec9c592006-02-02 20:15:09 +00003478 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_550,
3479 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3480 pbn_b0_bt_8_921600 },
3481 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_650,
3482 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3483 pbn_b0_bt_8_921600 },
3484 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_850,
3485 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3486 pbn_b0_bt_8_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003487
3488 /*
3489 * Computone devices submitted by Doug McNash dmcnash@computone.com
3490 */
3491 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
3492 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG4,
3493 0, 0, pbn_computone_4 },
3494 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
3495 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG8,
3496 0, 0, pbn_computone_8 },
3497 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
3498 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG6,
3499 0, 0, pbn_computone_6 },
3500
3501 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI95N,
3502 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3503 pbn_oxsemi },
3504 { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
3505 PCI_VENDOR_ID_TIMEDIA, PCI_ANY_ID, 0, 0,
3506 pbn_b0_bt_1_921600 },
3507
3508 /*
3509 * AFAVLAB serial card, from Harald Welte <laforge@gnumonks.org>
3510 */
3511 { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P028,
3512 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3513 pbn_b0_bt_8_115200 },
3514 { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P030,
3515 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3516 pbn_b0_bt_8_115200 },
3517
3518 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_DSERIAL,
3519 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3520 pbn_b0_bt_2_115200 },
3521 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_A,
3522 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3523 pbn_b0_bt_2_115200 },
3524 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B,
3525 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3526 pbn_b0_bt_2_115200 },
Lennert Buytenhekb87e5e22009-11-11 14:26:42 -08003527 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_A,
3528 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3529 pbn_b0_bt_2_115200 },
3530 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_B,
3531 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3532 pbn_b0_bt_2_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003533 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A,
3534 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3535 pbn_b0_bt_4_460800 },
3536 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_B,
3537 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3538 pbn_b0_bt_4_460800 },
3539 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_PLUS,
3540 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3541 pbn_b0_bt_2_460800 },
3542 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_A,
3543 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3544 pbn_b0_bt_2_460800 },
3545 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_B,
3546 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3547 pbn_b0_bt_2_460800 },
3548 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_SSERIAL,
3549 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3550 pbn_b0_bt_1_115200 },
3551 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_650,
3552 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3553 pbn_b0_bt_1_460800 },
3554
3555 /*
Russell King1fb8cac2006-12-13 14:45:46 +00003556 * Korenix Jetcard F0/F1 cards (JC1204, JC1208, JC1404, JC1408).
3557 * Cards are identified by their subsystem vendor IDs, which
3558 * (in hex) match the model number.
3559 *
3560 * Note that JC140x are RS422/485 cards which require ox950
3561 * ACR = 0x10, and as such are not currently fully supported.
3562 */
3563 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
3564 0x1204, 0x0004, 0, 0,
3565 pbn_b0_4_921600 },
3566 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
3567 0x1208, 0x0004, 0, 0,
3568 pbn_b0_4_921600 },
3569/* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
3570 0x1402, 0x0002, 0, 0,
3571 pbn_b0_2_921600 }, */
3572/* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
3573 0x1404, 0x0004, 0, 0,
3574 pbn_b0_4_921600 }, */
3575 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF1,
3576 0x1208, 0x0004, 0, 0,
3577 pbn_b0_4_921600 },
3578
Kiros Yeh2a52fcb2009-12-21 16:26:48 -08003579 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2,
3580 0x1204, 0x0004, 0, 0,
3581 pbn_b0_4_921600 },
3582 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2,
3583 0x1208, 0x0004, 0, 0,
3584 pbn_b0_4_921600 },
3585 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF3,
3586 0x1208, 0x0004, 0, 0,
3587 pbn_b0_4_921600 },
Russell King1fb8cac2006-12-13 14:45:46 +00003588 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003589 * Dell Remote Access Card 4 - Tim_T_Murphy@Dell.com
3590 */
3591 { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RAC4,
3592 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3593 pbn_b1_1_1382400 },
3594
3595 /*
3596 * Dell Remote Access Card III - Tim_T_Murphy@Dell.com
3597 */
3598 { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RACIII,
3599 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3600 pbn_b1_1_1382400 },
3601
3602 /*
3603 * RAStel 2 port modem, gerg@moreton.com.au
3604 */
3605 { PCI_VENDOR_ID_MORETON, PCI_DEVICE_ID_RASTEL_2PORT,
3606 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3607 pbn_b2_bt_2_115200 },
3608
3609 /*
3610 * EKF addition for i960 Boards form EKF with serial port
3611 */
3612 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80960_RP,
3613 0xE4BF, PCI_ANY_ID, 0, 0,
3614 pbn_intel_i960 },
3615
3616 /*
3617 * Xircom Cardbus/Ethernet combos
3618 */
3619 { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_X3201_MDM,
3620 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3621 pbn_b0_1_115200 },
3622 /*
3623 * Xircom RBM56G cardbus modem - Dirk Arnold (temp entry)
3624 */
3625 { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_RBM56G,
3626 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3627 pbn_b0_1_115200 },
3628
3629 /*
3630 * Untested PCI modems, sent in from various folks...
3631 */
3632
3633 /*
3634 * Elsa Model 56K PCI Modem, from Andreas Rath <arh@01019freenet.de>
3635 */
3636 { PCI_VENDOR_ID_ROCKWELL, 0x1004,
3637 0x1048, 0x1500, 0, 0,
3638 pbn_b1_1_115200 },
3639
3640 { PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
3641 0xFF00, 0, 0, 0,
3642 pbn_sgi_ioc3 },
3643
3644 /*
3645 * HP Diva card
3646 */
3647 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
3648 PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_RMP3, 0, 0,
3649 pbn_b1_1_115200 },
3650 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
3651 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3652 pbn_b0_5_115200 },
3653 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
3654 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3655 pbn_b2_1_115200 },
3656
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00003657 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,
3658 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3659 pbn_b3_2_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003660 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM4,
3661 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3662 pbn_b3_4_115200 },
3663 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM8,
3664 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3665 pbn_b3_8_115200 },
3666
3667 /*
3668 * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
3669 */
3670 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3671 PCI_ANY_ID, PCI_ANY_ID,
3672 0,
3673 0, pbn_exar_XR17C152 },
3674 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
3675 PCI_ANY_ID, PCI_ANY_ID,
3676 0,
3677 0, pbn_exar_XR17C154 },
3678 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3679 PCI_ANY_ID, PCI_ANY_ID,
3680 0,
3681 0, pbn_exar_XR17C158 },
3682
3683 /*
3684 * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke)
3685 */
3686 { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560,
3687 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3688 pbn_b0_1_115200 },
Niels de Vos84f8c6f2007-08-22 14:01:14 -07003689 /*
3690 * ITE
3691 */
3692 { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
3693 PCI_ANY_ID, PCI_ANY_ID,
3694 0, 0,
3695 pbn_b1_bt_1_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003696
3697 /*
Peter Horton737c1752006-08-26 09:07:36 +01003698 * IntaShield IS-200
3699 */
3700 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200,
3701 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */
3702 pbn_b2_2_115200 },
Ignacio García Pérez4b6f6ce2008-05-23 13:04:28 -07003703 /*
3704 * IntaShield IS-400
3705 */
3706 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
3707 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
3708 pbn_b2_4_115200 },
Peter Horton737c1752006-08-26 09:07:36 +01003709 /*
Thomas Hoehn48212002007-02-10 01:46:05 -08003710 * Perle PCI-RAS cards
3711 */
3712 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
3713 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS4,
3714 0, 0, pbn_b2_4_921600 },
3715 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
3716 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8,
3717 0, 0, pbn_b2_8_921600 },
Alan Coxbf0df632007-10-16 01:24:00 -07003718
3719 /*
3720 * Mainpine series cards: Fairly standard layout but fools
3721 * parts of the autodetect in some cases and uses otherwise
3722 * unmatched communications subclasses in the PCI Express case
3723 */
3724
3725 { /* RockForceDUO */
3726 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3727 PCI_VENDOR_ID_MAINPINE, 0x0200,
3728 0, 0, pbn_b0_2_115200 },
3729 { /* RockForceQUATRO */
3730 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3731 PCI_VENDOR_ID_MAINPINE, 0x0300,
3732 0, 0, pbn_b0_4_115200 },
3733 { /* RockForceDUO+ */
3734 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3735 PCI_VENDOR_ID_MAINPINE, 0x0400,
3736 0, 0, pbn_b0_2_115200 },
3737 { /* RockForceQUATRO+ */
3738 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3739 PCI_VENDOR_ID_MAINPINE, 0x0500,
3740 0, 0, pbn_b0_4_115200 },
3741 { /* RockForce+ */
3742 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3743 PCI_VENDOR_ID_MAINPINE, 0x0600,
3744 0, 0, pbn_b0_2_115200 },
3745 { /* RockForce+ */
3746 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3747 PCI_VENDOR_ID_MAINPINE, 0x0700,
3748 0, 0, pbn_b0_4_115200 },
3749 { /* RockForceOCTO+ */
3750 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3751 PCI_VENDOR_ID_MAINPINE, 0x0800,
3752 0, 0, pbn_b0_8_115200 },
3753 { /* RockForceDUO+ */
3754 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3755 PCI_VENDOR_ID_MAINPINE, 0x0C00,
3756 0, 0, pbn_b0_2_115200 },
3757 { /* RockForceQUARTRO+ */
3758 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3759 PCI_VENDOR_ID_MAINPINE, 0x0D00,
3760 0, 0, pbn_b0_4_115200 },
3761 { /* RockForceOCTO+ */
3762 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3763 PCI_VENDOR_ID_MAINPINE, 0x1D00,
3764 0, 0, pbn_b0_8_115200 },
3765 { /* RockForceD1 */
3766 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3767 PCI_VENDOR_ID_MAINPINE, 0x2000,
3768 0, 0, pbn_b0_1_115200 },
3769 { /* RockForceF1 */
3770 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3771 PCI_VENDOR_ID_MAINPINE, 0x2100,
3772 0, 0, pbn_b0_1_115200 },
3773 { /* RockForceD2 */
3774 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3775 PCI_VENDOR_ID_MAINPINE, 0x2200,
3776 0, 0, pbn_b0_2_115200 },
3777 { /* RockForceF2 */
3778 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3779 PCI_VENDOR_ID_MAINPINE, 0x2300,
3780 0, 0, pbn_b0_2_115200 },
3781 { /* RockForceD4 */
3782 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3783 PCI_VENDOR_ID_MAINPINE, 0x2400,
3784 0, 0, pbn_b0_4_115200 },
3785 { /* RockForceF4 */
3786 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3787 PCI_VENDOR_ID_MAINPINE, 0x2500,
3788 0, 0, pbn_b0_4_115200 },
3789 { /* RockForceD8 */
3790 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3791 PCI_VENDOR_ID_MAINPINE, 0x2600,
3792 0, 0, pbn_b0_8_115200 },
3793 { /* RockForceF8 */
3794 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3795 PCI_VENDOR_ID_MAINPINE, 0x2700,
3796 0, 0, pbn_b0_8_115200 },
3797 { /* IQ Express D1 */
3798 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3799 PCI_VENDOR_ID_MAINPINE, 0x3000,
3800 0, 0, pbn_b0_1_115200 },
3801 { /* IQ Express F1 */
3802 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3803 PCI_VENDOR_ID_MAINPINE, 0x3100,
3804 0, 0, pbn_b0_1_115200 },
3805 { /* IQ Express D2 */
3806 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3807 PCI_VENDOR_ID_MAINPINE, 0x3200,
3808 0, 0, pbn_b0_2_115200 },
3809 { /* IQ Express F2 */
3810 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3811 PCI_VENDOR_ID_MAINPINE, 0x3300,
3812 0, 0, pbn_b0_2_115200 },
3813 { /* IQ Express D4 */
3814 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3815 PCI_VENDOR_ID_MAINPINE, 0x3400,
3816 0, 0, pbn_b0_4_115200 },
3817 { /* IQ Express F4 */
3818 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3819 PCI_VENDOR_ID_MAINPINE, 0x3500,
3820 0, 0, pbn_b0_4_115200 },
3821 { /* IQ Express D8 */
3822 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3823 PCI_VENDOR_ID_MAINPINE, 0x3C00,
3824 0, 0, pbn_b0_8_115200 },
3825 { /* IQ Express F8 */
3826 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3827 PCI_VENDOR_ID_MAINPINE, 0x3D00,
3828 0, 0, pbn_b0_8_115200 },
3829
3830
Thomas Hoehn48212002007-02-10 01:46:05 -08003831 /*
Olof Johanssonaa798502007-08-22 14:01:55 -07003832 * PA Semi PA6T-1682M on-chip UART
3833 */
3834 { PCI_VENDOR_ID_PASEMI, 0xa004,
3835 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3836 pbn_pasemi_1682M },
3837
3838 /*
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01003839 * National Instruments
3840 */
Will Page04bf7e72009-04-06 17:32:15 +01003841 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI23216,
3842 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3843 pbn_b1_16_115200 },
3844 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2328,
3845 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3846 pbn_b1_8_115200 },
3847 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2324,
3848 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3849 pbn_b1_bt_4_115200 },
3850 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2322,
3851 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3852 pbn_b1_bt_2_115200 },
3853 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2324I,
3854 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3855 pbn_b1_bt_4_115200 },
3856 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2322I,
3857 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3858 pbn_b1_bt_2_115200 },
3859 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_23216,
3860 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3861 pbn_b1_16_115200 },
3862 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2328,
3863 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3864 pbn_b1_8_115200 },
3865 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2324,
3866 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3867 pbn_b1_bt_4_115200 },
3868 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2322,
3869 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3870 pbn_b1_bt_2_115200 },
3871 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8422_2324,
3872 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3873 pbn_b1_bt_4_115200 },
3874 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8422_2322,
3875 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3876 pbn_b1_bt_2_115200 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01003877 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2322,
3878 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3879 pbn_ni8430_2 },
3880 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2322,
3881 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3882 pbn_ni8430_2 },
3883 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2324,
3884 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3885 pbn_ni8430_4 },
3886 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2324,
3887 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3888 pbn_ni8430_4 },
3889 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2328,
3890 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3891 pbn_ni8430_8 },
3892 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2328,
3893 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3894 pbn_ni8430_8 },
3895 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_23216,
3896 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3897 pbn_ni8430_16 },
3898 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_23216,
3899 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3900 pbn_ni8430_16 },
3901 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8432_2322,
3902 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3903 pbn_ni8430_2 },
3904 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8432_2322,
3905 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3906 pbn_ni8430_2 },
3907 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8432_2324,
3908 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3909 pbn_ni8430_4 },
3910 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8432_2324,
3911 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3912 pbn_ni8430_4 },
3913
3914 /*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08003915 * ADDI-DATA GmbH communication cards <info@addi-data.com>
3916 */
3917 { PCI_VENDOR_ID_ADDIDATA,
3918 PCI_DEVICE_ID_ADDIDATA_APCI7500,
3919 PCI_ANY_ID,
3920 PCI_ANY_ID,
3921 0,
3922 0,
3923 pbn_b0_4_115200 },
3924
3925 { PCI_VENDOR_ID_ADDIDATA,
3926 PCI_DEVICE_ID_ADDIDATA_APCI7420,
3927 PCI_ANY_ID,
3928 PCI_ANY_ID,
3929 0,
3930 0,
3931 pbn_b0_2_115200 },
3932
3933 { PCI_VENDOR_ID_ADDIDATA,
3934 PCI_DEVICE_ID_ADDIDATA_APCI7300,
3935 PCI_ANY_ID,
3936 PCI_ANY_ID,
3937 0,
3938 0,
3939 pbn_b0_1_115200 },
3940
3941 { PCI_VENDOR_ID_ADDIDATA_OLD,
3942 PCI_DEVICE_ID_ADDIDATA_APCI7800,
3943 PCI_ANY_ID,
3944 PCI_ANY_ID,
3945 0,
3946 0,
3947 pbn_b1_8_115200 },
3948
3949 { PCI_VENDOR_ID_ADDIDATA,
3950 PCI_DEVICE_ID_ADDIDATA_APCI7500_2,
3951 PCI_ANY_ID,
3952 PCI_ANY_ID,
3953 0,
3954 0,
3955 pbn_b0_4_115200 },
3956
3957 { PCI_VENDOR_ID_ADDIDATA,
3958 PCI_DEVICE_ID_ADDIDATA_APCI7420_2,
3959 PCI_ANY_ID,
3960 PCI_ANY_ID,
3961 0,
3962 0,
3963 pbn_b0_2_115200 },
3964
3965 { PCI_VENDOR_ID_ADDIDATA,
3966 PCI_DEVICE_ID_ADDIDATA_APCI7300_2,
3967 PCI_ANY_ID,
3968 PCI_ANY_ID,
3969 0,
3970 0,
3971 pbn_b0_1_115200 },
3972
3973 { PCI_VENDOR_ID_ADDIDATA,
3974 PCI_DEVICE_ID_ADDIDATA_APCI7500_3,
3975 PCI_ANY_ID,
3976 PCI_ANY_ID,
3977 0,
3978 0,
3979 pbn_b0_4_115200 },
3980
3981 { PCI_VENDOR_ID_ADDIDATA,
3982 PCI_DEVICE_ID_ADDIDATA_APCI7420_3,
3983 PCI_ANY_ID,
3984 PCI_ANY_ID,
3985 0,
3986 0,
3987 pbn_b0_2_115200 },
3988
3989 { PCI_VENDOR_ID_ADDIDATA,
3990 PCI_DEVICE_ID_ADDIDATA_APCI7300_3,
3991 PCI_ANY_ID,
3992 PCI_ANY_ID,
3993 0,
3994 0,
3995 pbn_b0_1_115200 },
3996
3997 { PCI_VENDOR_ID_ADDIDATA,
3998 PCI_DEVICE_ID_ADDIDATA_APCI7800_3,
3999 PCI_ANY_ID,
4000 PCI_ANY_ID,
4001 0,
4002 0,
4003 pbn_b0_8_115200 },
4004
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07004005 { PCI_VENDOR_ID_ADDIDATA,
4006 PCI_DEVICE_ID_ADDIDATA_APCIe7500,
4007 PCI_ANY_ID,
4008 PCI_ANY_ID,
4009 0,
4010 0,
4011 pbn_ADDIDATA_PCIe_4_3906250 },
4012
4013 { PCI_VENDOR_ID_ADDIDATA,
4014 PCI_DEVICE_ID_ADDIDATA_APCIe7420,
4015 PCI_ANY_ID,
4016 PCI_ANY_ID,
4017 0,
4018 0,
4019 pbn_ADDIDATA_PCIe_2_3906250 },
4020
4021 { PCI_VENDOR_ID_ADDIDATA,
4022 PCI_DEVICE_ID_ADDIDATA_APCIe7300,
4023 PCI_ANY_ID,
4024 PCI_ANY_ID,
4025 0,
4026 0,
4027 pbn_ADDIDATA_PCIe_1_3906250 },
4028
4029 { PCI_VENDOR_ID_ADDIDATA,
4030 PCI_DEVICE_ID_ADDIDATA_APCIe7800,
4031 PCI_ANY_ID,
4032 PCI_ANY_ID,
4033 0,
4034 0,
4035 pbn_ADDIDATA_PCIe_8_3906250 },
4036
Jiri Slaby25cf9bc2009-01-15 13:30:34 +00004037 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
4038 PCI_VENDOR_ID_IBM, 0x0299,
4039 0, 0, pbn_b0_bt_2_115200 },
4040
Michael Bueschc4285b42009-06-30 11:41:21 -07004041 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901,
4042 0xA000, 0x1000,
4043 0, 0, pbn_b0_1_115200 },
4044
Nicos Gollan7808edc2011-05-05 21:00:37 +02004045 /* the 9901 is a rebranded 9912 */
4046 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
4047 0xA000, 0x1000,
4048 0, 0, pbn_b0_1_115200 },
4049
4050 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
4051 0xA000, 0x1000,
4052 0, 0, pbn_b0_1_115200 },
4053
4054 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9904,
4055 0xA000, 0x1000,
4056 0, 0, pbn_b0_1_115200 },
4057
4058 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
4059 0xA000, 0x1000,
4060 0, 0, pbn_b0_1_115200 },
4061
4062 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
4063 0xA000, 0x3002,
4064 0, 0, pbn_NETMOS9900_2s_115200 },
4065
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08004066 /*
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08004067 * Best Connectivity PCI Multi I/O cards
4068 */
4069
4070 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
4071 0xA000, 0x1000,
4072 0, 0, pbn_b0_1_115200 },
4073
4074 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
4075 0xA000, 0x3004,
4076 0, 0, pbn_b0_bt_4_115200 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08004077 /* Intel CE4100 */
4078 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
4079 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4080 pbn_ce4100_1_115200 },
4081
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04004082 /*
4083 * Cronyx Omega PCI
4084 */
4085 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
4086 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4087 pbn_omegapci },
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08004088
4089 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07004090 * These entries match devices with class COMMUNICATION_SERIAL,
4091 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
4092 */
4093 { PCI_ANY_ID, PCI_ANY_ID,
4094 PCI_ANY_ID, PCI_ANY_ID,
4095 PCI_CLASS_COMMUNICATION_SERIAL << 8,
4096 0xffff00, pbn_default },
4097 { PCI_ANY_ID, PCI_ANY_ID,
4098 PCI_ANY_ID, PCI_ANY_ID,
4099 PCI_CLASS_COMMUNICATION_MODEM << 8,
4100 0xffff00, pbn_default },
4101 { PCI_ANY_ID, PCI_ANY_ID,
4102 PCI_ANY_ID, PCI_ANY_ID,
4103 PCI_CLASS_COMMUNICATION_MULTISERIAL << 8,
4104 0xffff00, pbn_default },
4105 { 0, }
4106};
4107
Michael Reed28071902011-05-31 12:06:28 -05004108static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
4109 pci_channel_state_t state)
4110{
4111 struct serial_private *priv = pci_get_drvdata(dev);
4112
4113 if (state == pci_channel_io_perm_failure)
4114 return PCI_ERS_RESULT_DISCONNECT;
4115
4116 if (priv)
4117 pciserial_suspend_ports(priv);
4118
4119 pci_disable_device(dev);
4120
4121 return PCI_ERS_RESULT_NEED_RESET;
4122}
4123
4124static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
4125{
4126 int rc;
4127
4128 rc = pci_enable_device(dev);
4129
4130 if (rc)
4131 return PCI_ERS_RESULT_DISCONNECT;
4132
4133 pci_restore_state(dev);
4134 pci_save_state(dev);
4135
4136 return PCI_ERS_RESULT_RECOVERED;
4137}
4138
4139static void serial8250_io_resume(struct pci_dev *dev)
4140{
4141 struct serial_private *priv = pci_get_drvdata(dev);
4142
4143 if (priv)
4144 pciserial_resume_ports(priv);
4145}
4146
4147static struct pci_error_handlers serial8250_err_handler = {
4148 .error_detected = serial8250_io_error_detected,
4149 .slot_reset = serial8250_io_slot_reset,
4150 .resume = serial8250_io_resume,
4151};
4152
Linus Torvalds1da177e2005-04-16 15:20:36 -07004153static struct pci_driver serial_pci_driver = {
4154 .name = "serial",
4155 .probe = pciserial_init_one,
4156 .remove = __devexit_p(pciserial_remove_one),
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07004157#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -07004158 .suspend = pciserial_suspend_one,
4159 .resume = pciserial_resume_one,
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07004160#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07004161 .id_table = serial_pci_tbl,
Michael Reed28071902011-05-31 12:06:28 -05004162 .err_handler = &serial8250_err_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004163};
4164
4165static int __init serial8250_pci_init(void)
4166{
4167 return pci_register_driver(&serial_pci_driver);
4168}
4169
4170static void __exit serial8250_pci_exit(void)
4171{
4172 pci_unregister_driver(&serial_pci_driver);
4173}
4174
4175module_init(serial8250_pci_init);
4176module_exit(serial8250_pci_exit);
4177
4178MODULE_LICENSE("GPL");
4179MODULE_DESCRIPTION("Generic 8250/16x50 PCI serial probe module");
4180MODULE_DEVICE_TABLE(pci, serial_pci_tbl);