blob: 2285d3283b3be61a35cf5d88c147b90446216c3e [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>
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -070020#include <linux/serial_reg.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/serial_core.h>
22#include <linux/8250_pci.h>
23#include <linux/bitops.h>
24
25#include <asm/byteorder.h>
26#include <asm/io.h>
27
28#include "8250.h"
29
30#undef SERIAL_DEBUG_PCI
31
32/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 * init function returns:
34 * > 0 - number of ports
35 * = 0 - use board->num_ports
36 * < 0 - error
37 */
38struct pci_serial_quirk {
39 u32 vendor;
40 u32 device;
41 u32 subvendor;
42 u32 subdevice;
Frédéric Brière5bf8f502011-05-29 15:08:03 -040043 int (*probe)(struct pci_dev *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 int (*init)(struct pci_dev *dev);
Russell King975a1a7d2009-01-02 13:44:27 +000045 int (*setup)(struct serial_private *,
46 const struct pciserial_board *,
Alan Cox2655a2c2012-07-12 12:59:50 +010047 struct uart_8250_port *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 void (*exit)(struct pci_dev *dev);
49};
50
51#define PCI_NUM_BAR_RESOURCES 6
52
53struct serial_private {
Russell King70db3d92005-07-27 11:34:27 +010054 struct pci_dev *dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 unsigned int nr;
56 void __iomem *remapped_bar[PCI_NUM_BAR_RESOURCES];
57 struct pci_serial_quirk *quirk;
58 int line[0];
59};
60
Nicos Gollan7808edc2011-05-05 21:00:37 +020061static int pci_default_setup(struct serial_private*,
Alan Cox2655a2c2012-07-12 12:59:50 +010062 const struct pciserial_board*, struct uart_8250_port *, int);
Nicos Gollan7808edc2011-05-05 21:00:37 +020063
Linus Torvalds1da177e2005-04-16 15:20:36 -070064static void moan_device(const char *str, struct pci_dev *dev)
65{
Joe Perchesad361c92009-07-06 13:05:40 -070066 printk(KERN_WARNING
67 "%s: %s\n"
68 "Please send the output of lspci -vv, this\n"
69 "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n"
70 "manufacturer and name of serial board or\n"
71 "modem board to rmk+serial@arm.linux.org.uk.\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 pci_name(dev), str, dev->vendor, dev->device,
73 dev->subsystem_vendor, dev->subsystem_device);
74}
75
76static int
Alan Cox2655a2c2012-07-12 12:59:50 +010077setup_port(struct serial_private *priv, struct uart_8250_port *port,
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 int bar, int offset, int regshift)
79{
Russell King70db3d92005-07-27 11:34:27 +010080 struct pci_dev *dev = priv->dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 unsigned long base, len;
82
83 if (bar >= PCI_NUM_BAR_RESOURCES)
84 return -EINVAL;
85
Russell King72ce9a82005-07-27 11:32:04 +010086 base = pci_resource_start(dev, bar);
87
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 len = pci_resource_len(dev, bar);
90
91 if (!priv->remapped_bar[bar])
Alan Cox6f441fe2008-05-01 04:34:59 -070092 priv->remapped_bar[bar] = ioremap_nocache(base, len);
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 if (!priv->remapped_bar[bar])
94 return -ENOMEM;
95
Alan Cox2655a2c2012-07-12 12:59:50 +010096 port->port.iotype = UPIO_MEM;
97 port->port.iobase = 0;
98 port->port.mapbase = base + offset;
99 port->port.membase = priv->remapped_bar[bar] + offset;
100 port->port.regshift = regshift;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 } else {
Alan Cox2655a2c2012-07-12 12:59:50 +0100102 port->port.iotype = UPIO_PORT;
103 port->port.iobase = base + offset;
104 port->port.mapbase = 0;
105 port->port.membase = NULL;
106 port->port.regshift = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 }
108 return 0;
109}
110
111/*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -0800112 * ADDI-DATA GmbH communication cards <info@addi-data.com>
113 */
114static int addidata_apci7800_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000115 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100116 struct uart_8250_port *port, int idx)
Krauth.Julien02c9b5c2008-02-04 22:27:49 -0800117{
118 unsigned int bar = 0, offset = board->first_offset;
119 bar = FL_GET_BASE(board->flags);
120
121 if (idx < 2) {
122 offset += idx * board->uart_offset;
123 } else if ((idx >= 2) && (idx < 4)) {
124 bar += 1;
125 offset += ((idx - 2) * board->uart_offset);
126 } else if ((idx >= 4) && (idx < 6)) {
127 bar += 2;
128 offset += ((idx - 4) * board->uart_offset);
129 } else if (idx >= 6) {
130 bar += 3;
131 offset += ((idx - 6) * board->uart_offset);
132 }
133
134 return setup_port(priv, port, bar, offset, board->reg_shift);
135}
136
137/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 * AFAVLAB uses a different mixture of BARs and offsets
139 * Not that ugly ;) -- HW
140 */
141static int
Russell King975a1a7d2009-01-02 13:44:27 +0000142afavlab_setup(struct serial_private *priv, const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100143 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144{
145 unsigned int bar, offset = board->first_offset;
Alan Cox5756ee92008-02-08 04:18:51 -0800146
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 bar = FL_GET_BASE(board->flags);
148 if (idx < 4)
149 bar += idx;
150 else {
151 bar = 4;
152 offset += (idx - 4) * board->uart_offset;
153 }
154
Russell King70db3d92005-07-27 11:34:27 +0100155 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156}
157
158/*
159 * HP's Remote Management Console. The Diva chip came in several
160 * different versions. N-class, L2000 and A500 have two Diva chips, each
161 * with 3 UARTs (the third UART on the second chip is unused). Superdome
162 * and Keystone have one Diva chip with 3 UARTs. Some later machines have
163 * one Diva chip, but it has been expanded to 5 UARTs.
164 */
Russell King61a116e2006-07-03 15:22:35 +0100165static int pci_hp_diva_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166{
167 int rc = 0;
168
169 switch (dev->subsystem_device) {
170 case PCI_DEVICE_ID_HP_DIVA_TOSCA1:
171 case PCI_DEVICE_ID_HP_DIVA_HALFDOME:
172 case PCI_DEVICE_ID_HP_DIVA_KEYSTONE:
173 case PCI_DEVICE_ID_HP_DIVA_EVEREST:
174 rc = 3;
175 break;
176 case PCI_DEVICE_ID_HP_DIVA_TOSCA2:
177 rc = 2;
178 break;
179 case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
180 rc = 4;
181 break;
182 case PCI_DEVICE_ID_HP_DIVA_POWERBAR:
Justin Chen551f8f02005-10-24 22:16:38 +0100183 case PCI_DEVICE_ID_HP_DIVA_HURRICANE:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 rc = 1;
185 break;
186 }
187
188 return rc;
189}
190
191/*
192 * HP's Diva chip puts the 4th/5th serial port further out, and
193 * some serial ports are supposed to be hidden on certain models.
194 */
195static int
Russell King975a1a7d2009-01-02 13:44:27 +0000196pci_hp_diva_setup(struct serial_private *priv,
197 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100198 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199{
200 unsigned int offset = board->first_offset;
201 unsigned int bar = FL_GET_BASE(board->flags);
202
Russell King70db3d92005-07-27 11:34:27 +0100203 switch (priv->dev->subsystem_device) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
205 if (idx == 3)
206 idx++;
207 break;
208 case PCI_DEVICE_ID_HP_DIVA_EVEREST:
209 if (idx > 0)
210 idx++;
211 if (idx > 2)
212 idx++;
213 break;
214 }
215 if (idx > 2)
216 offset = 0x18;
217
218 offset += idx * board->uart_offset;
219
Russell King70db3d92005-07-27 11:34:27 +0100220 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221}
222
223/*
224 * Added for EKF Intel i960 serial boards
225 */
Russell King61a116e2006-07-03 15:22:35 +0100226static int pci_inteli960ni_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227{
228 unsigned long oldval;
229
230 if (!(dev->subsystem_device & 0x1000))
231 return -ENODEV;
232
233 /* is firmware started? */
Alan Cox5756ee92008-02-08 04:18:51 -0800234 pci_read_config_dword(dev, 0x44, (void *)&oldval);
235 if (oldval == 0x00001000L) { /* RESET value */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236 printk(KERN_DEBUG "Local i960 firmware missing");
237 return -ENODEV;
238 }
239 return 0;
240}
241
242/*
243 * Some PCI serial cards using the PLX 9050 PCI interface chip require
244 * that the card interrupt be explicitly enabled or disabled. This
245 * seems to be mainly needed on card using the PLX which also use I/O
246 * mapped memory.
247 */
Russell King61a116e2006-07-03 15:22:35 +0100248static int pci_plx9050_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249{
250 u8 irq_config;
251 void __iomem *p;
252
253 if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0) {
254 moan_device("no memory in bar 0", dev);
255 return 0;
256 }
257
258 irq_config = 0x41;
Bjorn Helgaasadd7b582005-10-24 22:11:57 +0100259 if (dev->vendor == PCI_VENDOR_ID_PANACOM ||
Alan Cox5756ee92008-02-08 04:18:51 -0800260 dev->subsystem_vendor == PCI_SUBVENDOR_ID_EXSYS)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261 irq_config = 0x43;
Alan Cox5756ee92008-02-08 04:18:51 -0800262
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 if ((dev->vendor == PCI_VENDOR_ID_PLX) &&
Alan Cox5756ee92008-02-08 04:18:51 -0800264 (dev->device == PCI_DEVICE_ID_PLX_ROMULUS))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 /*
266 * As the megawolf cards have the int pins active
267 * high, and have 2 UART chips, both ints must be
268 * enabled on the 9050. Also, the UARTS are set in
269 * 16450 mode by default, so we have to enable the
270 * 16C950 'enhanced' mode so that we can use the
271 * deep FIFOs
272 */
273 irq_config = 0x5b;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 /*
275 * enable/disable interrupts
276 */
Alan Cox6f441fe2008-05-01 04:34:59 -0700277 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278 if (p == NULL)
279 return -ENOMEM;
280 writel(irq_config, p + 0x4c);
281
282 /*
283 * Read the register back to ensure that it took effect.
284 */
285 readl(p + 0x4c);
286 iounmap(p);
287
288 return 0;
289}
290
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500291static void pci_plx9050_exit(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292{
293 u8 __iomem *p;
294
295 if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0)
296 return;
297
298 /*
299 * disable interrupts
300 */
Alan Cox6f441fe2008-05-01 04:34:59 -0700301 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 if (p != NULL) {
303 writel(0, p + 0x4c);
304
305 /*
306 * Read the register back to ensure that it took effect.
307 */
308 readl(p + 0x4c);
309 iounmap(p);
310 }
311}
312
Will Page04bf7e72009-04-06 17:32:15 +0100313#define NI8420_INT_ENABLE_REG 0x38
314#define NI8420_INT_ENABLE_BIT 0x2000
315
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500316static void pci_ni8420_exit(struct pci_dev *dev)
Will Page04bf7e72009-04-06 17:32:15 +0100317{
318 void __iomem *p;
319 unsigned long base, len;
320 unsigned int bar = 0;
321
322 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
323 moan_device("no memory in bar", dev);
324 return;
325 }
326
327 base = pci_resource_start(dev, bar);
328 len = pci_resource_len(dev, bar);
329 p = ioremap_nocache(base, len);
330 if (p == NULL)
331 return;
332
333 /* Disable the CPU Interrupt */
334 writel(readl(p + NI8420_INT_ENABLE_REG) & ~(NI8420_INT_ENABLE_BIT),
335 p + NI8420_INT_ENABLE_REG);
336 iounmap(p);
337}
338
339
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100340/* MITE registers */
341#define MITE_IOWBSR1 0xc4
342#define MITE_IOWCR1 0xf4
343#define MITE_LCIMR1 0x08
344#define MITE_LCIMR2 0x10
345
346#define MITE_LCIMR2_CLR_CPU_IE (1 << 30)
347
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500348static void pci_ni8430_exit(struct pci_dev *dev)
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100349{
350 void __iomem *p;
351 unsigned long base, len;
352 unsigned int bar = 0;
353
354 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
355 moan_device("no memory in bar", dev);
356 return;
357 }
358
359 base = pci_resource_start(dev, bar);
360 len = pci_resource_len(dev, bar);
361 p = ioremap_nocache(base, len);
362 if (p == NULL)
363 return;
364
365 /* Disable the CPU Interrupt */
366 writel(MITE_LCIMR2_CLR_CPU_IE, p + MITE_LCIMR2);
367 iounmap(p);
368}
369
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370/* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */
371static int
Russell King975a1a7d2009-01-02 13:44:27 +0000372sbs_setup(struct serial_private *priv, const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100373 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374{
375 unsigned int bar, offset = board->first_offset;
376
377 bar = 0;
378
379 if (idx < 4) {
380 /* first four channels map to 0, 0x100, 0x200, 0x300 */
381 offset += idx * board->uart_offset;
382 } else if (idx < 8) {
383 /* last four channels map to 0x1000, 0x1100, 0x1200, 0x1300 */
384 offset += idx * board->uart_offset + 0xC00;
385 } else /* we have only 8 ports on PMC-OCTALPRO */
386 return 1;
387
Russell King70db3d92005-07-27 11:34:27 +0100388 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389}
390
391/*
392* This does initialization for PMC OCTALPRO cards:
393* maps the device memory, resets the UARTs (needed, bc
394* if the module is removed and inserted again, the card
395* is in the sleep mode) and enables global interrupt.
396*/
397
398/* global control register offset for SBS PMC-OctalPro */
399#define OCT_REG_CR_OFF 0x500
400
Russell King61a116e2006-07-03 15:22:35 +0100401static int sbs_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402{
403 u8 __iomem *p;
404
Arjan van de Ven24ed3ab2009-06-24 18:34:58 +0100405 p = pci_ioremap_bar(dev, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406
407 if (p == NULL)
408 return -ENOMEM;
409 /* Set bit-4 Control Register (UART RESET) in to reset the uarts */
Alan Cox5756ee92008-02-08 04:18:51 -0800410 writeb(0x10, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 udelay(50);
Alan Cox5756ee92008-02-08 04:18:51 -0800412 writeb(0x0, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413
414 /* Set bit-2 (INTENABLE) of Control Register */
415 writeb(0x4, p + OCT_REG_CR_OFF);
416 iounmap(p);
417
418 return 0;
419}
420
421/*
422 * Disables the global interrupt of PMC-OctalPro
423 */
424
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500425static void sbs_exit(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426{
427 u8 __iomem *p;
428
Arjan van de Ven24ed3ab2009-06-24 18:34:58 +0100429 p = pci_ioremap_bar(dev, 0);
Alan Cox5756ee92008-02-08 04:18:51 -0800430 /* FIXME: What if resource_len < OCT_REG_CR_OFF */
431 if (p != NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 writeb(0, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 iounmap(p);
434}
435
436/*
437 * SIIG serial cards have an PCI interface chip which also controls
438 * the UART clocking frequency. Each UART can be clocked independently
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300439 * (except cards equipped with 4 UARTs) and initial clocking settings
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 * are stored in the EEPROM chip. It can cause problems because this
441 * version of serial driver doesn't support differently clocked UART's
442 * on single PCI card. To prevent this, initialization functions set
443 * high frequency clocking for all UART's on given card. It is safe (I
444 * hope) because it doesn't touch EEPROM settings to prevent conflicts
445 * with other OSes (like M$ DOS).
446 *
447 * SIIG support added by Andrey Panin <pazke@donpac.ru>, 10/1999
Alan Cox5756ee92008-02-08 04:18:51 -0800448 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449 * There is two family of SIIG serial cards with different PCI
450 * interface chip and different configuration methods:
451 * - 10x cards have control registers in IO and/or memory space;
452 * - 20x cards have control registers in standard PCI configuration space.
453 *
Russell King67d74b82005-07-27 11:33:03 +0100454 * Note: all 10x cards have PCI device ids 0x10..
455 * all 20x cards have PCI device ids 0x20..
456 *
Andrey Paninfbc0dc02005-07-18 11:38:09 +0100457 * There are also Quartet Serial cards which use Oxford Semiconductor
458 * 16954 quad UART PCI chip clocked by 18.432 MHz quartz.
459 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 * Note: some SIIG cards are probed by the parport_serial object.
461 */
462
463#define PCI_DEVICE_ID_SIIG_1S_10x (PCI_DEVICE_ID_SIIG_1S_10x_550 & 0xfffc)
464#define PCI_DEVICE_ID_SIIG_2S_10x (PCI_DEVICE_ID_SIIG_2S_10x_550 & 0xfff8)
465
466static int pci_siig10x_init(struct pci_dev *dev)
467{
468 u16 data;
469 void __iomem *p;
470
471 switch (dev->device & 0xfff8) {
472 case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */
473 data = 0xffdf;
474 break;
475 case PCI_DEVICE_ID_SIIG_2S_10x: /* 2S, 2S1P */
476 data = 0xf7ff;
477 break;
478 default: /* 1S1P, 4S */
479 data = 0xfffb;
480 break;
481 }
482
Alan Cox6f441fe2008-05-01 04:34:59 -0700483 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484 if (p == NULL)
485 return -ENOMEM;
486
487 writew(readw(p + 0x28) & data, p + 0x28);
488 readw(p + 0x28);
489 iounmap(p);
490 return 0;
491}
492
493#define PCI_DEVICE_ID_SIIG_2S_20x (PCI_DEVICE_ID_SIIG_2S_20x_550 & 0xfffc)
494#define PCI_DEVICE_ID_SIIG_2S1P_20x (PCI_DEVICE_ID_SIIG_2S1P_20x_550 & 0xfffc)
495
496static int pci_siig20x_init(struct pci_dev *dev)
497{
498 u8 data;
499
500 /* Change clock frequency for the first UART. */
501 pci_read_config_byte(dev, 0x6f, &data);
502 pci_write_config_byte(dev, 0x6f, data & 0xef);
503
504 /* If this card has 2 UART, we have to do the same with second UART. */
505 if (((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S_20x) ||
506 ((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S1P_20x)) {
507 pci_read_config_byte(dev, 0x73, &data);
508 pci_write_config_byte(dev, 0x73, data & 0xef);
509 }
510 return 0;
511}
512
Russell King67d74b82005-07-27 11:33:03 +0100513static int pci_siig_init(struct pci_dev *dev)
514{
515 unsigned int type = dev->device & 0xff00;
516
517 if (type == 0x1000)
518 return pci_siig10x_init(dev);
519 else if (type == 0x2000)
520 return pci_siig20x_init(dev);
521
522 moan_device("Unknown SIIG card", dev);
523 return -ENODEV;
524}
525
Andrey Panin3ec9c592006-02-02 20:15:09 +0000526static int pci_siig_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000527 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100528 struct uart_8250_port *port, int idx)
Andrey Panin3ec9c592006-02-02 20:15:09 +0000529{
530 unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0;
531
532 if (idx > 3) {
533 bar = 4;
534 offset = (idx - 4) * 8;
535 }
536
537 return setup_port(priv, port, bar, offset, 0);
538}
539
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540/*
541 * Timedia has an explosion of boards, and to avoid the PCI table from
542 * growing *huge*, we use this function to collapse some 70 entries
543 * in the PCI table into one, for sanity's and compactness's sake.
544 */
Helge Dellere9422e02006-08-29 21:57:29 +0200545static const unsigned short timedia_single_port[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546 0x4025, 0x4027, 0x4028, 0x5025, 0x5027, 0
547};
548
Helge Dellere9422e02006-08-29 21:57:29 +0200549static const unsigned short timedia_dual_port[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
Alan Cox5756ee92008-02-08 04:18:51 -0800551 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079,
552 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079,
554 0xD079, 0
555};
556
Helge Dellere9422e02006-08-29 21:57:29 +0200557static const unsigned short timedia_quad_port[] = {
Alan Cox5756ee92008-02-08 04:18:51 -0800558 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157,
559 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
561 0xB157, 0
562};
563
Helge Dellere9422e02006-08-29 21:57:29 +0200564static const unsigned short timedia_eight_port[] = {
Alan Cox5756ee92008-02-08 04:18:51 -0800565 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
567};
568
Arjan van de Vencb3592b2005-11-28 21:04:11 +0000569static const struct timedia_struct {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 int num;
Helge Dellere9422e02006-08-29 21:57:29 +0200571 const unsigned short *ids;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572} timedia_data[] = {
573 { 1, timedia_single_port },
574 { 2, timedia_dual_port },
575 { 4, timedia_quad_port },
Helge Dellere9422e02006-08-29 21:57:29 +0200576 { 8, timedia_eight_port }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577};
578
Frédéric Brièreb9b24552011-05-29 15:08:04 -0400579/*
580 * There are nearly 70 different Timedia/SUNIX PCI serial devices. Instead of
581 * listing them individually, this driver merely grabs them all with
582 * PCI_ANY_ID. Some of these devices, however, also feature a parallel port,
583 * and should be left free to be claimed by parport_serial instead.
584 */
585static int pci_timedia_probe(struct pci_dev *dev)
586{
587 /*
588 * Check the third digit of the subdevice ID
589 * (0,2,3,5,6: serial only -- 7,8,9: serial + parallel)
590 */
591 if ((dev->subsystem_device & 0x00f0) >= 0x70) {
592 dev_info(&dev->dev,
593 "ignoring Timedia subdevice %04x for parport_serial\n",
594 dev->subsystem_device);
595 return -ENODEV;
596 }
597
598 return 0;
599}
600
Russell King61a116e2006-07-03 15:22:35 +0100601static int pci_timedia_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602{
Helge Dellere9422e02006-08-29 21:57:29 +0200603 const unsigned short *ids;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 int i, j;
605
Helge Dellere9422e02006-08-29 21:57:29 +0200606 for (i = 0; i < ARRAY_SIZE(timedia_data); i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 ids = timedia_data[i].ids;
608 for (j = 0; ids[j]; j++)
609 if (dev->subsystem_device == ids[j])
610 return timedia_data[i].num;
611 }
612 return 0;
613}
614
615/*
616 * Timedia/SUNIX uses a mixture of BARs and offsets
617 * Ugh, this is ugly as all hell --- TYT
618 */
619static int
Russell King975a1a7d2009-01-02 13:44:27 +0000620pci_timedia_setup(struct serial_private *priv,
621 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100622 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623{
624 unsigned int bar = 0, offset = board->first_offset;
625
626 switch (idx) {
627 case 0:
628 bar = 0;
629 break;
630 case 1:
631 offset = board->uart_offset;
632 bar = 0;
633 break;
634 case 2:
635 bar = 1;
636 break;
637 case 3:
638 offset = board->uart_offset;
Dave Jonesc2cd6d32005-12-07 18:11:26 +0000639 /* FALLTHROUGH */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640 case 4: /* BAR 2 */
641 case 5: /* BAR 3 */
642 case 6: /* BAR 4 */
643 case 7: /* BAR 5 */
644 bar = idx - 2;
645 }
646
Russell King70db3d92005-07-27 11:34:27 +0100647 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648}
649
650/*
651 * Some Titan cards are also a little weird
652 */
653static int
Russell King70db3d92005-07-27 11:34:27 +0100654titan_400l_800l_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000655 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100656 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700657{
658 unsigned int bar, offset = board->first_offset;
659
660 switch (idx) {
661 case 0:
662 bar = 1;
663 break;
664 case 1:
665 bar = 2;
666 break;
667 default:
668 bar = 4;
669 offset = (idx - 2) * board->uart_offset;
670 }
671
Russell King70db3d92005-07-27 11:34:27 +0100672 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673}
674
Russell King61a116e2006-07-03 15:22:35 +0100675static int pci_xircom_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700676{
677 msleep(100);
678 return 0;
679}
680
Will Page04bf7e72009-04-06 17:32:15 +0100681static int pci_ni8420_init(struct pci_dev *dev)
682{
683 void __iomem *p;
684 unsigned long base, len;
685 unsigned int bar = 0;
686
687 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
688 moan_device("no memory in bar", dev);
689 return 0;
690 }
691
692 base = pci_resource_start(dev, bar);
693 len = pci_resource_len(dev, bar);
694 p = ioremap_nocache(base, len);
695 if (p == NULL)
696 return -ENOMEM;
697
698 /* Enable CPU Interrupt */
699 writel(readl(p + NI8420_INT_ENABLE_REG) | NI8420_INT_ENABLE_BIT,
700 p + NI8420_INT_ENABLE_REG);
701
702 iounmap(p);
703 return 0;
704}
705
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100706#define MITE_IOWBSR1_WSIZE 0xa
707#define MITE_IOWBSR1_WIN_OFFSET 0x800
708#define MITE_IOWBSR1_WENAB (1 << 7)
709#define MITE_LCIMR1_IO_IE_0 (1 << 24)
710#define MITE_LCIMR2_SET_CPU_IE (1 << 31)
711#define MITE_IOWCR1_RAMSEL_MASK 0xfffffffe
712
713static int pci_ni8430_init(struct pci_dev *dev)
714{
715 void __iomem *p;
716 unsigned long base, len;
717 u32 device_window;
718 unsigned int bar = 0;
719
720 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
721 moan_device("no memory in bar", dev);
722 return 0;
723 }
724
725 base = pci_resource_start(dev, bar);
726 len = pci_resource_len(dev, bar);
727 p = ioremap_nocache(base, len);
728 if (p == NULL)
729 return -ENOMEM;
730
731 /* Set device window address and size in BAR0 */
732 device_window = ((base + MITE_IOWBSR1_WIN_OFFSET) & 0xffffff00)
733 | MITE_IOWBSR1_WENAB | MITE_IOWBSR1_WSIZE;
734 writel(device_window, p + MITE_IOWBSR1);
735
736 /* Set window access to go to RAMSEL IO address space */
737 writel((readl(p + MITE_IOWCR1) & MITE_IOWCR1_RAMSEL_MASK),
738 p + MITE_IOWCR1);
739
740 /* Enable IO Bus Interrupt 0 */
741 writel(MITE_LCIMR1_IO_IE_0, p + MITE_LCIMR1);
742
743 /* Enable CPU Interrupt */
744 writel(MITE_LCIMR2_SET_CPU_IE, p + MITE_LCIMR2);
745
746 iounmap(p);
747 return 0;
748}
749
750/* UART Port Control Register */
751#define NI8430_PORTCON 0x0f
752#define NI8430_PORTCON_TXVR_ENABLE (1 << 3)
753
754static int
Alan Coxbf538fe2009-04-06 17:35:42 +0100755pci_ni8430_setup(struct serial_private *priv,
756 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100757 struct uart_8250_port *port, int idx)
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100758{
759 void __iomem *p;
760 unsigned long base, len;
761 unsigned int bar, offset = board->first_offset;
762
763 if (idx >= board->num_ports)
764 return 1;
765
766 bar = FL_GET_BASE(board->flags);
767 offset += idx * board->uart_offset;
768
769 base = pci_resource_start(priv->dev, bar);
770 len = pci_resource_len(priv->dev, bar);
771 p = ioremap_nocache(base, len);
772
Joe Perches7c9d4402011-06-23 11:39:20 -0700773 /* enable the transceiver */
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100774 writeb(readb(p + offset + NI8430_PORTCON) | NI8430_PORTCON_TXVR_ENABLE,
775 p + offset + NI8430_PORTCON);
776
777 iounmap(p);
778
779 return setup_port(priv, port, bar, offset, board->reg_shift);
780}
781
Nicos Gollan7808edc2011-05-05 21:00:37 +0200782static int pci_netmos_9900_setup(struct serial_private *priv,
783 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100784 struct uart_8250_port *port, int idx)
Nicos Gollan7808edc2011-05-05 21:00:37 +0200785{
786 unsigned int bar;
787
788 if ((priv->dev->subsystem_device & 0xff00) == 0x3000) {
789 /* netmos apparently orders BARs by datasheet layout, so serial
790 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
791 */
792 bar = 3 * idx;
793
794 return setup_port(priv, port, bar, 0, board->reg_shift);
795 } else {
796 return pci_default_setup(priv, board, port, idx);
797 }
798}
799
800/* the 99xx series comes with a range of device IDs and a variety
801 * of capabilities:
802 *
803 * 9900 has varying capabilities and can cascade to sub-controllers
804 * (cascading should be purely internal)
805 * 9904 is hardwired with 4 serial ports
806 * 9912 and 9922 are hardwired with 2 serial ports
807 */
808static int pci_netmos_9900_numports(struct pci_dev *dev)
809{
810 unsigned int c = dev->class;
811 unsigned int pi;
812 unsigned short sub_serports;
813
814 pi = (c & 0xff);
815
816 if (pi == 2) {
817 return 1;
818 } else if ((pi == 0) &&
819 (dev->device == PCI_DEVICE_ID_NETMOS_9900)) {
820 /* two possibilities: 0x30ps encodes number of parallel and
821 * serial ports, or 0x1000 indicates *something*. This is not
822 * immediately obvious, since the 2s1p+4s configuration seems
823 * to offer all functionality on functions 0..2, while still
824 * advertising the same function 3 as the 4s+2s1p config.
825 */
826 sub_serports = dev->subsystem_device & 0xf;
827 if (sub_serports > 0) {
828 return sub_serports;
829 } else {
830 printk(KERN_NOTICE "NetMos/Mostech serial driver ignoring port on ambiguous config.\n");
831 return 0;
832 }
833 }
834
835 moan_device("unknown NetMos/Mostech program interface", dev);
836 return 0;
837}
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100838
Russell King61a116e2006-07-03 15:22:35 +0100839static int pci_netmos_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840{
841 /* subdevice 0x00PS means <P> parallel, <S> serial */
842 unsigned int num_serial = dev->subsystem_device & 0xf;
843
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -0800844 if ((dev->device == PCI_DEVICE_ID_NETMOS_9901) ||
845 (dev->device == PCI_DEVICE_ID_NETMOS_9865))
Michael Bueschc4285b42009-06-30 11:41:21 -0700846 return 0;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200847
Jiri Slaby25cf9bc2009-01-15 13:30:34 +0000848 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
849 dev->subsystem_device == 0x0299)
850 return 0;
851
Nicos Gollan7808edc2011-05-05 21:00:37 +0200852 switch (dev->device) { /* FALLTHROUGH on all */
853 case PCI_DEVICE_ID_NETMOS_9904:
854 case PCI_DEVICE_ID_NETMOS_9912:
855 case PCI_DEVICE_ID_NETMOS_9922:
856 case PCI_DEVICE_ID_NETMOS_9900:
857 num_serial = pci_netmos_9900_numports(dev);
858 break;
859
860 default:
861 if (num_serial == 0 ) {
862 moan_device("unknown NetMos/Mostech device", dev);
863 }
864 }
865
Linus Torvalds1da177e2005-04-16 15:20:36 -0700866 if (num_serial == 0)
867 return -ENODEV;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200868
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869 return num_serial;
870}
871
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700872/*
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700873 * These chips are available with optionally one parallel port and up to
874 * two serial ports. Unfortunately they all have the same product id.
875 *
876 * Basic configuration is done over a region of 32 I/O ports. The base
877 * ioport is called INTA or INTC, depending on docs/other drivers.
878 *
879 * The region of the 32 I/O ports is configured in POSIO0R...
880 */
881
882/* registers */
883#define ITE_887x_MISCR 0x9c
884#define ITE_887x_INTCBAR 0x78
885#define ITE_887x_UARTBAR 0x7c
886#define ITE_887x_PS0BAR 0x10
887#define ITE_887x_POSIO0 0x60
888
889/* I/O space size */
890#define ITE_887x_IOSIZE 32
891/* I/O space size (bits 26-24; 8 bytes = 011b) */
892#define ITE_887x_POSIO_IOSIZE_8 (3 << 24)
893/* I/O space size (bits 26-24; 32 bytes = 101b) */
894#define ITE_887x_POSIO_IOSIZE_32 (5 << 24)
895/* Decoding speed (1 = slow, 2 = medium, 3 = fast) */
896#define ITE_887x_POSIO_SPEED (3 << 29)
897/* enable IO_Space bit */
898#define ITE_887x_POSIO_ENABLE (1 << 31)
899
Ralf Baechlef79abb82007-08-30 23:56:31 -0700900static int pci_ite887x_init(struct pci_dev *dev)
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700901{
902 /* inta_addr are the configuration addresses of the ITE */
903 static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0,
904 0x200, 0x280, 0 };
905 int ret, i, type;
906 struct resource *iobase = NULL;
907 u32 miscr, uartbar, ioport;
908
909 /* search for the base-ioport */
910 i = 0;
911 while (inta_addr[i] && iobase == NULL) {
912 iobase = request_region(inta_addr[i], ITE_887x_IOSIZE,
913 "ite887x");
914 if (iobase != NULL) {
915 /* write POSIO0R - speed | size | ioport */
916 pci_write_config_dword(dev, ITE_887x_POSIO0,
917 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
918 ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
919 /* write INTCBAR - ioport */
Alan Cox5756ee92008-02-08 04:18:51 -0800920 pci_write_config_dword(dev, ITE_887x_INTCBAR,
921 inta_addr[i]);
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700922 ret = inb(inta_addr[i]);
923 if (ret != 0xff) {
924 /* ioport connected */
925 break;
926 }
927 release_region(iobase->start, ITE_887x_IOSIZE);
928 iobase = NULL;
929 }
930 i++;
931 }
932
933 if (!inta_addr[i]) {
934 printk(KERN_ERR "ite887x: could not find iobase\n");
935 return -ENODEV;
936 }
937
938 /* start of undocumented type checking (see parport_pc.c) */
939 type = inb(iobase->start + 0x18) & 0x0f;
940
941 switch (type) {
942 case 0x2: /* ITE8871 (1P) */
943 case 0xa: /* ITE8875 (1P) */
944 ret = 0;
945 break;
946 case 0xe: /* ITE8872 (2S1P) */
947 ret = 2;
948 break;
949 case 0x6: /* ITE8873 (1S) */
950 ret = 1;
951 break;
952 case 0x8: /* ITE8874 (2S) */
953 ret = 2;
954 break;
955 default:
956 moan_device("Unknown ITE887x", dev);
957 ret = -ENODEV;
958 }
959
960 /* configure all serial ports */
961 for (i = 0; i < ret; i++) {
962 /* read the I/O port from the device */
963 pci_read_config_dword(dev, ITE_887x_PS0BAR + (0x4 * (i + 1)),
964 &ioport);
965 ioport &= 0x0000FF00; /* the actual base address */
966 pci_write_config_dword(dev, ITE_887x_POSIO0 + (0x4 * (i + 1)),
967 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
968 ITE_887x_POSIO_IOSIZE_8 | ioport);
969
970 /* write the ioport to the UARTBAR */
971 pci_read_config_dword(dev, ITE_887x_UARTBAR, &uartbar);
972 uartbar &= ~(0xffff << (16 * i)); /* clear half the reg */
973 uartbar |= (ioport << (16 * i)); /* set the ioport */
974 pci_write_config_dword(dev, ITE_887x_UARTBAR, uartbar);
975
976 /* get current config */
977 pci_read_config_dword(dev, ITE_887x_MISCR, &miscr);
978 /* disable interrupts (UARTx_Routing[3:0]) */
979 miscr &= ~(0xf << (12 - 4 * i));
980 /* activate the UART (UARTx_En) */
981 miscr |= 1 << (23 - i);
982 /* write new config with activated UART */
983 pci_write_config_dword(dev, ITE_887x_MISCR, miscr);
984 }
985
986 if (ret <= 0) {
987 /* the device has no UARTs if we get here */
988 release_region(iobase->start, ITE_887x_IOSIZE);
989 }
990
991 return ret;
992}
993
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500994static void pci_ite887x_exit(struct pci_dev *dev)
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700995{
996 u32 ioport;
997 /* the ioport is bit 0-15 in POSIO0R */
998 pci_read_config_dword(dev, ITE_887x_POSIO0, &ioport);
999 ioport &= 0xffff;
1000 release_region(ioport, ITE_887x_IOSIZE);
1001}
1002
Russell King9f2a0362009-01-02 13:44:20 +00001003/*
1004 * Oxford Semiconductor Inc.
1005 * Check that device is part of the Tornado range of devices, then determine
1006 * the number of ports available on the device.
1007 */
1008static int pci_oxsemi_tornado_init(struct pci_dev *dev)
1009{
1010 u8 __iomem *p;
1011 unsigned long deviceID;
1012 unsigned int number_uarts = 0;
1013
1014 /* OxSemi Tornado devices are all 0xCxxx */
1015 if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
1016 (dev->device & 0xF000) != 0xC000)
1017 return 0;
1018
1019 p = pci_iomap(dev, 0, 5);
1020 if (p == NULL)
1021 return -ENOMEM;
1022
1023 deviceID = ioread32(p);
1024 /* Tornado device */
1025 if (deviceID == 0x07000200) {
1026 number_uarts = ioread8(p + 4);
1027 printk(KERN_DEBUG
1028 "%d ports detected on Oxford PCI Express device\n",
1029 number_uarts);
1030 }
1031 pci_iounmap(dev, p);
1032 return number_uarts;
1033}
1034
Alan Coxeb26dfe2012-07-12 13:00:31 +01001035static int pci_asix_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +00001036 const struct pciserial_board *board,
Alan Coxeb26dfe2012-07-12 13:00:31 +01001037 struct uart_8250_port *port, int idx)
1038{
1039 port->bugs |= UART_BUG_PARITY;
1040 return pci_default_setup(priv, board, port, idx);
1041}
1042
1043static int pci_default_setup(struct serial_private *priv,
Russell King70db3d92005-07-27 11:34:27 +01001044 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001045 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001046{
1047 unsigned int bar, offset = board->first_offset, maxnr;
1048
1049 bar = FL_GET_BASE(board->flags);
1050 if (board->flags & FL_BASE_BARS)
1051 bar += idx;
1052 else
1053 offset += idx * board->uart_offset;
1054
Greg Kroah-Hartman2427ddd2006-06-12 17:07:52 -07001055 maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >>
1056 (board->reg_shift + 3);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001057
1058 if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
1059 return 1;
Alan Cox5756ee92008-02-08 04:18:51 -08001060
Russell King70db3d92005-07-27 11:34:27 +01001061 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001062}
1063
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001064static int
1065ce4100_serial_setup(struct serial_private *priv,
1066 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001067 struct uart_8250_port *port, int idx)
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001068{
1069 int ret;
1070
Maxime Bizon08ec2122012-10-19 10:45:07 +02001071 ret = setup_port(priv, port, idx, 0, board->reg_shift);
Alan Cox2655a2c2012-07-12 12:59:50 +01001072 port->port.iotype = UPIO_MEM32;
1073 port->port.type = PORT_XSCALE;
1074 port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1075 port->port.regshift = 2;
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001076
1077 return ret;
1078}
1079
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001080static int
1081pci_omegapci_setup(struct serial_private *priv,
Alan Cox1798ca12011-05-24 12:35:48 +01001082 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001083 struct uart_8250_port *port, int idx)
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001084{
1085 return setup_port(priv, port, 2, idx * 8, 0);
1086}
1087
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001088static int skip_tx_en_setup(struct serial_private *priv,
1089 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001090 struct uart_8250_port *port, int idx)
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001091{
Alan Cox2655a2c2012-07-12 12:59:50 +01001092 port->port.flags |= UPF_NO_TXEN_TEST;
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001093 printk(KERN_DEBUG "serial8250: skipping TxEn test for device "
1094 "[%04x:%04x] subsystem [%04x:%04x]\n",
1095 priv->dev->vendor,
1096 priv->dev->device,
1097 priv->dev->subsystem_vendor,
1098 priv->dev->subsystem_device);
1099
1100 return pci_default_setup(priv, board, port, idx);
1101}
1102
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -07001103static void kt_handle_break(struct uart_port *p)
1104{
1105 struct uart_8250_port *up =
1106 container_of(p, struct uart_8250_port, port);
1107 /*
1108 * On receipt of a BI, serial device in Intel ME (Intel
1109 * management engine) needs to have its fifos cleared for sane
1110 * SOL (Serial Over Lan) output.
1111 */
1112 serial8250_clear_and_reinit_fifos(up);
1113}
1114
1115static unsigned int kt_serial_in(struct uart_port *p, int offset)
1116{
1117 struct uart_8250_port *up =
1118 container_of(p, struct uart_8250_port, port);
1119 unsigned int val;
1120
1121 /*
1122 * When the Intel ME (management engine) gets reset its serial
1123 * port registers could return 0 momentarily. Functions like
1124 * serial8250_console_write, read and save the IER, perform
1125 * some operation and then restore it. In order to avoid
1126 * setting IER register inadvertently to 0, if the value read
1127 * is 0, double check with ier value in uart_8250_port and use
1128 * that instead. up->ier should be the same value as what is
1129 * currently configured.
1130 */
1131 val = inb(p->iobase + offset);
1132 if (offset == UART_IER) {
1133 if (val == 0)
1134 val = up->ier;
1135 }
1136 return val;
1137}
1138
Dan Williamsbc02d152012-04-06 11:49:50 -07001139static int kt_serial_setup(struct serial_private *priv,
1140 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001141 struct uart_8250_port *port, int idx)
Dan Williamsbc02d152012-04-06 11:49:50 -07001142{
Alan Cox2655a2c2012-07-12 12:59:50 +01001143 port->port.flags |= UPF_BUG_THRE;
1144 port->port.serial_in = kt_serial_in;
1145 port->port.handle_break = kt_handle_break;
Dan Williamsbc02d152012-04-06 11:49:50 -07001146 return skip_tx_en_setup(priv, board, port, idx);
1147}
1148
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001149static int pci_eg20t_init(struct pci_dev *dev)
1150{
1151#if defined(CONFIG_SERIAL_PCH_UART) || defined(CONFIG_SERIAL_PCH_UART_MODULE)
1152 return -ENODEV;
1153#else
1154 return 0;
1155#endif
1156}
1157
Søren Holm06315342011-09-02 22:55:37 +02001158static int
1159pci_xr17c154_setup(struct serial_private *priv,
1160 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001161 struct uart_8250_port *port, int idx)
Søren Holm06315342011-09-02 22:55:37 +02001162{
Alan Cox2655a2c2012-07-12 12:59:50 +01001163 port->port.flags |= UPF_EXAR_EFR;
Søren Holm06315342011-09-02 22:55:37 +02001164 return pci_default_setup(priv, board, port, idx);
1165}
1166
Guainluca Anzolin6971c632012-09-04 15:56:12 +01001167static int
Matt Schultedc96efb2012-11-19 09:12:04 -06001168pci_xr17v35x_setup(struct serial_private *priv,
1169 const struct pciserial_board *board,
1170 struct uart_8250_port *port, int idx)
1171{
1172 u8 __iomem *p;
1173
1174 p = pci_ioremap_bar(priv->dev, 0);
1175
1176 port->port.flags |= UPF_EXAR_EFR;
1177
1178 /*
1179 * Setup Multipurpose Input/Output pins.
1180 */
1181 if (idx == 0) {
1182 writeb(0x00, p + 0x8f); /*MPIOINT[7:0]*/
1183 writeb(0x00, p + 0x90); /*MPIOLVL[7:0]*/
1184 writeb(0x00, p + 0x91); /*MPIO3T[7:0]*/
1185 writeb(0x00, p + 0x92); /*MPIOINV[7:0]*/
1186 writeb(0x00, p + 0x93); /*MPIOSEL[7:0]*/
1187 writeb(0x00, p + 0x94); /*MPIOOD[7:0]*/
1188 writeb(0x00, p + 0x95); /*MPIOINT[15:8]*/
1189 writeb(0x00, p + 0x96); /*MPIOLVL[15:8]*/
1190 writeb(0x00, p + 0x97); /*MPIO3T[15:8]*/
1191 writeb(0x00, p + 0x98); /*MPIOINV[15:8]*/
1192 writeb(0x00, p + 0x99); /*MPIOSEL[15:8]*/
1193 writeb(0x00, p + 0x9a); /*MPIOOD[15:8]*/
1194 }
1195 iounmap(p);
1196
1197 return pci_default_setup(priv, board, port, idx);
1198}
1199
1200static int
Guainluca Anzolin6971c632012-09-04 15:56:12 +01001201pci_wch_ch353_setup(struct serial_private *priv,
1202 const struct pciserial_board *board,
1203 struct uart_8250_port *port, int idx)
1204{
1205 port->port.flags |= UPF_FIXED_TYPE;
1206 port->port.type = PORT_16550A;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001207 return pci_default_setup(priv, board, port, idx);
1208}
1209
Linus Torvalds1da177e2005-04-16 15:20:36 -07001210#define PCI_VENDOR_ID_SBSMODULARIO 0x124B
1211#define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B
1212#define PCI_DEVICE_ID_OCTPRO 0x0001
1213#define PCI_SUBDEVICE_ID_OCTPRO232 0x0108
1214#define PCI_SUBDEVICE_ID_OCTPRO422 0x0208
1215#define PCI_SUBDEVICE_ID_POCTAL232 0x0308
1216#define PCI_SUBDEVICE_ID_POCTAL422 0x0408
Flavio Leitner26e82202012-09-21 21:04:34 -03001217#define PCI_SUBDEVICE_ID_SIIG_DUAL_00 0x2500
1218#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 0x2530
Michael Bramer78d70d42009-01-27 11:51:16 +00001219#define PCI_VENDOR_ID_ADVANTECH 0x13fe
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001220#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66
Michael Bramer78d70d42009-01-27 11:51:16 +00001221#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620
Yegor Yefremov66169ad2010-06-04 09:58:18 +02001222#define PCI_DEVICE_ID_TITAN_200I 0x8028
1223#define PCI_DEVICE_ID_TITAN_400I 0x8048
1224#define PCI_DEVICE_ID_TITAN_800I 0x8088
1225#define PCI_DEVICE_ID_TITAN_800EH 0xA007
1226#define PCI_DEVICE_ID_TITAN_800EHB 0xA008
1227#define PCI_DEVICE_ID_TITAN_400EH 0xA009
1228#define PCI_DEVICE_ID_TITAN_100E 0xA010
1229#define PCI_DEVICE_ID_TITAN_200E 0xA012
1230#define PCI_DEVICE_ID_TITAN_400E 0xA013
1231#define PCI_DEVICE_ID_TITAN_800E 0xA014
1232#define PCI_DEVICE_ID_TITAN_200EI 0xA016
1233#define PCI_DEVICE_ID_TITAN_200EISI 0xA017
Yegor Yefremov1e9deb12011-12-27 15:47:37 +01001234#define PCI_DEVICE_ID_TITAN_400V3 0xA310
1235#define PCI_DEVICE_ID_TITAN_410V3 0xA312
1236#define PCI_DEVICE_ID_TITAN_800V3 0xA314
1237#define PCI_DEVICE_ID_TITAN_800V3B 0xA315
Lytochkin Borise8470032010-07-26 10:02:26 +04001238#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538
Scott Kilauaa273ae2011-05-11 15:41:59 -05001239#define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001240#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001
Dan Williamsbc02d152012-04-06 11:49:50 -07001241#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d
Alan Cox27788c52012-09-04 16:21:06 +01001242#define PCI_VENDOR_ID_WCH 0x4348
1243#define PCI_DEVICE_ID_WCH_CH353_4S 0x3453
1244#define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046
1245#define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053
Alan Cox66835492012-08-16 12:01:33 +01001246#define PCI_VENDOR_ID_AGESTAR 0x5372
1247#define PCI_DEVICE_ID_AGESTAR_9375 0x6872
Alan Coxeb26dfe2012-07-12 13:00:31 +01001248#define PCI_VENDOR_ID_ASIX 0x9710
Linus Torvalds1da177e2005-04-16 15:20:36 -07001249
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001250/* Unknown vendors/cards - this should not be in linux/pci_ids.h */
1251#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
1252
Linus Torvalds1da177e2005-04-16 15:20:36 -07001253/*
1254 * Master list of serial port init/setup/exit quirks.
1255 * This does not describe the general nature of the port.
1256 * (ie, baud base, number and location of ports, etc)
1257 *
1258 * This list is ordered alphabetically by vendor then device.
1259 * Specific entries must come before more generic entries.
1260 */
Sam Ravnborg7a63ce52008-04-28 02:14:02 -07001261static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001262 /*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08001263 * ADDI-DATA GmbH communication cards <info@addi-data.com>
1264 */
1265 {
1266 .vendor = PCI_VENDOR_ID_ADDIDATA_OLD,
1267 .device = PCI_DEVICE_ID_ADDIDATA_APCI7800,
1268 .subvendor = PCI_ANY_ID,
1269 .subdevice = PCI_ANY_ID,
1270 .setup = addidata_apci7800_setup,
1271 },
1272 /*
Russell King61a116e2006-07-03 15:22:35 +01001273 * AFAVLAB cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07001274 * It is not clear whether this applies to all products.
1275 */
1276 {
1277 .vendor = PCI_VENDOR_ID_AFAVLAB,
1278 .device = PCI_ANY_ID,
1279 .subvendor = PCI_ANY_ID,
1280 .subdevice = PCI_ANY_ID,
1281 .setup = afavlab_setup,
1282 },
1283 /*
1284 * HP Diva
1285 */
1286 {
1287 .vendor = PCI_VENDOR_ID_HP,
1288 .device = PCI_DEVICE_ID_HP_DIVA,
1289 .subvendor = PCI_ANY_ID,
1290 .subdevice = PCI_ANY_ID,
1291 .init = pci_hp_diva_init,
1292 .setup = pci_hp_diva_setup,
1293 },
1294 /*
1295 * Intel
1296 */
1297 {
1298 .vendor = PCI_VENDOR_ID_INTEL,
1299 .device = PCI_DEVICE_ID_INTEL_80960_RP,
1300 .subvendor = 0xe4bf,
1301 .subdevice = PCI_ANY_ID,
1302 .init = pci_inteli960ni_init,
1303 .setup = pci_default_setup,
1304 },
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001305 {
1306 .vendor = PCI_VENDOR_ID_INTEL,
1307 .device = PCI_DEVICE_ID_INTEL_8257X_SOL,
1308 .subvendor = PCI_ANY_ID,
1309 .subdevice = PCI_ANY_ID,
1310 .setup = skip_tx_en_setup,
1311 },
1312 {
1313 .vendor = PCI_VENDOR_ID_INTEL,
1314 .device = PCI_DEVICE_ID_INTEL_82573L_SOL,
1315 .subvendor = PCI_ANY_ID,
1316 .subdevice = PCI_ANY_ID,
1317 .setup = skip_tx_en_setup,
1318 },
1319 {
1320 .vendor = PCI_VENDOR_ID_INTEL,
1321 .device = PCI_DEVICE_ID_INTEL_82573E_SOL,
1322 .subvendor = PCI_ANY_ID,
1323 .subdevice = PCI_ANY_ID,
1324 .setup = skip_tx_en_setup,
1325 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001326 {
1327 .vendor = PCI_VENDOR_ID_INTEL,
1328 .device = PCI_DEVICE_ID_INTEL_CE4100_UART,
1329 .subvendor = PCI_ANY_ID,
1330 .subdevice = PCI_ANY_ID,
1331 .setup = ce4100_serial_setup,
1332 },
Dan Williamsbc02d152012-04-06 11:49:50 -07001333 {
1334 .vendor = PCI_VENDOR_ID_INTEL,
1335 .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT,
1336 .subvendor = PCI_ANY_ID,
1337 .subdevice = PCI_ANY_ID,
1338 .setup = kt_serial_setup,
1339 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001340 /*
Niels de Vos84f8c6f2007-08-22 14:01:14 -07001341 * ITE
1342 */
1343 {
1344 .vendor = PCI_VENDOR_ID_ITE,
1345 .device = PCI_DEVICE_ID_ITE_8872,
1346 .subvendor = PCI_ANY_ID,
1347 .subdevice = PCI_ANY_ID,
1348 .init = pci_ite887x_init,
1349 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001350 .exit = pci_ite887x_exit,
Niels de Vos84f8c6f2007-08-22 14:01:14 -07001351 },
1352 /*
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01001353 * National Instruments
1354 */
1355 {
1356 .vendor = PCI_VENDOR_ID_NI,
Will Page04bf7e72009-04-06 17:32:15 +01001357 .device = PCI_DEVICE_ID_NI_PCI23216,
1358 .subvendor = PCI_ANY_ID,
1359 .subdevice = PCI_ANY_ID,
1360 .init = pci_ni8420_init,
1361 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001362 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001363 },
1364 {
1365 .vendor = PCI_VENDOR_ID_NI,
1366 .device = PCI_DEVICE_ID_NI_PCI2328,
1367 .subvendor = PCI_ANY_ID,
1368 .subdevice = PCI_ANY_ID,
1369 .init = pci_ni8420_init,
1370 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001371 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001372 },
1373 {
1374 .vendor = PCI_VENDOR_ID_NI,
1375 .device = PCI_DEVICE_ID_NI_PCI2324,
1376 .subvendor = PCI_ANY_ID,
1377 .subdevice = PCI_ANY_ID,
1378 .init = pci_ni8420_init,
1379 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001380 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001381 },
1382 {
1383 .vendor = PCI_VENDOR_ID_NI,
1384 .device = PCI_DEVICE_ID_NI_PCI2322,
1385 .subvendor = PCI_ANY_ID,
1386 .subdevice = PCI_ANY_ID,
1387 .init = pci_ni8420_init,
1388 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001389 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001390 },
1391 {
1392 .vendor = PCI_VENDOR_ID_NI,
1393 .device = PCI_DEVICE_ID_NI_PCI2324I,
1394 .subvendor = PCI_ANY_ID,
1395 .subdevice = PCI_ANY_ID,
1396 .init = pci_ni8420_init,
1397 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001398 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001399 },
1400 {
1401 .vendor = PCI_VENDOR_ID_NI,
1402 .device = PCI_DEVICE_ID_NI_PCI2322I,
1403 .subvendor = PCI_ANY_ID,
1404 .subdevice = PCI_ANY_ID,
1405 .init = pci_ni8420_init,
1406 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001407 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001408 },
1409 {
1410 .vendor = PCI_VENDOR_ID_NI,
1411 .device = PCI_DEVICE_ID_NI_PXI8420_23216,
1412 .subvendor = PCI_ANY_ID,
1413 .subdevice = PCI_ANY_ID,
1414 .init = pci_ni8420_init,
1415 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001416 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001417 },
1418 {
1419 .vendor = PCI_VENDOR_ID_NI,
1420 .device = PCI_DEVICE_ID_NI_PXI8420_2328,
1421 .subvendor = PCI_ANY_ID,
1422 .subdevice = PCI_ANY_ID,
1423 .init = pci_ni8420_init,
1424 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001425 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001426 },
1427 {
1428 .vendor = PCI_VENDOR_ID_NI,
1429 .device = PCI_DEVICE_ID_NI_PXI8420_2324,
1430 .subvendor = PCI_ANY_ID,
1431 .subdevice = PCI_ANY_ID,
1432 .init = pci_ni8420_init,
1433 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001434 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001435 },
1436 {
1437 .vendor = PCI_VENDOR_ID_NI,
1438 .device = PCI_DEVICE_ID_NI_PXI8420_2322,
1439 .subvendor = PCI_ANY_ID,
1440 .subdevice = PCI_ANY_ID,
1441 .init = pci_ni8420_init,
1442 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001443 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001444 },
1445 {
1446 .vendor = PCI_VENDOR_ID_NI,
1447 .device = PCI_DEVICE_ID_NI_PXI8422_2324,
1448 .subvendor = PCI_ANY_ID,
1449 .subdevice = PCI_ANY_ID,
1450 .init = pci_ni8420_init,
1451 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001452 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001453 },
1454 {
1455 .vendor = PCI_VENDOR_ID_NI,
1456 .device = PCI_DEVICE_ID_NI_PXI8422_2322,
1457 .subvendor = PCI_ANY_ID,
1458 .subdevice = PCI_ANY_ID,
1459 .init = pci_ni8420_init,
1460 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001461 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001462 },
1463 {
1464 .vendor = PCI_VENDOR_ID_NI,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01001465 .device = PCI_ANY_ID,
1466 .subvendor = PCI_ANY_ID,
1467 .subdevice = PCI_ANY_ID,
1468 .init = pci_ni8430_init,
1469 .setup = pci_ni8430_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001470 .exit = pci_ni8430_exit,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01001471 },
1472 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07001473 * Panacom
1474 */
1475 {
1476 .vendor = PCI_VENDOR_ID_PANACOM,
1477 .device = PCI_DEVICE_ID_PANACOM_QUADMODEM,
1478 .subvendor = PCI_ANY_ID,
1479 .subdevice = PCI_ANY_ID,
1480 .init = pci_plx9050_init,
1481 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001482 .exit = pci_plx9050_exit,
Alan Cox5756ee92008-02-08 04:18:51 -08001483 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001484 {
1485 .vendor = PCI_VENDOR_ID_PANACOM,
1486 .device = PCI_DEVICE_ID_PANACOM_DUALMODEM,
1487 .subvendor = PCI_ANY_ID,
1488 .subdevice = PCI_ANY_ID,
1489 .init = pci_plx9050_init,
1490 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001491 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001492 },
1493 /*
1494 * PLX
1495 */
1496 {
1497 .vendor = PCI_VENDOR_ID_PLX,
Thomas Hoehn48212002007-02-10 01:46:05 -08001498 .device = PCI_DEVICE_ID_PLX_9030,
1499 .subvendor = PCI_SUBVENDOR_ID_PERLE,
1500 .subdevice = PCI_ANY_ID,
1501 .setup = pci_default_setup,
1502 },
1503 {
1504 .vendor = PCI_VENDOR_ID_PLX,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001505 .device = PCI_DEVICE_ID_PLX_9050,
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01001506 .subvendor = PCI_SUBVENDOR_ID_EXSYS,
1507 .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055,
1508 .init = pci_plx9050_init,
1509 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001510 .exit = pci_plx9050_exit,
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01001511 },
1512 {
1513 .vendor = PCI_VENDOR_ID_PLX,
1514 .device = PCI_DEVICE_ID_PLX_9050,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001515 .subvendor = PCI_SUBVENDOR_ID_KEYSPAN,
1516 .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2,
1517 .init = pci_plx9050_init,
1518 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001519 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001520 },
1521 {
1522 .vendor = PCI_VENDOR_ID_PLX,
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001523 .device = PCI_DEVICE_ID_PLX_9050,
1524 .subvendor = PCI_VENDOR_ID_PLX,
1525 .subdevice = PCI_SUBDEVICE_ID_UNKNOWN_0x1584,
1526 .init = pci_plx9050_init,
1527 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001528 .exit = pci_plx9050_exit,
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001529 },
1530 {
1531 .vendor = PCI_VENDOR_ID_PLX,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001532 .device = PCI_DEVICE_ID_PLX_ROMULUS,
1533 .subvendor = PCI_VENDOR_ID_PLX,
1534 .subdevice = PCI_DEVICE_ID_PLX_ROMULUS,
1535 .init = pci_plx9050_init,
1536 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001537 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001538 },
1539 /*
1540 * SBS Technologies, Inc., PMC-OCTALPRO 232
1541 */
1542 {
1543 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
1544 .device = PCI_DEVICE_ID_OCTPRO,
1545 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
1546 .subdevice = PCI_SUBDEVICE_ID_OCTPRO232,
1547 .init = sbs_init,
1548 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001549 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001550 },
1551 /*
1552 * SBS Technologies, Inc., PMC-OCTALPRO 422
1553 */
1554 {
1555 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
1556 .device = PCI_DEVICE_ID_OCTPRO,
1557 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
1558 .subdevice = PCI_SUBDEVICE_ID_OCTPRO422,
1559 .init = sbs_init,
1560 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001561 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001562 },
1563 /*
1564 * SBS Technologies, Inc., P-Octal 232
1565 */
1566 {
1567 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
1568 .device = PCI_DEVICE_ID_OCTPRO,
1569 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
1570 .subdevice = PCI_SUBDEVICE_ID_POCTAL232,
1571 .init = sbs_init,
1572 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001573 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001574 },
1575 /*
1576 * SBS Technologies, Inc., P-Octal 422
1577 */
1578 {
1579 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
1580 .device = PCI_DEVICE_ID_OCTPRO,
1581 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
1582 .subdevice = PCI_SUBDEVICE_ID_POCTAL422,
1583 .init = sbs_init,
1584 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001585 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001586 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001587 /*
Russell King61a116e2006-07-03 15:22:35 +01001588 * SIIG cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07001589 */
1590 {
1591 .vendor = PCI_VENDOR_ID_SIIG,
Russell King67d74b82005-07-27 11:33:03 +01001592 .device = PCI_ANY_ID,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001593 .subvendor = PCI_ANY_ID,
1594 .subdevice = PCI_ANY_ID,
Russell King67d74b82005-07-27 11:33:03 +01001595 .init = pci_siig_init,
Andrey Panin3ec9c592006-02-02 20:15:09 +00001596 .setup = pci_siig_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001597 },
1598 /*
1599 * Titan cards
1600 */
1601 {
1602 .vendor = PCI_VENDOR_ID_TITAN,
1603 .device = PCI_DEVICE_ID_TITAN_400L,
1604 .subvendor = PCI_ANY_ID,
1605 .subdevice = PCI_ANY_ID,
1606 .setup = titan_400l_800l_setup,
1607 },
1608 {
1609 .vendor = PCI_VENDOR_ID_TITAN,
1610 .device = PCI_DEVICE_ID_TITAN_800L,
1611 .subvendor = PCI_ANY_ID,
1612 .subdevice = PCI_ANY_ID,
1613 .setup = titan_400l_800l_setup,
1614 },
1615 /*
1616 * Timedia cards
1617 */
1618 {
1619 .vendor = PCI_VENDOR_ID_TIMEDIA,
1620 .device = PCI_DEVICE_ID_TIMEDIA_1889,
1621 .subvendor = PCI_VENDOR_ID_TIMEDIA,
1622 .subdevice = PCI_ANY_ID,
Frédéric Brièreb9b24552011-05-29 15:08:04 -04001623 .probe = pci_timedia_probe,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001624 .init = pci_timedia_init,
1625 .setup = pci_timedia_setup,
1626 },
1627 {
1628 .vendor = PCI_VENDOR_ID_TIMEDIA,
1629 .device = PCI_ANY_ID,
1630 .subvendor = PCI_ANY_ID,
1631 .subdevice = PCI_ANY_ID,
1632 .setup = pci_timedia_setup,
1633 },
1634 /*
Søren Holm06315342011-09-02 22:55:37 +02001635 * Exar cards
1636 */
1637 {
1638 .vendor = PCI_VENDOR_ID_EXAR,
1639 .device = PCI_DEVICE_ID_EXAR_XR17C152,
1640 .subvendor = PCI_ANY_ID,
1641 .subdevice = PCI_ANY_ID,
1642 .setup = pci_xr17c154_setup,
1643 },
1644 {
1645 .vendor = PCI_VENDOR_ID_EXAR,
1646 .device = PCI_DEVICE_ID_EXAR_XR17C154,
1647 .subvendor = PCI_ANY_ID,
1648 .subdevice = PCI_ANY_ID,
1649 .setup = pci_xr17c154_setup,
1650 },
1651 {
1652 .vendor = PCI_VENDOR_ID_EXAR,
1653 .device = PCI_DEVICE_ID_EXAR_XR17C158,
1654 .subvendor = PCI_ANY_ID,
1655 .subdevice = PCI_ANY_ID,
1656 .setup = pci_xr17c154_setup,
1657 },
Matt Schultedc96efb2012-11-19 09:12:04 -06001658 {
1659 .vendor = PCI_VENDOR_ID_EXAR,
1660 .device = PCI_DEVICE_ID_EXAR_XR17V352,
1661 .subvendor = PCI_ANY_ID,
1662 .subdevice = PCI_ANY_ID,
1663 .setup = pci_xr17v35x_setup,
1664 },
1665 {
1666 .vendor = PCI_VENDOR_ID_EXAR,
1667 .device = PCI_DEVICE_ID_EXAR_XR17V354,
1668 .subvendor = PCI_ANY_ID,
1669 .subdevice = PCI_ANY_ID,
1670 .setup = pci_xr17v35x_setup,
1671 },
1672 {
1673 .vendor = PCI_VENDOR_ID_EXAR,
1674 .device = PCI_DEVICE_ID_EXAR_XR17V358,
1675 .subvendor = PCI_ANY_ID,
1676 .subdevice = PCI_ANY_ID,
1677 .setup = pci_xr17v35x_setup,
1678 },
Søren Holm06315342011-09-02 22:55:37 +02001679 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07001680 * Xircom cards
1681 */
1682 {
1683 .vendor = PCI_VENDOR_ID_XIRCOM,
1684 .device = PCI_DEVICE_ID_XIRCOM_X3201_MDM,
1685 .subvendor = PCI_ANY_ID,
1686 .subdevice = PCI_ANY_ID,
1687 .init = pci_xircom_init,
1688 .setup = pci_default_setup,
1689 },
1690 /*
Russell King61a116e2006-07-03 15:22:35 +01001691 * Netmos cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07001692 */
1693 {
1694 .vendor = PCI_VENDOR_ID_NETMOS,
1695 .device = PCI_ANY_ID,
1696 .subvendor = PCI_ANY_ID,
1697 .subdevice = PCI_ANY_ID,
1698 .init = pci_netmos_init,
Nicos Gollan7808edc2011-05-05 21:00:37 +02001699 .setup = pci_netmos_9900_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001700 },
1701 /*
Scott Kilauaa273ae2011-05-11 15:41:59 -05001702 * For Oxford Semiconductor Tornado based devices
Russell King9f2a0362009-01-02 13:44:20 +00001703 */
1704 {
1705 .vendor = PCI_VENDOR_ID_OXSEMI,
1706 .device = PCI_ANY_ID,
1707 .subvendor = PCI_ANY_ID,
1708 .subdevice = PCI_ANY_ID,
1709 .init = pci_oxsemi_tornado_init,
1710 .setup = pci_default_setup,
1711 },
1712 {
1713 .vendor = PCI_VENDOR_ID_MAINPINE,
1714 .device = PCI_ANY_ID,
1715 .subvendor = PCI_ANY_ID,
1716 .subdevice = PCI_ANY_ID,
1717 .init = pci_oxsemi_tornado_init,
1718 .setup = pci_default_setup,
1719 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05001720 {
1721 .vendor = PCI_VENDOR_ID_DIGI,
1722 .device = PCIE_DEVICE_ID_NEO_2_OX_IBM,
1723 .subvendor = PCI_SUBVENDOR_ID_IBM,
1724 .subdevice = PCI_ANY_ID,
1725 .init = pci_oxsemi_tornado_init,
1726 .setup = pci_default_setup,
1727 },
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001728 {
1729 .vendor = PCI_VENDOR_ID_INTEL,
1730 .device = 0x8811,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001731 .subvendor = PCI_ANY_ID,
1732 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001733 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001734 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001735 },
1736 {
1737 .vendor = PCI_VENDOR_ID_INTEL,
1738 .device = 0x8812,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001739 .subvendor = PCI_ANY_ID,
1740 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001741 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001742 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001743 },
1744 {
1745 .vendor = PCI_VENDOR_ID_INTEL,
1746 .device = 0x8813,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001747 .subvendor = PCI_ANY_ID,
1748 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001749 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001750 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001751 },
1752 {
1753 .vendor = PCI_VENDOR_ID_INTEL,
1754 .device = 0x8814,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001755 .subvendor = PCI_ANY_ID,
1756 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001757 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001758 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001759 },
1760 {
1761 .vendor = 0x10DB,
1762 .device = 0x8027,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001763 .subvendor = PCI_ANY_ID,
1764 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001765 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001766 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001767 },
1768 {
1769 .vendor = 0x10DB,
1770 .device = 0x8028,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001771 .subvendor = PCI_ANY_ID,
1772 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001773 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001774 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001775 },
1776 {
1777 .vendor = 0x10DB,
1778 .device = 0x8029,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001779 .subvendor = PCI_ANY_ID,
1780 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001781 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001782 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001783 },
1784 {
1785 .vendor = 0x10DB,
1786 .device = 0x800C,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001787 .subvendor = PCI_ANY_ID,
1788 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001789 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001790 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001791 },
1792 {
1793 .vendor = 0x10DB,
1794 .device = 0x800D,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02001795 .subvendor = PCI_ANY_ID,
1796 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001797 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09001798 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001799 },
Russell King9f2a0362009-01-02 13:44:20 +00001800 /*
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001801 * Cronyx Omega PCI (PLX-chip based)
1802 */
1803 {
1804 .vendor = PCI_VENDOR_ID_PLX,
1805 .device = PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
1806 .subvendor = PCI_ANY_ID,
1807 .subdevice = PCI_ANY_ID,
1808 .setup = pci_omegapci_setup,
Alan Coxeb26dfe2012-07-12 13:00:31 +01001809 },
Guainluca Anzolin6971c632012-09-04 15:56:12 +01001810 /* WCH CH353 2S1P card (16550 clone) */
1811 {
Alan Cox27788c52012-09-04 16:21:06 +01001812 .vendor = PCI_VENDOR_ID_WCH,
1813 .device = PCI_DEVICE_ID_WCH_CH353_2S1P,
1814 .subvendor = PCI_ANY_ID,
1815 .subdevice = PCI_ANY_ID,
1816 .setup = pci_wch_ch353_setup,
1817 },
1818 /* WCH CH353 4S card (16550 clone) */
1819 {
1820 .vendor = PCI_VENDOR_ID_WCH,
1821 .device = PCI_DEVICE_ID_WCH_CH353_4S,
1822 .subvendor = PCI_ANY_ID,
1823 .subdevice = PCI_ANY_ID,
1824 .setup = pci_wch_ch353_setup,
1825 },
1826 /* WCH CH353 2S1PF card (16550 clone) */
1827 {
1828 .vendor = PCI_VENDOR_ID_WCH,
1829 .device = PCI_DEVICE_ID_WCH_CH353_2S1PF,
1830 .subvendor = PCI_ANY_ID,
1831 .subdevice = PCI_ANY_ID,
Guainluca Anzolin6971c632012-09-04 15:56:12 +01001832 .setup = pci_wch_ch353_setup,
1833 },
Alan Coxeb26dfe2012-07-12 13:00:31 +01001834 /*
1835 * ASIX devices with FIFO bug
1836 */
1837 {
1838 .vendor = PCI_VENDOR_ID_ASIX,
1839 .device = PCI_ANY_ID,
1840 .subvendor = PCI_ANY_ID,
1841 .subdevice = PCI_ANY_ID,
1842 .setup = pci_asix_setup,
1843 },
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001844 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07001845 * Default "match everything" terminator entry
1846 */
1847 {
1848 .vendor = PCI_ANY_ID,
1849 .device = PCI_ANY_ID,
1850 .subvendor = PCI_ANY_ID,
1851 .subdevice = PCI_ANY_ID,
1852 .setup = pci_default_setup,
1853 }
1854};
1855
1856static inline int quirk_id_matches(u32 quirk_id, u32 dev_id)
1857{
1858 return quirk_id == PCI_ANY_ID || quirk_id == dev_id;
1859}
1860
1861static struct pci_serial_quirk *find_quirk(struct pci_dev *dev)
1862{
1863 struct pci_serial_quirk *quirk;
1864
1865 for (quirk = pci_serial_quirks; ; quirk++)
1866 if (quirk_id_matches(quirk->vendor, dev->vendor) &&
1867 quirk_id_matches(quirk->device, dev->device) &&
1868 quirk_id_matches(quirk->subvendor, dev->subsystem_vendor) &&
1869 quirk_id_matches(quirk->subdevice, dev->subsystem_device))
Alan Cox5756ee92008-02-08 04:18:51 -08001870 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001871 return quirk;
1872}
1873
Andrew Mortondd68e882006-01-05 10:55:26 +00001874static inline int get_pci_irq(struct pci_dev *dev,
Russell King975a1a7d2009-01-02 13:44:27 +00001875 const struct pciserial_board *board)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001876{
1877 if (board->flags & FL_NOIRQ)
1878 return 0;
1879 else
1880 return dev->irq;
1881}
1882
1883/*
1884 * This is the configuration table for all of the PCI serial boards
1885 * which we support. It is directly indexed by the pci_board_num_t enum
1886 * value, which is encoded in the pci_device_id PCI probe table's
1887 * driver_data member.
1888 *
1889 * The makeup of these names are:
Gareth Howlett26e92862006-01-04 17:00:42 +00001890 * pbn_bn{_bt}_n_baud{_offsetinhex}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001891 *
Gareth Howlett26e92862006-01-04 17:00:42 +00001892 * bn = PCI BAR number
1893 * bt = Index using PCI BARs
1894 * n = number of serial ports
1895 * baud = baud rate
1896 * offsetinhex = offset for each sequential port (in hex)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001897 *
Gareth Howlett26e92862006-01-04 17:00:42 +00001898 * This table is sorted by (in order): bn, bt, baud, offsetindex, n.
Russell Kingf1690f32005-05-06 10:19:09 +01001899 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07001900 * Please note: in theory if n = 1, _bt infix should make no difference.
1901 * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200
1902 */
1903enum pci_board_num_t {
1904 pbn_default = 0,
1905
1906 pbn_b0_1_115200,
1907 pbn_b0_2_115200,
1908 pbn_b0_4_115200,
1909 pbn_b0_5_115200,
Alan Coxbf0df632007-10-16 01:24:00 -07001910 pbn_b0_8_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001911
1912 pbn_b0_1_921600,
1913 pbn_b0_2_921600,
1914 pbn_b0_4_921600,
1915
David Ransondb1de152005-07-27 11:43:55 -07001916 pbn_b0_2_1130000,
1917
Andrey Paninfbc0dc02005-07-18 11:38:09 +01001918 pbn_b0_4_1152000,
1919
Gareth Howlett26e92862006-01-04 17:00:42 +00001920 pbn_b0_2_1843200,
1921 pbn_b0_4_1843200,
1922
1923 pbn_b0_2_1843200_200,
1924 pbn_b0_4_1843200_200,
1925 pbn_b0_8_1843200_200,
1926
Lee Howard7106b4e2008-10-21 13:48:58 +01001927 pbn_b0_1_4000000,
1928
Linus Torvalds1da177e2005-04-16 15:20:36 -07001929 pbn_b0_bt_1_115200,
1930 pbn_b0_bt_2_115200,
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08001931 pbn_b0_bt_4_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001932 pbn_b0_bt_8_115200,
1933
1934 pbn_b0_bt_1_460800,
1935 pbn_b0_bt_2_460800,
1936 pbn_b0_bt_4_460800,
1937
1938 pbn_b0_bt_1_921600,
1939 pbn_b0_bt_2_921600,
1940 pbn_b0_bt_4_921600,
1941 pbn_b0_bt_8_921600,
1942
1943 pbn_b1_1_115200,
1944 pbn_b1_2_115200,
1945 pbn_b1_4_115200,
1946 pbn_b1_8_115200,
Will Page04bf7e72009-04-06 17:32:15 +01001947 pbn_b1_16_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001948
1949 pbn_b1_1_921600,
1950 pbn_b1_2_921600,
1951 pbn_b1_4_921600,
1952 pbn_b1_8_921600,
1953
Gareth Howlett26e92862006-01-04 17:00:42 +00001954 pbn_b1_2_1250000,
1955
Niels de Vos84f8c6f2007-08-22 14:01:14 -07001956 pbn_b1_bt_1_115200,
Will Page04bf7e72009-04-06 17:32:15 +01001957 pbn_b1_bt_2_115200,
1958 pbn_b1_bt_4_115200,
1959
Linus Torvalds1da177e2005-04-16 15:20:36 -07001960 pbn_b1_bt_2_921600,
1961
1962 pbn_b1_1_1382400,
1963 pbn_b1_2_1382400,
1964 pbn_b1_4_1382400,
1965 pbn_b1_8_1382400,
1966
1967 pbn_b2_1_115200,
Peter Horton737c1752006-08-26 09:07:36 +01001968 pbn_b2_2_115200,
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08001969 pbn_b2_4_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001970 pbn_b2_8_115200,
1971
1972 pbn_b2_1_460800,
1973 pbn_b2_4_460800,
1974 pbn_b2_8_460800,
1975 pbn_b2_16_460800,
1976
1977 pbn_b2_1_921600,
1978 pbn_b2_4_921600,
1979 pbn_b2_8_921600,
1980
Lytochkin Borise8470032010-07-26 10:02:26 +04001981 pbn_b2_8_1152000,
1982
Linus Torvalds1da177e2005-04-16 15:20:36 -07001983 pbn_b2_bt_1_115200,
1984 pbn_b2_bt_2_115200,
1985 pbn_b2_bt_4_115200,
1986
1987 pbn_b2_bt_2_921600,
1988 pbn_b2_bt_4_921600,
1989
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00001990 pbn_b3_2_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001991 pbn_b3_4_115200,
1992 pbn_b3_8_115200,
1993
Yegor Yefremov66169ad2010-06-04 09:58:18 +02001994 pbn_b4_bt_2_921600,
1995 pbn_b4_bt_4_921600,
1996 pbn_b4_bt_8_921600,
1997
Linus Torvalds1da177e2005-04-16 15:20:36 -07001998 /*
1999 * Board-specific versions.
2000 */
2001 pbn_panacom,
2002 pbn_panacom2,
2003 pbn_panacom4,
2004 pbn_plx_romulus,
2005 pbn_oxsemi,
Lee Howard7106b4e2008-10-21 13:48:58 +01002006 pbn_oxsemi_1_4000000,
2007 pbn_oxsemi_2_4000000,
2008 pbn_oxsemi_4_4000000,
2009 pbn_oxsemi_8_4000000,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002010 pbn_intel_i960,
2011 pbn_sgi_ioc3,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002012 pbn_computone_4,
2013 pbn_computone_6,
2014 pbn_computone_8,
2015 pbn_sbsxrsio,
2016 pbn_exar_XR17C152,
2017 pbn_exar_XR17C154,
2018 pbn_exar_XR17C158,
Matt Schultedc96efb2012-11-19 09:12:04 -06002019 pbn_exar_XR17V352,
2020 pbn_exar_XR17V354,
2021 pbn_exar_XR17V358,
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07002022 pbn_exar_ibm_saturn,
Olof Johanssonaa798502007-08-22 14:01:55 -07002023 pbn_pasemi_1682M,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002024 pbn_ni8430_2,
2025 pbn_ni8430_4,
2026 pbn_ni8430_8,
2027 pbn_ni8430_16,
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07002028 pbn_ADDIDATA_PCIe_1_3906250,
2029 pbn_ADDIDATA_PCIe_2_3906250,
2030 pbn_ADDIDATA_PCIe_4_3906250,
2031 pbn_ADDIDATA_PCIe_8_3906250,
Dirk Brandewie095e24b2010-11-17 07:35:20 -08002032 pbn_ce4100_1_115200,
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002033 pbn_omegapci,
Nicos Gollan7808edc2011-05-05 21:00:37 +02002034 pbn_NETMOS9900_2s_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002035};
2036
2037/*
2038 * uart_offset - the space between channels
2039 * reg_shift - describes how the UART registers are mapped
2040 * to PCI memory by the card.
2041 * For example IER register on SBS, Inc. PMC-OctPro is located at
2042 * offset 0x10 from the UART base, while UART_IER is defined as 1
2043 * in include/linux/serial_reg.h,
2044 * see first lines of serial_in() and serial_out() in 8250.c
2045*/
2046
Bill Pembertonde88b342012-11-19 13:24:32 -05002047static struct pciserial_board pci_boards[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002048 [pbn_default] = {
2049 .flags = FL_BASE0,
2050 .num_ports = 1,
2051 .base_baud = 115200,
2052 .uart_offset = 8,
2053 },
2054 [pbn_b0_1_115200] = {
2055 .flags = FL_BASE0,
2056 .num_ports = 1,
2057 .base_baud = 115200,
2058 .uart_offset = 8,
2059 },
2060 [pbn_b0_2_115200] = {
2061 .flags = FL_BASE0,
2062 .num_ports = 2,
2063 .base_baud = 115200,
2064 .uart_offset = 8,
2065 },
2066 [pbn_b0_4_115200] = {
2067 .flags = FL_BASE0,
2068 .num_ports = 4,
2069 .base_baud = 115200,
2070 .uart_offset = 8,
2071 },
2072 [pbn_b0_5_115200] = {
2073 .flags = FL_BASE0,
2074 .num_ports = 5,
2075 .base_baud = 115200,
2076 .uart_offset = 8,
2077 },
Alan Coxbf0df632007-10-16 01:24:00 -07002078 [pbn_b0_8_115200] = {
2079 .flags = FL_BASE0,
2080 .num_ports = 8,
2081 .base_baud = 115200,
2082 .uart_offset = 8,
2083 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002084 [pbn_b0_1_921600] = {
2085 .flags = FL_BASE0,
2086 .num_ports = 1,
2087 .base_baud = 921600,
2088 .uart_offset = 8,
2089 },
2090 [pbn_b0_2_921600] = {
2091 .flags = FL_BASE0,
2092 .num_ports = 2,
2093 .base_baud = 921600,
2094 .uart_offset = 8,
2095 },
2096 [pbn_b0_4_921600] = {
2097 .flags = FL_BASE0,
2098 .num_ports = 4,
2099 .base_baud = 921600,
2100 .uart_offset = 8,
2101 },
David Ransondb1de152005-07-27 11:43:55 -07002102
2103 [pbn_b0_2_1130000] = {
2104 .flags = FL_BASE0,
2105 .num_ports = 2,
2106 .base_baud = 1130000,
2107 .uart_offset = 8,
2108 },
2109
Andrey Paninfbc0dc02005-07-18 11:38:09 +01002110 [pbn_b0_4_1152000] = {
2111 .flags = FL_BASE0,
2112 .num_ports = 4,
2113 .base_baud = 1152000,
2114 .uart_offset = 8,
2115 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002116
Gareth Howlett26e92862006-01-04 17:00:42 +00002117 [pbn_b0_2_1843200] = {
2118 .flags = FL_BASE0,
2119 .num_ports = 2,
2120 .base_baud = 1843200,
2121 .uart_offset = 8,
2122 },
2123 [pbn_b0_4_1843200] = {
2124 .flags = FL_BASE0,
2125 .num_ports = 4,
2126 .base_baud = 1843200,
2127 .uart_offset = 8,
2128 },
2129
2130 [pbn_b0_2_1843200_200] = {
2131 .flags = FL_BASE0,
2132 .num_ports = 2,
2133 .base_baud = 1843200,
2134 .uart_offset = 0x200,
2135 },
2136 [pbn_b0_4_1843200_200] = {
2137 .flags = FL_BASE0,
2138 .num_ports = 4,
2139 .base_baud = 1843200,
2140 .uart_offset = 0x200,
2141 },
2142 [pbn_b0_8_1843200_200] = {
2143 .flags = FL_BASE0,
2144 .num_ports = 8,
2145 .base_baud = 1843200,
2146 .uart_offset = 0x200,
2147 },
Lee Howard7106b4e2008-10-21 13:48:58 +01002148 [pbn_b0_1_4000000] = {
2149 .flags = FL_BASE0,
2150 .num_ports = 1,
2151 .base_baud = 4000000,
2152 .uart_offset = 8,
2153 },
Gareth Howlett26e92862006-01-04 17:00:42 +00002154
Linus Torvalds1da177e2005-04-16 15:20:36 -07002155 [pbn_b0_bt_1_115200] = {
2156 .flags = FL_BASE0|FL_BASE_BARS,
2157 .num_ports = 1,
2158 .base_baud = 115200,
2159 .uart_offset = 8,
2160 },
2161 [pbn_b0_bt_2_115200] = {
2162 .flags = FL_BASE0|FL_BASE_BARS,
2163 .num_ports = 2,
2164 .base_baud = 115200,
2165 .uart_offset = 8,
2166 },
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08002167 [pbn_b0_bt_4_115200] = {
2168 .flags = FL_BASE0|FL_BASE_BARS,
2169 .num_ports = 4,
2170 .base_baud = 115200,
2171 .uart_offset = 8,
2172 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002173 [pbn_b0_bt_8_115200] = {
2174 .flags = FL_BASE0|FL_BASE_BARS,
2175 .num_ports = 8,
2176 .base_baud = 115200,
2177 .uart_offset = 8,
2178 },
2179
2180 [pbn_b0_bt_1_460800] = {
2181 .flags = FL_BASE0|FL_BASE_BARS,
2182 .num_ports = 1,
2183 .base_baud = 460800,
2184 .uart_offset = 8,
2185 },
2186 [pbn_b0_bt_2_460800] = {
2187 .flags = FL_BASE0|FL_BASE_BARS,
2188 .num_ports = 2,
2189 .base_baud = 460800,
2190 .uart_offset = 8,
2191 },
2192 [pbn_b0_bt_4_460800] = {
2193 .flags = FL_BASE0|FL_BASE_BARS,
2194 .num_ports = 4,
2195 .base_baud = 460800,
2196 .uart_offset = 8,
2197 },
2198
2199 [pbn_b0_bt_1_921600] = {
2200 .flags = FL_BASE0|FL_BASE_BARS,
2201 .num_ports = 1,
2202 .base_baud = 921600,
2203 .uart_offset = 8,
2204 },
2205 [pbn_b0_bt_2_921600] = {
2206 .flags = FL_BASE0|FL_BASE_BARS,
2207 .num_ports = 2,
2208 .base_baud = 921600,
2209 .uart_offset = 8,
2210 },
2211 [pbn_b0_bt_4_921600] = {
2212 .flags = FL_BASE0|FL_BASE_BARS,
2213 .num_ports = 4,
2214 .base_baud = 921600,
2215 .uart_offset = 8,
2216 },
2217 [pbn_b0_bt_8_921600] = {
2218 .flags = FL_BASE0|FL_BASE_BARS,
2219 .num_ports = 8,
2220 .base_baud = 921600,
2221 .uart_offset = 8,
2222 },
2223
2224 [pbn_b1_1_115200] = {
2225 .flags = FL_BASE1,
2226 .num_ports = 1,
2227 .base_baud = 115200,
2228 .uart_offset = 8,
2229 },
2230 [pbn_b1_2_115200] = {
2231 .flags = FL_BASE1,
2232 .num_ports = 2,
2233 .base_baud = 115200,
2234 .uart_offset = 8,
2235 },
2236 [pbn_b1_4_115200] = {
2237 .flags = FL_BASE1,
2238 .num_ports = 4,
2239 .base_baud = 115200,
2240 .uart_offset = 8,
2241 },
2242 [pbn_b1_8_115200] = {
2243 .flags = FL_BASE1,
2244 .num_ports = 8,
2245 .base_baud = 115200,
2246 .uart_offset = 8,
2247 },
Will Page04bf7e72009-04-06 17:32:15 +01002248 [pbn_b1_16_115200] = {
2249 .flags = FL_BASE1,
2250 .num_ports = 16,
2251 .base_baud = 115200,
2252 .uart_offset = 8,
2253 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002254
2255 [pbn_b1_1_921600] = {
2256 .flags = FL_BASE1,
2257 .num_ports = 1,
2258 .base_baud = 921600,
2259 .uart_offset = 8,
2260 },
2261 [pbn_b1_2_921600] = {
2262 .flags = FL_BASE1,
2263 .num_ports = 2,
2264 .base_baud = 921600,
2265 .uart_offset = 8,
2266 },
2267 [pbn_b1_4_921600] = {
2268 .flags = FL_BASE1,
2269 .num_ports = 4,
2270 .base_baud = 921600,
2271 .uart_offset = 8,
2272 },
2273 [pbn_b1_8_921600] = {
2274 .flags = FL_BASE1,
2275 .num_ports = 8,
2276 .base_baud = 921600,
2277 .uart_offset = 8,
2278 },
Gareth Howlett26e92862006-01-04 17:00:42 +00002279 [pbn_b1_2_1250000] = {
2280 .flags = FL_BASE1,
2281 .num_ports = 2,
2282 .base_baud = 1250000,
2283 .uart_offset = 8,
2284 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002285
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002286 [pbn_b1_bt_1_115200] = {
2287 .flags = FL_BASE1|FL_BASE_BARS,
2288 .num_ports = 1,
2289 .base_baud = 115200,
2290 .uart_offset = 8,
2291 },
Will Page04bf7e72009-04-06 17:32:15 +01002292 [pbn_b1_bt_2_115200] = {
2293 .flags = FL_BASE1|FL_BASE_BARS,
2294 .num_ports = 2,
2295 .base_baud = 115200,
2296 .uart_offset = 8,
2297 },
2298 [pbn_b1_bt_4_115200] = {
2299 .flags = FL_BASE1|FL_BASE_BARS,
2300 .num_ports = 4,
2301 .base_baud = 115200,
2302 .uart_offset = 8,
2303 },
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002304
Linus Torvalds1da177e2005-04-16 15:20:36 -07002305 [pbn_b1_bt_2_921600] = {
2306 .flags = FL_BASE1|FL_BASE_BARS,
2307 .num_ports = 2,
2308 .base_baud = 921600,
2309 .uart_offset = 8,
2310 },
2311
2312 [pbn_b1_1_1382400] = {
2313 .flags = FL_BASE1,
2314 .num_ports = 1,
2315 .base_baud = 1382400,
2316 .uart_offset = 8,
2317 },
2318 [pbn_b1_2_1382400] = {
2319 .flags = FL_BASE1,
2320 .num_ports = 2,
2321 .base_baud = 1382400,
2322 .uart_offset = 8,
2323 },
2324 [pbn_b1_4_1382400] = {
2325 .flags = FL_BASE1,
2326 .num_ports = 4,
2327 .base_baud = 1382400,
2328 .uart_offset = 8,
2329 },
2330 [pbn_b1_8_1382400] = {
2331 .flags = FL_BASE1,
2332 .num_ports = 8,
2333 .base_baud = 1382400,
2334 .uart_offset = 8,
2335 },
2336
2337 [pbn_b2_1_115200] = {
2338 .flags = FL_BASE2,
2339 .num_ports = 1,
2340 .base_baud = 115200,
2341 .uart_offset = 8,
2342 },
Peter Horton737c1752006-08-26 09:07:36 +01002343 [pbn_b2_2_115200] = {
2344 .flags = FL_BASE2,
2345 .num_ports = 2,
2346 .base_baud = 115200,
2347 .uart_offset = 8,
2348 },
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08002349 [pbn_b2_4_115200] = {
2350 .flags = FL_BASE2,
2351 .num_ports = 4,
2352 .base_baud = 115200,
2353 .uart_offset = 8,
2354 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002355 [pbn_b2_8_115200] = {
2356 .flags = FL_BASE2,
2357 .num_ports = 8,
2358 .base_baud = 115200,
2359 .uart_offset = 8,
2360 },
2361
2362 [pbn_b2_1_460800] = {
2363 .flags = FL_BASE2,
2364 .num_ports = 1,
2365 .base_baud = 460800,
2366 .uart_offset = 8,
2367 },
2368 [pbn_b2_4_460800] = {
2369 .flags = FL_BASE2,
2370 .num_ports = 4,
2371 .base_baud = 460800,
2372 .uart_offset = 8,
2373 },
2374 [pbn_b2_8_460800] = {
2375 .flags = FL_BASE2,
2376 .num_ports = 8,
2377 .base_baud = 460800,
2378 .uart_offset = 8,
2379 },
2380 [pbn_b2_16_460800] = {
2381 .flags = FL_BASE2,
2382 .num_ports = 16,
2383 .base_baud = 460800,
2384 .uart_offset = 8,
2385 },
2386
2387 [pbn_b2_1_921600] = {
2388 .flags = FL_BASE2,
2389 .num_ports = 1,
2390 .base_baud = 921600,
2391 .uart_offset = 8,
2392 },
2393 [pbn_b2_4_921600] = {
2394 .flags = FL_BASE2,
2395 .num_ports = 4,
2396 .base_baud = 921600,
2397 .uart_offset = 8,
2398 },
2399 [pbn_b2_8_921600] = {
2400 .flags = FL_BASE2,
2401 .num_ports = 8,
2402 .base_baud = 921600,
2403 .uart_offset = 8,
2404 },
2405
Lytochkin Borise8470032010-07-26 10:02:26 +04002406 [pbn_b2_8_1152000] = {
2407 .flags = FL_BASE2,
2408 .num_ports = 8,
2409 .base_baud = 1152000,
2410 .uart_offset = 8,
2411 },
2412
Linus Torvalds1da177e2005-04-16 15:20:36 -07002413 [pbn_b2_bt_1_115200] = {
2414 .flags = FL_BASE2|FL_BASE_BARS,
2415 .num_ports = 1,
2416 .base_baud = 115200,
2417 .uart_offset = 8,
2418 },
2419 [pbn_b2_bt_2_115200] = {
2420 .flags = FL_BASE2|FL_BASE_BARS,
2421 .num_ports = 2,
2422 .base_baud = 115200,
2423 .uart_offset = 8,
2424 },
2425 [pbn_b2_bt_4_115200] = {
2426 .flags = FL_BASE2|FL_BASE_BARS,
2427 .num_ports = 4,
2428 .base_baud = 115200,
2429 .uart_offset = 8,
2430 },
2431
2432 [pbn_b2_bt_2_921600] = {
2433 .flags = FL_BASE2|FL_BASE_BARS,
2434 .num_ports = 2,
2435 .base_baud = 921600,
2436 .uart_offset = 8,
2437 },
2438 [pbn_b2_bt_4_921600] = {
2439 .flags = FL_BASE2|FL_BASE_BARS,
2440 .num_ports = 4,
2441 .base_baud = 921600,
2442 .uart_offset = 8,
2443 },
2444
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00002445 [pbn_b3_2_115200] = {
2446 .flags = FL_BASE3,
2447 .num_ports = 2,
2448 .base_baud = 115200,
2449 .uart_offset = 8,
2450 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002451 [pbn_b3_4_115200] = {
2452 .flags = FL_BASE3,
2453 .num_ports = 4,
2454 .base_baud = 115200,
2455 .uart_offset = 8,
2456 },
2457 [pbn_b3_8_115200] = {
2458 .flags = FL_BASE3,
2459 .num_ports = 8,
2460 .base_baud = 115200,
2461 .uart_offset = 8,
2462 },
2463
Yegor Yefremov66169ad2010-06-04 09:58:18 +02002464 [pbn_b4_bt_2_921600] = {
2465 .flags = FL_BASE4,
2466 .num_ports = 2,
2467 .base_baud = 921600,
2468 .uart_offset = 8,
2469 },
2470 [pbn_b4_bt_4_921600] = {
2471 .flags = FL_BASE4,
2472 .num_ports = 4,
2473 .base_baud = 921600,
2474 .uart_offset = 8,
2475 },
2476 [pbn_b4_bt_8_921600] = {
2477 .flags = FL_BASE4,
2478 .num_ports = 8,
2479 .base_baud = 921600,
2480 .uart_offset = 8,
2481 },
2482
Linus Torvalds1da177e2005-04-16 15:20:36 -07002483 /*
2484 * Entries following this are board-specific.
2485 */
2486
2487 /*
2488 * Panacom - IOMEM
2489 */
2490 [pbn_panacom] = {
2491 .flags = FL_BASE2,
2492 .num_ports = 2,
2493 .base_baud = 921600,
2494 .uart_offset = 0x400,
2495 .reg_shift = 7,
2496 },
2497 [pbn_panacom2] = {
2498 .flags = FL_BASE2|FL_BASE_BARS,
2499 .num_ports = 2,
2500 .base_baud = 921600,
2501 .uart_offset = 0x400,
2502 .reg_shift = 7,
2503 },
2504 [pbn_panacom4] = {
2505 .flags = FL_BASE2|FL_BASE_BARS,
2506 .num_ports = 4,
2507 .base_baud = 921600,
2508 .uart_offset = 0x400,
2509 .reg_shift = 7,
2510 },
2511
2512 /* I think this entry is broken - the first_offset looks wrong --rmk */
2513 [pbn_plx_romulus] = {
2514 .flags = FL_BASE2,
2515 .num_ports = 4,
2516 .base_baud = 921600,
2517 .uart_offset = 8 << 2,
2518 .reg_shift = 2,
2519 .first_offset = 0x03,
2520 },
2521
2522 /*
2523 * This board uses the size of PCI Base region 0 to
2524 * signal now many ports are available
2525 */
2526 [pbn_oxsemi] = {
2527 .flags = FL_BASE0|FL_REGION_SZ_CAP,
2528 .num_ports = 32,
2529 .base_baud = 115200,
2530 .uart_offset = 8,
2531 },
Lee Howard7106b4e2008-10-21 13:48:58 +01002532 [pbn_oxsemi_1_4000000] = {
2533 .flags = FL_BASE0,
2534 .num_ports = 1,
2535 .base_baud = 4000000,
2536 .uart_offset = 0x200,
2537 .first_offset = 0x1000,
2538 },
2539 [pbn_oxsemi_2_4000000] = {
2540 .flags = FL_BASE0,
2541 .num_ports = 2,
2542 .base_baud = 4000000,
2543 .uart_offset = 0x200,
2544 .first_offset = 0x1000,
2545 },
2546 [pbn_oxsemi_4_4000000] = {
2547 .flags = FL_BASE0,
2548 .num_ports = 4,
2549 .base_baud = 4000000,
2550 .uart_offset = 0x200,
2551 .first_offset = 0x1000,
2552 },
2553 [pbn_oxsemi_8_4000000] = {
2554 .flags = FL_BASE0,
2555 .num_ports = 8,
2556 .base_baud = 4000000,
2557 .uart_offset = 0x200,
2558 .first_offset = 0x1000,
2559 },
2560
Linus Torvalds1da177e2005-04-16 15:20:36 -07002561
2562 /*
2563 * EKF addition for i960 Boards form EKF with serial port.
2564 * Max 256 ports.
2565 */
2566 [pbn_intel_i960] = {
2567 .flags = FL_BASE0,
2568 .num_ports = 32,
2569 .base_baud = 921600,
2570 .uart_offset = 8 << 2,
2571 .reg_shift = 2,
2572 .first_offset = 0x10000,
2573 },
2574 [pbn_sgi_ioc3] = {
2575 .flags = FL_BASE0|FL_NOIRQ,
2576 .num_ports = 1,
2577 .base_baud = 458333,
2578 .uart_offset = 8,
2579 .reg_shift = 0,
2580 .first_offset = 0x20178,
2581 },
2582
2583 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002584 * Computone - uses IOMEM.
2585 */
2586 [pbn_computone_4] = {
2587 .flags = FL_BASE0,
2588 .num_ports = 4,
2589 .base_baud = 921600,
2590 .uart_offset = 0x40,
2591 .reg_shift = 2,
2592 .first_offset = 0x200,
2593 },
2594 [pbn_computone_6] = {
2595 .flags = FL_BASE0,
2596 .num_ports = 6,
2597 .base_baud = 921600,
2598 .uart_offset = 0x40,
2599 .reg_shift = 2,
2600 .first_offset = 0x200,
2601 },
2602 [pbn_computone_8] = {
2603 .flags = FL_BASE0,
2604 .num_ports = 8,
2605 .base_baud = 921600,
2606 .uart_offset = 0x40,
2607 .reg_shift = 2,
2608 .first_offset = 0x200,
2609 },
2610 [pbn_sbsxrsio] = {
2611 .flags = FL_BASE0,
2612 .num_ports = 8,
2613 .base_baud = 460800,
2614 .uart_offset = 256,
2615 .reg_shift = 4,
2616 },
2617 /*
2618 * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
2619 * Only basic 16550A support.
2620 * XR17C15[24] are not tested, but they should work.
2621 */
2622 [pbn_exar_XR17C152] = {
2623 .flags = FL_BASE0,
2624 .num_ports = 2,
2625 .base_baud = 921600,
2626 .uart_offset = 0x200,
2627 },
2628 [pbn_exar_XR17C154] = {
2629 .flags = FL_BASE0,
2630 .num_ports = 4,
2631 .base_baud = 921600,
2632 .uart_offset = 0x200,
2633 },
2634 [pbn_exar_XR17C158] = {
2635 .flags = FL_BASE0,
2636 .num_ports = 8,
2637 .base_baud = 921600,
2638 .uart_offset = 0x200,
2639 },
Matt Schultedc96efb2012-11-19 09:12:04 -06002640 [pbn_exar_XR17V352] = {
2641 .flags = FL_BASE0,
2642 .num_ports = 2,
2643 .base_baud = 7812500,
2644 .uart_offset = 0x400,
2645 .reg_shift = 0,
2646 .first_offset = 0,
2647 },
2648 [pbn_exar_XR17V354] = {
2649 .flags = FL_BASE0,
2650 .num_ports = 4,
2651 .base_baud = 7812500,
2652 .uart_offset = 0x400,
2653 .reg_shift = 0,
2654 .first_offset = 0,
2655 },
2656 [pbn_exar_XR17V358] = {
2657 .flags = FL_BASE0,
2658 .num_ports = 8,
2659 .base_baud = 7812500,
2660 .uart_offset = 0x400,
2661 .reg_shift = 0,
2662 .first_offset = 0,
2663 },
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07002664 [pbn_exar_ibm_saturn] = {
2665 .flags = FL_BASE0,
2666 .num_ports = 1,
2667 .base_baud = 921600,
2668 .uart_offset = 0x200,
2669 },
2670
Olof Johanssonaa798502007-08-22 14:01:55 -07002671 /*
2672 * PA Semi PWRficient PA6T-1682M on-chip UART
2673 */
2674 [pbn_pasemi_1682M] = {
2675 .flags = FL_BASE0,
2676 .num_ports = 1,
2677 .base_baud = 8333333,
2678 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002679 /*
2680 * National Instruments 843x
2681 */
2682 [pbn_ni8430_16] = {
2683 .flags = FL_BASE0,
2684 .num_ports = 16,
2685 .base_baud = 3686400,
2686 .uart_offset = 0x10,
2687 .first_offset = 0x800,
2688 },
2689 [pbn_ni8430_8] = {
2690 .flags = FL_BASE0,
2691 .num_ports = 8,
2692 .base_baud = 3686400,
2693 .uart_offset = 0x10,
2694 .first_offset = 0x800,
2695 },
2696 [pbn_ni8430_4] = {
2697 .flags = FL_BASE0,
2698 .num_ports = 4,
2699 .base_baud = 3686400,
2700 .uart_offset = 0x10,
2701 .first_offset = 0x800,
2702 },
2703 [pbn_ni8430_2] = {
2704 .flags = FL_BASE0,
2705 .num_ports = 2,
2706 .base_baud = 3686400,
2707 .uart_offset = 0x10,
2708 .first_offset = 0x800,
2709 },
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07002710 /*
2711 * ADDI-DATA GmbH PCI-Express communication cards <info@addi-data.com>
2712 */
2713 [pbn_ADDIDATA_PCIe_1_3906250] = {
2714 .flags = FL_BASE0,
2715 .num_ports = 1,
2716 .base_baud = 3906250,
2717 .uart_offset = 0x200,
2718 .first_offset = 0x1000,
2719 },
2720 [pbn_ADDIDATA_PCIe_2_3906250] = {
2721 .flags = FL_BASE0,
2722 .num_ports = 2,
2723 .base_baud = 3906250,
2724 .uart_offset = 0x200,
2725 .first_offset = 0x1000,
2726 },
2727 [pbn_ADDIDATA_PCIe_4_3906250] = {
2728 .flags = FL_BASE0,
2729 .num_ports = 4,
2730 .base_baud = 3906250,
2731 .uart_offset = 0x200,
2732 .first_offset = 0x1000,
2733 },
2734 [pbn_ADDIDATA_PCIe_8_3906250] = {
2735 .flags = FL_BASE0,
2736 .num_ports = 8,
2737 .base_baud = 3906250,
2738 .uart_offset = 0x200,
2739 .first_offset = 0x1000,
2740 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08002741 [pbn_ce4100_1_115200] = {
Maxime Bizon08ec2122012-10-19 10:45:07 +02002742 .flags = FL_BASE_BARS,
2743 .num_ports = 2,
Dirk Brandewie095e24b2010-11-17 07:35:20 -08002744 .base_baud = 921600,
2745 .reg_shift = 2,
2746 },
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002747 [pbn_omegapci] = {
2748 .flags = FL_BASE0,
2749 .num_ports = 8,
2750 .base_baud = 115200,
2751 .uart_offset = 0x200,
2752 },
Nicos Gollan7808edc2011-05-05 21:00:37 +02002753 [pbn_NETMOS9900_2s_115200] = {
2754 .flags = FL_BASE0,
2755 .num_ports = 2,
2756 .base_baud = 115200,
2757 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002758};
2759
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002760static const struct pci_device_id blacklist[] = {
2761 /* softmodems */
Alan Cox5756ee92008-02-08 04:18:51 -08002762 { PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */
Maciej Szmigieroebf7c062010-10-26 21:48:21 +02002763 { PCI_VDEVICE(MOTOROLA, 0x3052), }, /* Motorola Si3052-based modem */
2764 { PCI_DEVICE(0x1543, 0x3052), }, /* Si3052-based modem, default IDs */
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002765
2766 /* multi-io cards handled by parport_serial */
2767 { PCI_DEVICE(0x4348, 0x7053), }, /* WCH CH353 2S1P */
Christian Schmidt436bbd42007-08-22 14:01:19 -07002768};
2769
Linus Torvalds1da177e2005-04-16 15:20:36 -07002770/*
2771 * Given a complete unknown PCI device, try to use some heuristics to
2772 * guess what the configuration might be, based on the pitiful PCI
2773 * serial specs. Returns 0 on success, 1 on failure.
2774 */
Bill Pemberton9671f092012-11-19 13:21:50 -05002775static int
Russell King1c7c1fe2005-07-27 11:31:19 +01002776serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002777{
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002778 const struct pci_device_id *bldev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002779 int num_iomem, num_port, first_port = -1, i;
Alan Cox5756ee92008-02-08 04:18:51 -08002780
Linus Torvalds1da177e2005-04-16 15:20:36 -07002781 /*
2782 * If it is not a communications device or the programming
2783 * interface is greater than 6, give up.
2784 *
2785 * (Should we try to make guesses for multiport serial devices
Alan Cox5756ee92008-02-08 04:18:51 -08002786 * later?)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002787 */
2788 if ((((dev->class >> 8) != PCI_CLASS_COMMUNICATION_SERIAL) &&
2789 ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) ||
2790 (dev->class & 0xff) > 6)
2791 return -ENODEV;
2792
Christian Schmidt436bbd42007-08-22 14:01:19 -07002793 /*
2794 * Do not access blacklisted devices that are known not to
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002795 * feature serial ports or are handled by other modules.
Christian Schmidt436bbd42007-08-22 14:01:19 -07002796 */
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002797 for (bldev = blacklist;
2798 bldev < blacklist + ARRAY_SIZE(blacklist);
2799 bldev++) {
2800 if (dev->vendor == bldev->vendor &&
2801 dev->device == bldev->device)
Christian Schmidt436bbd42007-08-22 14:01:19 -07002802 return -ENODEV;
2803 }
2804
Linus Torvalds1da177e2005-04-16 15:20:36 -07002805 num_iomem = num_port = 0;
2806 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
2807 if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
2808 num_port++;
2809 if (first_port == -1)
2810 first_port = i;
2811 }
2812 if (pci_resource_flags(dev, i) & IORESOURCE_MEM)
2813 num_iomem++;
2814 }
2815
2816 /*
2817 * If there is 1 or 0 iomem regions, and exactly one port,
2818 * use it. We guess the number of ports based on the IO
2819 * region size.
2820 */
2821 if (num_iomem <= 1 && num_port == 1) {
2822 board->flags = first_port;
2823 board->num_ports = pci_resource_len(dev, first_port) / 8;
2824 return 0;
2825 }
2826
2827 /*
2828 * Now guess if we've got a board which indexes by BARs.
2829 * Each IO BAR should be 8 bytes, and they should follow
2830 * consecutively.
2831 */
2832 first_port = -1;
2833 num_port = 0;
2834 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
2835 if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
2836 pci_resource_len(dev, i) == 8 &&
2837 (first_port == -1 || (first_port + num_port) == i)) {
2838 num_port++;
2839 if (first_port == -1)
2840 first_port = i;
2841 }
2842 }
2843
2844 if (num_port > 1) {
2845 board->flags = first_port | FL_BASE_BARS;
2846 board->num_ports = num_port;
2847 return 0;
2848 }
2849
2850 return -ENODEV;
2851}
2852
2853static inline int
Russell King975a1a7d2009-01-02 13:44:27 +00002854serial_pci_matches(const struct pciserial_board *board,
2855 const struct pciserial_board *guessed)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002856{
2857 return
2858 board->num_ports == guessed->num_ports &&
2859 board->base_baud == guessed->base_baud &&
2860 board->uart_offset == guessed->uart_offset &&
2861 board->reg_shift == guessed->reg_shift &&
2862 board->first_offset == guessed->first_offset;
2863}
2864
Russell King241fc432005-07-27 11:35:54 +01002865struct serial_private *
Russell King975a1a7d2009-01-02 13:44:27 +00002866pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
Russell King241fc432005-07-27 11:35:54 +01002867{
Alan Cox2655a2c2012-07-12 12:59:50 +01002868 struct uart_8250_port uart;
Russell King241fc432005-07-27 11:35:54 +01002869 struct serial_private *priv;
2870 struct pci_serial_quirk *quirk;
2871 int rc, nr_ports, i;
2872
2873 nr_ports = board->num_ports;
2874
2875 /*
2876 * Find an init and setup quirks.
2877 */
2878 quirk = find_quirk(dev);
2879
2880 /*
2881 * Run the new-style initialization function.
2882 * The initialization function returns:
2883 * <0 - error
2884 * 0 - use board->num_ports
2885 * >0 - number of ports
2886 */
2887 if (quirk->init) {
2888 rc = quirk->init(dev);
2889 if (rc < 0) {
2890 priv = ERR_PTR(rc);
2891 goto err_out;
2892 }
2893 if (rc)
2894 nr_ports = rc;
2895 }
2896
Burman Yan8f31bb32007-02-14 00:33:07 -08002897 priv = kzalloc(sizeof(struct serial_private) +
Russell King241fc432005-07-27 11:35:54 +01002898 sizeof(unsigned int) * nr_ports,
2899 GFP_KERNEL);
2900 if (!priv) {
2901 priv = ERR_PTR(-ENOMEM);
2902 goto err_deinit;
2903 }
2904
Russell King241fc432005-07-27 11:35:54 +01002905 priv->dev = dev;
2906 priv->quirk = quirk;
2907
Alan Cox2655a2c2012-07-12 12:59:50 +01002908 memset(&uart, 0, sizeof(uart));
2909 uart.port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
2910 uart.port.uartclk = board->base_baud * 16;
2911 uart.port.irq = get_pci_irq(dev, board);
2912 uart.port.dev = &dev->dev;
Russell King241fc432005-07-27 11:35:54 +01002913
2914 for (i = 0; i < nr_ports; i++) {
Alan Cox2655a2c2012-07-12 12:59:50 +01002915 if (quirk->setup(priv, board, &uart, i))
Russell King241fc432005-07-27 11:35:54 +01002916 break;
2917
2918#ifdef SERIAL_DEBUG_PCI
Lennert Buytenhek80647b92009-11-11 14:26:41 -08002919 printk(KERN_DEBUG "Setup PCI port: port %lx, irq %d, type %d\n",
Alan Cox2655a2c2012-07-12 12:59:50 +01002920 uart.port.iobase, uart.port.irq, uart.port.iotype);
Russell King241fc432005-07-27 11:35:54 +01002921#endif
Alan Cox5756ee92008-02-08 04:18:51 -08002922
Alan Cox2655a2c2012-07-12 12:59:50 +01002923 priv->line[i] = serial8250_register_8250_port(&uart);
Russell King241fc432005-07-27 11:35:54 +01002924 if (priv->line[i] < 0) {
2925 printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), priv->line[i]);
2926 break;
2927 }
2928 }
Russell King241fc432005-07-27 11:35:54 +01002929 priv->nr = i;
Russell King241fc432005-07-27 11:35:54 +01002930 return priv;
2931
Alan Cox5756ee92008-02-08 04:18:51 -08002932err_deinit:
Russell King241fc432005-07-27 11:35:54 +01002933 if (quirk->exit)
2934 quirk->exit(dev);
Alan Cox5756ee92008-02-08 04:18:51 -08002935err_out:
Russell King241fc432005-07-27 11:35:54 +01002936 return priv;
2937}
2938EXPORT_SYMBOL_GPL(pciserial_init_ports);
2939
2940void pciserial_remove_ports(struct serial_private *priv)
2941{
2942 struct pci_serial_quirk *quirk;
2943 int i;
2944
2945 for (i = 0; i < priv->nr; i++)
2946 serial8250_unregister_port(priv->line[i]);
2947
2948 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
2949 if (priv->remapped_bar[i])
2950 iounmap(priv->remapped_bar[i]);
2951 priv->remapped_bar[i] = NULL;
2952 }
2953
2954 /*
2955 * Find the exit quirks.
2956 */
2957 quirk = find_quirk(priv->dev);
2958 if (quirk->exit)
2959 quirk->exit(priv->dev);
2960
2961 kfree(priv);
2962}
2963EXPORT_SYMBOL_GPL(pciserial_remove_ports);
2964
2965void pciserial_suspend_ports(struct serial_private *priv)
2966{
2967 int i;
2968
2969 for (i = 0; i < priv->nr; i++)
2970 if (priv->line[i] >= 0)
2971 serial8250_suspend_port(priv->line[i]);
Dan Williams5f1a3892012-04-10 14:11:03 -07002972
2973 /*
2974 * Ensure that every init quirk is properly torn down
2975 */
2976 if (priv->quirk->exit)
2977 priv->quirk->exit(priv->dev);
Russell King241fc432005-07-27 11:35:54 +01002978}
2979EXPORT_SYMBOL_GPL(pciserial_suspend_ports);
2980
2981void pciserial_resume_ports(struct serial_private *priv)
2982{
2983 int i;
2984
2985 /*
2986 * Ensure that the board is correctly configured.
2987 */
2988 if (priv->quirk->init)
2989 priv->quirk->init(priv->dev);
2990
2991 for (i = 0; i < priv->nr; i++)
2992 if (priv->line[i] >= 0)
2993 serial8250_resume_port(priv->line[i]);
2994}
2995EXPORT_SYMBOL_GPL(pciserial_resume_ports);
2996
Linus Torvalds1da177e2005-04-16 15:20:36 -07002997/*
2998 * Probe one serial board. Unfortunately, there is no rhyme nor reason
2999 * to the arrangement of serial ports on a PCI card.
3000 */
Bill Pemberton9671f092012-11-19 13:21:50 -05003001static int
Linus Torvalds1da177e2005-04-16 15:20:36 -07003002pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
3003{
Frédéric Brière5bf8f502011-05-29 15:08:03 -04003004 struct pci_serial_quirk *quirk;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003005 struct serial_private *priv;
Russell King975a1a7d2009-01-02 13:44:27 +00003006 const struct pciserial_board *board;
3007 struct pciserial_board tmp;
Russell King241fc432005-07-27 11:35:54 +01003008 int rc;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003009
Frédéric Brière5bf8f502011-05-29 15:08:03 -04003010 quirk = find_quirk(dev);
3011 if (quirk->probe) {
3012 rc = quirk->probe(dev);
3013 if (rc)
3014 return rc;
3015 }
3016
Linus Torvalds1da177e2005-04-16 15:20:36 -07003017 if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
3018 printk(KERN_ERR "pci_init_one: invalid driver_data: %ld\n",
3019 ent->driver_data);
3020 return -EINVAL;
3021 }
3022
3023 board = &pci_boards[ent->driver_data];
3024
3025 rc = pci_enable_device(dev);
Michael Reed28071902011-05-31 12:06:28 -05003026 pci_save_state(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003027 if (rc)
3028 return rc;
3029
3030 if (ent->driver_data == pbn_default) {
3031 /*
3032 * Use a copy of the pci_board entry for this;
3033 * avoid changing entries in the table.
3034 */
Russell King1c7c1fe2005-07-27 11:31:19 +01003035 memcpy(&tmp, board, sizeof(struct pciserial_board));
Linus Torvalds1da177e2005-04-16 15:20:36 -07003036 board = &tmp;
3037
3038 /*
3039 * We matched one of our class entries. Try to
3040 * determine the parameters of this board.
3041 */
Russell King975a1a7d2009-01-02 13:44:27 +00003042 rc = serial_pci_guess_board(dev, &tmp);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003043 if (rc)
3044 goto disable;
3045 } else {
3046 /*
3047 * We matched an explicit entry. If we are able to
3048 * detect this boards settings with our heuristic,
3049 * then we no longer need this entry.
3050 */
Russell King1c7c1fe2005-07-27 11:31:19 +01003051 memcpy(&tmp, &pci_boards[pbn_default],
3052 sizeof(struct pciserial_board));
Linus Torvalds1da177e2005-04-16 15:20:36 -07003053 rc = serial_pci_guess_board(dev, &tmp);
3054 if (rc == 0 && serial_pci_matches(board, &tmp))
3055 moan_device("Redundant entry in serial pci_table.",
3056 dev);
3057 }
3058
Russell King241fc432005-07-27 11:35:54 +01003059 priv = pciserial_init_ports(dev, board);
3060 if (!IS_ERR(priv)) {
3061 pci_set_drvdata(dev, priv);
3062 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003063 }
3064
Russell King241fc432005-07-27 11:35:54 +01003065 rc = PTR_ERR(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003066
Linus Torvalds1da177e2005-04-16 15:20:36 -07003067 disable:
3068 pci_disable_device(dev);
3069 return rc;
3070}
3071
Bill Pembertonae8d8a12012-11-19 13:26:18 -05003072static void pciserial_remove_one(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003073{
3074 struct serial_private *priv = pci_get_drvdata(dev);
3075
3076 pci_set_drvdata(dev, NULL);
3077
Russell King241fc432005-07-27 11:35:54 +01003078 pciserial_remove_ports(priv);
Russell King056a8762005-07-22 10:15:04 +01003079
3080 pci_disable_device(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003081}
3082
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07003083#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -07003084static int pciserial_suspend_one(struct pci_dev *dev, pm_message_t state)
3085{
3086 struct serial_private *priv = pci_get_drvdata(dev);
3087
Russell King241fc432005-07-27 11:35:54 +01003088 if (priv)
3089 pciserial_suspend_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003090
Linus Torvalds1da177e2005-04-16 15:20:36 -07003091 pci_save_state(dev);
3092 pci_set_power_state(dev, pci_choose_state(dev, state));
3093 return 0;
3094}
3095
3096static int pciserial_resume_one(struct pci_dev *dev)
3097{
Dirk Hohndelccb9d592007-10-29 06:28:17 -07003098 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003099 struct serial_private *priv = pci_get_drvdata(dev);
3100
3101 pci_set_power_state(dev, PCI_D0);
3102 pci_restore_state(dev);
3103
3104 if (priv) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07003105 /*
3106 * The device may have been disabled. Re-enable it.
3107 */
Dirk Hohndelccb9d592007-10-29 06:28:17 -07003108 err = pci_enable_device(dev);
Alan Cox40836c42008-10-13 10:36:11 +01003109 /* FIXME: We cannot simply error out here */
Dirk Hohndelccb9d592007-10-29 06:28:17 -07003110 if (err)
Alan Cox40836c42008-10-13 10:36:11 +01003111 printk(KERN_ERR "pciserial: Unable to re-enable ports, trying to continue.\n");
Russell King241fc432005-07-27 11:35:54 +01003112 pciserial_resume_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003113 }
3114 return 0;
3115}
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07003116#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07003117
3118static struct pci_device_id serial_pci_tbl[] = {
Michael Bramer78d70d42009-01-27 11:51:16 +00003119 /* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */
3120 { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620,
3121 PCI_DEVICE_ID_ADVANTECH_PCI3620, 0x0001, 0, 0,
3122 pbn_b2_8_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003123 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
3124 PCI_SUBVENDOR_ID_CONNECT_TECH,
3125 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
3126 pbn_b1_8_1382400 },
3127 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
3128 PCI_SUBVENDOR_ID_CONNECT_TECH,
3129 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
3130 pbn_b1_4_1382400 },
3131 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
3132 PCI_SUBVENDOR_ID_CONNECT_TECH,
3133 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
3134 pbn_b1_2_1382400 },
3135 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3136 PCI_SUBVENDOR_ID_CONNECT_TECH,
3137 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
3138 pbn_b1_8_1382400 },
3139 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3140 PCI_SUBVENDOR_ID_CONNECT_TECH,
3141 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
3142 pbn_b1_4_1382400 },
3143 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3144 PCI_SUBVENDOR_ID_CONNECT_TECH,
3145 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
3146 pbn_b1_2_1382400 },
3147 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3148 PCI_SUBVENDOR_ID_CONNECT_TECH,
3149 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485, 0, 0,
3150 pbn_b1_8_921600 },
3151 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3152 PCI_SUBVENDOR_ID_CONNECT_TECH,
3153 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4, 0, 0,
3154 pbn_b1_8_921600 },
3155 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3156 PCI_SUBVENDOR_ID_CONNECT_TECH,
3157 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485, 0, 0,
3158 pbn_b1_4_921600 },
3159 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3160 PCI_SUBVENDOR_ID_CONNECT_TECH,
3161 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2, 0, 0,
3162 pbn_b1_4_921600 },
3163 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3164 PCI_SUBVENDOR_ID_CONNECT_TECH,
3165 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485, 0, 0,
3166 pbn_b1_2_921600 },
3167 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3168 PCI_SUBVENDOR_ID_CONNECT_TECH,
3169 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6, 0, 0,
3170 pbn_b1_8_921600 },
3171 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3172 PCI_SUBVENDOR_ID_CONNECT_TECH,
3173 PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1, 0, 0,
3174 pbn_b1_8_921600 },
3175 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3176 PCI_SUBVENDOR_ID_CONNECT_TECH,
3177 PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1, 0, 0,
3178 pbn_b1_4_921600 },
Gareth Howlett26e92862006-01-04 17:00:42 +00003179 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3180 PCI_SUBVENDOR_ID_CONNECT_TECH,
3181 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ, 0, 0,
3182 pbn_b1_2_1250000 },
3183 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
3184 PCI_SUBVENDOR_ID_CONNECT_TECH,
3185 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2, 0, 0,
3186 pbn_b0_2_1843200 },
3187 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
3188 PCI_SUBVENDOR_ID_CONNECT_TECH,
3189 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0,
3190 pbn_b0_4_1843200 },
Yoichi Yuasa85d14942006-02-08 21:46:24 +00003191 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
3192 PCI_VENDOR_ID_AFAVLAB,
3193 PCI_SUBDEVICE_ID_AFAVLAB_P061, 0, 0,
3194 pbn_b0_4_1152000 },
Gareth Howlett26e92862006-01-04 17:00:42 +00003195 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3196 PCI_SUBVENDOR_ID_CONNECT_TECH,
3197 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0,
3198 pbn_b0_2_1843200_200 },
3199 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
3200 PCI_SUBVENDOR_ID_CONNECT_TECH,
3201 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232, 0, 0,
3202 pbn_b0_4_1843200_200 },
3203 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3204 PCI_SUBVENDOR_ID_CONNECT_TECH,
3205 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232, 0, 0,
3206 pbn_b0_8_1843200_200 },
3207 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3208 PCI_SUBVENDOR_ID_CONNECT_TECH,
3209 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1, 0, 0,
3210 pbn_b0_2_1843200_200 },
3211 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
3212 PCI_SUBVENDOR_ID_CONNECT_TECH,
3213 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2, 0, 0,
3214 pbn_b0_4_1843200_200 },
3215 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3216 PCI_SUBVENDOR_ID_CONNECT_TECH,
3217 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4, 0, 0,
3218 pbn_b0_8_1843200_200 },
3219 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3220 PCI_SUBVENDOR_ID_CONNECT_TECH,
3221 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2, 0, 0,
3222 pbn_b0_2_1843200_200 },
3223 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
3224 PCI_SUBVENDOR_ID_CONNECT_TECH,
3225 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4, 0, 0,
3226 pbn_b0_4_1843200_200 },
3227 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3228 PCI_SUBVENDOR_ID_CONNECT_TECH,
3229 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8, 0, 0,
3230 pbn_b0_8_1843200_200 },
3231 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3232 PCI_SUBVENDOR_ID_CONNECT_TECH,
3233 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485, 0, 0,
3234 pbn_b0_2_1843200_200 },
3235 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
3236 PCI_SUBVENDOR_ID_CONNECT_TECH,
3237 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485, 0, 0,
3238 pbn_b0_4_1843200_200 },
3239 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3240 PCI_SUBVENDOR_ID_CONNECT_TECH,
3241 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0,
3242 pbn_b0_8_1843200_200 },
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07003243 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3244 PCI_VENDOR_ID_IBM, PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT,
3245 0, 0, pbn_exar_ibm_saturn },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003246
3247 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
Alan Cox5756ee92008-02-08 04:18:51 -08003248 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003249 pbn_b2_bt_1_115200 },
3250 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM2,
Alan Cox5756ee92008-02-08 04:18:51 -08003251 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003252 pbn_b2_bt_2_115200 },
3253 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM422,
Alan Cox5756ee92008-02-08 04:18:51 -08003254 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003255 pbn_b2_bt_4_115200 },
3256 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM232,
Alan Cox5756ee92008-02-08 04:18:51 -08003257 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003258 pbn_b2_bt_2_115200 },
3259 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM4,
Alan Cox5756ee92008-02-08 04:18:51 -08003260 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003261 pbn_b2_bt_4_115200 },
3262 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8,
Alan Cox5756ee92008-02-08 04:18:51 -08003263 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003264 pbn_b2_8_115200 },
Flavio Leitnere65f0f82009-01-02 13:50:43 +00003265 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_7803,
3266 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3267 pbn_b2_8_460800 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003268 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM8,
3269 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3270 pbn_b2_8_115200 },
3271
3272 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_GTEK_SERIAL2,
3273 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3274 pbn_b2_bt_2_115200 },
3275 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM200,
3276 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3277 pbn_b2_bt_2_921600 },
3278 /*
3279 * VScom SPCOM800, from sl@s.pl
3280 */
Alan Cox5756ee92008-02-08 04:18:51 -08003281 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM800,
3282 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003283 pbn_b2_8_921600 },
3284 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_1077,
Alan Cox5756ee92008-02-08 04:18:51 -08003285 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003286 pbn_b2_4_921600 },
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07003287 /* Unknown card - subdevice 0x1584 */
3288 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3289 PCI_VENDOR_ID_PLX,
3290 PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0,
3291 pbn_b0_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003292 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3293 PCI_SUBVENDOR_ID_KEYSPAN,
3294 PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0,
3295 pbn_panacom },
3296 { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_QUADMODEM,
3297 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3298 pbn_panacom4 },
3299 { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_DUALMODEM,
3300 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3301 pbn_panacom2 },
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08003302 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
3303 PCI_VENDOR_ID_ESDGMBH,
3304 PCI_DEVICE_ID_ESDGMBH_CPCIASIO4, 0, 0,
3305 pbn_b2_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003306 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3307 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08003308 PCI_SUBDEVICE_ID_CHASE_PCIFAST4, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003309 pbn_b2_4_460800 },
3310 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3311 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08003312 PCI_SUBDEVICE_ID_CHASE_PCIFAST8, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003313 pbn_b2_8_460800 },
3314 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3315 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08003316 PCI_SUBDEVICE_ID_CHASE_PCIFAST16, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003317 pbn_b2_16_460800 },
3318 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3319 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08003320 PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003321 pbn_b2_16_460800 },
3322 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3323 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
Alan Cox5756ee92008-02-08 04:18:51 -08003324 PCI_SUBDEVICE_ID_CHASE_PCIRAS4, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003325 pbn_b2_4_460800 },
3326 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3327 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
Alan Cox5756ee92008-02-08 04:18:51 -08003328 PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003329 pbn_b2_8_460800 },
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01003330 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3331 PCI_SUBVENDOR_ID_EXSYS,
3332 PCI_SUBDEVICE_ID_EXSYS_4055, 0, 0,
Shawn Bohreree4cd1b2012-05-28 15:20:47 -05003333 pbn_b2_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003334 /*
3335 * Megawolf Romulus PCI Serial Card, from Mike Hudson
3336 * (Exoray@isys.ca)
3337 */
3338 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_ROMULUS,
3339 0x10b5, 0x106a, 0, 0,
3340 pbn_plx_romulus },
3341 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC100,
3342 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3343 pbn_b1_4_115200 },
3344 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100,
3345 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3346 pbn_b1_2_115200 },
3347 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100D,
3348 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3349 pbn_b1_8_115200 },
3350 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100M,
3351 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3352 pbn_b1_8_115200 },
3353 { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_OXSEMI_16PCI954,
Alan Cox5756ee92008-02-08 04:18:51 -08003354 PCI_VENDOR_ID_SPECIALIX, PCI_SUBDEVICE_ID_SPECIALIX_SPEED4,
3355 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003356 pbn_b0_4_921600 },
3357 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
Alan Cox5756ee92008-02-08 04:18:51 -08003358 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL,
3359 0, 0,
Andrey Paninfbc0dc02005-07-18 11:38:09 +01003360 pbn_b0_4_1152000 },
Mikulas Patockac9bd9d02010-10-26 14:20:48 -04003361 { PCI_VENDOR_ID_OXSEMI, 0x9505,
3362 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3363 pbn_b0_bt_2_921600 },
David Ransondb1de152005-07-27 11:43:55 -07003364
3365 /*
3366 * The below card is a little controversial since it is the
3367 * subject of a PCI vendor/device ID clash. (See
3368 * www.ussg.iu.edu/hypermail/linux/kernel/0303.1/0516.html).
3369 * For now just used the hex ID 0x950a.
3370 */
3371 { PCI_VENDOR_ID_OXSEMI, 0x950a,
Flavio Leitner26e82202012-09-21 21:04:34 -03003372 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_00,
3373 0, 0, pbn_b0_2_115200 },
3374 { PCI_VENDOR_ID_OXSEMI, 0x950a,
3375 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_30,
3376 0, 0, pbn_b0_2_115200 },
Niels de Vos39aced62009-01-02 13:46:58 +00003377 { PCI_VENDOR_ID_OXSEMI, 0x950a,
David Ransondb1de152005-07-27 11:43:55 -07003378 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3379 pbn_b0_2_1130000 },
Andre Przywara70fd8fd2009-06-11 12:41:57 +01003380 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_C950,
3381 PCI_VENDOR_ID_OXSEMI, PCI_SUBDEVICE_ID_OXSEMI_C950, 0, 0,
3382 pbn_b0_1_921600 },
Andrey Paninfbc0dc02005-07-18 11:38:09 +01003383 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003384 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3385 pbn_b0_4_115200 },
3386 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952,
3387 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3388 pbn_b0_bt_2_921600 },
Lytochkin Borise8470032010-07-26 10:02:26 +04003389 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI958,
3390 PCI_ANY_ID , PCI_ANY_ID, 0, 0,
3391 pbn_b2_8_1152000 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003392
3393 /*
Lee Howard7106b4e2008-10-21 13:48:58 +01003394 * Oxford Semiconductor Inc. Tornado PCI express device range.
3395 */
3396 { PCI_VENDOR_ID_OXSEMI, 0xc101, /* OXPCIe952 1 Legacy UART */
3397 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3398 pbn_b0_1_4000000 },
3399 { PCI_VENDOR_ID_OXSEMI, 0xc105, /* OXPCIe952 1 Legacy UART */
3400 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3401 pbn_b0_1_4000000 },
3402 { PCI_VENDOR_ID_OXSEMI, 0xc11b, /* OXPCIe952 1 Native UART */
3403 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3404 pbn_oxsemi_1_4000000 },
3405 { PCI_VENDOR_ID_OXSEMI, 0xc11f, /* OXPCIe952 1 Native UART */
3406 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3407 pbn_oxsemi_1_4000000 },
3408 { PCI_VENDOR_ID_OXSEMI, 0xc120, /* OXPCIe952 1 Legacy UART */
3409 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3410 pbn_b0_1_4000000 },
3411 { PCI_VENDOR_ID_OXSEMI, 0xc124, /* OXPCIe952 1 Legacy UART */
3412 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3413 pbn_b0_1_4000000 },
3414 { PCI_VENDOR_ID_OXSEMI, 0xc138, /* OXPCIe952 1 Native UART */
3415 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3416 pbn_oxsemi_1_4000000 },
3417 { PCI_VENDOR_ID_OXSEMI, 0xc13d, /* OXPCIe952 1 Native UART */
3418 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3419 pbn_oxsemi_1_4000000 },
3420 { PCI_VENDOR_ID_OXSEMI, 0xc140, /* OXPCIe952 1 Legacy UART */
3421 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3422 pbn_b0_1_4000000 },
3423 { PCI_VENDOR_ID_OXSEMI, 0xc141, /* OXPCIe952 1 Legacy UART */
3424 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3425 pbn_b0_1_4000000 },
3426 { PCI_VENDOR_ID_OXSEMI, 0xc144, /* OXPCIe952 1 Legacy UART */
3427 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3428 pbn_b0_1_4000000 },
3429 { PCI_VENDOR_ID_OXSEMI, 0xc145, /* OXPCIe952 1 Legacy UART */
3430 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3431 pbn_b0_1_4000000 },
3432 { PCI_VENDOR_ID_OXSEMI, 0xc158, /* OXPCIe952 2 Native UART */
3433 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3434 pbn_oxsemi_2_4000000 },
3435 { PCI_VENDOR_ID_OXSEMI, 0xc15d, /* OXPCIe952 2 Native UART */
3436 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3437 pbn_oxsemi_2_4000000 },
3438 { PCI_VENDOR_ID_OXSEMI, 0xc208, /* OXPCIe954 4 Native UART */
3439 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3440 pbn_oxsemi_4_4000000 },
3441 { PCI_VENDOR_ID_OXSEMI, 0xc20d, /* OXPCIe954 4 Native UART */
3442 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3443 pbn_oxsemi_4_4000000 },
3444 { PCI_VENDOR_ID_OXSEMI, 0xc308, /* OXPCIe958 8 Native UART */
3445 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3446 pbn_oxsemi_8_4000000 },
3447 { PCI_VENDOR_ID_OXSEMI, 0xc30d, /* OXPCIe958 8 Native UART */
3448 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3449 pbn_oxsemi_8_4000000 },
3450 { PCI_VENDOR_ID_OXSEMI, 0xc40b, /* OXPCIe200 1 Native UART */
3451 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3452 pbn_oxsemi_1_4000000 },
3453 { PCI_VENDOR_ID_OXSEMI, 0xc40f, /* OXPCIe200 1 Native UART */
3454 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3455 pbn_oxsemi_1_4000000 },
3456 { PCI_VENDOR_ID_OXSEMI, 0xc41b, /* OXPCIe200 1 Native UART */
3457 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3458 pbn_oxsemi_1_4000000 },
3459 { PCI_VENDOR_ID_OXSEMI, 0xc41f, /* OXPCIe200 1 Native UART */
3460 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3461 pbn_oxsemi_1_4000000 },
3462 { PCI_VENDOR_ID_OXSEMI, 0xc42b, /* OXPCIe200 1 Native UART */
3463 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3464 pbn_oxsemi_1_4000000 },
3465 { PCI_VENDOR_ID_OXSEMI, 0xc42f, /* OXPCIe200 1 Native UART */
3466 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3467 pbn_oxsemi_1_4000000 },
3468 { PCI_VENDOR_ID_OXSEMI, 0xc43b, /* OXPCIe200 1 Native UART */
3469 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3470 pbn_oxsemi_1_4000000 },
3471 { PCI_VENDOR_ID_OXSEMI, 0xc43f, /* OXPCIe200 1 Native UART */
3472 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3473 pbn_oxsemi_1_4000000 },
3474 { PCI_VENDOR_ID_OXSEMI, 0xc44b, /* OXPCIe200 1 Native UART */
3475 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3476 pbn_oxsemi_1_4000000 },
3477 { PCI_VENDOR_ID_OXSEMI, 0xc44f, /* OXPCIe200 1 Native UART */
3478 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3479 pbn_oxsemi_1_4000000 },
3480 { PCI_VENDOR_ID_OXSEMI, 0xc45b, /* OXPCIe200 1 Native UART */
3481 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3482 pbn_oxsemi_1_4000000 },
3483 { PCI_VENDOR_ID_OXSEMI, 0xc45f, /* OXPCIe200 1 Native UART */
3484 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3485 pbn_oxsemi_1_4000000 },
3486 { PCI_VENDOR_ID_OXSEMI, 0xc46b, /* OXPCIe200 1 Native UART */
3487 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3488 pbn_oxsemi_1_4000000 },
3489 { PCI_VENDOR_ID_OXSEMI, 0xc46f, /* OXPCIe200 1 Native UART */
3490 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3491 pbn_oxsemi_1_4000000 },
3492 { PCI_VENDOR_ID_OXSEMI, 0xc47b, /* OXPCIe200 1 Native UART */
3493 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3494 pbn_oxsemi_1_4000000 },
3495 { PCI_VENDOR_ID_OXSEMI, 0xc47f, /* OXPCIe200 1 Native UART */
3496 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3497 pbn_oxsemi_1_4000000 },
3498 { PCI_VENDOR_ID_OXSEMI, 0xc48b, /* OXPCIe200 1 Native UART */
3499 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3500 pbn_oxsemi_1_4000000 },
3501 { PCI_VENDOR_ID_OXSEMI, 0xc48f, /* OXPCIe200 1 Native UART */
3502 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3503 pbn_oxsemi_1_4000000 },
3504 { PCI_VENDOR_ID_OXSEMI, 0xc49b, /* OXPCIe200 1 Native UART */
3505 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3506 pbn_oxsemi_1_4000000 },
3507 { PCI_VENDOR_ID_OXSEMI, 0xc49f, /* OXPCIe200 1 Native UART */
3508 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3509 pbn_oxsemi_1_4000000 },
3510 { PCI_VENDOR_ID_OXSEMI, 0xc4ab, /* OXPCIe200 1 Native UART */
3511 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3512 pbn_oxsemi_1_4000000 },
3513 { PCI_VENDOR_ID_OXSEMI, 0xc4af, /* OXPCIe200 1 Native UART */
3514 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3515 pbn_oxsemi_1_4000000 },
3516 { PCI_VENDOR_ID_OXSEMI, 0xc4bb, /* OXPCIe200 1 Native UART */
3517 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3518 pbn_oxsemi_1_4000000 },
3519 { PCI_VENDOR_ID_OXSEMI, 0xc4bf, /* OXPCIe200 1 Native UART */
3520 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3521 pbn_oxsemi_1_4000000 },
3522 { PCI_VENDOR_ID_OXSEMI, 0xc4cb, /* OXPCIe200 1 Native UART */
3523 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3524 pbn_oxsemi_1_4000000 },
3525 { PCI_VENDOR_ID_OXSEMI, 0xc4cf, /* OXPCIe200 1 Native UART */
3526 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3527 pbn_oxsemi_1_4000000 },
Lee Howardb80de362008-10-21 13:50:14 +01003528 /*
3529 * Mainpine Inc. IQ Express "Rev3" utilizing OxSemi Tornado
3530 */
3531 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 1 Port V.34 Super-G3 Fax */
3532 PCI_VENDOR_ID_MAINPINE, 0x4001, 0, 0,
3533 pbn_oxsemi_1_4000000 },
3534 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 2 Port V.34 Super-G3 Fax */
3535 PCI_VENDOR_ID_MAINPINE, 0x4002, 0, 0,
3536 pbn_oxsemi_2_4000000 },
3537 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 4 Port V.34 Super-G3 Fax */
3538 PCI_VENDOR_ID_MAINPINE, 0x4004, 0, 0,
3539 pbn_oxsemi_4_4000000 },
3540 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 8 Port V.34 Super-G3 Fax */
3541 PCI_VENDOR_ID_MAINPINE, 0x4008, 0, 0,
3542 pbn_oxsemi_8_4000000 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05003543
3544 /*
3545 * Digi/IBM PCIe 2-port Async EIA-232 Adapter utilizing OxSemi Tornado
3546 */
3547 { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM,
3548 PCI_SUBVENDOR_ID_IBM, PCI_ANY_ID, 0, 0,
3549 pbn_oxsemi_2_4000000 },
3550
Lee Howard7106b4e2008-10-21 13:48:58 +01003551 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003552 * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards,
3553 * from skokodyn@yahoo.com
3554 */
3555 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
3556 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO232, 0, 0,
3557 pbn_sbsxrsio },
3558 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
3559 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO422, 0, 0,
3560 pbn_sbsxrsio },
3561 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
3562 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL232, 0, 0,
3563 pbn_sbsxrsio },
3564 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
3565 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL422, 0, 0,
3566 pbn_sbsxrsio },
3567
3568 /*
3569 * Digitan DS560-558, from jimd@esoft.com
3570 */
3571 { PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_ATT_VENUS_MODEM,
Alan Cox5756ee92008-02-08 04:18:51 -08003572 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003573 pbn_b1_1_115200 },
3574
3575 /*
3576 * Titan Electronic cards
3577 * The 400L and 800L have a custom setup quirk.
3578 */
3579 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100,
Alan Cox5756ee92008-02-08 04:18:51 -08003580 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003581 pbn_b0_1_921600 },
3582 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200,
Alan Cox5756ee92008-02-08 04:18:51 -08003583 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003584 pbn_b0_2_921600 },
3585 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400,
Alan Cox5756ee92008-02-08 04:18:51 -08003586 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003587 pbn_b0_4_921600 },
3588 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800B,
Alan Cox5756ee92008-02-08 04:18:51 -08003589 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07003590 pbn_b0_4_921600 },
3591 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100L,
3592 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3593 pbn_b1_1_921600 },
3594 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200L,
3595 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3596 pbn_b1_bt_2_921600 },
3597 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400L,
3598 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3599 pbn_b0_bt_4_921600 },
3600 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800L,
3601 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3602 pbn_b0_bt_8_921600 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02003603 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200I,
3604 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3605 pbn_b4_bt_2_921600 },
3606 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400I,
3607 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3608 pbn_b4_bt_4_921600 },
3609 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800I,
3610 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3611 pbn_b4_bt_8_921600 },
3612 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400EH,
3613 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3614 pbn_b0_4_921600 },
3615 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EH,
3616 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3617 pbn_b0_4_921600 },
3618 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EHB,
3619 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3620 pbn_b0_4_921600 },
3621 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100E,
3622 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3623 pbn_oxsemi_1_4000000 },
3624 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200E,
3625 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3626 pbn_oxsemi_2_4000000 },
3627 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400E,
3628 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3629 pbn_oxsemi_4_4000000 },
3630 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800E,
3631 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3632 pbn_oxsemi_8_4000000 },
3633 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EI,
3634 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3635 pbn_oxsemi_2_4000000 },
3636 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EISI,
3637 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3638 pbn_oxsemi_2_4000000 },
Yegor Yefremov1e9deb12011-12-27 15:47:37 +01003639 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400V3,
3640 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3641 pbn_b0_4_921600 },
3642 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_410V3,
3643 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3644 pbn_b0_4_921600 },
3645 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800V3,
3646 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3647 pbn_b0_4_921600 },
3648 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800V3B,
3649 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3650 pbn_b0_4_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003651
3652 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550,
3653 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3654 pbn_b2_1_460800 },
3655 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_650,
3656 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3657 pbn_b2_1_460800 },
3658 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_850,
3659 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3660 pbn_b2_1_460800 },
3661 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_550,
3662 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3663 pbn_b2_bt_2_921600 },
3664 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_650,
3665 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3666 pbn_b2_bt_2_921600 },
3667 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_850,
3668 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3669 pbn_b2_bt_2_921600 },
3670 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_550,
3671 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3672 pbn_b2_bt_4_921600 },
3673 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_650,
3674 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3675 pbn_b2_bt_4_921600 },
3676 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_850,
3677 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3678 pbn_b2_bt_4_921600 },
3679 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_550,
3680 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3681 pbn_b0_1_921600 },
3682 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_650,
3683 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3684 pbn_b0_1_921600 },
3685 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_850,
3686 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3687 pbn_b0_1_921600 },
3688 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_550,
3689 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3690 pbn_b0_bt_2_921600 },
3691 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_650,
3692 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3693 pbn_b0_bt_2_921600 },
3694 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_850,
3695 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3696 pbn_b0_bt_2_921600 },
3697 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_550,
3698 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3699 pbn_b0_bt_4_921600 },
3700 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_650,
3701 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3702 pbn_b0_bt_4_921600 },
3703 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850,
3704 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3705 pbn_b0_bt_4_921600 },
Andrey Panin3ec9c592006-02-02 20:15:09 +00003706 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_550,
3707 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3708 pbn_b0_bt_8_921600 },
3709 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_650,
3710 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3711 pbn_b0_bt_8_921600 },
3712 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_850,
3713 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3714 pbn_b0_bt_8_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003715
3716 /*
3717 * Computone devices submitted by Doug McNash dmcnash@computone.com
3718 */
3719 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
3720 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG4,
3721 0, 0, pbn_computone_4 },
3722 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
3723 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG8,
3724 0, 0, pbn_computone_8 },
3725 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
3726 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG6,
3727 0, 0, pbn_computone_6 },
3728
3729 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI95N,
3730 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3731 pbn_oxsemi },
3732 { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
3733 PCI_VENDOR_ID_TIMEDIA, PCI_ANY_ID, 0, 0,
3734 pbn_b0_bt_1_921600 },
3735
3736 /*
3737 * AFAVLAB serial card, from Harald Welte <laforge@gnumonks.org>
3738 */
3739 { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P028,
3740 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3741 pbn_b0_bt_8_115200 },
3742 { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P030,
3743 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3744 pbn_b0_bt_8_115200 },
3745
3746 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_DSERIAL,
3747 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3748 pbn_b0_bt_2_115200 },
3749 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_A,
3750 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3751 pbn_b0_bt_2_115200 },
3752 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B,
3753 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3754 pbn_b0_bt_2_115200 },
Lennert Buytenhekb87e5e22009-11-11 14:26:42 -08003755 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_A,
3756 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3757 pbn_b0_bt_2_115200 },
3758 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_B,
3759 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3760 pbn_b0_bt_2_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003761 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A,
3762 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3763 pbn_b0_bt_4_460800 },
3764 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_B,
3765 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3766 pbn_b0_bt_4_460800 },
3767 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_PLUS,
3768 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3769 pbn_b0_bt_2_460800 },
3770 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_A,
3771 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3772 pbn_b0_bt_2_460800 },
3773 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_B,
3774 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3775 pbn_b0_bt_2_460800 },
3776 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_SSERIAL,
3777 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3778 pbn_b0_bt_1_115200 },
3779 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_650,
3780 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3781 pbn_b0_bt_1_460800 },
3782
3783 /*
Russell King1fb8cac2006-12-13 14:45:46 +00003784 * Korenix Jetcard F0/F1 cards (JC1204, JC1208, JC1404, JC1408).
3785 * Cards are identified by their subsystem vendor IDs, which
3786 * (in hex) match the model number.
3787 *
3788 * Note that JC140x are RS422/485 cards which require ox950
3789 * ACR = 0x10, and as such are not currently fully supported.
3790 */
3791 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
3792 0x1204, 0x0004, 0, 0,
3793 pbn_b0_4_921600 },
3794 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
3795 0x1208, 0x0004, 0, 0,
3796 pbn_b0_4_921600 },
3797/* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
3798 0x1402, 0x0002, 0, 0,
3799 pbn_b0_2_921600 }, */
3800/* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
3801 0x1404, 0x0004, 0, 0,
3802 pbn_b0_4_921600 }, */
3803 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF1,
3804 0x1208, 0x0004, 0, 0,
3805 pbn_b0_4_921600 },
3806
Kiros Yeh2a52fcb2009-12-21 16:26:48 -08003807 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2,
3808 0x1204, 0x0004, 0, 0,
3809 pbn_b0_4_921600 },
3810 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2,
3811 0x1208, 0x0004, 0, 0,
3812 pbn_b0_4_921600 },
3813 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF3,
3814 0x1208, 0x0004, 0, 0,
3815 pbn_b0_4_921600 },
Russell King1fb8cac2006-12-13 14:45:46 +00003816 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003817 * Dell Remote Access Card 4 - Tim_T_Murphy@Dell.com
3818 */
3819 { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RAC4,
3820 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3821 pbn_b1_1_1382400 },
3822
3823 /*
3824 * Dell Remote Access Card III - Tim_T_Murphy@Dell.com
3825 */
3826 { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RACIII,
3827 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3828 pbn_b1_1_1382400 },
3829
3830 /*
3831 * RAStel 2 port modem, gerg@moreton.com.au
3832 */
3833 { PCI_VENDOR_ID_MORETON, PCI_DEVICE_ID_RASTEL_2PORT,
3834 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3835 pbn_b2_bt_2_115200 },
3836
3837 /*
3838 * EKF addition for i960 Boards form EKF with serial port
3839 */
3840 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80960_RP,
3841 0xE4BF, PCI_ANY_ID, 0, 0,
3842 pbn_intel_i960 },
3843
3844 /*
3845 * Xircom Cardbus/Ethernet combos
3846 */
3847 { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_X3201_MDM,
3848 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3849 pbn_b0_1_115200 },
3850 /*
3851 * Xircom RBM56G cardbus modem - Dirk Arnold (temp entry)
3852 */
3853 { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_RBM56G,
3854 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3855 pbn_b0_1_115200 },
3856
3857 /*
3858 * Untested PCI modems, sent in from various folks...
3859 */
3860
3861 /*
3862 * Elsa Model 56K PCI Modem, from Andreas Rath <arh@01019freenet.de>
3863 */
3864 { PCI_VENDOR_ID_ROCKWELL, 0x1004,
3865 0x1048, 0x1500, 0, 0,
3866 pbn_b1_1_115200 },
3867
3868 { PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
3869 0xFF00, 0, 0, 0,
3870 pbn_sgi_ioc3 },
3871
3872 /*
3873 * HP Diva card
3874 */
3875 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
3876 PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_RMP3, 0, 0,
3877 pbn_b1_1_115200 },
3878 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
3879 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3880 pbn_b0_5_115200 },
3881 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
3882 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3883 pbn_b2_1_115200 },
3884
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00003885 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,
3886 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3887 pbn_b3_2_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003888 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM4,
3889 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3890 pbn_b3_4_115200 },
3891 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM8,
3892 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3893 pbn_b3_8_115200 },
3894
3895 /*
3896 * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
3897 */
3898 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
3899 PCI_ANY_ID, PCI_ANY_ID,
3900 0,
3901 0, pbn_exar_XR17C152 },
3902 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
3903 PCI_ANY_ID, PCI_ANY_ID,
3904 0,
3905 0, pbn_exar_XR17C154 },
3906 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
3907 PCI_ANY_ID, PCI_ANY_ID,
3908 0,
3909 0, pbn_exar_XR17C158 },
Matt Schultedc96efb2012-11-19 09:12:04 -06003910 /*
3911 * Exar Corp. XR17V35[248] Dual/Quad/Octal PCIe UARTs
3912 */
3913 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V352,
3914 PCI_ANY_ID, PCI_ANY_ID,
3915 0,
3916 0, pbn_exar_XR17V352 },
3917 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V354,
3918 PCI_ANY_ID, PCI_ANY_ID,
3919 0,
3920 0, pbn_exar_XR17V354 },
3921 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V358,
3922 PCI_ANY_ID, PCI_ANY_ID,
3923 0,
3924 0, pbn_exar_XR17V358 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003925
3926 /*
3927 * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke)
3928 */
3929 { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560,
3930 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
3931 pbn_b0_1_115200 },
Niels de Vos84f8c6f2007-08-22 14:01:14 -07003932 /*
3933 * ITE
3934 */
3935 { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
3936 PCI_ANY_ID, PCI_ANY_ID,
3937 0, 0,
3938 pbn_b1_bt_1_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003939
3940 /*
Peter Horton737c1752006-08-26 09:07:36 +01003941 * IntaShield IS-200
3942 */
3943 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200,
3944 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */
3945 pbn_b2_2_115200 },
Ignacio García Pérez4b6f6ce2008-05-23 13:04:28 -07003946 /*
3947 * IntaShield IS-400
3948 */
3949 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
3950 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
3951 pbn_b2_4_115200 },
Peter Horton737c1752006-08-26 09:07:36 +01003952 /*
Thomas Hoehn48212002007-02-10 01:46:05 -08003953 * Perle PCI-RAS cards
3954 */
3955 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
3956 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS4,
3957 0, 0, pbn_b2_4_921600 },
3958 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
3959 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8,
3960 0, 0, pbn_b2_8_921600 },
Alan Coxbf0df632007-10-16 01:24:00 -07003961
3962 /*
3963 * Mainpine series cards: Fairly standard layout but fools
3964 * parts of the autodetect in some cases and uses otherwise
3965 * unmatched communications subclasses in the PCI Express case
3966 */
3967
3968 { /* RockForceDUO */
3969 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3970 PCI_VENDOR_ID_MAINPINE, 0x0200,
3971 0, 0, pbn_b0_2_115200 },
3972 { /* RockForceQUATRO */
3973 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3974 PCI_VENDOR_ID_MAINPINE, 0x0300,
3975 0, 0, pbn_b0_4_115200 },
3976 { /* RockForceDUO+ */
3977 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3978 PCI_VENDOR_ID_MAINPINE, 0x0400,
3979 0, 0, pbn_b0_2_115200 },
3980 { /* RockForceQUATRO+ */
3981 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3982 PCI_VENDOR_ID_MAINPINE, 0x0500,
3983 0, 0, pbn_b0_4_115200 },
3984 { /* RockForce+ */
3985 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3986 PCI_VENDOR_ID_MAINPINE, 0x0600,
3987 0, 0, pbn_b0_2_115200 },
3988 { /* RockForce+ */
3989 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3990 PCI_VENDOR_ID_MAINPINE, 0x0700,
3991 0, 0, pbn_b0_4_115200 },
3992 { /* RockForceOCTO+ */
3993 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3994 PCI_VENDOR_ID_MAINPINE, 0x0800,
3995 0, 0, pbn_b0_8_115200 },
3996 { /* RockForceDUO+ */
3997 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
3998 PCI_VENDOR_ID_MAINPINE, 0x0C00,
3999 0, 0, pbn_b0_2_115200 },
4000 { /* RockForceQUARTRO+ */
4001 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4002 PCI_VENDOR_ID_MAINPINE, 0x0D00,
4003 0, 0, pbn_b0_4_115200 },
4004 { /* RockForceOCTO+ */
4005 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4006 PCI_VENDOR_ID_MAINPINE, 0x1D00,
4007 0, 0, pbn_b0_8_115200 },
4008 { /* RockForceD1 */
4009 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4010 PCI_VENDOR_ID_MAINPINE, 0x2000,
4011 0, 0, pbn_b0_1_115200 },
4012 { /* RockForceF1 */
4013 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4014 PCI_VENDOR_ID_MAINPINE, 0x2100,
4015 0, 0, pbn_b0_1_115200 },
4016 { /* RockForceD2 */
4017 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4018 PCI_VENDOR_ID_MAINPINE, 0x2200,
4019 0, 0, pbn_b0_2_115200 },
4020 { /* RockForceF2 */
4021 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4022 PCI_VENDOR_ID_MAINPINE, 0x2300,
4023 0, 0, pbn_b0_2_115200 },
4024 { /* RockForceD4 */
4025 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4026 PCI_VENDOR_ID_MAINPINE, 0x2400,
4027 0, 0, pbn_b0_4_115200 },
4028 { /* RockForceF4 */
4029 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4030 PCI_VENDOR_ID_MAINPINE, 0x2500,
4031 0, 0, pbn_b0_4_115200 },
4032 { /* RockForceD8 */
4033 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4034 PCI_VENDOR_ID_MAINPINE, 0x2600,
4035 0, 0, pbn_b0_8_115200 },
4036 { /* RockForceF8 */
4037 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4038 PCI_VENDOR_ID_MAINPINE, 0x2700,
4039 0, 0, pbn_b0_8_115200 },
4040 { /* IQ Express D1 */
4041 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4042 PCI_VENDOR_ID_MAINPINE, 0x3000,
4043 0, 0, pbn_b0_1_115200 },
4044 { /* IQ Express F1 */
4045 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4046 PCI_VENDOR_ID_MAINPINE, 0x3100,
4047 0, 0, pbn_b0_1_115200 },
4048 { /* IQ Express D2 */
4049 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4050 PCI_VENDOR_ID_MAINPINE, 0x3200,
4051 0, 0, pbn_b0_2_115200 },
4052 { /* IQ Express F2 */
4053 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4054 PCI_VENDOR_ID_MAINPINE, 0x3300,
4055 0, 0, pbn_b0_2_115200 },
4056 { /* IQ Express D4 */
4057 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4058 PCI_VENDOR_ID_MAINPINE, 0x3400,
4059 0, 0, pbn_b0_4_115200 },
4060 { /* IQ Express F4 */
4061 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4062 PCI_VENDOR_ID_MAINPINE, 0x3500,
4063 0, 0, pbn_b0_4_115200 },
4064 { /* IQ Express D8 */
4065 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4066 PCI_VENDOR_ID_MAINPINE, 0x3C00,
4067 0, 0, pbn_b0_8_115200 },
4068 { /* IQ Express F8 */
4069 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4070 PCI_VENDOR_ID_MAINPINE, 0x3D00,
4071 0, 0, pbn_b0_8_115200 },
4072
4073
Thomas Hoehn48212002007-02-10 01:46:05 -08004074 /*
Olof Johanssonaa798502007-08-22 14:01:55 -07004075 * PA Semi PA6T-1682M on-chip UART
4076 */
4077 { PCI_VENDOR_ID_PASEMI, 0xa004,
4078 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4079 pbn_pasemi_1682M },
4080
4081 /*
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01004082 * National Instruments
4083 */
Will Page04bf7e72009-04-06 17:32:15 +01004084 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI23216,
4085 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4086 pbn_b1_16_115200 },
4087 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2328,
4088 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4089 pbn_b1_8_115200 },
4090 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2324,
4091 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4092 pbn_b1_bt_4_115200 },
4093 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2322,
4094 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4095 pbn_b1_bt_2_115200 },
4096 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2324I,
4097 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4098 pbn_b1_bt_4_115200 },
4099 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2322I,
4100 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4101 pbn_b1_bt_2_115200 },
4102 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_23216,
4103 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4104 pbn_b1_16_115200 },
4105 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2328,
4106 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4107 pbn_b1_8_115200 },
4108 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2324,
4109 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4110 pbn_b1_bt_4_115200 },
4111 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2322,
4112 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4113 pbn_b1_bt_2_115200 },
4114 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8422_2324,
4115 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4116 pbn_b1_bt_4_115200 },
4117 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8422_2322,
4118 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4119 pbn_b1_bt_2_115200 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01004120 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2322,
4121 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4122 pbn_ni8430_2 },
4123 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2322,
4124 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4125 pbn_ni8430_2 },
4126 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2324,
4127 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4128 pbn_ni8430_4 },
4129 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2324,
4130 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4131 pbn_ni8430_4 },
4132 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2328,
4133 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4134 pbn_ni8430_8 },
4135 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2328,
4136 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4137 pbn_ni8430_8 },
4138 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_23216,
4139 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4140 pbn_ni8430_16 },
4141 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_23216,
4142 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4143 pbn_ni8430_16 },
4144 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8432_2322,
4145 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4146 pbn_ni8430_2 },
4147 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8432_2322,
4148 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4149 pbn_ni8430_2 },
4150 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8432_2324,
4151 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4152 pbn_ni8430_4 },
4153 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8432_2324,
4154 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4155 pbn_ni8430_4 },
4156
4157 /*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08004158 * ADDI-DATA GmbH communication cards <info@addi-data.com>
4159 */
4160 { PCI_VENDOR_ID_ADDIDATA,
4161 PCI_DEVICE_ID_ADDIDATA_APCI7500,
4162 PCI_ANY_ID,
4163 PCI_ANY_ID,
4164 0,
4165 0,
4166 pbn_b0_4_115200 },
4167
4168 { PCI_VENDOR_ID_ADDIDATA,
4169 PCI_DEVICE_ID_ADDIDATA_APCI7420,
4170 PCI_ANY_ID,
4171 PCI_ANY_ID,
4172 0,
4173 0,
4174 pbn_b0_2_115200 },
4175
4176 { PCI_VENDOR_ID_ADDIDATA,
4177 PCI_DEVICE_ID_ADDIDATA_APCI7300,
4178 PCI_ANY_ID,
4179 PCI_ANY_ID,
4180 0,
4181 0,
4182 pbn_b0_1_115200 },
4183
4184 { PCI_VENDOR_ID_ADDIDATA_OLD,
4185 PCI_DEVICE_ID_ADDIDATA_APCI7800,
4186 PCI_ANY_ID,
4187 PCI_ANY_ID,
4188 0,
4189 0,
4190 pbn_b1_8_115200 },
4191
4192 { PCI_VENDOR_ID_ADDIDATA,
4193 PCI_DEVICE_ID_ADDIDATA_APCI7500_2,
4194 PCI_ANY_ID,
4195 PCI_ANY_ID,
4196 0,
4197 0,
4198 pbn_b0_4_115200 },
4199
4200 { PCI_VENDOR_ID_ADDIDATA,
4201 PCI_DEVICE_ID_ADDIDATA_APCI7420_2,
4202 PCI_ANY_ID,
4203 PCI_ANY_ID,
4204 0,
4205 0,
4206 pbn_b0_2_115200 },
4207
4208 { PCI_VENDOR_ID_ADDIDATA,
4209 PCI_DEVICE_ID_ADDIDATA_APCI7300_2,
4210 PCI_ANY_ID,
4211 PCI_ANY_ID,
4212 0,
4213 0,
4214 pbn_b0_1_115200 },
4215
4216 { PCI_VENDOR_ID_ADDIDATA,
4217 PCI_DEVICE_ID_ADDIDATA_APCI7500_3,
4218 PCI_ANY_ID,
4219 PCI_ANY_ID,
4220 0,
4221 0,
4222 pbn_b0_4_115200 },
4223
4224 { PCI_VENDOR_ID_ADDIDATA,
4225 PCI_DEVICE_ID_ADDIDATA_APCI7420_3,
4226 PCI_ANY_ID,
4227 PCI_ANY_ID,
4228 0,
4229 0,
4230 pbn_b0_2_115200 },
4231
4232 { PCI_VENDOR_ID_ADDIDATA,
4233 PCI_DEVICE_ID_ADDIDATA_APCI7300_3,
4234 PCI_ANY_ID,
4235 PCI_ANY_ID,
4236 0,
4237 0,
4238 pbn_b0_1_115200 },
4239
4240 { PCI_VENDOR_ID_ADDIDATA,
4241 PCI_DEVICE_ID_ADDIDATA_APCI7800_3,
4242 PCI_ANY_ID,
4243 PCI_ANY_ID,
4244 0,
4245 0,
4246 pbn_b0_8_115200 },
4247
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07004248 { PCI_VENDOR_ID_ADDIDATA,
4249 PCI_DEVICE_ID_ADDIDATA_APCIe7500,
4250 PCI_ANY_ID,
4251 PCI_ANY_ID,
4252 0,
4253 0,
4254 pbn_ADDIDATA_PCIe_4_3906250 },
4255
4256 { PCI_VENDOR_ID_ADDIDATA,
4257 PCI_DEVICE_ID_ADDIDATA_APCIe7420,
4258 PCI_ANY_ID,
4259 PCI_ANY_ID,
4260 0,
4261 0,
4262 pbn_ADDIDATA_PCIe_2_3906250 },
4263
4264 { PCI_VENDOR_ID_ADDIDATA,
4265 PCI_DEVICE_ID_ADDIDATA_APCIe7300,
4266 PCI_ANY_ID,
4267 PCI_ANY_ID,
4268 0,
4269 0,
4270 pbn_ADDIDATA_PCIe_1_3906250 },
4271
4272 { PCI_VENDOR_ID_ADDIDATA,
4273 PCI_DEVICE_ID_ADDIDATA_APCIe7800,
4274 PCI_ANY_ID,
4275 PCI_ANY_ID,
4276 0,
4277 0,
4278 pbn_ADDIDATA_PCIe_8_3906250 },
4279
Jiri Slaby25cf9bc2009-01-15 13:30:34 +00004280 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
4281 PCI_VENDOR_ID_IBM, 0x0299,
4282 0, 0, pbn_b0_bt_2_115200 },
4283
Michael Bueschc4285b42009-06-30 11:41:21 -07004284 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901,
4285 0xA000, 0x1000,
4286 0, 0, pbn_b0_1_115200 },
4287
Nicos Gollan7808edc2011-05-05 21:00:37 +02004288 /* the 9901 is a rebranded 9912 */
4289 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
4290 0xA000, 0x1000,
4291 0, 0, pbn_b0_1_115200 },
4292
4293 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
4294 0xA000, 0x1000,
4295 0, 0, pbn_b0_1_115200 },
4296
4297 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9904,
4298 0xA000, 0x1000,
4299 0, 0, pbn_b0_1_115200 },
4300
4301 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
4302 0xA000, 0x1000,
4303 0, 0, pbn_b0_1_115200 },
4304
4305 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
4306 0xA000, 0x3002,
4307 0, 0, pbn_NETMOS9900_2s_115200 },
4308
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08004309 /*
Eric Smith44178172011-07-11 22:53:13 -06004310 * Best Connectivity and Rosewill PCI Multi I/O cards
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08004311 */
4312
4313 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
4314 0xA000, 0x1000,
4315 0, 0, pbn_b0_1_115200 },
4316
4317 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
Eric Smith44178172011-07-11 22:53:13 -06004318 0xA000, 0x3002,
4319 0, 0, pbn_b0_bt_2_115200 },
4320
4321 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08004322 0xA000, 0x3004,
4323 0, 0, pbn_b0_bt_4_115200 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08004324 /* Intel CE4100 */
4325 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
4326 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4327 pbn_ce4100_1_115200 },
4328
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04004329 /*
4330 * Cronyx Omega PCI
4331 */
4332 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
4333 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4334 pbn_omegapci },
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08004335
4336 /*
Alan Cox66835492012-08-16 12:01:33 +01004337 * AgeStar as-prs2-009
4338 */
4339 { PCI_VENDOR_ID_AGESTAR, PCI_DEVICE_ID_AGESTAR_9375,
4340 PCI_ANY_ID, PCI_ANY_ID,
4341 0, 0, pbn_b0_bt_2_115200 },
Alan Cox27788c52012-09-04 16:21:06 +01004342
4343 /*
4344 * WCH CH353 series devices: The 2S1P is handled by parport_serial
4345 * so not listed here.
4346 */
4347 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH353_4S,
4348 PCI_ANY_ID, PCI_ANY_ID,
4349 0, 0, pbn_b0_bt_4_115200 },
4350
4351 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH353_2S1PF,
4352 PCI_ANY_ID, PCI_ANY_ID,
4353 0, 0, pbn_b0_bt_2_115200 },
4354
Alan Cox66835492012-08-16 12:01:33 +01004355 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07004356 * These entries match devices with class COMMUNICATION_SERIAL,
4357 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
4358 */
4359 { PCI_ANY_ID, PCI_ANY_ID,
4360 PCI_ANY_ID, PCI_ANY_ID,
4361 PCI_CLASS_COMMUNICATION_SERIAL << 8,
4362 0xffff00, pbn_default },
4363 { PCI_ANY_ID, PCI_ANY_ID,
4364 PCI_ANY_ID, PCI_ANY_ID,
4365 PCI_CLASS_COMMUNICATION_MODEM << 8,
4366 0xffff00, pbn_default },
4367 { PCI_ANY_ID, PCI_ANY_ID,
4368 PCI_ANY_ID, PCI_ANY_ID,
4369 PCI_CLASS_COMMUNICATION_MULTISERIAL << 8,
4370 0xffff00, pbn_default },
4371 { 0, }
4372};
4373
Michael Reed28071902011-05-31 12:06:28 -05004374static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
4375 pci_channel_state_t state)
4376{
4377 struct serial_private *priv = pci_get_drvdata(dev);
4378
4379 if (state == pci_channel_io_perm_failure)
4380 return PCI_ERS_RESULT_DISCONNECT;
4381
4382 if (priv)
4383 pciserial_suspend_ports(priv);
4384
4385 pci_disable_device(dev);
4386
4387 return PCI_ERS_RESULT_NEED_RESET;
4388}
4389
4390static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
4391{
4392 int rc;
4393
4394 rc = pci_enable_device(dev);
4395
4396 if (rc)
4397 return PCI_ERS_RESULT_DISCONNECT;
4398
4399 pci_restore_state(dev);
4400 pci_save_state(dev);
4401
4402 return PCI_ERS_RESULT_RECOVERED;
4403}
4404
4405static void serial8250_io_resume(struct pci_dev *dev)
4406{
4407 struct serial_private *priv = pci_get_drvdata(dev);
4408
4409 if (priv)
4410 pciserial_resume_ports(priv);
4411}
4412
Stephen Hemminger1d352032012-09-07 09:33:17 -07004413static const struct pci_error_handlers serial8250_err_handler = {
Michael Reed28071902011-05-31 12:06:28 -05004414 .error_detected = serial8250_io_error_detected,
4415 .slot_reset = serial8250_io_slot_reset,
4416 .resume = serial8250_io_resume,
4417};
4418
Linus Torvalds1da177e2005-04-16 15:20:36 -07004419static struct pci_driver serial_pci_driver = {
4420 .name = "serial",
4421 .probe = pciserial_init_one,
Bill Pemberton2d47b712012-11-19 13:21:34 -05004422 .remove = pciserial_remove_one,
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07004423#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -07004424 .suspend = pciserial_suspend_one,
4425 .resume = pciserial_resume_one,
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07004426#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07004427 .id_table = serial_pci_tbl,
Michael Reed28071902011-05-31 12:06:28 -05004428 .err_handler = &serial8250_err_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004429};
4430
Wei Yongjun15a12e82012-10-26 23:04:22 +08004431module_pci_driver(serial_pci_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -07004432
4433MODULE_LICENSE("GPL");
4434MODULE_DESCRIPTION("Generic 8250/16x50 PCI serial probe module");
4435MODULE_DEVICE_TABLE(pci, serial_pci_tbl);