blob: 177eaeafeb3eaa8907705f4be3dfe2f597f61fd6 [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 */
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -070012#undef DEBUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#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>
Andy Shevchenko21947ba2015-03-13 18:51:12 +020024#include <linux/rational.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
26#include <asm/byteorder.h>
27#include <asm/io.h>
28
Andy Shevchenko9a1870c2014-08-19 20:29:22 +030029#include <linux/dmaengine.h>
30#include <linux/platform_data/dma-dw.h>
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include "8250.h"
33
Linus Torvalds1da177e2005-04-16 15:20:36 -070034/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 * init function returns:
36 * > 0 - number of ports
37 * = 0 - use board->num_ports
38 * < 0 - error
39 */
40struct pci_serial_quirk {
41 u32 vendor;
42 u32 device;
43 u32 subvendor;
44 u32 subdevice;
Frédéric Brière5bf8f502011-05-29 15:08:03 -040045 int (*probe)(struct pci_dev *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 int (*init)(struct pci_dev *dev);
Russell King975a1a7d2009-01-02 13:44:27 +000047 int (*setup)(struct serial_private *,
48 const struct pciserial_board *,
Alan Cox2655a2c2012-07-12 12:59:50 +010049 struct uart_8250_port *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 void (*exit)(struct pci_dev *dev);
51};
52
53#define PCI_NUM_BAR_RESOURCES 6
54
55struct serial_private {
Russell King70db3d92005-07-27 11:34:27 +010056 struct pci_dev *dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 unsigned int nr;
58 void __iomem *remapped_bar[PCI_NUM_BAR_RESOURCES];
59 struct pci_serial_quirk *quirk;
60 int line[0];
61};
62
Nicos Gollan7808edc2011-05-05 21:00:37 +020063static int pci_default_setup(struct serial_private*,
Alan Cox2655a2c2012-07-12 12:59:50 +010064 const struct pciserial_board*, struct uart_8250_port *, int);
Nicos Gollan7808edc2011-05-05 21:00:37 +020065
Linus Torvalds1da177e2005-04-16 15:20:36 -070066static void moan_device(const char *str, struct pci_dev *dev)
67{
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -070068 dev_err(&dev->dev,
Joe Perchesad361c92009-07-06 13:05:40 -070069 "%s: %s\n"
70 "Please send the output of lspci -vv, this\n"
71 "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n"
72 "manufacturer and name of serial board or\n"
Russell Kingf2e0ea82015-03-06 10:49:21 +000073 "modem board to <linux-serial@vger.kernel.org>.\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 pci_name(dev), str, dev->vendor, dev->device,
75 dev->subsystem_vendor, dev->subsystem_device);
76}
77
78static int
Alan Cox2655a2c2012-07-12 12:59:50 +010079setup_port(struct serial_private *priv, struct uart_8250_port *port,
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 int bar, int offset, int regshift)
81{
Russell King70db3d92005-07-27 11:34:27 +010082 struct pci_dev *dev = priv->dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
84 if (bar >= PCI_NUM_BAR_RESOURCES)
85 return -EINVAL;
86
87 if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 if (!priv->remapped_bar[bar])
Aaron Sierra398a9db2014-10-30 19:49:45 -050089 priv->remapped_bar[bar] = pci_ioremap_bar(dev, bar);
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 if (!priv->remapped_bar[bar])
91 return -ENOMEM;
92
Alan Cox2655a2c2012-07-12 12:59:50 +010093 port->port.iotype = UPIO_MEM;
94 port->port.iobase = 0;
Aaron Sierra398a9db2014-10-30 19:49:45 -050095 port->port.mapbase = pci_resource_start(dev, bar) + offset;
Alan Cox2655a2c2012-07-12 12:59:50 +010096 port->port.membase = priv->remapped_bar[bar] + offset;
97 port->port.regshift = regshift;
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 } else {
Alan Cox2655a2c2012-07-12 12:59:50 +010099 port->port.iotype = UPIO_PORT;
Aaron Sierra398a9db2014-10-30 19:49:45 -0500100 port->port.iobase = pci_resource_start(dev, bar) + offset;
Alan Cox2655a2c2012-07-12 12:59:50 +0100101 port->port.mapbase = 0;
102 port->port.membase = NULL;
103 port->port.regshift = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 }
105 return 0;
106}
107
108/*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -0800109 * ADDI-DATA GmbH communication cards <info@addi-data.com>
110 */
111static int addidata_apci7800_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000112 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100113 struct uart_8250_port *port, int idx)
Krauth.Julien02c9b5c2008-02-04 22:27:49 -0800114{
115 unsigned int bar = 0, offset = board->first_offset;
116 bar = FL_GET_BASE(board->flags);
117
118 if (idx < 2) {
119 offset += idx * board->uart_offset;
120 } else if ((idx >= 2) && (idx < 4)) {
121 bar += 1;
122 offset += ((idx - 2) * board->uart_offset);
123 } else if ((idx >= 4) && (idx < 6)) {
124 bar += 2;
125 offset += ((idx - 4) * board->uart_offset);
126 } else if (idx >= 6) {
127 bar += 3;
128 offset += ((idx - 6) * board->uart_offset);
129 }
130
131 return setup_port(priv, port, bar, offset, board->reg_shift);
132}
133
134/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 * AFAVLAB uses a different mixture of BARs and offsets
136 * Not that ugly ;) -- HW
137 */
138static int
Russell King975a1a7d2009-01-02 13:44:27 +0000139afavlab_setup(struct serial_private *priv, const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100140 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141{
142 unsigned int bar, offset = board->first_offset;
Alan Cox5756ee92008-02-08 04:18:51 -0800143
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 bar = FL_GET_BASE(board->flags);
145 if (idx < 4)
146 bar += idx;
147 else {
148 bar = 4;
149 offset += (idx - 4) * board->uart_offset;
150 }
151
Russell King70db3d92005-07-27 11:34:27 +0100152 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153}
154
155/*
156 * HP's Remote Management Console. The Diva chip came in several
157 * different versions. N-class, L2000 and A500 have two Diva chips, each
158 * with 3 UARTs (the third UART on the second chip is unused). Superdome
159 * and Keystone have one Diva chip with 3 UARTs. Some later machines have
160 * one Diva chip, but it has been expanded to 5 UARTs.
161 */
Russell King61a116e2006-07-03 15:22:35 +0100162static int pci_hp_diva_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163{
164 int rc = 0;
165
166 switch (dev->subsystem_device) {
167 case PCI_DEVICE_ID_HP_DIVA_TOSCA1:
168 case PCI_DEVICE_ID_HP_DIVA_HALFDOME:
169 case PCI_DEVICE_ID_HP_DIVA_KEYSTONE:
170 case PCI_DEVICE_ID_HP_DIVA_EVEREST:
171 rc = 3;
172 break;
173 case PCI_DEVICE_ID_HP_DIVA_TOSCA2:
174 rc = 2;
175 break;
176 case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
177 rc = 4;
178 break;
179 case PCI_DEVICE_ID_HP_DIVA_POWERBAR:
Justin Chen551f8f02005-10-24 22:16:38 +0100180 case PCI_DEVICE_ID_HP_DIVA_HURRICANE:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 rc = 1;
182 break;
183 }
184
185 return rc;
186}
187
188/*
189 * HP's Diva chip puts the 4th/5th serial port further out, and
190 * some serial ports are supposed to be hidden on certain models.
191 */
192static int
Russell King975a1a7d2009-01-02 13:44:27 +0000193pci_hp_diva_setup(struct serial_private *priv,
194 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100195 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196{
197 unsigned int offset = board->first_offset;
198 unsigned int bar = FL_GET_BASE(board->flags);
199
Russell King70db3d92005-07-27 11:34:27 +0100200 switch (priv->dev->subsystem_device) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
202 if (idx == 3)
203 idx++;
204 break;
205 case PCI_DEVICE_ID_HP_DIVA_EVEREST:
206 if (idx > 0)
207 idx++;
208 if (idx > 2)
209 idx++;
210 break;
211 }
212 if (idx > 2)
213 offset = 0x18;
214
215 offset += idx * board->uart_offset;
216
Russell King70db3d92005-07-27 11:34:27 +0100217 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218}
219
220/*
221 * Added for EKF Intel i960 serial boards
222 */
Russell King61a116e2006-07-03 15:22:35 +0100223static int pci_inteli960ni_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224{
Heikki Krogerus0a0d4122015-01-12 13:47:46 +0200225 u32 oldval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226
227 if (!(dev->subsystem_device & 0x1000))
228 return -ENODEV;
229
230 /* is firmware started? */
Heikki Krogerus0a0d4122015-01-12 13:47:46 +0200231 pci_read_config_dword(dev, 0x44, &oldval);
Alan Cox5756ee92008-02-08 04:18:51 -0800232 if (oldval == 0x00001000L) { /* RESET value */
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -0700233 dev_dbg(&dev->dev, "Local i960 firmware missing\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 return -ENODEV;
235 }
236 return 0;
237}
238
239/*
240 * Some PCI serial cards using the PLX 9050 PCI interface chip require
241 * that the card interrupt be explicitly enabled or disabled. This
242 * seems to be mainly needed on card using the PLX which also use I/O
243 * mapped memory.
244 */
Russell King61a116e2006-07-03 15:22:35 +0100245static int pci_plx9050_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246{
247 u8 irq_config;
248 void __iomem *p;
249
250 if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0) {
251 moan_device("no memory in bar 0", dev);
252 return 0;
253 }
254
255 irq_config = 0x41;
Bjorn Helgaasadd7b582005-10-24 22:11:57 +0100256 if (dev->vendor == PCI_VENDOR_ID_PANACOM ||
Alan Cox5756ee92008-02-08 04:18:51 -0800257 dev->subsystem_vendor == PCI_SUBVENDOR_ID_EXSYS)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 irq_config = 0x43;
Alan Cox5756ee92008-02-08 04:18:51 -0800259
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 if ((dev->vendor == PCI_VENDOR_ID_PLX) &&
Alan Cox5756ee92008-02-08 04:18:51 -0800261 (dev->device == PCI_DEVICE_ID_PLX_ROMULUS))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 /*
263 * As the megawolf cards have the int pins active
264 * high, and have 2 UART chips, both ints must be
265 * enabled on the 9050. Also, the UARTS are set in
266 * 16450 mode by default, so we have to enable the
267 * 16C950 'enhanced' mode so that we can use the
268 * deep FIFOs
269 */
270 irq_config = 0x5b;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 /*
272 * enable/disable interrupts
273 */
Alan Cox6f441fe2008-05-01 04:34:59 -0700274 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 if (p == NULL)
276 return -ENOMEM;
277 writel(irq_config, p + 0x4c);
278
279 /*
280 * Read the register back to ensure that it took effect.
281 */
282 readl(p + 0x4c);
283 iounmap(p);
284
285 return 0;
286}
287
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500288static void pci_plx9050_exit(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289{
290 u8 __iomem *p;
291
292 if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0)
293 return;
294
295 /*
296 * disable interrupts
297 */
Alan Cox6f441fe2008-05-01 04:34:59 -0700298 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 if (p != NULL) {
300 writel(0, p + 0x4c);
301
302 /*
303 * Read the register back to ensure that it took effect.
304 */
305 readl(p + 0x4c);
306 iounmap(p);
307 }
308}
309
Will Page04bf7e72009-04-06 17:32:15 +0100310#define NI8420_INT_ENABLE_REG 0x38
311#define NI8420_INT_ENABLE_BIT 0x2000
312
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500313static void pci_ni8420_exit(struct pci_dev *dev)
Will Page04bf7e72009-04-06 17:32:15 +0100314{
315 void __iomem *p;
Will Page04bf7e72009-04-06 17:32:15 +0100316 unsigned int bar = 0;
317
318 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
319 moan_device("no memory in bar", dev);
320 return;
321 }
322
Aaron Sierra398a9db2014-10-30 19:49:45 -0500323 p = pci_ioremap_bar(dev, bar);
Will Page04bf7e72009-04-06 17:32:15 +0100324 if (p == NULL)
325 return;
326
327 /* Disable the CPU Interrupt */
328 writel(readl(p + NI8420_INT_ENABLE_REG) & ~(NI8420_INT_ENABLE_BIT),
329 p + NI8420_INT_ENABLE_REG);
330 iounmap(p);
331}
332
333
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100334/* MITE registers */
335#define MITE_IOWBSR1 0xc4
336#define MITE_IOWCR1 0xf4
337#define MITE_LCIMR1 0x08
338#define MITE_LCIMR2 0x10
339
340#define MITE_LCIMR2_CLR_CPU_IE (1 << 30)
341
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500342static void pci_ni8430_exit(struct pci_dev *dev)
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100343{
344 void __iomem *p;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100345 unsigned int bar = 0;
346
347 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
348 moan_device("no memory in bar", dev);
349 return;
350 }
351
Aaron Sierra398a9db2014-10-30 19:49:45 -0500352 p = pci_ioremap_bar(dev, bar);
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100353 if (p == NULL)
354 return;
355
356 /* Disable the CPU Interrupt */
357 writel(MITE_LCIMR2_CLR_CPU_IE, p + MITE_LCIMR2);
358 iounmap(p);
359}
360
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361/* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */
362static int
Russell King975a1a7d2009-01-02 13:44:27 +0000363sbs_setup(struct serial_private *priv, const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100364 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365{
366 unsigned int bar, offset = board->first_offset;
367
368 bar = 0;
369
370 if (idx < 4) {
371 /* first four channels map to 0, 0x100, 0x200, 0x300 */
372 offset += idx * board->uart_offset;
373 } else if (idx < 8) {
374 /* last four channels map to 0x1000, 0x1100, 0x1200, 0x1300 */
375 offset += idx * board->uart_offset + 0xC00;
376 } else /* we have only 8 ports on PMC-OCTALPRO */
377 return 1;
378
Russell King70db3d92005-07-27 11:34:27 +0100379 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380}
381
382/*
383* This does initialization for PMC OCTALPRO cards:
384* maps the device memory, resets the UARTs (needed, bc
385* if the module is removed and inserted again, the card
386* is in the sleep mode) and enables global interrupt.
387*/
388
389/* global control register offset for SBS PMC-OctalPro */
390#define OCT_REG_CR_OFF 0x500
391
Russell King61a116e2006-07-03 15:22:35 +0100392static int sbs_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393{
394 u8 __iomem *p;
395
Arjan van de Ven24ed3ab2009-06-24 18:34:58 +0100396 p = pci_ioremap_bar(dev, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397
398 if (p == NULL)
399 return -ENOMEM;
400 /* Set bit-4 Control Register (UART RESET) in to reset the uarts */
Alan Cox5756ee92008-02-08 04:18:51 -0800401 writeb(0x10, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402 udelay(50);
Alan Cox5756ee92008-02-08 04:18:51 -0800403 writeb(0x0, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404
405 /* Set bit-2 (INTENABLE) of Control Register */
406 writeb(0x4, p + OCT_REG_CR_OFF);
407 iounmap(p);
408
409 return 0;
410}
411
412/*
413 * Disables the global interrupt of PMC-OctalPro
414 */
415
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500416static void sbs_exit(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417{
418 u8 __iomem *p;
419
Arjan van de Ven24ed3ab2009-06-24 18:34:58 +0100420 p = pci_ioremap_bar(dev, 0);
Alan Cox5756ee92008-02-08 04:18:51 -0800421 /* FIXME: What if resource_len < OCT_REG_CR_OFF */
422 if (p != NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 writeb(0, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 iounmap(p);
425}
426
427/*
428 * SIIG serial cards have an PCI interface chip which also controls
429 * the UART clocking frequency. Each UART can be clocked independently
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300430 * (except cards equipped with 4 UARTs) and initial clocking settings
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 * are stored in the EEPROM chip. It can cause problems because this
432 * version of serial driver doesn't support differently clocked UART's
433 * on single PCI card. To prevent this, initialization functions set
434 * high frequency clocking for all UART's on given card. It is safe (I
435 * hope) because it doesn't touch EEPROM settings to prevent conflicts
436 * with other OSes (like M$ DOS).
437 *
438 * SIIG support added by Andrey Panin <pazke@donpac.ru>, 10/1999
Alan Cox5756ee92008-02-08 04:18:51 -0800439 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 * There is two family of SIIG serial cards with different PCI
441 * interface chip and different configuration methods:
442 * - 10x cards have control registers in IO and/or memory space;
443 * - 20x cards have control registers in standard PCI configuration space.
444 *
Russell King67d74b82005-07-27 11:33:03 +0100445 * Note: all 10x cards have PCI device ids 0x10..
446 * all 20x cards have PCI device ids 0x20..
447 *
Andrey Paninfbc0dc02005-07-18 11:38:09 +0100448 * There are also Quartet Serial cards which use Oxford Semiconductor
449 * 16954 quad UART PCI chip clocked by 18.432 MHz quartz.
450 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 * Note: some SIIG cards are probed by the parport_serial object.
452 */
453
454#define PCI_DEVICE_ID_SIIG_1S_10x (PCI_DEVICE_ID_SIIG_1S_10x_550 & 0xfffc)
455#define PCI_DEVICE_ID_SIIG_2S_10x (PCI_DEVICE_ID_SIIG_2S_10x_550 & 0xfff8)
456
457static int pci_siig10x_init(struct pci_dev *dev)
458{
459 u16 data;
460 void __iomem *p;
461
462 switch (dev->device & 0xfff8) {
463 case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */
464 data = 0xffdf;
465 break;
466 case PCI_DEVICE_ID_SIIG_2S_10x: /* 2S, 2S1P */
467 data = 0xf7ff;
468 break;
469 default: /* 1S1P, 4S */
470 data = 0xfffb;
471 break;
472 }
473
Alan Cox6f441fe2008-05-01 04:34:59 -0700474 p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 if (p == NULL)
476 return -ENOMEM;
477
478 writew(readw(p + 0x28) & data, p + 0x28);
479 readw(p + 0x28);
480 iounmap(p);
481 return 0;
482}
483
484#define PCI_DEVICE_ID_SIIG_2S_20x (PCI_DEVICE_ID_SIIG_2S_20x_550 & 0xfffc)
485#define PCI_DEVICE_ID_SIIG_2S1P_20x (PCI_DEVICE_ID_SIIG_2S1P_20x_550 & 0xfffc)
486
487static int pci_siig20x_init(struct pci_dev *dev)
488{
489 u8 data;
490
491 /* Change clock frequency for the first UART. */
492 pci_read_config_byte(dev, 0x6f, &data);
493 pci_write_config_byte(dev, 0x6f, data & 0xef);
494
495 /* If this card has 2 UART, we have to do the same with second UART. */
496 if (((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S_20x) ||
497 ((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S1P_20x)) {
498 pci_read_config_byte(dev, 0x73, &data);
499 pci_write_config_byte(dev, 0x73, data & 0xef);
500 }
501 return 0;
502}
503
Russell King67d74b82005-07-27 11:33:03 +0100504static int pci_siig_init(struct pci_dev *dev)
505{
506 unsigned int type = dev->device & 0xff00;
507
508 if (type == 0x1000)
509 return pci_siig10x_init(dev);
510 else if (type == 0x2000)
511 return pci_siig20x_init(dev);
512
513 moan_device("Unknown SIIG card", dev);
514 return -ENODEV;
515}
516
Andrey Panin3ec9c592006-02-02 20:15:09 +0000517static int pci_siig_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000518 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100519 struct uart_8250_port *port, int idx)
Andrey Panin3ec9c592006-02-02 20:15:09 +0000520{
521 unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0;
522
523 if (idx > 3) {
524 bar = 4;
525 offset = (idx - 4) * 8;
526 }
527
528 return setup_port(priv, port, bar, offset, 0);
529}
530
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531/*
532 * Timedia has an explosion of boards, and to avoid the PCI table from
533 * growing *huge*, we use this function to collapse some 70 entries
534 * in the PCI table into one, for sanity's and compactness's sake.
535 */
Helge Dellere9422e02006-08-29 21:57:29 +0200536static const unsigned short timedia_single_port[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 0x4025, 0x4027, 0x4028, 0x5025, 0x5027, 0
538};
539
Helge Dellere9422e02006-08-29 21:57:29 +0200540static const unsigned short timedia_dual_port[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700541 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
Alan Cox5756ee92008-02-08 04:18:51 -0800542 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079,
543 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079,
545 0xD079, 0
546};
547
Helge Dellere9422e02006-08-29 21:57:29 +0200548static const unsigned short timedia_quad_port[] = {
Alan Cox5756ee92008-02-08 04:18:51 -0800549 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157,
550 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
552 0xB157, 0
553};
554
Helge Dellere9422e02006-08-29 21:57:29 +0200555static const unsigned short timedia_eight_port[] = {
Alan Cox5756ee92008-02-08 04:18:51 -0800556 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
558};
559
Arjan van de Vencb3592b2005-11-28 21:04:11 +0000560static const struct timedia_struct {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 int num;
Helge Dellere9422e02006-08-29 21:57:29 +0200562 const unsigned short *ids;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563} timedia_data[] = {
564 { 1, timedia_single_port },
565 { 2, timedia_dual_port },
566 { 4, timedia_quad_port },
Helge Dellere9422e02006-08-29 21:57:29 +0200567 { 8, timedia_eight_port }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568};
569
Frédéric Brièreb9b24552011-05-29 15:08:04 -0400570/*
571 * There are nearly 70 different Timedia/SUNIX PCI serial devices. Instead of
572 * listing them individually, this driver merely grabs them all with
573 * PCI_ANY_ID. Some of these devices, however, also feature a parallel port,
574 * and should be left free to be claimed by parport_serial instead.
575 */
576static int pci_timedia_probe(struct pci_dev *dev)
577{
578 /*
579 * Check the third digit of the subdevice ID
580 * (0,2,3,5,6: serial only -- 7,8,9: serial + parallel)
581 */
582 if ((dev->subsystem_device & 0x00f0) >= 0x70) {
583 dev_info(&dev->dev,
584 "ignoring Timedia subdevice %04x for parport_serial\n",
585 dev->subsystem_device);
586 return -ENODEV;
587 }
588
589 return 0;
590}
591
Russell King61a116e2006-07-03 15:22:35 +0100592static int pci_timedia_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593{
Helge Dellere9422e02006-08-29 21:57:29 +0200594 const unsigned short *ids;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 int i, j;
596
Helge Dellere9422e02006-08-29 21:57:29 +0200597 for (i = 0; i < ARRAY_SIZE(timedia_data); i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598 ids = timedia_data[i].ids;
599 for (j = 0; ids[j]; j++)
600 if (dev->subsystem_device == ids[j])
601 return timedia_data[i].num;
602 }
603 return 0;
604}
605
606/*
607 * Timedia/SUNIX uses a mixture of BARs and offsets
608 * Ugh, this is ugly as all hell --- TYT
609 */
610static int
Russell King975a1a7d2009-01-02 13:44:27 +0000611pci_timedia_setup(struct serial_private *priv,
612 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100613 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700614{
615 unsigned int bar = 0, offset = board->first_offset;
616
617 switch (idx) {
618 case 0:
619 bar = 0;
620 break;
621 case 1:
622 offset = board->uart_offset;
623 bar = 0;
624 break;
625 case 2:
626 bar = 1;
627 break;
628 case 3:
629 offset = board->uart_offset;
Dave Jonesc2cd6d32005-12-07 18:11:26 +0000630 /* FALLTHROUGH */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631 case 4: /* BAR 2 */
632 case 5: /* BAR 3 */
633 case 6: /* BAR 4 */
634 case 7: /* BAR 5 */
635 bar = idx - 2;
636 }
637
Russell King70db3d92005-07-27 11:34:27 +0100638 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639}
640
641/*
642 * Some Titan cards are also a little weird
643 */
644static int
Russell King70db3d92005-07-27 11:34:27 +0100645titan_400l_800l_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000646 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100647 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648{
649 unsigned int bar, offset = board->first_offset;
650
651 switch (idx) {
652 case 0:
653 bar = 1;
654 break;
655 case 1:
656 bar = 2;
657 break;
658 default:
659 bar = 4;
660 offset = (idx - 2) * board->uart_offset;
661 }
662
Russell King70db3d92005-07-27 11:34:27 +0100663 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664}
665
Russell King61a116e2006-07-03 15:22:35 +0100666static int pci_xircom_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667{
668 msleep(100);
669 return 0;
670}
671
Will Page04bf7e72009-04-06 17:32:15 +0100672static int pci_ni8420_init(struct pci_dev *dev)
673{
674 void __iomem *p;
Will Page04bf7e72009-04-06 17:32:15 +0100675 unsigned int bar = 0;
676
677 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
678 moan_device("no memory in bar", dev);
679 return 0;
680 }
681
Aaron Sierra398a9db2014-10-30 19:49:45 -0500682 p = pci_ioremap_bar(dev, bar);
Will Page04bf7e72009-04-06 17:32:15 +0100683 if (p == NULL)
684 return -ENOMEM;
685
686 /* Enable CPU Interrupt */
687 writel(readl(p + NI8420_INT_ENABLE_REG) | NI8420_INT_ENABLE_BIT,
688 p + NI8420_INT_ENABLE_REG);
689
690 iounmap(p);
691 return 0;
692}
693
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100694#define MITE_IOWBSR1_WSIZE 0xa
695#define MITE_IOWBSR1_WIN_OFFSET 0x800
696#define MITE_IOWBSR1_WENAB (1 << 7)
697#define MITE_LCIMR1_IO_IE_0 (1 << 24)
698#define MITE_LCIMR2_SET_CPU_IE (1 << 31)
699#define MITE_IOWCR1_RAMSEL_MASK 0xfffffffe
700
701static int pci_ni8430_init(struct pci_dev *dev)
702{
703 void __iomem *p;
Aaron Sierra398a9db2014-10-30 19:49:45 -0500704 struct pci_bus_region region;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100705 u32 device_window;
706 unsigned int bar = 0;
707
708 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
709 moan_device("no memory in bar", dev);
710 return 0;
711 }
712
Aaron Sierra398a9db2014-10-30 19:49:45 -0500713 p = pci_ioremap_bar(dev, bar);
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100714 if (p == NULL)
715 return -ENOMEM;
716
Aaron Sierra398a9db2014-10-30 19:49:45 -0500717 /*
718 * Set device window address and size in BAR0, while acknowledging that
719 * the resource structure may contain a translated address that differs
720 * from the address the device responds to.
721 */
722 pcibios_resource_to_bus(dev->bus, &region, &dev->resource[bar]);
723 device_window = ((region.start + MITE_IOWBSR1_WIN_OFFSET) & 0xffffff00)
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100724 | MITE_IOWBSR1_WENAB | MITE_IOWBSR1_WSIZE;
725 writel(device_window, p + MITE_IOWBSR1);
726
727 /* Set window access to go to RAMSEL IO address space */
728 writel((readl(p + MITE_IOWCR1) & MITE_IOWCR1_RAMSEL_MASK),
729 p + MITE_IOWCR1);
730
731 /* Enable IO Bus Interrupt 0 */
732 writel(MITE_LCIMR1_IO_IE_0, p + MITE_LCIMR1);
733
734 /* Enable CPU Interrupt */
735 writel(MITE_LCIMR2_SET_CPU_IE, p + MITE_LCIMR2);
736
737 iounmap(p);
738 return 0;
739}
740
741/* UART Port Control Register */
742#define NI8430_PORTCON 0x0f
743#define NI8430_PORTCON_TXVR_ENABLE (1 << 3)
744
745static int
Alan Coxbf538fe2009-04-06 17:35:42 +0100746pci_ni8430_setup(struct serial_private *priv,
747 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100748 struct uart_8250_port *port, int idx)
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100749{
Aaron Sierra398a9db2014-10-30 19:49:45 -0500750 struct pci_dev *dev = priv->dev;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100751 void __iomem *p;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100752 unsigned int bar, offset = board->first_offset;
753
754 if (idx >= board->num_ports)
755 return 1;
756
757 bar = FL_GET_BASE(board->flags);
758 offset += idx * board->uart_offset;
759
Aaron Sierra398a9db2014-10-30 19:49:45 -0500760 p = pci_ioremap_bar(dev, bar);
Aaron Sierra5d14bba2014-10-30 19:49:52 -0500761 if (!p)
762 return -ENOMEM;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100763
Joe Perches7c9d4402011-06-23 11:39:20 -0700764 /* enable the transceiver */
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100765 writeb(readb(p + offset + NI8430_PORTCON) | NI8430_PORTCON_TXVR_ENABLE,
766 p + offset + NI8430_PORTCON);
767
768 iounmap(p);
769
770 return setup_port(priv, port, bar, offset, board->reg_shift);
771}
772
Nicos Gollan7808edc2011-05-05 21:00:37 +0200773static int pci_netmos_9900_setup(struct serial_private *priv,
774 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100775 struct uart_8250_port *port, int idx)
Nicos Gollan7808edc2011-05-05 21:00:37 +0200776{
777 unsigned int bar;
778
Dmitry Eremin-Solenikov333c0852014-02-11 14:18:13 +0400779 if ((priv->dev->device != PCI_DEVICE_ID_NETMOS_9865) &&
780 (priv->dev->subsystem_device & 0xff00) == 0x3000) {
Nicos Gollan7808edc2011-05-05 21:00:37 +0200781 /* netmos apparently orders BARs by datasheet layout, so serial
782 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
783 */
784 bar = 3 * idx;
785
786 return setup_port(priv, port, bar, 0, board->reg_shift);
787 } else {
788 return pci_default_setup(priv, board, port, idx);
789 }
790}
791
792/* the 99xx series comes with a range of device IDs and a variety
793 * of capabilities:
794 *
795 * 9900 has varying capabilities and can cascade to sub-controllers
796 * (cascading should be purely internal)
797 * 9904 is hardwired with 4 serial ports
798 * 9912 and 9922 are hardwired with 2 serial ports
799 */
800static int pci_netmos_9900_numports(struct pci_dev *dev)
801{
802 unsigned int c = dev->class;
803 unsigned int pi;
804 unsigned short sub_serports;
805
806 pi = (c & 0xff);
807
808 if (pi == 2) {
809 return 1;
810 } else if ((pi == 0) &&
811 (dev->device == PCI_DEVICE_ID_NETMOS_9900)) {
812 /* two possibilities: 0x30ps encodes number of parallel and
813 * serial ports, or 0x1000 indicates *something*. This is not
814 * immediately obvious, since the 2s1p+4s configuration seems
815 * to offer all functionality on functions 0..2, while still
816 * advertising the same function 3 as the 4s+2s1p config.
817 */
818 sub_serports = dev->subsystem_device & 0xf;
819 if (sub_serports > 0) {
820 return sub_serports;
821 } else {
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -0700822 dev_err(&dev->dev, "NetMos/Mostech serial driver ignoring port on ambiguous config.\n");
Nicos Gollan7808edc2011-05-05 21:00:37 +0200823 return 0;
824 }
825 }
826
827 moan_device("unknown NetMos/Mostech program interface", dev);
828 return 0;
829}
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100830
Russell King61a116e2006-07-03 15:22:35 +0100831static int pci_netmos_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832{
833 /* subdevice 0x00PS means <P> parallel, <S> serial */
834 unsigned int num_serial = dev->subsystem_device & 0xf;
835
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -0800836 if ((dev->device == PCI_DEVICE_ID_NETMOS_9901) ||
837 (dev->device == PCI_DEVICE_ID_NETMOS_9865))
Michael Bueschc4285b42009-06-30 11:41:21 -0700838 return 0;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200839
Jiri Slaby25cf9bc2009-01-15 13:30:34 +0000840 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
841 dev->subsystem_device == 0x0299)
842 return 0;
843
Nicos Gollan7808edc2011-05-05 21:00:37 +0200844 switch (dev->device) { /* FALLTHROUGH on all */
845 case PCI_DEVICE_ID_NETMOS_9904:
846 case PCI_DEVICE_ID_NETMOS_9912:
847 case PCI_DEVICE_ID_NETMOS_9922:
848 case PCI_DEVICE_ID_NETMOS_9900:
849 num_serial = pci_netmos_9900_numports(dev);
850 break;
851
852 default:
853 if (num_serial == 0 ) {
854 moan_device("unknown NetMos/Mostech device", dev);
855 }
856 }
857
Linus Torvalds1da177e2005-04-16 15:20:36 -0700858 if (num_serial == 0)
859 return -ENODEV;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200860
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861 return num_serial;
862}
863
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700864/*
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700865 * These chips are available with optionally one parallel port and up to
866 * two serial ports. Unfortunately they all have the same product id.
867 *
868 * Basic configuration is done over a region of 32 I/O ports. The base
869 * ioport is called INTA or INTC, depending on docs/other drivers.
870 *
871 * The region of the 32 I/O ports is configured in POSIO0R...
872 */
873
874/* registers */
875#define ITE_887x_MISCR 0x9c
876#define ITE_887x_INTCBAR 0x78
877#define ITE_887x_UARTBAR 0x7c
878#define ITE_887x_PS0BAR 0x10
879#define ITE_887x_POSIO0 0x60
880
881/* I/O space size */
882#define ITE_887x_IOSIZE 32
883/* I/O space size (bits 26-24; 8 bytes = 011b) */
884#define ITE_887x_POSIO_IOSIZE_8 (3 << 24)
885/* I/O space size (bits 26-24; 32 bytes = 101b) */
886#define ITE_887x_POSIO_IOSIZE_32 (5 << 24)
887/* Decoding speed (1 = slow, 2 = medium, 3 = fast) */
888#define ITE_887x_POSIO_SPEED (3 << 29)
889/* enable IO_Space bit */
890#define ITE_887x_POSIO_ENABLE (1 << 31)
891
Ralf Baechlef79abb82007-08-30 23:56:31 -0700892static int pci_ite887x_init(struct pci_dev *dev)
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700893{
894 /* inta_addr are the configuration addresses of the ITE */
895 static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0,
896 0x200, 0x280, 0 };
897 int ret, i, type;
898 struct resource *iobase = NULL;
899 u32 miscr, uartbar, ioport;
900
901 /* search for the base-ioport */
902 i = 0;
903 while (inta_addr[i] && iobase == NULL) {
904 iobase = request_region(inta_addr[i], ITE_887x_IOSIZE,
905 "ite887x");
906 if (iobase != NULL) {
907 /* write POSIO0R - speed | size | ioport */
908 pci_write_config_dword(dev, ITE_887x_POSIO0,
909 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
910 ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
911 /* write INTCBAR - ioport */
Alan Cox5756ee92008-02-08 04:18:51 -0800912 pci_write_config_dword(dev, ITE_887x_INTCBAR,
913 inta_addr[i]);
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700914 ret = inb(inta_addr[i]);
915 if (ret != 0xff) {
916 /* ioport connected */
917 break;
918 }
919 release_region(iobase->start, ITE_887x_IOSIZE);
920 iobase = NULL;
921 }
922 i++;
923 }
924
925 if (!inta_addr[i]) {
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -0700926 dev_err(&dev->dev, "ite887x: could not find iobase\n");
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700927 return -ENODEV;
928 }
929
930 /* start of undocumented type checking (see parport_pc.c) */
931 type = inb(iobase->start + 0x18) & 0x0f;
932
933 switch (type) {
934 case 0x2: /* ITE8871 (1P) */
935 case 0xa: /* ITE8875 (1P) */
936 ret = 0;
937 break;
938 case 0xe: /* ITE8872 (2S1P) */
939 ret = 2;
940 break;
941 case 0x6: /* ITE8873 (1S) */
942 ret = 1;
943 break;
944 case 0x8: /* ITE8874 (2S) */
945 ret = 2;
946 break;
947 default:
948 moan_device("Unknown ITE887x", dev);
949 ret = -ENODEV;
950 }
951
952 /* configure all serial ports */
953 for (i = 0; i < ret; i++) {
954 /* read the I/O port from the device */
955 pci_read_config_dword(dev, ITE_887x_PS0BAR + (0x4 * (i + 1)),
956 &ioport);
957 ioport &= 0x0000FF00; /* the actual base address */
958 pci_write_config_dword(dev, ITE_887x_POSIO0 + (0x4 * (i + 1)),
959 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
960 ITE_887x_POSIO_IOSIZE_8 | ioport);
961
962 /* write the ioport to the UARTBAR */
963 pci_read_config_dword(dev, ITE_887x_UARTBAR, &uartbar);
964 uartbar &= ~(0xffff << (16 * i)); /* clear half the reg */
965 uartbar |= (ioport << (16 * i)); /* set the ioport */
966 pci_write_config_dword(dev, ITE_887x_UARTBAR, uartbar);
967
968 /* get current config */
969 pci_read_config_dword(dev, ITE_887x_MISCR, &miscr);
970 /* disable interrupts (UARTx_Routing[3:0]) */
971 miscr &= ~(0xf << (12 - 4 * i));
972 /* activate the UART (UARTx_En) */
973 miscr |= 1 << (23 - i);
974 /* write new config with activated UART */
975 pci_write_config_dword(dev, ITE_887x_MISCR, miscr);
976 }
977
978 if (ret <= 0) {
979 /* the device has no UARTs if we get here */
980 release_region(iobase->start, ITE_887x_IOSIZE);
981 }
982
983 return ret;
984}
985
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500986static void pci_ite887x_exit(struct pci_dev *dev)
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700987{
988 u32 ioport;
989 /* the ioport is bit 0-15 in POSIO0R */
990 pci_read_config_dword(dev, ITE_887x_POSIO0, &ioport);
991 ioport &= 0xffff;
992 release_region(ioport, ITE_887x_IOSIZE);
993}
994
Russell King9f2a0362009-01-02 13:44:20 +0000995/*
Mike Skoog1bc8cde2014-10-16 13:10:01 -0700996 * EndRun Technologies.
997 * Determine the number of ports available on the device.
998 */
999#define PCI_VENDOR_ID_ENDRUN 0x7401
1000#define PCI_DEVICE_ID_ENDRUN_1588 0xe100
1001
1002static int pci_endrun_init(struct pci_dev *dev)
1003{
1004 u8 __iomem *p;
1005 unsigned long deviceID;
1006 unsigned int number_uarts = 0;
1007
1008 /* EndRun device is all 0xexxx */
1009 if (dev->vendor == PCI_VENDOR_ID_ENDRUN &&
1010 (dev->device & 0xf000) != 0xe000)
1011 return 0;
1012
1013 p = pci_iomap(dev, 0, 5);
1014 if (p == NULL)
1015 return -ENOMEM;
1016
1017 deviceID = ioread32(p);
1018 /* EndRun device */
1019 if (deviceID == 0x07000200) {
1020 number_uarts = ioread8(p + 4);
1021 dev_dbg(&dev->dev,
1022 "%d ports detected on EndRun PCI Express device\n",
1023 number_uarts);
1024 }
1025 pci_iounmap(dev, p);
1026 return number_uarts;
1027}
1028
1029/*
Russell King9f2a0362009-01-02 13:44:20 +00001030 * Oxford Semiconductor Inc.
1031 * Check that device is part of the Tornado range of devices, then determine
1032 * the number of ports available on the device.
1033 */
1034static int pci_oxsemi_tornado_init(struct pci_dev *dev)
1035{
1036 u8 __iomem *p;
1037 unsigned long deviceID;
1038 unsigned int number_uarts = 0;
1039
1040 /* OxSemi Tornado devices are all 0xCxxx */
1041 if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
1042 (dev->device & 0xF000) != 0xC000)
1043 return 0;
1044
1045 p = pci_iomap(dev, 0, 5);
1046 if (p == NULL)
1047 return -ENOMEM;
1048
1049 deviceID = ioread32(p);
1050 /* Tornado device */
1051 if (deviceID == 0x07000200) {
1052 number_uarts = ioread8(p + 4);
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07001053 dev_dbg(&dev->dev,
Russell King9f2a0362009-01-02 13:44:20 +00001054 "%d ports detected on Oxford PCI Express device\n",
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07001055 number_uarts);
Russell King9f2a0362009-01-02 13:44:20 +00001056 }
1057 pci_iounmap(dev, p);
1058 return number_uarts;
1059}
1060
Alan Coxeb26dfe2012-07-12 13:00:31 +01001061static int pci_asix_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +00001062 const struct pciserial_board *board,
Alan Coxeb26dfe2012-07-12 13:00:31 +01001063 struct uart_8250_port *port, int idx)
1064{
1065 port->bugs |= UART_BUG_PARITY;
1066 return pci_default_setup(priv, board, port, idx);
1067}
1068
Alan Cox55c7c0f2012-11-29 09:03:00 +10301069/* Quatech devices have their own extra interface features */
1070
1071struct quatech_feature {
1072 u16 devid;
1073 bool amcc;
1074};
1075
1076#define QPCR_TEST_FOR1 0x3F
1077#define QPCR_TEST_GET1 0x00
1078#define QPCR_TEST_FOR2 0x40
1079#define QPCR_TEST_GET2 0x40
1080#define QPCR_TEST_FOR3 0x80
1081#define QPCR_TEST_GET3 0x40
1082#define QPCR_TEST_FOR4 0xC0
1083#define QPCR_TEST_GET4 0x80
1084
1085#define QOPR_CLOCK_X1 0x0000
1086#define QOPR_CLOCK_X2 0x0001
1087#define QOPR_CLOCK_X4 0x0002
1088#define QOPR_CLOCK_X8 0x0003
1089#define QOPR_CLOCK_RATE_MASK 0x0003
1090
1091
1092static struct quatech_feature quatech_cards[] = {
1093 { PCI_DEVICE_ID_QUATECH_QSC100, 1 },
1094 { PCI_DEVICE_ID_QUATECH_DSC100, 1 },
1095 { PCI_DEVICE_ID_QUATECH_DSC100E, 0 },
1096 { PCI_DEVICE_ID_QUATECH_DSC200, 1 },
1097 { PCI_DEVICE_ID_QUATECH_DSC200E, 0 },
1098 { PCI_DEVICE_ID_QUATECH_ESC100D, 1 },
1099 { PCI_DEVICE_ID_QUATECH_ESC100M, 1 },
1100 { PCI_DEVICE_ID_QUATECH_QSCP100, 1 },
1101 { PCI_DEVICE_ID_QUATECH_DSCP100, 1 },
1102 { PCI_DEVICE_ID_QUATECH_QSCP200, 1 },
1103 { PCI_DEVICE_ID_QUATECH_DSCP200, 1 },
1104 { PCI_DEVICE_ID_QUATECH_ESCLP100, 0 },
1105 { PCI_DEVICE_ID_QUATECH_QSCLP100, 0 },
1106 { PCI_DEVICE_ID_QUATECH_DSCLP100, 0 },
1107 { PCI_DEVICE_ID_QUATECH_SSCLP100, 0 },
1108 { PCI_DEVICE_ID_QUATECH_QSCLP200, 0 },
1109 { PCI_DEVICE_ID_QUATECH_DSCLP200, 0 },
1110 { PCI_DEVICE_ID_QUATECH_SSCLP200, 0 },
1111 { PCI_DEVICE_ID_QUATECH_SPPXP_100, 0 },
1112 { 0, }
1113};
1114
1115static int pci_quatech_amcc(u16 devid)
1116{
1117 struct quatech_feature *qf = &quatech_cards[0];
1118 while (qf->devid) {
1119 if (qf->devid == devid)
1120 return qf->amcc;
1121 qf++;
1122 }
1123 pr_err("quatech: unknown port type '0x%04X'.\n", devid);
1124 return 0;
1125};
1126
1127static int pci_quatech_rqopr(struct uart_8250_port *port)
1128{
1129 unsigned long base = port->port.iobase;
1130 u8 LCR, val;
1131
1132 LCR = inb(base + UART_LCR);
1133 outb(0xBF, base + UART_LCR);
1134 val = inb(base + UART_SCR);
1135 outb(LCR, base + UART_LCR);
1136 return val;
1137}
1138
1139static void pci_quatech_wqopr(struct uart_8250_port *port, u8 qopr)
1140{
1141 unsigned long base = port->port.iobase;
1142 u8 LCR, val;
1143
1144 LCR = inb(base + UART_LCR);
1145 outb(0xBF, base + UART_LCR);
1146 val = inb(base + UART_SCR);
1147 outb(qopr, base + UART_SCR);
1148 outb(LCR, base + UART_LCR);
1149}
1150
1151static int pci_quatech_rqmcr(struct uart_8250_port *port)
1152{
1153 unsigned long base = port->port.iobase;
1154 u8 LCR, val, qmcr;
1155
1156 LCR = inb(base + UART_LCR);
1157 outb(0xBF, base + UART_LCR);
1158 val = inb(base + UART_SCR);
1159 outb(val | 0x10, base + UART_SCR);
1160 qmcr = inb(base + UART_MCR);
1161 outb(val, base + UART_SCR);
1162 outb(LCR, base + UART_LCR);
1163
1164 return qmcr;
1165}
1166
1167static void pci_quatech_wqmcr(struct uart_8250_port *port, u8 qmcr)
1168{
1169 unsigned long base = port->port.iobase;
1170 u8 LCR, val;
1171
1172 LCR = inb(base + UART_LCR);
1173 outb(0xBF, base + UART_LCR);
1174 val = inb(base + UART_SCR);
1175 outb(val | 0x10, base + UART_SCR);
1176 outb(qmcr, base + UART_MCR);
1177 outb(val, base + UART_SCR);
1178 outb(LCR, base + UART_LCR);
1179}
1180
1181static int pci_quatech_has_qmcr(struct uart_8250_port *port)
1182{
1183 unsigned long base = port->port.iobase;
1184 u8 LCR, val;
1185
1186 LCR = inb(base + UART_LCR);
1187 outb(0xBF, base + UART_LCR);
1188 val = inb(base + UART_SCR);
1189 if (val & 0x20) {
1190 outb(0x80, UART_LCR);
1191 if (!(inb(UART_SCR) & 0x20)) {
1192 outb(LCR, base + UART_LCR);
1193 return 1;
1194 }
1195 }
1196 return 0;
1197}
1198
1199static int pci_quatech_test(struct uart_8250_port *port)
1200{
1201 u8 reg;
1202 u8 qopr = pci_quatech_rqopr(port);
1203 pci_quatech_wqopr(port, qopr & QPCR_TEST_FOR1);
1204 reg = pci_quatech_rqopr(port) & 0xC0;
1205 if (reg != QPCR_TEST_GET1)
1206 return -EINVAL;
1207 pci_quatech_wqopr(port, (qopr & QPCR_TEST_FOR1)|QPCR_TEST_FOR2);
1208 reg = pci_quatech_rqopr(port) & 0xC0;
1209 if (reg != QPCR_TEST_GET2)
1210 return -EINVAL;
1211 pci_quatech_wqopr(port, (qopr & QPCR_TEST_FOR1)|QPCR_TEST_FOR3);
1212 reg = pci_quatech_rqopr(port) & 0xC0;
1213 if (reg != QPCR_TEST_GET3)
1214 return -EINVAL;
1215 pci_quatech_wqopr(port, (qopr & QPCR_TEST_FOR1)|QPCR_TEST_FOR4);
1216 reg = pci_quatech_rqopr(port) & 0xC0;
1217 if (reg != QPCR_TEST_GET4)
1218 return -EINVAL;
1219
1220 pci_quatech_wqopr(port, qopr);
1221 return 0;
1222}
1223
1224static int pci_quatech_clock(struct uart_8250_port *port)
1225{
1226 u8 qopr, reg, set;
1227 unsigned long clock;
1228
1229 if (pci_quatech_test(port) < 0)
1230 return 1843200;
1231
1232 qopr = pci_quatech_rqopr(port);
1233
1234 pci_quatech_wqopr(port, qopr & ~QOPR_CLOCK_X8);
1235 reg = pci_quatech_rqopr(port);
1236 if (reg & QOPR_CLOCK_X8) {
1237 clock = 1843200;
1238 goto out;
1239 }
1240 pci_quatech_wqopr(port, qopr | QOPR_CLOCK_X8);
1241 reg = pci_quatech_rqopr(port);
1242 if (!(reg & QOPR_CLOCK_X8)) {
1243 clock = 1843200;
1244 goto out;
1245 }
1246 reg &= QOPR_CLOCK_X8;
1247 if (reg == QOPR_CLOCK_X2) {
1248 clock = 3685400;
1249 set = QOPR_CLOCK_X2;
1250 } else if (reg == QOPR_CLOCK_X4) {
1251 clock = 7372800;
1252 set = QOPR_CLOCK_X4;
1253 } else if (reg == QOPR_CLOCK_X8) {
1254 clock = 14745600;
1255 set = QOPR_CLOCK_X8;
1256 } else {
1257 clock = 1843200;
1258 set = QOPR_CLOCK_X1;
1259 }
1260 qopr &= ~QOPR_CLOCK_RATE_MASK;
1261 qopr |= set;
1262
1263out:
1264 pci_quatech_wqopr(port, qopr);
1265 return clock;
1266}
1267
1268static int pci_quatech_rs422(struct uart_8250_port *port)
1269{
1270 u8 qmcr;
1271 int rs422 = 0;
1272
1273 if (!pci_quatech_has_qmcr(port))
1274 return 0;
1275 qmcr = pci_quatech_rqmcr(port);
1276 pci_quatech_wqmcr(port, 0xFF);
1277 if (pci_quatech_rqmcr(port))
1278 rs422 = 1;
1279 pci_quatech_wqmcr(port, qmcr);
1280 return rs422;
1281}
1282
1283static int pci_quatech_init(struct pci_dev *dev)
1284{
1285 if (pci_quatech_amcc(dev->device)) {
1286 unsigned long base = pci_resource_start(dev, 0);
1287 if (base) {
1288 u32 tmp;
Jonathan Woithe9c5320f2013-12-09 16:33:08 +10301289 outl(inl(base + 0x38) | 0x00002000, base + 0x38);
Alan Cox55c7c0f2012-11-29 09:03:00 +10301290 tmp = inl(base + 0x3c);
1291 outl(tmp | 0x01000000, base + 0x3c);
Jonathan Woithe9c5320f2013-12-09 16:33:08 +10301292 outl(tmp &= ~0x01000000, base + 0x3c);
Alan Cox55c7c0f2012-11-29 09:03:00 +10301293 }
1294 }
1295 return 0;
1296}
1297
1298static int pci_quatech_setup(struct serial_private *priv,
1299 const struct pciserial_board *board,
1300 struct uart_8250_port *port, int idx)
1301{
1302 /* Needed by pci_quatech calls below */
1303 port->port.iobase = pci_resource_start(priv->dev, FL_GET_BASE(board->flags));
1304 /* Set up the clocking */
1305 port->port.uartclk = pci_quatech_clock(port);
1306 /* For now just warn about RS422 */
1307 if (pci_quatech_rs422(port))
1308 pr_warn("quatech: software control of RS422 features not currently supported.\n");
1309 return pci_default_setup(priv, board, port, idx);
1310}
1311
Greg Kroah-Hartmand73dfc62013-01-15 22:44:48 -08001312static void pci_quatech_exit(struct pci_dev *dev)
Alan Cox55c7c0f2012-11-29 09:03:00 +10301313{
1314}
1315
Alan Coxeb26dfe2012-07-12 13:00:31 +01001316static int pci_default_setup(struct serial_private *priv,
Russell King70db3d92005-07-27 11:34:27 +01001317 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001318 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001319{
1320 unsigned int bar, offset = board->first_offset, maxnr;
1321
1322 bar = FL_GET_BASE(board->flags);
1323 if (board->flags & FL_BASE_BARS)
1324 bar += idx;
1325 else
1326 offset += idx * board->uart_offset;
1327
Greg Kroah-Hartman2427ddd2006-06-12 17:07:52 -07001328 maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >>
1329 (board->reg_shift + 3);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001330
1331 if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
1332 return 1;
Alan Cox5756ee92008-02-08 04:18:51 -08001333
Russell King70db3d92005-07-27 11:34:27 +01001334 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001335}
1336
Angelo Butti94341472013-10-15 22:41:10 +03001337static int pci_pericom_setup(struct serial_private *priv,
1338 const struct pciserial_board *board,
1339 struct uart_8250_port *port, int idx)
1340{
1341 unsigned int bar, offset = board->first_offset, maxnr;
1342
1343 bar = FL_GET_BASE(board->flags);
1344 if (board->flags & FL_BASE_BARS)
1345 bar += idx;
1346 else
1347 offset += idx * board->uart_offset;
1348
1349 maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >>
1350 (board->reg_shift + 3);
1351
1352 if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
1353 return 1;
1354
1355 port->port.uartclk = 14745600;
1356
1357 return setup_port(priv, port, bar, offset, board->reg_shift);
1358}
1359
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001360static int
1361ce4100_serial_setup(struct serial_private *priv,
1362 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001363 struct uart_8250_port *port, int idx)
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001364{
1365 int ret;
1366
Maxime Bizon08ec2122012-10-19 10:45:07 +02001367 ret = setup_port(priv, port, idx, 0, board->reg_shift);
Alan Cox2655a2c2012-07-12 12:59:50 +01001368 port->port.iotype = UPIO_MEM32;
1369 port->port.type = PORT_XSCALE;
1370 port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1371 port->port.regshift = 2;
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001372
1373 return ret;
1374}
1375
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001376#define PCI_DEVICE_ID_INTEL_BYT_UART1 0x0f0a
1377#define PCI_DEVICE_ID_INTEL_BYT_UART2 0x0f0c
1378
Alan Cox29897082014-08-19 20:29:23 +03001379#define PCI_DEVICE_ID_INTEL_BSW_UART1 0x228a
1380#define PCI_DEVICE_ID_INTEL_BSW_UART2 0x228c
1381
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001382#define BYT_PRV_CLK 0x800
1383#define BYT_PRV_CLK_EN (1 << 0)
1384#define BYT_PRV_CLK_M_VAL_SHIFT 1
1385#define BYT_PRV_CLK_N_VAL_SHIFT 16
1386#define BYT_PRV_CLK_UPDATE (1 << 31)
1387
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001388#define BYT_TX_OVF_INT 0x820
1389#define BYT_TX_OVF_INT_MASK (1 << 1)
1390
1391static void
1392byt_set_termios(struct uart_port *p, struct ktermios *termios,
1393 struct ktermios *old)
1394{
1395 unsigned int baud = tty_termios_baud_rate(termios);
Andy Shevchenko21947ba2015-03-13 18:51:12 +02001396 unsigned long fref = 100000000, fuart = baud * 16;
1397 unsigned long w = BIT(15) - 1;
1398 unsigned long m, n;
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001399 u32 reg;
1400
Andy Shevchenko21947ba2015-03-13 18:51:12 +02001401 /* Get Fuart closer to Fref */
1402 fuart *= rounddown_pow_of_two(fref / fuart);
1403
Aaron Sierra50825c52014-03-03 19:54:29 -06001404 /*
1405 * For baud rates 0.5M, 1M, 1.5M, 2M, 2.5M, 3M, 3.5M and 4M the
1406 * dividers must be adjusted.
1407 *
1408 * uartclk = (m / n) * 100 MHz, where m <= n
1409 */
Andy Shevchenko21947ba2015-03-13 18:51:12 +02001410 rational_best_approximation(fuart, fref, w, w, &m, &n);
1411 p->uartclk = fuart;
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001412
1413 /* Reset the clock */
1414 reg = (m << BYT_PRV_CLK_M_VAL_SHIFT) | (n << BYT_PRV_CLK_N_VAL_SHIFT);
1415 writel(reg, p->membase + BYT_PRV_CLK);
1416 reg |= BYT_PRV_CLK_EN | BYT_PRV_CLK_UPDATE;
1417 writel(reg, p->membase + BYT_PRV_CLK);
1418
Qipeng Zha0a6c3012015-07-29 18:23:32 +08001419 p->status &= ~UPSTAT_AUTOCTS;
1420 if (termios->c_cflag & CRTSCTS)
1421 p->status |= UPSTAT_AUTOCTS;
1422
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001423 serial8250_do_set_termios(p, termios, old);
1424}
1425
1426static bool byt_dma_filter(struct dma_chan *chan, void *param)
1427{
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001428 struct dw_dma_slave *dws = param;
1429
1430 if (dws->dma_dev != chan->device->dev)
1431 return false;
1432
1433 chan->private = dws;
1434 return true;
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001435}
1436
1437static int
1438byt_serial_setup(struct serial_private *priv,
1439 const struct pciserial_board *board,
1440 struct uart_8250_port *port, int idx)
1441{
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001442 struct pci_dev *pdev = priv->dev;
1443 struct device *dev = port->port.dev;
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001444 struct uart_8250_dma *dma;
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001445 struct dw_dma_slave *tx_param, *rx_param;
1446 struct pci_dev *dma_dev;
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001447 int ret;
1448
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001449 dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL);
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001450 if (!dma)
1451 return -ENOMEM;
1452
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001453 tx_param = devm_kzalloc(dev, sizeof(*tx_param), GFP_KERNEL);
1454 if (!tx_param)
1455 return -ENOMEM;
1456
1457 rx_param = devm_kzalloc(dev, sizeof(*rx_param), GFP_KERNEL);
1458 if (!rx_param)
1459 return -ENOMEM;
1460
1461 switch (pdev->device) {
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001462 case PCI_DEVICE_ID_INTEL_BYT_UART1:
Alan Cox29897082014-08-19 20:29:23 +03001463 case PCI_DEVICE_ID_INTEL_BSW_UART1:
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001464 rx_param->src_id = 3;
1465 tx_param->dst_id = 2;
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001466 break;
1467 case PCI_DEVICE_ID_INTEL_BYT_UART2:
Alan Cox29897082014-08-19 20:29:23 +03001468 case PCI_DEVICE_ID_INTEL_BSW_UART2:
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001469 rx_param->src_id = 5;
1470 tx_param->dst_id = 4;
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001471 break;
1472 default:
1473 return -EINVAL;
1474 }
1475
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001476 rx_param->src_master = 1;
1477 rx_param->dst_master = 0;
1478
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001479 dma->rxconf.src_maxburst = 16;
1480
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001481 tx_param->src_master = 1;
1482 tx_param->dst_master = 0;
1483
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001484 dma->txconf.dst_maxburst = 16;
1485
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001486 dma_dev = pci_get_slot(pdev->bus, PCI_DEVFN(PCI_SLOT(pdev->devfn), 0));
1487 rx_param->dma_dev = &dma_dev->dev;
1488 tx_param->dma_dev = &dma_dev->dev;
1489
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001490 dma->fn = byt_dma_filter;
Andy Shevchenko9a1870c2014-08-19 20:29:22 +03001491 dma->rx_param = rx_param;
1492 dma->tx_param = tx_param;
Heikki Krogerusb15e5692013-09-27 10:52:59 +03001493
1494 ret = pci_default_setup(priv, board, port, idx);
1495 port->port.iotype = UPIO_MEM;
1496 port->port.type = PORT_16550A;
1497 port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1498 port->port.set_termios = byt_set_termios;
1499 port->port.fifosize = 64;
1500 port->tx_loadsz = 64;
1501 port->dma = dma;
1502 port->capabilities = UART_CAP_FIFO | UART_CAP_AFE;
1503
1504 /* Disable Tx counter interrupts */
1505 writel(BYT_TX_OVF_INT_MASK, port->port.membase + BYT_TX_OVF_INT);
1506
1507 return ret;
1508}
1509
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001510static int
1511pci_omegapci_setup(struct serial_private *priv,
Alan Cox1798ca12011-05-24 12:35:48 +01001512 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001513 struct uart_8250_port *port, int idx)
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001514{
1515 return setup_port(priv, port, 2, idx * 8, 0);
1516}
1517
Stephen Hurdebebd492013-01-17 14:14:53 -08001518static int
1519pci_brcm_trumanage_setup(struct serial_private *priv,
1520 const struct pciserial_board *board,
1521 struct uart_8250_port *port, int idx)
1522{
1523 int ret = pci_default_setup(priv, board, port, idx);
1524
1525 port->port.type = PORT_BRCM_TRUMANAGE;
1526 port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1527 return ret;
1528}
1529
Peter Hungfecf27a2015-07-28 11:59:24 +08001530/* RTS will control by MCR if this bit is 0 */
1531#define FINTEK_RTS_CONTROL_BY_HW BIT(4)
1532/* only worked with FINTEK_RTS_CONTROL_BY_HW on */
1533#define FINTEK_RTS_INVERT BIT(5)
1534
1535/* We should do proper H/W transceiver setting before change to RS485 mode */
1536static int pci_fintek_rs485_config(struct uart_port *port,
1537 struct serial_rs485 *rs485)
1538{
1539 u8 setting;
1540 u8 *index = (u8 *) port->private_data;
1541 struct pci_dev *pci_dev = container_of(port->dev, struct pci_dev,
1542 dev);
1543
1544 pci_read_config_byte(pci_dev, 0x40 + 8 * *index + 7, &setting);
1545
Peter Hungd3159452015-08-05 14:44:53 +08001546 if (!rs485)
1547 rs485 = &port->rs485;
1548 else if (rs485->flags & SER_RS485_ENABLED)
Peter Hungfecf27a2015-07-28 11:59:24 +08001549 memset(rs485->padding, 0, sizeof(rs485->padding));
1550 else
1551 memset(rs485, 0, sizeof(*rs485));
1552
1553 /* F81504/508/512 not support RTS delay before or after send */
1554 rs485->flags &= SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND;
1555
1556 if (rs485->flags & SER_RS485_ENABLED) {
1557 /* Enable RTS H/W control mode */
1558 setting |= FINTEK_RTS_CONTROL_BY_HW;
1559
1560 if (rs485->flags & SER_RS485_RTS_ON_SEND) {
1561 /* RTS driving high on TX */
1562 setting &= ~FINTEK_RTS_INVERT;
1563 } else {
1564 /* RTS driving low on TX */
1565 setting |= FINTEK_RTS_INVERT;
1566 }
1567
1568 rs485->delay_rts_after_send = 0;
1569 rs485->delay_rts_before_send = 0;
1570 } else {
1571 /* Disable RTS H/W control mode */
1572 setting &= ~(FINTEK_RTS_CONTROL_BY_HW | FINTEK_RTS_INVERT);
1573 }
1574
1575 pci_write_config_byte(pci_dev, 0x40 + 8 * *index + 7, setting);
Peter Hungd3159452015-08-05 14:44:53 +08001576
1577 if (rs485 != &port->rs485)
1578 port->rs485 = *rs485;
1579
Peter Hungfecf27a2015-07-28 11:59:24 +08001580 return 0;
1581}
1582
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001583static int pci_fintek_setup(struct serial_private *priv,
1584 const struct pciserial_board *board,
1585 struct uart_8250_port *port, int idx)
1586{
1587 struct pci_dev *pdev = priv->dev;
Peter Hungfecf27a2015-07-28 11:59:24 +08001588 u8 *data;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001589 u8 config_base;
Peter Hung6a8bc232015-04-01 14:00:21 +08001590 u16 iobase;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001591
Peter Hung6a8bc232015-04-01 14:00:21 +08001592 config_base = 0x40 + 0x08 * idx;
1593
1594 /* Get the io address from configuration space */
1595 pci_read_config_word(pdev, config_base + 4, &iobase);
1596
1597 dev_dbg(&pdev->dev, "%s: idx=%d iobase=0x%x", __func__, idx, iobase);
1598
1599 port->port.iotype = UPIO_PORT;
1600 port->port.iobase = iobase;
Peter Hungfecf27a2015-07-28 11:59:24 +08001601 port->port.rs485_config = pci_fintek_rs485_config;
1602
1603 data = devm_kzalloc(&pdev->dev, sizeof(u8), GFP_KERNEL);
1604 if (!data)
1605 return -ENOMEM;
1606
1607 /* preserve index in PCI configuration space */
1608 *data = idx;
1609 port->port.private_data = data;
Peter Hung6a8bc232015-04-01 14:00:21 +08001610
1611 return 0;
1612}
1613
1614static int pci_fintek_init(struct pci_dev *dev)
1615{
1616 unsigned long iobase;
1617 u32 max_port, i;
1618 u32 bar_data[3];
1619 u8 config_base;
Peter Hungd3159452015-08-05 14:44:53 +08001620 struct serial_private *priv = pci_get_drvdata(dev);
1621 struct uart_8250_port *port;
Peter Hung6a8bc232015-04-01 14:00:21 +08001622
1623 switch (dev->device) {
1624 case 0x1104: /* 4 ports */
1625 case 0x1108: /* 8 ports */
1626 max_port = dev->device & 0xff;
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001627 break;
Peter Hung6a8bc232015-04-01 14:00:21 +08001628 case 0x1112: /* 12 ports */
1629 max_port = 12;
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001630 break;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001631 default:
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001632 return -EINVAL;
1633 }
1634
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001635 /* Get the io address dispatch from the BIOS */
Peter Hung6a8bc232015-04-01 14:00:21 +08001636 pci_read_config_dword(dev, 0x24, &bar_data[0]);
1637 pci_read_config_dword(dev, 0x20, &bar_data[1]);
1638 pci_read_config_dword(dev, 0x1c, &bar_data[2]);
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001639
Peter Hung6a8bc232015-04-01 14:00:21 +08001640 for (i = 0; i < max_port; ++i) {
1641 /* UART0 configuration offset start from 0x40 */
1642 config_base = 0x40 + 0x08 * i;
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001643
Peter Hung6a8bc232015-04-01 14:00:21 +08001644 /* Calculate Real IO Port */
1645 iobase = (bar_data[i / 4] & 0xffffffe0) + (i % 4) * 8;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001646
Peter Hung6a8bc232015-04-01 14:00:21 +08001647 /* Enable UART I/O port */
1648 pci_write_config_byte(dev, config_base + 0x00, 0x01);
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001649
Peter Hung6a8bc232015-04-01 14:00:21 +08001650 /* Select 128-byte FIFO and 8x FIFO threshold */
1651 pci_write_config_byte(dev, config_base + 0x01, 0x33);
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001652
Peter Hung6a8bc232015-04-01 14:00:21 +08001653 /* LSB UART */
1654 pci_write_config_byte(dev, config_base + 0x04,
1655 (u8)(iobase & 0xff));
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001656
Peter Hung6a8bc232015-04-01 14:00:21 +08001657 /* MSB UART */
1658 pci_write_config_byte(dev, config_base + 0x05,
1659 (u8)((iobase & 0xff00) >> 8));
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001660
Peter Hung6a8bc232015-04-01 14:00:21 +08001661 pci_write_config_byte(dev, config_base + 0x06, dev->irq);
Peter Hungfecf27a2015-07-28 11:59:24 +08001662
Peter Hungd3159452015-08-05 14:44:53 +08001663 if (priv) {
1664 /* re-apply RS232/485 mode when
1665 * pciserial_resume_ports()
1666 */
1667 port = serial8250_get_port(priv->line[i]);
1668 pci_fintek_rs485_config(&port->port, NULL);
1669 } else {
1670 /* First init without port data
1671 * force init to RS232 Mode
1672 */
1673 pci_write_config_byte(dev, config_base + 0x07, 0x01);
1674 }
Peter Hung6a8bc232015-04-01 14:00:21 +08001675 }
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001676
Peter Hung6a8bc232015-04-01 14:00:21 +08001677 return max_port;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001678}
1679
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001680static int skip_tx_en_setup(struct serial_private *priv,
1681 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001682 struct uart_8250_port *port, int idx)
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001683{
Alan Cox2655a2c2012-07-12 12:59:50 +01001684 port->port.flags |= UPF_NO_TXEN_TEST;
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07001685 dev_dbg(&priv->dev->dev,
1686 "serial8250: skipping TxEn test for device [%04x:%04x] subsystem [%04x:%04x]\n",
1687 priv->dev->vendor, priv->dev->device,
1688 priv->dev->subsystem_vendor, priv->dev->subsystem_device);
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001689
1690 return pci_default_setup(priv, board, port, idx);
1691}
1692
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -07001693static void kt_handle_break(struct uart_port *p)
1694{
Andy Shevchenkob1261c82014-07-14 14:26:14 +03001695 struct uart_8250_port *up = up_to_u8250p(p);
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -07001696 /*
1697 * On receipt of a BI, serial device in Intel ME (Intel
1698 * management engine) needs to have its fifos cleared for sane
1699 * SOL (Serial Over Lan) output.
1700 */
1701 serial8250_clear_and_reinit_fifos(up);
1702}
1703
1704static unsigned int kt_serial_in(struct uart_port *p, int offset)
1705{
Andy Shevchenkob1261c82014-07-14 14:26:14 +03001706 struct uart_8250_port *up = up_to_u8250p(p);
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -07001707 unsigned int val;
1708
1709 /*
1710 * When the Intel ME (management engine) gets reset its serial
1711 * port registers could return 0 momentarily. Functions like
1712 * serial8250_console_write, read and save the IER, perform
1713 * some operation and then restore it. In order to avoid
1714 * setting IER register inadvertently to 0, if the value read
1715 * is 0, double check with ier value in uart_8250_port and use
1716 * that instead. up->ier should be the same value as what is
1717 * currently configured.
1718 */
1719 val = inb(p->iobase + offset);
1720 if (offset == UART_IER) {
1721 if (val == 0)
1722 val = up->ier;
1723 }
1724 return val;
1725}
1726
Dan Williamsbc02d152012-04-06 11:49:50 -07001727static int kt_serial_setup(struct serial_private *priv,
1728 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001729 struct uart_8250_port *port, int idx)
Dan Williamsbc02d152012-04-06 11:49:50 -07001730{
Alan Cox2655a2c2012-07-12 12:59:50 +01001731 port->port.flags |= UPF_BUG_THRE;
1732 port->port.serial_in = kt_serial_in;
1733 port->port.handle_break = kt_handle_break;
Dan Williamsbc02d152012-04-06 11:49:50 -07001734 return skip_tx_en_setup(priv, board, port, idx);
1735}
1736
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001737static int pci_eg20t_init(struct pci_dev *dev)
1738{
1739#if defined(CONFIG_SERIAL_PCH_UART) || defined(CONFIG_SERIAL_PCH_UART_MODULE)
1740 return -ENODEV;
1741#else
1742 return 0;
1743#endif
1744}
1745
Soeren Grunewald899f0c12015-06-11 09:25:05 +02001746#define PCI_DEVICE_ID_EXAR_XR17V4358 0x4358
1747#define PCI_DEVICE_ID_EXAR_XR17V8358 0x8358
1748
Søren Holm06315342011-09-02 22:55:37 +02001749static int
1750pci_xr17c154_setup(struct serial_private *priv,
1751 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001752 struct uart_8250_port *port, int idx)
Søren Holm06315342011-09-02 22:55:37 +02001753{
Alan Cox2655a2c2012-07-12 12:59:50 +01001754 port->port.flags |= UPF_EXAR_EFR;
Søren Holm06315342011-09-02 22:55:37 +02001755 return pci_default_setup(priv, board, port, idx);
1756}
1757
Soeren Grunewald899f0c12015-06-11 09:25:05 +02001758static inline int
1759xr17v35x_has_slave(struct serial_private *priv)
1760{
1761 const int dev_id = priv->dev->device;
1762
1763 return ((dev_id == PCI_DEVICE_ID_EXAR_XR17V4358) ||
1764 (dev_id == PCI_DEVICE_ID_EXAR_XR17V8358));
1765}
1766
Guainluca Anzolin6971c632012-09-04 15:56:12 +01001767static int
Matt Schultedc96efb2012-11-19 09:12:04 -06001768pci_xr17v35x_setup(struct serial_private *priv,
1769 const struct pciserial_board *board,
1770 struct uart_8250_port *port, int idx)
1771{
1772 u8 __iomem *p;
1773
1774 p = pci_ioremap_bar(priv->dev, 0);
Matt Schulte13c32372012-11-21 10:39:18 -06001775 if (p == NULL)
1776 return -ENOMEM;
Matt Schultedc96efb2012-11-19 09:12:04 -06001777
1778 port->port.flags |= UPF_EXAR_EFR;
1779
1780 /*
Soeren Grunewald899f0c12015-06-11 09:25:05 +02001781 * Setup the uart clock for the devices on expansion slot to
1782 * half the clock speed of the main chip (which is 125MHz)
1783 */
1784 if (xr17v35x_has_slave(priv) && idx >= 8)
1785 port->port.uartclk = (7812500 * 16 / 2);
1786
1787 /*
Matt Schultedc96efb2012-11-19 09:12:04 -06001788 * Setup Multipurpose Input/Output pins.
1789 */
1790 if (idx == 0) {
1791 writeb(0x00, p + 0x8f); /*MPIOINT[7:0]*/
1792 writeb(0x00, p + 0x90); /*MPIOLVL[7:0]*/
1793 writeb(0x00, p + 0x91); /*MPIO3T[7:0]*/
1794 writeb(0x00, p + 0x92); /*MPIOINV[7:0]*/
1795 writeb(0x00, p + 0x93); /*MPIOSEL[7:0]*/
1796 writeb(0x00, p + 0x94); /*MPIOOD[7:0]*/
1797 writeb(0x00, p + 0x95); /*MPIOINT[15:8]*/
1798 writeb(0x00, p + 0x96); /*MPIOLVL[15:8]*/
1799 writeb(0x00, p + 0x97); /*MPIO3T[15:8]*/
1800 writeb(0x00, p + 0x98); /*MPIOINV[15:8]*/
1801 writeb(0x00, p + 0x99); /*MPIOSEL[15:8]*/
1802 writeb(0x00, p + 0x9a); /*MPIOOD[15:8]*/
1803 }
Matt Schultef965b9c2012-11-20 11:25:40 -06001804 writeb(0x00, p + UART_EXAR_8XMODE);
1805 writeb(UART_FCTR_EXAR_TRGD, p + UART_EXAR_FCTR);
1806 writeb(128, p + UART_EXAR_TXTRG);
1807 writeb(128, p + UART_EXAR_RXTRG);
Matt Schultedc96efb2012-11-19 09:12:04 -06001808 iounmap(p);
1809
1810 return pci_default_setup(priv, board, port, idx);
1811}
1812
Matt Schulte14faa8c2012-11-21 10:35:15 -06001813#define PCI_DEVICE_ID_COMMTECH_4222PCI335 0x0004
1814#define PCI_DEVICE_ID_COMMTECH_4224PCI335 0x0002
1815#define PCI_DEVICE_ID_COMMTECH_2324PCI335 0x000a
1816#define PCI_DEVICE_ID_COMMTECH_2328PCI335 0x000b
1817
1818static int
1819pci_fastcom335_setup(struct serial_private *priv,
1820 const struct pciserial_board *board,
1821 struct uart_8250_port *port, int idx)
1822{
1823 u8 __iomem *p;
1824
1825 p = pci_ioremap_bar(priv->dev, 0);
1826 if (p == NULL)
1827 return -ENOMEM;
1828
1829 port->port.flags |= UPF_EXAR_EFR;
1830
1831 /*
1832 * Setup Multipurpose Input/Output pins.
1833 */
1834 if (idx == 0) {
1835 switch (priv->dev->device) {
1836 case PCI_DEVICE_ID_COMMTECH_4222PCI335:
1837 case PCI_DEVICE_ID_COMMTECH_4224PCI335:
1838 writeb(0x78, p + 0x90); /* MPIOLVL[7:0] */
1839 writeb(0x00, p + 0x92); /* MPIOINV[7:0] */
1840 writeb(0x00, p + 0x93); /* MPIOSEL[7:0] */
1841 break;
1842 case PCI_DEVICE_ID_COMMTECH_2324PCI335:
1843 case PCI_DEVICE_ID_COMMTECH_2328PCI335:
1844 writeb(0x00, p + 0x90); /* MPIOLVL[7:0] */
1845 writeb(0xc0, p + 0x92); /* MPIOINV[7:0] */
1846 writeb(0xc0, p + 0x93); /* MPIOSEL[7:0] */
1847 break;
1848 }
1849 writeb(0x00, p + 0x8f); /* MPIOINT[7:0] */
1850 writeb(0x00, p + 0x91); /* MPIO3T[7:0] */
1851 writeb(0x00, p + 0x94); /* MPIOOD[7:0] */
1852 }
1853 writeb(0x00, p + UART_EXAR_8XMODE);
1854 writeb(UART_FCTR_EXAR_TRGD, p + UART_EXAR_FCTR);
1855 writeb(32, p + UART_EXAR_TXTRG);
1856 writeb(32, p + UART_EXAR_RXTRG);
1857 iounmap(p);
1858
1859 return pci_default_setup(priv, board, port, idx);
1860}
1861
Matt Schultedc96efb2012-11-19 09:12:04 -06001862static int
Guainluca Anzolin6971c632012-09-04 15:56:12 +01001863pci_wch_ch353_setup(struct serial_private *priv,
1864 const struct pciserial_board *board,
1865 struct uart_8250_port *port, int idx)
1866{
1867 port->port.flags |= UPF_FIXED_TYPE;
1868 port->port.type = PORT_16550A;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001869 return pci_default_setup(priv, board, port, idx);
1870}
1871
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03001872static int
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03001873pci_wch_ch38x_setup(struct serial_private *priv,
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03001874 const struct pciserial_board *board,
1875 struct uart_8250_port *port, int idx)
1876{
1877 port->port.flags |= UPF_FIXED_TYPE;
1878 port->port.type = PORT_16850;
1879 return pci_default_setup(priv, board, port, idx);
1880}
1881
Linus Torvalds1da177e2005-04-16 15:20:36 -07001882#define PCI_VENDOR_ID_SBSMODULARIO 0x124B
1883#define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B
1884#define PCI_DEVICE_ID_OCTPRO 0x0001
1885#define PCI_SUBDEVICE_ID_OCTPRO232 0x0108
1886#define PCI_SUBDEVICE_ID_OCTPRO422 0x0208
1887#define PCI_SUBDEVICE_ID_POCTAL232 0x0308
1888#define PCI_SUBDEVICE_ID_POCTAL422 0x0408
Flavio Leitner26e82202012-09-21 21:04:34 -03001889#define PCI_SUBDEVICE_ID_SIIG_DUAL_00 0x2500
1890#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 0x2530
Michael Bramer78d70d42009-01-27 11:51:16 +00001891#define PCI_VENDOR_ID_ADVANTECH 0x13fe
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001892#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66
Michael Bramer78d70d42009-01-27 11:51:16 +00001893#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620
Thomee Wright0c6d7742014-05-19 20:30:51 +00001894#define PCI_DEVICE_ID_ADVANTECH_PCI3618 0x3618
1895#define PCI_DEVICE_ID_ADVANTECH_PCIf618 0xf618
Yegor Yefremov66169ad2010-06-04 09:58:18 +02001896#define PCI_DEVICE_ID_TITAN_200I 0x8028
1897#define PCI_DEVICE_ID_TITAN_400I 0x8048
1898#define PCI_DEVICE_ID_TITAN_800I 0x8088
1899#define PCI_DEVICE_ID_TITAN_800EH 0xA007
1900#define PCI_DEVICE_ID_TITAN_800EHB 0xA008
1901#define PCI_DEVICE_ID_TITAN_400EH 0xA009
1902#define PCI_DEVICE_ID_TITAN_100E 0xA010
1903#define PCI_DEVICE_ID_TITAN_200E 0xA012
1904#define PCI_DEVICE_ID_TITAN_400E 0xA013
1905#define PCI_DEVICE_ID_TITAN_800E 0xA014
1906#define PCI_DEVICE_ID_TITAN_200EI 0xA016
1907#define PCI_DEVICE_ID_TITAN_200EISI 0xA017
Yegor Yefremov48c02472013-12-09 12:11:15 +01001908#define PCI_DEVICE_ID_TITAN_200V3 0xA306
Yegor Yefremov1e9deb12011-12-27 15:47:37 +01001909#define PCI_DEVICE_ID_TITAN_400V3 0xA310
1910#define PCI_DEVICE_ID_TITAN_410V3 0xA312
1911#define PCI_DEVICE_ID_TITAN_800V3 0xA314
1912#define PCI_DEVICE_ID_TITAN_800V3B 0xA315
Lytochkin Borise8470032010-07-26 10:02:26 +04001913#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538
Scott Kilauaa273ae2011-05-11 15:41:59 -05001914#define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001915#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001
Dan Williamsbc02d152012-04-06 11:49:50 -07001916#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d
Alan Cox27788c52012-09-04 16:21:06 +01001917#define PCI_VENDOR_ID_WCH 0x4348
Wang YanQing8b5c9132013-03-05 23:16:48 +08001918#define PCI_DEVICE_ID_WCH_CH352_2S 0x3253
Alan Cox27788c52012-09-04 16:21:06 +01001919#define PCI_DEVICE_ID_WCH_CH353_4S 0x3453
1920#define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046
Ezequiel Garciafeb58142014-05-24 15:24:51 -03001921#define PCI_DEVICE_ID_WCH_CH353_1S1P 0x5053
Alan Cox27788c52012-09-04 16:21:06 +01001922#define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053
Alan Cox66835492012-08-16 12:01:33 +01001923#define PCI_VENDOR_ID_AGESTAR 0x5372
1924#define PCI_DEVICE_ID_AGESTAR_9375 0x6872
Alan Coxeb26dfe2012-07-12 13:00:31 +01001925#define PCI_VENDOR_ID_ASIX 0x9710
Matt Schulte14faa8c2012-11-21 10:35:15 -06001926#define PCI_DEVICE_ID_COMMTECH_4224PCIE 0x0020
1927#define PCI_DEVICE_ID_COMMTECH_4228PCIE 0x0021
Matt Schulteb7b90412012-12-06 22:19:59 -06001928#define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0022
Stephen Hurdebebd492013-01-17 14:14:53 -08001929#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a
Ian Abbott57c1f0e2013-07-16 16:14:40 +01001930#define PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800 0x818e
Bryan O'Donoghue1ede7dc2014-09-23 01:21:11 +01001931#define PCI_DEVICE_ID_INTEL_QRK_UART 0x0936
Matt Schulte14faa8c2012-11-21 10:35:15 -06001932
Stephen Chiversabd7bac2013-01-28 19:49:20 +11001933#define PCI_VENDOR_ID_SUNIX 0x1fd4
1934#define PCI_DEVICE_ID_SUNIX_1999 0x1999
1935
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03001936#define PCIE_VENDOR_ID_WCH 0x1c00
1937#define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03001938#define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470
Linus Torvalds1da177e2005-04-16 15:20:36 -07001939
Adam Lee89c043a2015-08-03 13:28:13 +08001940#define PCI_VENDOR_ID_PERICOM 0x12D8
1941#define PCI_DEVICE_ID_PERICOM_PI7C9X7951 0x7951
1942#define PCI_DEVICE_ID_PERICOM_PI7C9X7952 0x7952
1943#define PCI_DEVICE_ID_PERICOM_PI7C9X7954 0x7954
1944#define PCI_DEVICE_ID_PERICOM_PI7C9X7958 0x7958
1945
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001946/* Unknown vendors/cards - this should not be in linux/pci_ids.h */
1947#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
Scott Ashcroftd13402a2013-03-03 21:35:06 +00001948#define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001949
Linus Torvalds1da177e2005-04-16 15:20:36 -07001950/*
1951 * Master list of serial port init/setup/exit quirks.
1952 * This does not describe the general nature of the port.
1953 * (ie, baud base, number and location of ports, etc)
1954 *
1955 * This list is ordered alphabetically by vendor then device.
1956 * Specific entries must come before more generic entries.
1957 */
Sam Ravnborg7a63ce52008-04-28 02:14:02 -07001958static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001959 /*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08001960 * ADDI-DATA GmbH communication cards <info@addi-data.com>
1961 */
1962 {
Ian Abbott086231f2013-07-16 16:14:39 +01001963 .vendor = PCI_VENDOR_ID_AMCC,
Ian Abbott57c1f0e2013-07-16 16:14:40 +01001964 .device = PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800,
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08001965 .subvendor = PCI_ANY_ID,
1966 .subdevice = PCI_ANY_ID,
1967 .setup = addidata_apci7800_setup,
1968 },
1969 /*
Russell King61a116e2006-07-03 15:22:35 +01001970 * AFAVLAB cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07001971 * It is not clear whether this applies to all products.
1972 */
1973 {
1974 .vendor = PCI_VENDOR_ID_AFAVLAB,
1975 .device = PCI_ANY_ID,
1976 .subvendor = PCI_ANY_ID,
1977 .subdevice = PCI_ANY_ID,
1978 .setup = afavlab_setup,
1979 },
1980 /*
1981 * HP Diva
1982 */
1983 {
1984 .vendor = PCI_VENDOR_ID_HP,
1985 .device = PCI_DEVICE_ID_HP_DIVA,
1986 .subvendor = PCI_ANY_ID,
1987 .subdevice = PCI_ANY_ID,
1988 .init = pci_hp_diva_init,
1989 .setup = pci_hp_diva_setup,
1990 },
1991 /*
1992 * Intel
1993 */
1994 {
1995 .vendor = PCI_VENDOR_ID_INTEL,
1996 .device = PCI_DEVICE_ID_INTEL_80960_RP,
1997 .subvendor = 0xe4bf,
1998 .subdevice = PCI_ANY_ID,
1999 .init = pci_inteli960ni_init,
2000 .setup = pci_default_setup,
2001 },
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08002002 {
2003 .vendor = PCI_VENDOR_ID_INTEL,
2004 .device = PCI_DEVICE_ID_INTEL_8257X_SOL,
2005 .subvendor = PCI_ANY_ID,
2006 .subdevice = PCI_ANY_ID,
2007 .setup = skip_tx_en_setup,
2008 },
2009 {
2010 .vendor = PCI_VENDOR_ID_INTEL,
2011 .device = PCI_DEVICE_ID_INTEL_82573L_SOL,
2012 .subvendor = PCI_ANY_ID,
2013 .subdevice = PCI_ANY_ID,
2014 .setup = skip_tx_en_setup,
2015 },
2016 {
2017 .vendor = PCI_VENDOR_ID_INTEL,
2018 .device = PCI_DEVICE_ID_INTEL_82573E_SOL,
2019 .subvendor = PCI_ANY_ID,
2020 .subdevice = PCI_ANY_ID,
2021 .setup = skip_tx_en_setup,
2022 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08002023 {
2024 .vendor = PCI_VENDOR_ID_INTEL,
2025 .device = PCI_DEVICE_ID_INTEL_CE4100_UART,
2026 .subvendor = PCI_ANY_ID,
2027 .subdevice = PCI_ANY_ID,
2028 .setup = ce4100_serial_setup,
2029 },
Dan Williamsbc02d152012-04-06 11:49:50 -07002030 {
2031 .vendor = PCI_VENDOR_ID_INTEL,
2032 .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT,
2033 .subvendor = PCI_ANY_ID,
2034 .subdevice = PCI_ANY_ID,
2035 .setup = kt_serial_setup,
2036 },
Heikki Krogerusb15e5692013-09-27 10:52:59 +03002037 {
2038 .vendor = PCI_VENDOR_ID_INTEL,
2039 .device = PCI_DEVICE_ID_INTEL_BYT_UART1,
2040 .subvendor = PCI_ANY_ID,
2041 .subdevice = PCI_ANY_ID,
2042 .setup = byt_serial_setup,
2043 },
2044 {
2045 .vendor = PCI_VENDOR_ID_INTEL,
2046 .device = PCI_DEVICE_ID_INTEL_BYT_UART2,
2047 .subvendor = PCI_ANY_ID,
2048 .subdevice = PCI_ANY_ID,
2049 .setup = byt_serial_setup,
2050 },
Bryan O'Donoghue1ede7dc2014-09-23 01:21:11 +01002051 {
2052 .vendor = PCI_VENDOR_ID_INTEL,
Alan Cox29897082014-08-19 20:29:23 +03002053 .device = PCI_DEVICE_ID_INTEL_BSW_UART1,
2054 .subvendor = PCI_ANY_ID,
2055 .subdevice = PCI_ANY_ID,
2056 .setup = byt_serial_setup,
2057 },
2058 {
2059 .vendor = PCI_VENDOR_ID_INTEL,
2060 .device = PCI_DEVICE_ID_INTEL_BSW_UART2,
2061 .subvendor = PCI_ANY_ID,
2062 .subdevice = PCI_ANY_ID,
2063 .setup = byt_serial_setup,
2064 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002065 /*
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002066 * ITE
2067 */
2068 {
2069 .vendor = PCI_VENDOR_ID_ITE,
2070 .device = PCI_DEVICE_ID_ITE_8872,
2071 .subvendor = PCI_ANY_ID,
2072 .subdevice = PCI_ANY_ID,
2073 .init = pci_ite887x_init,
2074 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002075 .exit = pci_ite887x_exit,
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002076 },
2077 /*
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002078 * National Instruments
2079 */
2080 {
2081 .vendor = PCI_VENDOR_ID_NI,
Will Page04bf7e72009-04-06 17:32:15 +01002082 .device = PCI_DEVICE_ID_NI_PCI23216,
2083 .subvendor = PCI_ANY_ID,
2084 .subdevice = PCI_ANY_ID,
2085 .init = pci_ni8420_init,
2086 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002087 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002088 },
2089 {
2090 .vendor = PCI_VENDOR_ID_NI,
2091 .device = PCI_DEVICE_ID_NI_PCI2328,
2092 .subvendor = PCI_ANY_ID,
2093 .subdevice = PCI_ANY_ID,
2094 .init = pci_ni8420_init,
2095 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002096 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002097 },
2098 {
2099 .vendor = PCI_VENDOR_ID_NI,
2100 .device = PCI_DEVICE_ID_NI_PCI2324,
2101 .subvendor = PCI_ANY_ID,
2102 .subdevice = PCI_ANY_ID,
2103 .init = pci_ni8420_init,
2104 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002105 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002106 },
2107 {
2108 .vendor = PCI_VENDOR_ID_NI,
2109 .device = PCI_DEVICE_ID_NI_PCI2322,
2110 .subvendor = PCI_ANY_ID,
2111 .subdevice = PCI_ANY_ID,
2112 .init = pci_ni8420_init,
2113 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002114 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002115 },
2116 {
2117 .vendor = PCI_VENDOR_ID_NI,
2118 .device = PCI_DEVICE_ID_NI_PCI2324I,
2119 .subvendor = PCI_ANY_ID,
2120 .subdevice = PCI_ANY_ID,
2121 .init = pci_ni8420_init,
2122 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002123 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002124 },
2125 {
2126 .vendor = PCI_VENDOR_ID_NI,
2127 .device = PCI_DEVICE_ID_NI_PCI2322I,
2128 .subvendor = PCI_ANY_ID,
2129 .subdevice = PCI_ANY_ID,
2130 .init = pci_ni8420_init,
2131 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002132 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002133 },
2134 {
2135 .vendor = PCI_VENDOR_ID_NI,
2136 .device = PCI_DEVICE_ID_NI_PXI8420_23216,
2137 .subvendor = PCI_ANY_ID,
2138 .subdevice = PCI_ANY_ID,
2139 .init = pci_ni8420_init,
2140 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002141 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002142 },
2143 {
2144 .vendor = PCI_VENDOR_ID_NI,
2145 .device = PCI_DEVICE_ID_NI_PXI8420_2328,
2146 .subvendor = PCI_ANY_ID,
2147 .subdevice = PCI_ANY_ID,
2148 .init = pci_ni8420_init,
2149 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002150 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002151 },
2152 {
2153 .vendor = PCI_VENDOR_ID_NI,
2154 .device = PCI_DEVICE_ID_NI_PXI8420_2324,
2155 .subvendor = PCI_ANY_ID,
2156 .subdevice = PCI_ANY_ID,
2157 .init = pci_ni8420_init,
2158 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002159 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002160 },
2161 {
2162 .vendor = PCI_VENDOR_ID_NI,
2163 .device = PCI_DEVICE_ID_NI_PXI8420_2322,
2164 .subvendor = PCI_ANY_ID,
2165 .subdevice = PCI_ANY_ID,
2166 .init = pci_ni8420_init,
2167 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002168 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002169 },
2170 {
2171 .vendor = PCI_VENDOR_ID_NI,
2172 .device = PCI_DEVICE_ID_NI_PXI8422_2324,
2173 .subvendor = PCI_ANY_ID,
2174 .subdevice = PCI_ANY_ID,
2175 .init = pci_ni8420_init,
2176 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002177 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002178 },
2179 {
2180 .vendor = PCI_VENDOR_ID_NI,
2181 .device = PCI_DEVICE_ID_NI_PXI8422_2322,
2182 .subvendor = PCI_ANY_ID,
2183 .subdevice = PCI_ANY_ID,
2184 .init = pci_ni8420_init,
2185 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002186 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002187 },
2188 {
2189 .vendor = PCI_VENDOR_ID_NI,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002190 .device = PCI_ANY_ID,
2191 .subvendor = PCI_ANY_ID,
2192 .subdevice = PCI_ANY_ID,
2193 .init = pci_ni8430_init,
2194 .setup = pci_ni8430_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002195 .exit = pci_ni8430_exit,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002196 },
Alan Cox55c7c0f2012-11-29 09:03:00 +10302197 /* Quatech */
2198 {
2199 .vendor = PCI_VENDOR_ID_QUATECH,
2200 .device = PCI_ANY_ID,
2201 .subvendor = PCI_ANY_ID,
2202 .subdevice = PCI_ANY_ID,
2203 .init = pci_quatech_init,
2204 .setup = pci_quatech_setup,
Greg Kroah-Hartmand73dfc62013-01-15 22:44:48 -08002205 .exit = pci_quatech_exit,
Alan Cox55c7c0f2012-11-29 09:03:00 +10302206 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002207 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002208 * Panacom
2209 */
2210 {
2211 .vendor = PCI_VENDOR_ID_PANACOM,
2212 .device = PCI_DEVICE_ID_PANACOM_QUADMODEM,
2213 .subvendor = PCI_ANY_ID,
2214 .subdevice = PCI_ANY_ID,
2215 .init = pci_plx9050_init,
2216 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002217 .exit = pci_plx9050_exit,
Alan Cox5756ee92008-02-08 04:18:51 -08002218 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002219 {
2220 .vendor = PCI_VENDOR_ID_PANACOM,
2221 .device = PCI_DEVICE_ID_PANACOM_DUALMODEM,
2222 .subvendor = PCI_ANY_ID,
2223 .subdevice = PCI_ANY_ID,
2224 .init = pci_plx9050_init,
2225 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002226 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002227 },
2228 /*
Angelo Butti94341472013-10-15 22:41:10 +03002229 * Pericom
2230 */
2231 {
Adam Lee89c043a2015-08-03 13:28:13 +08002232 .vendor = PCI_VENDOR_ID_PERICOM,
2233 .device = PCI_ANY_ID,
2234 .subvendor = PCI_ANY_ID,
2235 .subdevice = PCI_ANY_ID,
2236 .setup = pci_pericom_setup,
Angelo Butti94341472013-10-15 22:41:10 +03002237 },
Angelo Butti94341472013-10-15 22:41:10 +03002238 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002239 * PLX
2240 */
2241 {
2242 .vendor = PCI_VENDOR_ID_PLX,
2243 .device = PCI_DEVICE_ID_PLX_9050,
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01002244 .subvendor = PCI_SUBVENDOR_ID_EXSYS,
2245 .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055,
2246 .init = pci_plx9050_init,
2247 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002248 .exit = pci_plx9050_exit,
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01002249 },
2250 {
2251 .vendor = PCI_VENDOR_ID_PLX,
2252 .device = PCI_DEVICE_ID_PLX_9050,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002253 .subvendor = PCI_SUBVENDOR_ID_KEYSPAN,
2254 .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2,
2255 .init = pci_plx9050_init,
2256 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002257 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002258 },
2259 {
2260 .vendor = PCI_VENDOR_ID_PLX,
2261 .device = PCI_DEVICE_ID_PLX_ROMULUS,
2262 .subvendor = PCI_VENDOR_ID_PLX,
2263 .subdevice = PCI_DEVICE_ID_PLX_ROMULUS,
2264 .init = pci_plx9050_init,
2265 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002266 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002267 },
2268 /*
2269 * SBS Technologies, Inc., PMC-OCTALPRO 232
2270 */
2271 {
2272 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
2273 .device = PCI_DEVICE_ID_OCTPRO,
2274 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
2275 .subdevice = PCI_SUBDEVICE_ID_OCTPRO232,
2276 .init = sbs_init,
2277 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002278 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002279 },
2280 /*
2281 * SBS Technologies, Inc., PMC-OCTALPRO 422
2282 */
2283 {
2284 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
2285 .device = PCI_DEVICE_ID_OCTPRO,
2286 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
2287 .subdevice = PCI_SUBDEVICE_ID_OCTPRO422,
2288 .init = sbs_init,
2289 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002290 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002291 },
2292 /*
2293 * SBS Technologies, Inc., P-Octal 232
2294 */
2295 {
2296 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
2297 .device = PCI_DEVICE_ID_OCTPRO,
2298 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
2299 .subdevice = PCI_SUBDEVICE_ID_POCTAL232,
2300 .init = sbs_init,
2301 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002302 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002303 },
2304 /*
2305 * SBS Technologies, Inc., P-Octal 422
2306 */
2307 {
2308 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
2309 .device = PCI_DEVICE_ID_OCTPRO,
2310 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
2311 .subdevice = PCI_SUBDEVICE_ID_POCTAL422,
2312 .init = sbs_init,
2313 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002314 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002315 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002316 /*
Russell King61a116e2006-07-03 15:22:35 +01002317 * SIIG cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07002318 */
2319 {
2320 .vendor = PCI_VENDOR_ID_SIIG,
Russell King67d74b82005-07-27 11:33:03 +01002321 .device = PCI_ANY_ID,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002322 .subvendor = PCI_ANY_ID,
2323 .subdevice = PCI_ANY_ID,
Russell King67d74b82005-07-27 11:33:03 +01002324 .init = pci_siig_init,
Andrey Panin3ec9c592006-02-02 20:15:09 +00002325 .setup = pci_siig_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002326 },
2327 /*
2328 * Titan cards
2329 */
2330 {
2331 .vendor = PCI_VENDOR_ID_TITAN,
2332 .device = PCI_DEVICE_ID_TITAN_400L,
2333 .subvendor = PCI_ANY_ID,
2334 .subdevice = PCI_ANY_ID,
2335 .setup = titan_400l_800l_setup,
2336 },
2337 {
2338 .vendor = PCI_VENDOR_ID_TITAN,
2339 .device = PCI_DEVICE_ID_TITAN_800L,
2340 .subvendor = PCI_ANY_ID,
2341 .subdevice = PCI_ANY_ID,
2342 .setup = titan_400l_800l_setup,
2343 },
2344 /*
2345 * Timedia cards
2346 */
2347 {
2348 .vendor = PCI_VENDOR_ID_TIMEDIA,
2349 .device = PCI_DEVICE_ID_TIMEDIA_1889,
2350 .subvendor = PCI_VENDOR_ID_TIMEDIA,
2351 .subdevice = PCI_ANY_ID,
Frédéric Brièreb9b24552011-05-29 15:08:04 -04002352 .probe = pci_timedia_probe,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002353 .init = pci_timedia_init,
2354 .setup = pci_timedia_setup,
2355 },
2356 {
2357 .vendor = PCI_VENDOR_ID_TIMEDIA,
2358 .device = PCI_ANY_ID,
2359 .subvendor = PCI_ANY_ID,
2360 .subdevice = PCI_ANY_ID,
2361 .setup = pci_timedia_setup,
2362 },
2363 /*
Stephen Chiversabd7bac2013-01-28 19:49:20 +11002364 * SUNIX (Timedia) cards
2365 * Do not "probe" for these cards as there is at least one combination
2366 * card that should be handled by parport_pc that doesn't match the
2367 * rule in pci_timedia_probe.
2368 * It is part number is MIO5079A but its subdevice ID is 0x0102.
2369 * There are some boards with part number SER5037AL that report
2370 * subdevice ID 0x0002.
2371 */
2372 {
2373 .vendor = PCI_VENDOR_ID_SUNIX,
2374 .device = PCI_DEVICE_ID_SUNIX_1999,
2375 .subvendor = PCI_VENDOR_ID_SUNIX,
2376 .subdevice = PCI_ANY_ID,
2377 .init = pci_timedia_init,
2378 .setup = pci_timedia_setup,
2379 },
2380 /*
Søren Holm06315342011-09-02 22:55:37 +02002381 * Exar cards
2382 */
2383 {
2384 .vendor = PCI_VENDOR_ID_EXAR,
2385 .device = PCI_DEVICE_ID_EXAR_XR17C152,
2386 .subvendor = PCI_ANY_ID,
2387 .subdevice = PCI_ANY_ID,
2388 .setup = pci_xr17c154_setup,
2389 },
2390 {
2391 .vendor = PCI_VENDOR_ID_EXAR,
2392 .device = PCI_DEVICE_ID_EXAR_XR17C154,
2393 .subvendor = PCI_ANY_ID,
2394 .subdevice = PCI_ANY_ID,
2395 .setup = pci_xr17c154_setup,
2396 },
2397 {
2398 .vendor = PCI_VENDOR_ID_EXAR,
2399 .device = PCI_DEVICE_ID_EXAR_XR17C158,
2400 .subvendor = PCI_ANY_ID,
2401 .subdevice = PCI_ANY_ID,
2402 .setup = pci_xr17c154_setup,
2403 },
Matt Schultedc96efb2012-11-19 09:12:04 -06002404 {
2405 .vendor = PCI_VENDOR_ID_EXAR,
2406 .device = PCI_DEVICE_ID_EXAR_XR17V352,
2407 .subvendor = PCI_ANY_ID,
2408 .subdevice = PCI_ANY_ID,
2409 .setup = pci_xr17v35x_setup,
2410 },
2411 {
2412 .vendor = PCI_VENDOR_ID_EXAR,
2413 .device = PCI_DEVICE_ID_EXAR_XR17V354,
2414 .subvendor = PCI_ANY_ID,
2415 .subdevice = PCI_ANY_ID,
2416 .setup = pci_xr17v35x_setup,
2417 },
2418 {
2419 .vendor = PCI_VENDOR_ID_EXAR,
2420 .device = PCI_DEVICE_ID_EXAR_XR17V358,
2421 .subvendor = PCI_ANY_ID,
2422 .subdevice = PCI_ANY_ID,
2423 .setup = pci_xr17v35x_setup,
2424 },
Soeren Grunewald96a5d182015-04-28 16:29:49 +02002425 {
2426 .vendor = PCI_VENDOR_ID_EXAR,
Soeren Grunewaldbe32c0c2015-06-11 09:25:04 +02002427 .device = PCI_DEVICE_ID_EXAR_XR17V4358,
2428 .subvendor = PCI_ANY_ID,
2429 .subdevice = PCI_ANY_ID,
2430 .setup = pci_xr17v35x_setup,
2431 },
2432 {
2433 .vendor = PCI_VENDOR_ID_EXAR,
Soeren Grunewald96a5d182015-04-28 16:29:49 +02002434 .device = PCI_DEVICE_ID_EXAR_XR17V8358,
2435 .subvendor = PCI_ANY_ID,
2436 .subdevice = PCI_ANY_ID,
2437 .setup = pci_xr17v35x_setup,
2438 },
Søren Holm06315342011-09-02 22:55:37 +02002439 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002440 * Xircom cards
2441 */
2442 {
2443 .vendor = PCI_VENDOR_ID_XIRCOM,
2444 .device = PCI_DEVICE_ID_XIRCOM_X3201_MDM,
2445 .subvendor = PCI_ANY_ID,
2446 .subdevice = PCI_ANY_ID,
2447 .init = pci_xircom_init,
2448 .setup = pci_default_setup,
2449 },
2450 /*
Russell King61a116e2006-07-03 15:22:35 +01002451 * Netmos cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07002452 */
2453 {
2454 .vendor = PCI_VENDOR_ID_NETMOS,
2455 .device = PCI_ANY_ID,
2456 .subvendor = PCI_ANY_ID,
2457 .subdevice = PCI_ANY_ID,
2458 .init = pci_netmos_init,
Nicos Gollan7808edc2011-05-05 21:00:37 +02002459 .setup = pci_netmos_9900_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002460 },
2461 /*
Mike Skoog1bc8cde2014-10-16 13:10:01 -07002462 * EndRun Technologies
2463 */
2464 {
2465 .vendor = PCI_VENDOR_ID_ENDRUN,
2466 .device = PCI_ANY_ID,
2467 .subvendor = PCI_ANY_ID,
2468 .subdevice = PCI_ANY_ID,
2469 .init = pci_endrun_init,
2470 .setup = pci_default_setup,
2471 },
2472 /*
Scott Kilauaa273ae2011-05-11 15:41:59 -05002473 * For Oxford Semiconductor Tornado based devices
Russell King9f2a0362009-01-02 13:44:20 +00002474 */
2475 {
2476 .vendor = PCI_VENDOR_ID_OXSEMI,
2477 .device = PCI_ANY_ID,
2478 .subvendor = PCI_ANY_ID,
2479 .subdevice = PCI_ANY_ID,
2480 .init = pci_oxsemi_tornado_init,
2481 .setup = pci_default_setup,
2482 },
2483 {
2484 .vendor = PCI_VENDOR_ID_MAINPINE,
2485 .device = PCI_ANY_ID,
2486 .subvendor = PCI_ANY_ID,
2487 .subdevice = PCI_ANY_ID,
2488 .init = pci_oxsemi_tornado_init,
2489 .setup = pci_default_setup,
2490 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05002491 {
2492 .vendor = PCI_VENDOR_ID_DIGI,
2493 .device = PCIE_DEVICE_ID_NEO_2_OX_IBM,
2494 .subvendor = PCI_SUBVENDOR_ID_IBM,
2495 .subdevice = PCI_ANY_ID,
2496 .init = pci_oxsemi_tornado_init,
2497 .setup = pci_default_setup,
2498 },
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002499 {
2500 .vendor = PCI_VENDOR_ID_INTEL,
2501 .device = 0x8811,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002502 .subvendor = PCI_ANY_ID,
2503 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002504 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002505 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002506 },
2507 {
2508 .vendor = PCI_VENDOR_ID_INTEL,
2509 .device = 0x8812,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002510 .subvendor = PCI_ANY_ID,
2511 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002512 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002513 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002514 },
2515 {
2516 .vendor = PCI_VENDOR_ID_INTEL,
2517 .device = 0x8813,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002518 .subvendor = PCI_ANY_ID,
2519 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002520 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002521 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002522 },
2523 {
2524 .vendor = PCI_VENDOR_ID_INTEL,
2525 .device = 0x8814,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002526 .subvendor = PCI_ANY_ID,
2527 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002528 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002529 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002530 },
2531 {
2532 .vendor = 0x10DB,
2533 .device = 0x8027,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002534 .subvendor = PCI_ANY_ID,
2535 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002536 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002537 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002538 },
2539 {
2540 .vendor = 0x10DB,
2541 .device = 0x8028,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002542 .subvendor = PCI_ANY_ID,
2543 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002544 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002545 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002546 },
2547 {
2548 .vendor = 0x10DB,
2549 .device = 0x8029,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002550 .subvendor = PCI_ANY_ID,
2551 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002552 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002553 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002554 },
2555 {
2556 .vendor = 0x10DB,
2557 .device = 0x800C,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002558 .subvendor = PCI_ANY_ID,
2559 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002560 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002561 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002562 },
2563 {
2564 .vendor = 0x10DB,
2565 .device = 0x800D,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002566 .subvendor = PCI_ANY_ID,
2567 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002568 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002569 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002570 },
Russell King9f2a0362009-01-02 13:44:20 +00002571 /*
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002572 * Cronyx Omega PCI (PLX-chip based)
2573 */
2574 {
2575 .vendor = PCI_VENDOR_ID_PLX,
2576 .device = PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
2577 .subvendor = PCI_ANY_ID,
2578 .subdevice = PCI_ANY_ID,
2579 .setup = pci_omegapci_setup,
Alan Coxeb26dfe2012-07-12 13:00:31 +01002580 },
Ezequiel Garciafeb58142014-05-24 15:24:51 -03002581 /* WCH CH353 1S1P card (16550 clone) */
2582 {
2583 .vendor = PCI_VENDOR_ID_WCH,
2584 .device = PCI_DEVICE_ID_WCH_CH353_1S1P,
2585 .subvendor = PCI_ANY_ID,
2586 .subdevice = PCI_ANY_ID,
2587 .setup = pci_wch_ch353_setup,
2588 },
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002589 /* WCH CH353 2S1P card (16550 clone) */
2590 {
Alan Cox27788c52012-09-04 16:21:06 +01002591 .vendor = PCI_VENDOR_ID_WCH,
2592 .device = PCI_DEVICE_ID_WCH_CH353_2S1P,
2593 .subvendor = PCI_ANY_ID,
2594 .subdevice = PCI_ANY_ID,
2595 .setup = pci_wch_ch353_setup,
2596 },
2597 /* WCH CH353 4S card (16550 clone) */
2598 {
2599 .vendor = PCI_VENDOR_ID_WCH,
2600 .device = PCI_DEVICE_ID_WCH_CH353_4S,
2601 .subvendor = PCI_ANY_ID,
2602 .subdevice = PCI_ANY_ID,
2603 .setup = pci_wch_ch353_setup,
2604 },
2605 /* WCH CH353 2S1PF card (16550 clone) */
2606 {
2607 .vendor = PCI_VENDOR_ID_WCH,
2608 .device = PCI_DEVICE_ID_WCH_CH353_2S1PF,
2609 .subvendor = PCI_ANY_ID,
2610 .subdevice = PCI_ANY_ID,
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002611 .setup = pci_wch_ch353_setup,
2612 },
Wang YanQing8b5c9132013-03-05 23:16:48 +08002613 /* WCH CH352 2S card (16550 clone) */
2614 {
2615 .vendor = PCI_VENDOR_ID_WCH,
2616 .device = PCI_DEVICE_ID_WCH_CH352_2S,
2617 .subvendor = PCI_ANY_ID,
2618 .subdevice = PCI_ANY_ID,
2619 .setup = pci_wch_ch353_setup,
2620 },
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03002621 /* WCH CH382 2S1P card (16850 clone) */
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03002622 {
2623 .vendor = PCIE_VENDOR_ID_WCH,
2624 .device = PCIE_DEVICE_ID_WCH_CH382_2S1P,
2625 .subvendor = PCI_ANY_ID,
2626 .subdevice = PCI_ANY_ID,
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03002627 .setup = pci_wch_ch38x_setup,
2628 },
2629 /* WCH CH384 4S card (16850 clone) */
2630 {
2631 .vendor = PCIE_VENDOR_ID_WCH,
2632 .device = PCIE_DEVICE_ID_WCH_CH384_4S,
2633 .subvendor = PCI_ANY_ID,
2634 .subdevice = PCI_ANY_ID,
2635 .setup = pci_wch_ch38x_setup,
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03002636 },
Alan Coxeb26dfe2012-07-12 13:00:31 +01002637 /*
2638 * ASIX devices with FIFO bug
2639 */
2640 {
2641 .vendor = PCI_VENDOR_ID_ASIX,
2642 .device = PCI_ANY_ID,
2643 .subvendor = PCI_ANY_ID,
2644 .subdevice = PCI_ANY_ID,
2645 .setup = pci_asix_setup,
2646 },
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002647 /*
Matt Schulte14faa8c2012-11-21 10:35:15 -06002648 * Commtech, Inc. Fastcom adapters
2649 *
2650 */
2651 {
2652 .vendor = PCI_VENDOR_ID_COMMTECH,
2653 .device = PCI_DEVICE_ID_COMMTECH_4222PCI335,
2654 .subvendor = PCI_ANY_ID,
2655 .subdevice = PCI_ANY_ID,
2656 .setup = pci_fastcom335_setup,
2657 },
2658 {
2659 .vendor = PCI_VENDOR_ID_COMMTECH,
2660 .device = PCI_DEVICE_ID_COMMTECH_4224PCI335,
2661 .subvendor = PCI_ANY_ID,
2662 .subdevice = PCI_ANY_ID,
2663 .setup = pci_fastcom335_setup,
2664 },
2665 {
2666 .vendor = PCI_VENDOR_ID_COMMTECH,
2667 .device = PCI_DEVICE_ID_COMMTECH_2324PCI335,
2668 .subvendor = PCI_ANY_ID,
2669 .subdevice = PCI_ANY_ID,
2670 .setup = pci_fastcom335_setup,
2671 },
2672 {
2673 .vendor = PCI_VENDOR_ID_COMMTECH,
2674 .device = PCI_DEVICE_ID_COMMTECH_2328PCI335,
2675 .subvendor = PCI_ANY_ID,
2676 .subdevice = PCI_ANY_ID,
2677 .setup = pci_fastcom335_setup,
2678 },
2679 {
2680 .vendor = PCI_VENDOR_ID_COMMTECH,
2681 .device = PCI_DEVICE_ID_COMMTECH_4222PCIE,
2682 .subvendor = PCI_ANY_ID,
2683 .subdevice = PCI_ANY_ID,
2684 .setup = pci_xr17v35x_setup,
2685 },
2686 {
2687 .vendor = PCI_VENDOR_ID_COMMTECH,
2688 .device = PCI_DEVICE_ID_COMMTECH_4224PCIE,
2689 .subvendor = PCI_ANY_ID,
2690 .subdevice = PCI_ANY_ID,
2691 .setup = pci_xr17v35x_setup,
2692 },
2693 {
2694 .vendor = PCI_VENDOR_ID_COMMTECH,
2695 .device = PCI_DEVICE_ID_COMMTECH_4228PCIE,
2696 .subvendor = PCI_ANY_ID,
2697 .subdevice = PCI_ANY_ID,
2698 .setup = pci_xr17v35x_setup,
2699 },
2700 /*
Stephen Hurdebebd492013-01-17 14:14:53 -08002701 * Broadcom TruManage (NetXtreme)
2702 */
2703 {
2704 .vendor = PCI_VENDOR_ID_BROADCOM,
2705 .device = PCI_DEVICE_ID_BROADCOM_TRUMANAGE,
2706 .subvendor = PCI_ANY_ID,
2707 .subdevice = PCI_ANY_ID,
2708 .setup = pci_brcm_trumanage_setup,
2709 },
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002710 {
2711 .vendor = 0x1c29,
2712 .device = 0x1104,
2713 .subvendor = PCI_ANY_ID,
2714 .subdevice = PCI_ANY_ID,
2715 .setup = pci_fintek_setup,
Peter Hung6a8bc232015-04-01 14:00:21 +08002716 .init = pci_fintek_init,
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002717 },
2718 {
2719 .vendor = 0x1c29,
2720 .device = 0x1108,
2721 .subvendor = PCI_ANY_ID,
2722 .subdevice = PCI_ANY_ID,
2723 .setup = pci_fintek_setup,
Peter Hung6a8bc232015-04-01 14:00:21 +08002724 .init = pci_fintek_init,
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002725 },
2726 {
2727 .vendor = 0x1c29,
2728 .device = 0x1112,
2729 .subvendor = PCI_ANY_ID,
2730 .subdevice = PCI_ANY_ID,
2731 .setup = pci_fintek_setup,
Peter Hung6a8bc232015-04-01 14:00:21 +08002732 .init = pci_fintek_init,
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002733 },
Stephen Hurdebebd492013-01-17 14:14:53 -08002734
2735 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002736 * Default "match everything" terminator entry
2737 */
2738 {
2739 .vendor = PCI_ANY_ID,
2740 .device = PCI_ANY_ID,
2741 .subvendor = PCI_ANY_ID,
2742 .subdevice = PCI_ANY_ID,
2743 .setup = pci_default_setup,
2744 }
2745};
2746
2747static inline int quirk_id_matches(u32 quirk_id, u32 dev_id)
2748{
2749 return quirk_id == PCI_ANY_ID || quirk_id == dev_id;
2750}
2751
2752static struct pci_serial_quirk *find_quirk(struct pci_dev *dev)
2753{
2754 struct pci_serial_quirk *quirk;
2755
2756 for (quirk = pci_serial_quirks; ; quirk++)
2757 if (quirk_id_matches(quirk->vendor, dev->vendor) &&
2758 quirk_id_matches(quirk->device, dev->device) &&
2759 quirk_id_matches(quirk->subvendor, dev->subsystem_vendor) &&
2760 quirk_id_matches(quirk->subdevice, dev->subsystem_device))
Alan Cox5756ee92008-02-08 04:18:51 -08002761 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002762 return quirk;
2763}
2764
Andrew Mortondd68e882006-01-05 10:55:26 +00002765static inline int get_pci_irq(struct pci_dev *dev,
Russell King975a1a7d2009-01-02 13:44:27 +00002766 const struct pciserial_board *board)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002767{
2768 if (board->flags & FL_NOIRQ)
2769 return 0;
2770 else
2771 return dev->irq;
2772}
2773
2774/*
2775 * This is the configuration table for all of the PCI serial boards
2776 * which we support. It is directly indexed by the pci_board_num_t enum
2777 * value, which is encoded in the pci_device_id PCI probe table's
2778 * driver_data member.
2779 *
2780 * The makeup of these names are:
Gareth Howlett26e92862006-01-04 17:00:42 +00002781 * pbn_bn{_bt}_n_baud{_offsetinhex}
Linus Torvalds1da177e2005-04-16 15:20:36 -07002782 *
Gareth Howlett26e92862006-01-04 17:00:42 +00002783 * bn = PCI BAR number
2784 * bt = Index using PCI BARs
2785 * n = number of serial ports
2786 * baud = baud rate
2787 * offsetinhex = offset for each sequential port (in hex)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002788 *
Gareth Howlett26e92862006-01-04 17:00:42 +00002789 * This table is sorted by (in order): bn, bt, baud, offsetindex, n.
Russell Kingf1690f32005-05-06 10:19:09 +01002790 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07002791 * Please note: in theory if n = 1, _bt infix should make no difference.
2792 * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200
2793 */
2794enum pci_board_num_t {
2795 pbn_default = 0,
2796
2797 pbn_b0_1_115200,
2798 pbn_b0_2_115200,
2799 pbn_b0_4_115200,
2800 pbn_b0_5_115200,
Alan Coxbf0df632007-10-16 01:24:00 -07002801 pbn_b0_8_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002802
2803 pbn_b0_1_921600,
2804 pbn_b0_2_921600,
2805 pbn_b0_4_921600,
2806
David Ransondb1de152005-07-27 11:43:55 -07002807 pbn_b0_2_1130000,
2808
Andrey Paninfbc0dc02005-07-18 11:38:09 +01002809 pbn_b0_4_1152000,
2810
Matt Schulte14faa8c2012-11-21 10:35:15 -06002811 pbn_b0_2_1152000_200,
2812 pbn_b0_4_1152000_200,
2813 pbn_b0_8_1152000_200,
2814
Gareth Howlett26e92862006-01-04 17:00:42 +00002815 pbn_b0_2_1843200,
2816 pbn_b0_4_1843200,
2817
2818 pbn_b0_2_1843200_200,
2819 pbn_b0_4_1843200_200,
2820 pbn_b0_8_1843200_200,
2821
Lee Howard7106b4e2008-10-21 13:48:58 +01002822 pbn_b0_1_4000000,
2823
Linus Torvalds1da177e2005-04-16 15:20:36 -07002824 pbn_b0_bt_1_115200,
2825 pbn_b0_bt_2_115200,
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08002826 pbn_b0_bt_4_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002827 pbn_b0_bt_8_115200,
2828
2829 pbn_b0_bt_1_460800,
2830 pbn_b0_bt_2_460800,
2831 pbn_b0_bt_4_460800,
2832
2833 pbn_b0_bt_1_921600,
2834 pbn_b0_bt_2_921600,
2835 pbn_b0_bt_4_921600,
2836 pbn_b0_bt_8_921600,
2837
2838 pbn_b1_1_115200,
2839 pbn_b1_2_115200,
2840 pbn_b1_4_115200,
2841 pbn_b1_8_115200,
Will Page04bf7e72009-04-06 17:32:15 +01002842 pbn_b1_16_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002843
2844 pbn_b1_1_921600,
2845 pbn_b1_2_921600,
2846 pbn_b1_4_921600,
2847 pbn_b1_8_921600,
2848
Gareth Howlett26e92862006-01-04 17:00:42 +00002849 pbn_b1_2_1250000,
2850
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002851 pbn_b1_bt_1_115200,
Will Page04bf7e72009-04-06 17:32:15 +01002852 pbn_b1_bt_2_115200,
2853 pbn_b1_bt_4_115200,
2854
Linus Torvalds1da177e2005-04-16 15:20:36 -07002855 pbn_b1_bt_2_921600,
2856
2857 pbn_b1_1_1382400,
2858 pbn_b1_2_1382400,
2859 pbn_b1_4_1382400,
2860 pbn_b1_8_1382400,
2861
2862 pbn_b2_1_115200,
Peter Horton737c1752006-08-26 09:07:36 +01002863 pbn_b2_2_115200,
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08002864 pbn_b2_4_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002865 pbn_b2_8_115200,
2866
2867 pbn_b2_1_460800,
2868 pbn_b2_4_460800,
2869 pbn_b2_8_460800,
2870 pbn_b2_16_460800,
2871
2872 pbn_b2_1_921600,
2873 pbn_b2_4_921600,
2874 pbn_b2_8_921600,
2875
Lytochkin Borise8470032010-07-26 10:02:26 +04002876 pbn_b2_8_1152000,
2877
Linus Torvalds1da177e2005-04-16 15:20:36 -07002878 pbn_b2_bt_1_115200,
2879 pbn_b2_bt_2_115200,
2880 pbn_b2_bt_4_115200,
2881
2882 pbn_b2_bt_2_921600,
2883 pbn_b2_bt_4_921600,
2884
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00002885 pbn_b3_2_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002886 pbn_b3_4_115200,
2887 pbn_b3_8_115200,
2888
Yegor Yefremov66169ad2010-06-04 09:58:18 +02002889 pbn_b4_bt_2_921600,
2890 pbn_b4_bt_4_921600,
2891 pbn_b4_bt_8_921600,
2892
Linus Torvalds1da177e2005-04-16 15:20:36 -07002893 /*
2894 * Board-specific versions.
2895 */
2896 pbn_panacom,
2897 pbn_panacom2,
2898 pbn_panacom4,
2899 pbn_plx_romulus,
Mike Skoog1bc8cde2014-10-16 13:10:01 -07002900 pbn_endrun_2_4000000,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002901 pbn_oxsemi,
Lee Howard7106b4e2008-10-21 13:48:58 +01002902 pbn_oxsemi_1_4000000,
2903 pbn_oxsemi_2_4000000,
2904 pbn_oxsemi_4_4000000,
2905 pbn_oxsemi_8_4000000,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002906 pbn_intel_i960,
2907 pbn_sgi_ioc3,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002908 pbn_computone_4,
2909 pbn_computone_6,
2910 pbn_computone_8,
2911 pbn_sbsxrsio,
2912 pbn_exar_XR17C152,
2913 pbn_exar_XR17C154,
2914 pbn_exar_XR17C158,
Matt Schultedc96efb2012-11-19 09:12:04 -06002915 pbn_exar_XR17V352,
2916 pbn_exar_XR17V354,
2917 pbn_exar_XR17V358,
Soeren Grunewaldbe32c0c2015-06-11 09:25:04 +02002918 pbn_exar_XR17V4358,
Soeren Grunewald96a5d182015-04-28 16:29:49 +02002919 pbn_exar_XR17V8358,
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07002920 pbn_exar_ibm_saturn,
Olof Johanssonaa798502007-08-22 14:01:55 -07002921 pbn_pasemi_1682M,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002922 pbn_ni8430_2,
2923 pbn_ni8430_4,
2924 pbn_ni8430_8,
2925 pbn_ni8430_16,
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07002926 pbn_ADDIDATA_PCIe_1_3906250,
2927 pbn_ADDIDATA_PCIe_2_3906250,
2928 pbn_ADDIDATA_PCIe_4_3906250,
2929 pbn_ADDIDATA_PCIe_8_3906250,
Dirk Brandewie095e24b2010-11-17 07:35:20 -08002930 pbn_ce4100_1_115200,
Heikki Krogerusb15e5692013-09-27 10:52:59 +03002931 pbn_byt,
Bryan O'Donoghue1ede7dc2014-09-23 01:21:11 +01002932 pbn_qrk,
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002933 pbn_omegapci,
Nicos Gollan7808edc2011-05-05 21:00:37 +02002934 pbn_NETMOS9900_2s_115200,
Stephen Hurdebebd492013-01-17 14:14:53 -08002935 pbn_brcm_trumanage,
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002936 pbn_fintek_4,
2937 pbn_fintek_8,
2938 pbn_fintek_12,
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03002939 pbn_wch384_4,
Adam Lee89c043a2015-08-03 13:28:13 +08002940 pbn_pericom_PI7C9X7951,
2941 pbn_pericom_PI7C9X7952,
2942 pbn_pericom_PI7C9X7954,
2943 pbn_pericom_PI7C9X7958,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002944};
2945
2946/*
2947 * uart_offset - the space between channels
2948 * reg_shift - describes how the UART registers are mapped
2949 * to PCI memory by the card.
2950 * For example IER register on SBS, Inc. PMC-OctPro is located at
2951 * offset 0x10 from the UART base, while UART_IER is defined as 1
2952 * in include/linux/serial_reg.h,
2953 * see first lines of serial_in() and serial_out() in 8250.c
2954*/
2955
Bill Pembertonde88b342012-11-19 13:24:32 -05002956static struct pciserial_board pci_boards[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002957 [pbn_default] = {
2958 .flags = FL_BASE0,
2959 .num_ports = 1,
2960 .base_baud = 115200,
2961 .uart_offset = 8,
2962 },
2963 [pbn_b0_1_115200] = {
2964 .flags = FL_BASE0,
2965 .num_ports = 1,
2966 .base_baud = 115200,
2967 .uart_offset = 8,
2968 },
2969 [pbn_b0_2_115200] = {
2970 .flags = FL_BASE0,
2971 .num_ports = 2,
2972 .base_baud = 115200,
2973 .uart_offset = 8,
2974 },
2975 [pbn_b0_4_115200] = {
2976 .flags = FL_BASE0,
2977 .num_ports = 4,
2978 .base_baud = 115200,
2979 .uart_offset = 8,
2980 },
2981 [pbn_b0_5_115200] = {
2982 .flags = FL_BASE0,
2983 .num_ports = 5,
2984 .base_baud = 115200,
2985 .uart_offset = 8,
2986 },
Alan Coxbf0df632007-10-16 01:24:00 -07002987 [pbn_b0_8_115200] = {
2988 .flags = FL_BASE0,
2989 .num_ports = 8,
2990 .base_baud = 115200,
2991 .uart_offset = 8,
2992 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002993 [pbn_b0_1_921600] = {
2994 .flags = FL_BASE0,
2995 .num_ports = 1,
2996 .base_baud = 921600,
2997 .uart_offset = 8,
2998 },
2999 [pbn_b0_2_921600] = {
3000 .flags = FL_BASE0,
3001 .num_ports = 2,
3002 .base_baud = 921600,
3003 .uart_offset = 8,
3004 },
3005 [pbn_b0_4_921600] = {
3006 .flags = FL_BASE0,
3007 .num_ports = 4,
3008 .base_baud = 921600,
3009 .uart_offset = 8,
3010 },
David Ransondb1de152005-07-27 11:43:55 -07003011
3012 [pbn_b0_2_1130000] = {
3013 .flags = FL_BASE0,
3014 .num_ports = 2,
3015 .base_baud = 1130000,
3016 .uart_offset = 8,
3017 },
3018
Andrey Paninfbc0dc02005-07-18 11:38:09 +01003019 [pbn_b0_4_1152000] = {
3020 .flags = FL_BASE0,
3021 .num_ports = 4,
3022 .base_baud = 1152000,
3023 .uart_offset = 8,
3024 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003025
Matt Schulte14faa8c2012-11-21 10:35:15 -06003026 [pbn_b0_2_1152000_200] = {
3027 .flags = FL_BASE0,
3028 .num_ports = 2,
3029 .base_baud = 1152000,
3030 .uart_offset = 0x200,
3031 },
3032
3033 [pbn_b0_4_1152000_200] = {
3034 .flags = FL_BASE0,
3035 .num_ports = 4,
3036 .base_baud = 1152000,
3037 .uart_offset = 0x200,
3038 },
3039
3040 [pbn_b0_8_1152000_200] = {
3041 .flags = FL_BASE0,
Matt Schulte4f7d67d2012-12-06 22:19:58 -06003042 .num_ports = 8,
Matt Schulte14faa8c2012-11-21 10:35:15 -06003043 .base_baud = 1152000,
3044 .uart_offset = 0x200,
3045 },
3046
Gareth Howlett26e92862006-01-04 17:00:42 +00003047 [pbn_b0_2_1843200] = {
3048 .flags = FL_BASE0,
3049 .num_ports = 2,
3050 .base_baud = 1843200,
3051 .uart_offset = 8,
3052 },
3053 [pbn_b0_4_1843200] = {
3054 .flags = FL_BASE0,
3055 .num_ports = 4,
3056 .base_baud = 1843200,
3057 .uart_offset = 8,
3058 },
3059
3060 [pbn_b0_2_1843200_200] = {
3061 .flags = FL_BASE0,
3062 .num_ports = 2,
3063 .base_baud = 1843200,
3064 .uart_offset = 0x200,
3065 },
3066 [pbn_b0_4_1843200_200] = {
3067 .flags = FL_BASE0,
3068 .num_ports = 4,
3069 .base_baud = 1843200,
3070 .uart_offset = 0x200,
3071 },
3072 [pbn_b0_8_1843200_200] = {
3073 .flags = FL_BASE0,
3074 .num_ports = 8,
3075 .base_baud = 1843200,
3076 .uart_offset = 0x200,
3077 },
Lee Howard7106b4e2008-10-21 13:48:58 +01003078 [pbn_b0_1_4000000] = {
3079 .flags = FL_BASE0,
3080 .num_ports = 1,
3081 .base_baud = 4000000,
3082 .uart_offset = 8,
3083 },
Gareth Howlett26e92862006-01-04 17:00:42 +00003084
Linus Torvalds1da177e2005-04-16 15:20:36 -07003085 [pbn_b0_bt_1_115200] = {
3086 .flags = FL_BASE0|FL_BASE_BARS,
3087 .num_ports = 1,
3088 .base_baud = 115200,
3089 .uart_offset = 8,
3090 },
3091 [pbn_b0_bt_2_115200] = {
3092 .flags = FL_BASE0|FL_BASE_BARS,
3093 .num_ports = 2,
3094 .base_baud = 115200,
3095 .uart_offset = 8,
3096 },
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08003097 [pbn_b0_bt_4_115200] = {
3098 .flags = FL_BASE0|FL_BASE_BARS,
3099 .num_ports = 4,
3100 .base_baud = 115200,
3101 .uart_offset = 8,
3102 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003103 [pbn_b0_bt_8_115200] = {
3104 .flags = FL_BASE0|FL_BASE_BARS,
3105 .num_ports = 8,
3106 .base_baud = 115200,
3107 .uart_offset = 8,
3108 },
3109
3110 [pbn_b0_bt_1_460800] = {
3111 .flags = FL_BASE0|FL_BASE_BARS,
3112 .num_ports = 1,
3113 .base_baud = 460800,
3114 .uart_offset = 8,
3115 },
3116 [pbn_b0_bt_2_460800] = {
3117 .flags = FL_BASE0|FL_BASE_BARS,
3118 .num_ports = 2,
3119 .base_baud = 460800,
3120 .uart_offset = 8,
3121 },
3122 [pbn_b0_bt_4_460800] = {
3123 .flags = FL_BASE0|FL_BASE_BARS,
3124 .num_ports = 4,
3125 .base_baud = 460800,
3126 .uart_offset = 8,
3127 },
3128
3129 [pbn_b0_bt_1_921600] = {
3130 .flags = FL_BASE0|FL_BASE_BARS,
3131 .num_ports = 1,
3132 .base_baud = 921600,
3133 .uart_offset = 8,
3134 },
3135 [pbn_b0_bt_2_921600] = {
3136 .flags = FL_BASE0|FL_BASE_BARS,
3137 .num_ports = 2,
3138 .base_baud = 921600,
3139 .uart_offset = 8,
3140 },
3141 [pbn_b0_bt_4_921600] = {
3142 .flags = FL_BASE0|FL_BASE_BARS,
3143 .num_ports = 4,
3144 .base_baud = 921600,
3145 .uart_offset = 8,
3146 },
3147 [pbn_b0_bt_8_921600] = {
3148 .flags = FL_BASE0|FL_BASE_BARS,
3149 .num_ports = 8,
3150 .base_baud = 921600,
3151 .uart_offset = 8,
3152 },
3153
3154 [pbn_b1_1_115200] = {
3155 .flags = FL_BASE1,
3156 .num_ports = 1,
3157 .base_baud = 115200,
3158 .uart_offset = 8,
3159 },
3160 [pbn_b1_2_115200] = {
3161 .flags = FL_BASE1,
3162 .num_ports = 2,
3163 .base_baud = 115200,
3164 .uart_offset = 8,
3165 },
3166 [pbn_b1_4_115200] = {
3167 .flags = FL_BASE1,
3168 .num_ports = 4,
3169 .base_baud = 115200,
3170 .uart_offset = 8,
3171 },
3172 [pbn_b1_8_115200] = {
3173 .flags = FL_BASE1,
3174 .num_ports = 8,
3175 .base_baud = 115200,
3176 .uart_offset = 8,
3177 },
Will Page04bf7e72009-04-06 17:32:15 +01003178 [pbn_b1_16_115200] = {
3179 .flags = FL_BASE1,
3180 .num_ports = 16,
3181 .base_baud = 115200,
3182 .uart_offset = 8,
3183 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003184
3185 [pbn_b1_1_921600] = {
3186 .flags = FL_BASE1,
3187 .num_ports = 1,
3188 .base_baud = 921600,
3189 .uart_offset = 8,
3190 },
3191 [pbn_b1_2_921600] = {
3192 .flags = FL_BASE1,
3193 .num_ports = 2,
3194 .base_baud = 921600,
3195 .uart_offset = 8,
3196 },
3197 [pbn_b1_4_921600] = {
3198 .flags = FL_BASE1,
3199 .num_ports = 4,
3200 .base_baud = 921600,
3201 .uart_offset = 8,
3202 },
3203 [pbn_b1_8_921600] = {
3204 .flags = FL_BASE1,
3205 .num_ports = 8,
3206 .base_baud = 921600,
3207 .uart_offset = 8,
3208 },
Gareth Howlett26e92862006-01-04 17:00:42 +00003209 [pbn_b1_2_1250000] = {
3210 .flags = FL_BASE1,
3211 .num_ports = 2,
3212 .base_baud = 1250000,
3213 .uart_offset = 8,
3214 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003215
Niels de Vos84f8c6f2007-08-22 14:01:14 -07003216 [pbn_b1_bt_1_115200] = {
3217 .flags = FL_BASE1|FL_BASE_BARS,
3218 .num_ports = 1,
3219 .base_baud = 115200,
3220 .uart_offset = 8,
3221 },
Will Page04bf7e72009-04-06 17:32:15 +01003222 [pbn_b1_bt_2_115200] = {
3223 .flags = FL_BASE1|FL_BASE_BARS,
3224 .num_ports = 2,
3225 .base_baud = 115200,
3226 .uart_offset = 8,
3227 },
3228 [pbn_b1_bt_4_115200] = {
3229 .flags = FL_BASE1|FL_BASE_BARS,
3230 .num_ports = 4,
3231 .base_baud = 115200,
3232 .uart_offset = 8,
3233 },
Niels de Vos84f8c6f2007-08-22 14:01:14 -07003234
Linus Torvalds1da177e2005-04-16 15:20:36 -07003235 [pbn_b1_bt_2_921600] = {
3236 .flags = FL_BASE1|FL_BASE_BARS,
3237 .num_ports = 2,
3238 .base_baud = 921600,
3239 .uart_offset = 8,
3240 },
3241
3242 [pbn_b1_1_1382400] = {
3243 .flags = FL_BASE1,
3244 .num_ports = 1,
3245 .base_baud = 1382400,
3246 .uart_offset = 8,
3247 },
3248 [pbn_b1_2_1382400] = {
3249 .flags = FL_BASE1,
3250 .num_ports = 2,
3251 .base_baud = 1382400,
3252 .uart_offset = 8,
3253 },
3254 [pbn_b1_4_1382400] = {
3255 .flags = FL_BASE1,
3256 .num_ports = 4,
3257 .base_baud = 1382400,
3258 .uart_offset = 8,
3259 },
3260 [pbn_b1_8_1382400] = {
3261 .flags = FL_BASE1,
3262 .num_ports = 8,
3263 .base_baud = 1382400,
3264 .uart_offset = 8,
3265 },
3266
3267 [pbn_b2_1_115200] = {
3268 .flags = FL_BASE2,
3269 .num_ports = 1,
3270 .base_baud = 115200,
3271 .uart_offset = 8,
3272 },
Peter Horton737c1752006-08-26 09:07:36 +01003273 [pbn_b2_2_115200] = {
3274 .flags = FL_BASE2,
3275 .num_ports = 2,
3276 .base_baud = 115200,
3277 .uart_offset = 8,
3278 },
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08003279 [pbn_b2_4_115200] = {
3280 .flags = FL_BASE2,
3281 .num_ports = 4,
3282 .base_baud = 115200,
3283 .uart_offset = 8,
3284 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003285 [pbn_b2_8_115200] = {
3286 .flags = FL_BASE2,
3287 .num_ports = 8,
3288 .base_baud = 115200,
3289 .uart_offset = 8,
3290 },
3291
3292 [pbn_b2_1_460800] = {
3293 .flags = FL_BASE2,
3294 .num_ports = 1,
3295 .base_baud = 460800,
3296 .uart_offset = 8,
3297 },
3298 [pbn_b2_4_460800] = {
3299 .flags = FL_BASE2,
3300 .num_ports = 4,
3301 .base_baud = 460800,
3302 .uart_offset = 8,
3303 },
3304 [pbn_b2_8_460800] = {
3305 .flags = FL_BASE2,
3306 .num_ports = 8,
3307 .base_baud = 460800,
3308 .uart_offset = 8,
3309 },
3310 [pbn_b2_16_460800] = {
3311 .flags = FL_BASE2,
3312 .num_ports = 16,
3313 .base_baud = 460800,
3314 .uart_offset = 8,
3315 },
3316
3317 [pbn_b2_1_921600] = {
3318 .flags = FL_BASE2,
3319 .num_ports = 1,
3320 .base_baud = 921600,
3321 .uart_offset = 8,
3322 },
3323 [pbn_b2_4_921600] = {
3324 .flags = FL_BASE2,
3325 .num_ports = 4,
3326 .base_baud = 921600,
3327 .uart_offset = 8,
3328 },
3329 [pbn_b2_8_921600] = {
3330 .flags = FL_BASE2,
3331 .num_ports = 8,
3332 .base_baud = 921600,
3333 .uart_offset = 8,
3334 },
3335
Lytochkin Borise8470032010-07-26 10:02:26 +04003336 [pbn_b2_8_1152000] = {
3337 .flags = FL_BASE2,
3338 .num_ports = 8,
3339 .base_baud = 1152000,
3340 .uart_offset = 8,
3341 },
3342
Linus Torvalds1da177e2005-04-16 15:20:36 -07003343 [pbn_b2_bt_1_115200] = {
3344 .flags = FL_BASE2|FL_BASE_BARS,
3345 .num_ports = 1,
3346 .base_baud = 115200,
3347 .uart_offset = 8,
3348 },
3349 [pbn_b2_bt_2_115200] = {
3350 .flags = FL_BASE2|FL_BASE_BARS,
3351 .num_ports = 2,
3352 .base_baud = 115200,
3353 .uart_offset = 8,
3354 },
3355 [pbn_b2_bt_4_115200] = {
3356 .flags = FL_BASE2|FL_BASE_BARS,
3357 .num_ports = 4,
3358 .base_baud = 115200,
3359 .uart_offset = 8,
3360 },
3361
3362 [pbn_b2_bt_2_921600] = {
3363 .flags = FL_BASE2|FL_BASE_BARS,
3364 .num_ports = 2,
3365 .base_baud = 921600,
3366 .uart_offset = 8,
3367 },
3368 [pbn_b2_bt_4_921600] = {
3369 .flags = FL_BASE2|FL_BASE_BARS,
3370 .num_ports = 4,
3371 .base_baud = 921600,
3372 .uart_offset = 8,
3373 },
3374
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00003375 [pbn_b3_2_115200] = {
3376 .flags = FL_BASE3,
3377 .num_ports = 2,
3378 .base_baud = 115200,
3379 .uart_offset = 8,
3380 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003381 [pbn_b3_4_115200] = {
3382 .flags = FL_BASE3,
3383 .num_ports = 4,
3384 .base_baud = 115200,
3385 .uart_offset = 8,
3386 },
3387 [pbn_b3_8_115200] = {
3388 .flags = FL_BASE3,
3389 .num_ports = 8,
3390 .base_baud = 115200,
3391 .uart_offset = 8,
3392 },
3393
Yegor Yefremov66169ad2010-06-04 09:58:18 +02003394 [pbn_b4_bt_2_921600] = {
3395 .flags = FL_BASE4,
3396 .num_ports = 2,
3397 .base_baud = 921600,
3398 .uart_offset = 8,
3399 },
3400 [pbn_b4_bt_4_921600] = {
3401 .flags = FL_BASE4,
3402 .num_ports = 4,
3403 .base_baud = 921600,
3404 .uart_offset = 8,
3405 },
3406 [pbn_b4_bt_8_921600] = {
3407 .flags = FL_BASE4,
3408 .num_ports = 8,
3409 .base_baud = 921600,
3410 .uart_offset = 8,
3411 },
3412
Linus Torvalds1da177e2005-04-16 15:20:36 -07003413 /*
3414 * Entries following this are board-specific.
3415 */
3416
3417 /*
3418 * Panacom - IOMEM
3419 */
3420 [pbn_panacom] = {
3421 .flags = FL_BASE2,
3422 .num_ports = 2,
3423 .base_baud = 921600,
3424 .uart_offset = 0x400,
3425 .reg_shift = 7,
3426 },
3427 [pbn_panacom2] = {
3428 .flags = FL_BASE2|FL_BASE_BARS,
3429 .num_ports = 2,
3430 .base_baud = 921600,
3431 .uart_offset = 0x400,
3432 .reg_shift = 7,
3433 },
3434 [pbn_panacom4] = {
3435 .flags = FL_BASE2|FL_BASE_BARS,
3436 .num_ports = 4,
3437 .base_baud = 921600,
3438 .uart_offset = 0x400,
3439 .reg_shift = 7,
3440 },
3441
3442 /* I think this entry is broken - the first_offset looks wrong --rmk */
3443 [pbn_plx_romulus] = {
3444 .flags = FL_BASE2,
3445 .num_ports = 4,
3446 .base_baud = 921600,
3447 .uart_offset = 8 << 2,
3448 .reg_shift = 2,
3449 .first_offset = 0x03,
3450 },
3451
3452 /*
Mike Skoog1bc8cde2014-10-16 13:10:01 -07003453 * EndRun Technologies
3454 * Uses the size of PCI Base region 0 to
3455 * signal now many ports are available
3456 * 2 port 952 Uart support
3457 */
3458 [pbn_endrun_2_4000000] = {
3459 .flags = FL_BASE0,
3460 .num_ports = 2,
3461 .base_baud = 4000000,
3462 .uart_offset = 0x200,
3463 .first_offset = 0x1000,
3464 },
3465
3466 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003467 * This board uses the size of PCI Base region 0 to
3468 * signal now many ports are available
3469 */
3470 [pbn_oxsemi] = {
3471 .flags = FL_BASE0|FL_REGION_SZ_CAP,
3472 .num_ports = 32,
3473 .base_baud = 115200,
3474 .uart_offset = 8,
3475 },
Lee Howard7106b4e2008-10-21 13:48:58 +01003476 [pbn_oxsemi_1_4000000] = {
3477 .flags = FL_BASE0,
3478 .num_ports = 1,
3479 .base_baud = 4000000,
3480 .uart_offset = 0x200,
3481 .first_offset = 0x1000,
3482 },
3483 [pbn_oxsemi_2_4000000] = {
3484 .flags = FL_BASE0,
3485 .num_ports = 2,
3486 .base_baud = 4000000,
3487 .uart_offset = 0x200,
3488 .first_offset = 0x1000,
3489 },
3490 [pbn_oxsemi_4_4000000] = {
3491 .flags = FL_BASE0,
3492 .num_ports = 4,
3493 .base_baud = 4000000,
3494 .uart_offset = 0x200,
3495 .first_offset = 0x1000,
3496 },
3497 [pbn_oxsemi_8_4000000] = {
3498 .flags = FL_BASE0,
3499 .num_ports = 8,
3500 .base_baud = 4000000,
3501 .uart_offset = 0x200,
3502 .first_offset = 0x1000,
3503 },
3504
Linus Torvalds1da177e2005-04-16 15:20:36 -07003505
3506 /*
3507 * EKF addition for i960 Boards form EKF with serial port.
3508 * Max 256 ports.
3509 */
3510 [pbn_intel_i960] = {
3511 .flags = FL_BASE0,
3512 .num_ports = 32,
3513 .base_baud = 921600,
3514 .uart_offset = 8 << 2,
3515 .reg_shift = 2,
3516 .first_offset = 0x10000,
3517 },
3518 [pbn_sgi_ioc3] = {
3519 .flags = FL_BASE0|FL_NOIRQ,
3520 .num_ports = 1,
3521 .base_baud = 458333,
3522 .uart_offset = 8,
3523 .reg_shift = 0,
3524 .first_offset = 0x20178,
3525 },
3526
3527 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003528 * Computone - uses IOMEM.
3529 */
3530 [pbn_computone_4] = {
3531 .flags = FL_BASE0,
3532 .num_ports = 4,
3533 .base_baud = 921600,
3534 .uart_offset = 0x40,
3535 .reg_shift = 2,
3536 .first_offset = 0x200,
3537 },
3538 [pbn_computone_6] = {
3539 .flags = FL_BASE0,
3540 .num_ports = 6,
3541 .base_baud = 921600,
3542 .uart_offset = 0x40,
3543 .reg_shift = 2,
3544 .first_offset = 0x200,
3545 },
3546 [pbn_computone_8] = {
3547 .flags = FL_BASE0,
3548 .num_ports = 8,
3549 .base_baud = 921600,
3550 .uart_offset = 0x40,
3551 .reg_shift = 2,
3552 .first_offset = 0x200,
3553 },
3554 [pbn_sbsxrsio] = {
3555 .flags = FL_BASE0,
3556 .num_ports = 8,
3557 .base_baud = 460800,
3558 .uart_offset = 256,
3559 .reg_shift = 4,
3560 },
3561 /*
3562 * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
3563 * Only basic 16550A support.
3564 * XR17C15[24] are not tested, but they should work.
3565 */
3566 [pbn_exar_XR17C152] = {
3567 .flags = FL_BASE0,
3568 .num_ports = 2,
3569 .base_baud = 921600,
3570 .uart_offset = 0x200,
3571 },
3572 [pbn_exar_XR17C154] = {
3573 .flags = FL_BASE0,
3574 .num_ports = 4,
3575 .base_baud = 921600,
3576 .uart_offset = 0x200,
3577 },
3578 [pbn_exar_XR17C158] = {
3579 .flags = FL_BASE0,
3580 .num_ports = 8,
3581 .base_baud = 921600,
3582 .uart_offset = 0x200,
3583 },
Matt Schultedc96efb2012-11-19 09:12:04 -06003584 [pbn_exar_XR17V352] = {
3585 .flags = FL_BASE0,
3586 .num_ports = 2,
3587 .base_baud = 7812500,
3588 .uart_offset = 0x400,
3589 .reg_shift = 0,
3590 .first_offset = 0,
3591 },
3592 [pbn_exar_XR17V354] = {
3593 .flags = FL_BASE0,
3594 .num_ports = 4,
3595 .base_baud = 7812500,
3596 .uart_offset = 0x400,
3597 .reg_shift = 0,
3598 .first_offset = 0,
3599 },
3600 [pbn_exar_XR17V358] = {
3601 .flags = FL_BASE0,
3602 .num_ports = 8,
3603 .base_baud = 7812500,
3604 .uart_offset = 0x400,
3605 .reg_shift = 0,
3606 .first_offset = 0,
3607 },
Soeren Grunewaldbe32c0c2015-06-11 09:25:04 +02003608 [pbn_exar_XR17V4358] = {
3609 .flags = FL_BASE0,
3610 .num_ports = 12,
3611 .base_baud = 7812500,
3612 .uart_offset = 0x400,
3613 .reg_shift = 0,
3614 .first_offset = 0,
3615 },
Soeren Grunewald96a5d182015-04-28 16:29:49 +02003616 [pbn_exar_XR17V8358] = {
3617 .flags = FL_BASE0,
3618 .num_ports = 16,
3619 .base_baud = 7812500,
3620 .uart_offset = 0x400,
3621 .reg_shift = 0,
3622 .first_offset = 0,
3623 },
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07003624 [pbn_exar_ibm_saturn] = {
3625 .flags = FL_BASE0,
3626 .num_ports = 1,
3627 .base_baud = 921600,
3628 .uart_offset = 0x200,
3629 },
3630
Olof Johanssonaa798502007-08-22 14:01:55 -07003631 /*
3632 * PA Semi PWRficient PA6T-1682M on-chip UART
3633 */
3634 [pbn_pasemi_1682M] = {
3635 .flags = FL_BASE0,
3636 .num_ports = 1,
3637 .base_baud = 8333333,
3638 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01003639 /*
3640 * National Instruments 843x
3641 */
3642 [pbn_ni8430_16] = {
3643 .flags = FL_BASE0,
3644 .num_ports = 16,
3645 .base_baud = 3686400,
3646 .uart_offset = 0x10,
3647 .first_offset = 0x800,
3648 },
3649 [pbn_ni8430_8] = {
3650 .flags = FL_BASE0,
3651 .num_ports = 8,
3652 .base_baud = 3686400,
3653 .uart_offset = 0x10,
3654 .first_offset = 0x800,
3655 },
3656 [pbn_ni8430_4] = {
3657 .flags = FL_BASE0,
3658 .num_ports = 4,
3659 .base_baud = 3686400,
3660 .uart_offset = 0x10,
3661 .first_offset = 0x800,
3662 },
3663 [pbn_ni8430_2] = {
3664 .flags = FL_BASE0,
3665 .num_ports = 2,
3666 .base_baud = 3686400,
3667 .uart_offset = 0x10,
3668 .first_offset = 0x800,
3669 },
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07003670 /*
3671 * ADDI-DATA GmbH PCI-Express communication cards <info@addi-data.com>
3672 */
3673 [pbn_ADDIDATA_PCIe_1_3906250] = {
3674 .flags = FL_BASE0,
3675 .num_ports = 1,
3676 .base_baud = 3906250,
3677 .uart_offset = 0x200,
3678 .first_offset = 0x1000,
3679 },
3680 [pbn_ADDIDATA_PCIe_2_3906250] = {
3681 .flags = FL_BASE0,
3682 .num_ports = 2,
3683 .base_baud = 3906250,
3684 .uart_offset = 0x200,
3685 .first_offset = 0x1000,
3686 },
3687 [pbn_ADDIDATA_PCIe_4_3906250] = {
3688 .flags = FL_BASE0,
3689 .num_ports = 4,
3690 .base_baud = 3906250,
3691 .uart_offset = 0x200,
3692 .first_offset = 0x1000,
3693 },
3694 [pbn_ADDIDATA_PCIe_8_3906250] = {
3695 .flags = FL_BASE0,
3696 .num_ports = 8,
3697 .base_baud = 3906250,
3698 .uart_offset = 0x200,
3699 .first_offset = 0x1000,
3700 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08003701 [pbn_ce4100_1_115200] = {
Maxime Bizon08ec2122012-10-19 10:45:07 +02003702 .flags = FL_BASE_BARS,
3703 .num_ports = 2,
Dirk Brandewie095e24b2010-11-17 07:35:20 -08003704 .base_baud = 921600,
3705 .reg_shift = 2,
3706 },
Aaron Sierra41d3f092014-03-03 19:54:36 -06003707 /*
3708 * Intel BayTrail HSUART reference clock is 44.2368 MHz at power-on,
3709 * but is overridden by byt_set_termios.
3710 */
Heikki Krogerusb15e5692013-09-27 10:52:59 +03003711 [pbn_byt] = {
3712 .flags = FL_BASE0,
3713 .num_ports = 1,
3714 .base_baud = 2764800,
3715 .uart_offset = 0x80,
3716 .reg_shift = 2,
3717 },
Bryan O'Donoghue1ede7dc2014-09-23 01:21:11 +01003718 [pbn_qrk] = {
3719 .flags = FL_BASE0,
3720 .num_ports = 1,
3721 .base_baud = 2764800,
3722 .reg_shift = 2,
3723 },
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04003724 [pbn_omegapci] = {
3725 .flags = FL_BASE0,
3726 .num_ports = 8,
3727 .base_baud = 115200,
3728 .uart_offset = 0x200,
3729 },
Nicos Gollan7808edc2011-05-05 21:00:37 +02003730 [pbn_NETMOS9900_2s_115200] = {
3731 .flags = FL_BASE0,
3732 .num_ports = 2,
3733 .base_baud = 115200,
3734 },
Stephen Hurdebebd492013-01-17 14:14:53 -08003735 [pbn_brcm_trumanage] = {
3736 .flags = FL_BASE0,
3737 .num_ports = 1,
3738 .reg_shift = 2,
3739 .base_baud = 115200,
3740 },
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07003741 [pbn_fintek_4] = {
3742 .num_ports = 4,
3743 .uart_offset = 8,
3744 .base_baud = 115200,
3745 .first_offset = 0x40,
3746 },
3747 [pbn_fintek_8] = {
3748 .num_ports = 8,
3749 .uart_offset = 8,
3750 .base_baud = 115200,
3751 .first_offset = 0x40,
3752 },
3753 [pbn_fintek_12] = {
3754 .num_ports = 12,
3755 .uart_offset = 8,
3756 .base_baud = 115200,
3757 .first_offset = 0x40,
3758 },
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03003759 [pbn_wch384_4] = {
3760 .flags = FL_BASE0,
3761 .num_ports = 4,
3762 .base_baud = 115200,
3763 .uart_offset = 8,
3764 .first_offset = 0xC0,
3765 },
Adam Lee89c043a2015-08-03 13:28:13 +08003766 /*
3767 * Pericom PI7C9X795[1248] Uno/Dual/Quad/Octal UART
3768 */
3769 [pbn_pericom_PI7C9X7951] = {
3770 .flags = FL_BASE0,
3771 .num_ports = 1,
3772 .base_baud = 921600,
3773 .uart_offset = 0x8,
3774 },
3775 [pbn_pericom_PI7C9X7952] = {
3776 .flags = FL_BASE0,
3777 .num_ports = 2,
3778 .base_baud = 921600,
3779 .uart_offset = 0x8,
3780 },
3781 [pbn_pericom_PI7C9X7954] = {
3782 .flags = FL_BASE0,
3783 .num_ports = 4,
3784 .base_baud = 921600,
3785 .uart_offset = 0x8,
3786 },
3787 [pbn_pericom_PI7C9X7958] = {
3788 .flags = FL_BASE0,
3789 .num_ports = 8,
3790 .base_baud = 921600,
3791 .uart_offset = 0x8,
3792 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003793};
3794
Guainluca Anzolin6971c632012-09-04 15:56:12 +01003795static const struct pci_device_id blacklist[] = {
3796 /* softmodems */
Alan Cox5756ee92008-02-08 04:18:51 -08003797 { PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */
Maciej Szmigieroebf7c062010-10-26 21:48:21 +02003798 { PCI_VDEVICE(MOTOROLA, 0x3052), }, /* Motorola Si3052-based modem */
3799 { PCI_DEVICE(0x1543, 0x3052), }, /* Si3052-based modem, default IDs */
Guainluca Anzolin6971c632012-09-04 15:56:12 +01003800
3801 /* multi-io cards handled by parport_serial */
3802 { PCI_DEVICE(0x4348, 0x7053), }, /* WCH CH353 2S1P */
Ezequiel Garciafeb58142014-05-24 15:24:51 -03003803 { PCI_DEVICE(0x4348, 0x5053), }, /* WCH CH353 1S1P */
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03003804 { PCI_DEVICE(0x1c00, 0x3250), }, /* WCH CH382 2S1P */
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03003805 { PCI_DEVICE(0x1c00, 0x3470), }, /* WCH CH384 4S */
Heikki Krogerusd9eda9b2015-10-13 13:29:02 +03003806
3807 /* Intel platforms with MID UART */
3808 { PCI_VDEVICE(INTEL, 0x081b), },
3809 { PCI_VDEVICE(INTEL, 0x081c), },
3810 { PCI_VDEVICE(INTEL, 0x081d), },
3811 { PCI_VDEVICE(INTEL, 0x1191), },
Christian Schmidt436bbd42007-08-22 14:01:19 -07003812};
3813
Linus Torvalds1da177e2005-04-16 15:20:36 -07003814/*
3815 * Given a complete unknown PCI device, try to use some heuristics to
3816 * guess what the configuration might be, based on the pitiful PCI
3817 * serial specs. Returns 0 on success, 1 on failure.
3818 */
Bill Pemberton9671f092012-11-19 13:21:50 -05003819static int
Russell King1c7c1fe2005-07-27 11:31:19 +01003820serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003821{
Guainluca Anzolin6971c632012-09-04 15:56:12 +01003822 const struct pci_device_id *bldev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003823 int num_iomem, num_port, first_port = -1, i;
Alan Cox5756ee92008-02-08 04:18:51 -08003824
Linus Torvalds1da177e2005-04-16 15:20:36 -07003825 /*
3826 * If it is not a communications device or the programming
3827 * interface is greater than 6, give up.
3828 *
3829 * (Should we try to make guesses for multiport serial devices
Alan Cox5756ee92008-02-08 04:18:51 -08003830 * later?)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003831 */
3832 if ((((dev->class >> 8) != PCI_CLASS_COMMUNICATION_SERIAL) &&
3833 ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) ||
3834 (dev->class & 0xff) > 6)
3835 return -ENODEV;
3836
Christian Schmidt436bbd42007-08-22 14:01:19 -07003837 /*
3838 * Do not access blacklisted devices that are known not to
Guainluca Anzolin6971c632012-09-04 15:56:12 +01003839 * feature serial ports or are handled by other modules.
Christian Schmidt436bbd42007-08-22 14:01:19 -07003840 */
Guainluca Anzolin6971c632012-09-04 15:56:12 +01003841 for (bldev = blacklist;
3842 bldev < blacklist + ARRAY_SIZE(blacklist);
3843 bldev++) {
3844 if (dev->vendor == bldev->vendor &&
3845 dev->device == bldev->device)
Christian Schmidt436bbd42007-08-22 14:01:19 -07003846 return -ENODEV;
3847 }
3848
Linus Torvalds1da177e2005-04-16 15:20:36 -07003849 num_iomem = num_port = 0;
3850 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
3851 if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
3852 num_port++;
3853 if (first_port == -1)
3854 first_port = i;
3855 }
3856 if (pci_resource_flags(dev, i) & IORESOURCE_MEM)
3857 num_iomem++;
3858 }
3859
3860 /*
3861 * If there is 1 or 0 iomem regions, and exactly one port,
3862 * use it. We guess the number of ports based on the IO
3863 * region size.
3864 */
3865 if (num_iomem <= 1 && num_port == 1) {
3866 board->flags = first_port;
3867 board->num_ports = pci_resource_len(dev, first_port) / 8;
3868 return 0;
3869 }
3870
3871 /*
3872 * Now guess if we've got a board which indexes by BARs.
3873 * Each IO BAR should be 8 bytes, and they should follow
3874 * consecutively.
3875 */
3876 first_port = -1;
3877 num_port = 0;
3878 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
3879 if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
3880 pci_resource_len(dev, i) == 8 &&
3881 (first_port == -1 || (first_port + num_port) == i)) {
3882 num_port++;
3883 if (first_port == -1)
3884 first_port = i;
3885 }
3886 }
3887
3888 if (num_port > 1) {
3889 board->flags = first_port | FL_BASE_BARS;
3890 board->num_ports = num_port;
3891 return 0;
3892 }
3893
3894 return -ENODEV;
3895}
3896
3897static inline int
Russell King975a1a7d2009-01-02 13:44:27 +00003898serial_pci_matches(const struct pciserial_board *board,
3899 const struct pciserial_board *guessed)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003900{
3901 return
3902 board->num_ports == guessed->num_ports &&
3903 board->base_baud == guessed->base_baud &&
3904 board->uart_offset == guessed->uart_offset &&
3905 board->reg_shift == guessed->reg_shift &&
3906 board->first_offset == guessed->first_offset;
3907}
3908
Russell King241fc432005-07-27 11:35:54 +01003909struct serial_private *
Russell King975a1a7d2009-01-02 13:44:27 +00003910pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
Russell King241fc432005-07-27 11:35:54 +01003911{
Alan Cox2655a2c2012-07-12 12:59:50 +01003912 struct uart_8250_port uart;
Russell King241fc432005-07-27 11:35:54 +01003913 struct serial_private *priv;
3914 struct pci_serial_quirk *quirk;
3915 int rc, nr_ports, i;
3916
3917 nr_ports = board->num_ports;
3918
3919 /*
3920 * Find an init and setup quirks.
3921 */
3922 quirk = find_quirk(dev);
3923
3924 /*
3925 * Run the new-style initialization function.
3926 * The initialization function returns:
3927 * <0 - error
3928 * 0 - use board->num_ports
3929 * >0 - number of ports
3930 */
3931 if (quirk->init) {
3932 rc = quirk->init(dev);
3933 if (rc < 0) {
3934 priv = ERR_PTR(rc);
3935 goto err_out;
3936 }
3937 if (rc)
3938 nr_ports = rc;
3939 }
3940
Burman Yan8f31bb32007-02-14 00:33:07 -08003941 priv = kzalloc(sizeof(struct serial_private) +
Russell King241fc432005-07-27 11:35:54 +01003942 sizeof(unsigned int) * nr_ports,
3943 GFP_KERNEL);
3944 if (!priv) {
3945 priv = ERR_PTR(-ENOMEM);
3946 goto err_deinit;
3947 }
3948
Russell King241fc432005-07-27 11:35:54 +01003949 priv->dev = dev;
3950 priv->quirk = quirk;
3951
Alan Cox2655a2c2012-07-12 12:59:50 +01003952 memset(&uart, 0, sizeof(uart));
3953 uart.port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
3954 uart.port.uartclk = board->base_baud * 16;
3955 uart.port.irq = get_pci_irq(dev, board);
3956 uart.port.dev = &dev->dev;
Russell King241fc432005-07-27 11:35:54 +01003957
3958 for (i = 0; i < nr_ports; i++) {
Alan Cox2655a2c2012-07-12 12:59:50 +01003959 if (quirk->setup(priv, board, &uart, i))
Russell King241fc432005-07-27 11:35:54 +01003960 break;
3961
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07003962 dev_dbg(&dev->dev, "Setup PCI port: port %lx, irq %d, type %d\n",
3963 uart.port.iobase, uart.port.irq, uart.port.iotype);
Alan Cox5756ee92008-02-08 04:18:51 -08003964
Alan Cox2655a2c2012-07-12 12:59:50 +01003965 priv->line[i] = serial8250_register_8250_port(&uart);
Russell King241fc432005-07-27 11:35:54 +01003966 if (priv->line[i] < 0) {
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07003967 dev_err(&dev->dev,
3968 "Couldn't register serial port %lx, irq %d, type %d, error %d\n",
3969 uart.port.iobase, uart.port.irq,
3970 uart.port.iotype, priv->line[i]);
Russell King241fc432005-07-27 11:35:54 +01003971 break;
3972 }
3973 }
Russell King241fc432005-07-27 11:35:54 +01003974 priv->nr = i;
Russell King241fc432005-07-27 11:35:54 +01003975 return priv;
3976
Alan Cox5756ee92008-02-08 04:18:51 -08003977err_deinit:
Russell King241fc432005-07-27 11:35:54 +01003978 if (quirk->exit)
3979 quirk->exit(dev);
Alan Cox5756ee92008-02-08 04:18:51 -08003980err_out:
Russell King241fc432005-07-27 11:35:54 +01003981 return priv;
3982}
3983EXPORT_SYMBOL_GPL(pciserial_init_ports);
3984
3985void pciserial_remove_ports(struct serial_private *priv)
3986{
3987 struct pci_serial_quirk *quirk;
3988 int i;
3989
3990 for (i = 0; i < priv->nr; i++)
3991 serial8250_unregister_port(priv->line[i]);
3992
3993 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
3994 if (priv->remapped_bar[i])
3995 iounmap(priv->remapped_bar[i]);
3996 priv->remapped_bar[i] = NULL;
3997 }
3998
3999 /*
4000 * Find the exit quirks.
4001 */
4002 quirk = find_quirk(priv->dev);
4003 if (quirk->exit)
4004 quirk->exit(priv->dev);
4005
4006 kfree(priv);
4007}
4008EXPORT_SYMBOL_GPL(pciserial_remove_ports);
4009
4010void pciserial_suspend_ports(struct serial_private *priv)
4011{
4012 int i;
4013
4014 for (i = 0; i < priv->nr; i++)
4015 if (priv->line[i] >= 0)
4016 serial8250_suspend_port(priv->line[i]);
Dan Williams5f1a3892012-04-10 14:11:03 -07004017
4018 /*
4019 * Ensure that every init quirk is properly torn down
4020 */
4021 if (priv->quirk->exit)
4022 priv->quirk->exit(priv->dev);
Russell King241fc432005-07-27 11:35:54 +01004023}
4024EXPORT_SYMBOL_GPL(pciserial_suspend_ports);
4025
4026void pciserial_resume_ports(struct serial_private *priv)
4027{
4028 int i;
4029
4030 /*
4031 * Ensure that the board is correctly configured.
4032 */
4033 if (priv->quirk->init)
4034 priv->quirk->init(priv->dev);
4035
4036 for (i = 0; i < priv->nr; i++)
4037 if (priv->line[i] >= 0)
4038 serial8250_resume_port(priv->line[i]);
4039}
4040EXPORT_SYMBOL_GPL(pciserial_resume_ports);
4041
Linus Torvalds1da177e2005-04-16 15:20:36 -07004042/*
4043 * Probe one serial board. Unfortunately, there is no rhyme nor reason
4044 * to the arrangement of serial ports on a PCI card.
4045 */
Bill Pemberton9671f092012-11-19 13:21:50 -05004046static int
Linus Torvalds1da177e2005-04-16 15:20:36 -07004047pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
4048{
Frédéric Brière5bf8f502011-05-29 15:08:03 -04004049 struct pci_serial_quirk *quirk;
Linus Torvalds1da177e2005-04-16 15:20:36 -07004050 struct serial_private *priv;
Russell King975a1a7d2009-01-02 13:44:27 +00004051 const struct pciserial_board *board;
4052 struct pciserial_board tmp;
Russell King241fc432005-07-27 11:35:54 +01004053 int rc;
Linus Torvalds1da177e2005-04-16 15:20:36 -07004054
Frédéric Brière5bf8f502011-05-29 15:08:03 -04004055 quirk = find_quirk(dev);
4056 if (quirk->probe) {
4057 rc = quirk->probe(dev);
4058 if (rc)
4059 return rc;
4060 }
4061
Linus Torvalds1da177e2005-04-16 15:20:36 -07004062 if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07004063 dev_err(&dev->dev, "invalid driver_data: %ld\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -07004064 ent->driver_data);
4065 return -EINVAL;
4066 }
4067
4068 board = &pci_boards[ent->driver_data];
4069
4070 rc = pci_enable_device(dev);
Michael Reed28071902011-05-31 12:06:28 -05004071 pci_save_state(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07004072 if (rc)
4073 return rc;
4074
4075 if (ent->driver_data == pbn_default) {
4076 /*
4077 * Use a copy of the pci_board entry for this;
4078 * avoid changing entries in the table.
4079 */
Russell King1c7c1fe2005-07-27 11:31:19 +01004080 memcpy(&tmp, board, sizeof(struct pciserial_board));
Linus Torvalds1da177e2005-04-16 15:20:36 -07004081 board = &tmp;
4082
4083 /*
4084 * We matched one of our class entries. Try to
4085 * determine the parameters of this board.
4086 */
Russell King975a1a7d2009-01-02 13:44:27 +00004087 rc = serial_pci_guess_board(dev, &tmp);
Linus Torvalds1da177e2005-04-16 15:20:36 -07004088 if (rc)
4089 goto disable;
4090 } else {
4091 /*
4092 * We matched an explicit entry. If we are able to
4093 * detect this boards settings with our heuristic,
4094 * then we no longer need this entry.
4095 */
Russell King1c7c1fe2005-07-27 11:31:19 +01004096 memcpy(&tmp, &pci_boards[pbn_default],
4097 sizeof(struct pciserial_board));
Linus Torvalds1da177e2005-04-16 15:20:36 -07004098 rc = serial_pci_guess_board(dev, &tmp);
4099 if (rc == 0 && serial_pci_matches(board, &tmp))
4100 moan_device("Redundant entry in serial pci_table.",
4101 dev);
4102 }
4103
Russell King241fc432005-07-27 11:35:54 +01004104 priv = pciserial_init_ports(dev, board);
4105 if (!IS_ERR(priv)) {
4106 pci_set_drvdata(dev, priv);
4107 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -07004108 }
4109
Russell King241fc432005-07-27 11:35:54 +01004110 rc = PTR_ERR(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07004111
Linus Torvalds1da177e2005-04-16 15:20:36 -07004112 disable:
4113 pci_disable_device(dev);
4114 return rc;
4115}
4116
Bill Pembertonae8d8a12012-11-19 13:26:18 -05004117static void pciserial_remove_one(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -07004118{
4119 struct serial_private *priv = pci_get_drvdata(dev);
4120
Russell King241fc432005-07-27 11:35:54 +01004121 pciserial_remove_ports(priv);
Russell King056a8762005-07-22 10:15:04 +01004122
4123 pci_disable_device(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07004124}
4125
Andy Shevchenko61702c32015-02-02 14:53:26 +02004126#ifdef CONFIG_PM_SLEEP
4127static int pciserial_suspend_one(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -07004128{
Andy Shevchenko61702c32015-02-02 14:53:26 +02004129 struct pci_dev *pdev = to_pci_dev(dev);
4130 struct serial_private *priv = pci_get_drvdata(pdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07004131
Russell King241fc432005-07-27 11:35:54 +01004132 if (priv)
4133 pciserial_suspend_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07004134
Linus Torvalds1da177e2005-04-16 15:20:36 -07004135 return 0;
4136}
4137
Andy Shevchenko61702c32015-02-02 14:53:26 +02004138static int pciserial_resume_one(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -07004139{
Andy Shevchenko61702c32015-02-02 14:53:26 +02004140 struct pci_dev *pdev = to_pci_dev(dev);
4141 struct serial_private *priv = pci_get_drvdata(pdev);
Dirk Hohndelccb9d592007-10-29 06:28:17 -07004142 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07004143
4144 if (priv) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07004145 /*
4146 * The device may have been disabled. Re-enable it.
4147 */
Andy Shevchenko61702c32015-02-02 14:53:26 +02004148 err = pci_enable_device(pdev);
Alan Cox40836c42008-10-13 10:36:11 +01004149 /* FIXME: We cannot simply error out here */
Dirk Hohndelccb9d592007-10-29 06:28:17 -07004150 if (err)
Andy Shevchenko61702c32015-02-02 14:53:26 +02004151 dev_err(dev, "Unable to re-enable ports, trying to continue.\n");
Russell King241fc432005-07-27 11:35:54 +01004152 pciserial_resume_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07004153 }
4154 return 0;
4155}
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07004156#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07004157
Andy Shevchenko61702c32015-02-02 14:53:26 +02004158static SIMPLE_DEV_PM_OPS(pciserial_pm_ops, pciserial_suspend_one,
4159 pciserial_resume_one);
4160
Linus Torvalds1da177e2005-04-16 15:20:36 -07004161static struct pci_device_id serial_pci_tbl[] = {
Michael Bramer78d70d42009-01-27 11:51:16 +00004162 /* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */
4163 { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620,
4164 PCI_DEVICE_ID_ADVANTECH_PCI3620, 0x0001, 0, 0,
4165 pbn_b2_8_921600 },
Thomee Wright0c6d7742014-05-19 20:30:51 +00004166 /* Advantech also use 0x3618 and 0xf618 */
4167 { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3618,
4168 PCI_DEVICE_ID_ADVANTECH_PCI3618, PCI_ANY_ID, 0, 0,
4169 pbn_b0_4_921600 },
4170 { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCIf618,
4171 PCI_DEVICE_ID_ADVANTECH_PCI3618, PCI_ANY_ID, 0, 0,
4172 pbn_b0_4_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004173 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
4174 PCI_SUBVENDOR_ID_CONNECT_TECH,
4175 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
4176 pbn_b1_8_1382400 },
4177 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
4178 PCI_SUBVENDOR_ID_CONNECT_TECH,
4179 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
4180 pbn_b1_4_1382400 },
4181 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
4182 PCI_SUBVENDOR_ID_CONNECT_TECH,
4183 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
4184 pbn_b1_2_1382400 },
4185 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4186 PCI_SUBVENDOR_ID_CONNECT_TECH,
4187 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
4188 pbn_b1_8_1382400 },
4189 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4190 PCI_SUBVENDOR_ID_CONNECT_TECH,
4191 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
4192 pbn_b1_4_1382400 },
4193 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4194 PCI_SUBVENDOR_ID_CONNECT_TECH,
4195 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
4196 pbn_b1_2_1382400 },
4197 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4198 PCI_SUBVENDOR_ID_CONNECT_TECH,
4199 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485, 0, 0,
4200 pbn_b1_8_921600 },
4201 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4202 PCI_SUBVENDOR_ID_CONNECT_TECH,
4203 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4, 0, 0,
4204 pbn_b1_8_921600 },
4205 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4206 PCI_SUBVENDOR_ID_CONNECT_TECH,
4207 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485, 0, 0,
4208 pbn_b1_4_921600 },
4209 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4210 PCI_SUBVENDOR_ID_CONNECT_TECH,
4211 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2, 0, 0,
4212 pbn_b1_4_921600 },
4213 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4214 PCI_SUBVENDOR_ID_CONNECT_TECH,
4215 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485, 0, 0,
4216 pbn_b1_2_921600 },
4217 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4218 PCI_SUBVENDOR_ID_CONNECT_TECH,
4219 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6, 0, 0,
4220 pbn_b1_8_921600 },
4221 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4222 PCI_SUBVENDOR_ID_CONNECT_TECH,
4223 PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1, 0, 0,
4224 pbn_b1_8_921600 },
4225 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4226 PCI_SUBVENDOR_ID_CONNECT_TECH,
4227 PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1, 0, 0,
4228 pbn_b1_4_921600 },
Gareth Howlett26e92862006-01-04 17:00:42 +00004229 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
4230 PCI_SUBVENDOR_ID_CONNECT_TECH,
4231 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ, 0, 0,
4232 pbn_b1_2_1250000 },
4233 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
4234 PCI_SUBVENDOR_ID_CONNECT_TECH,
4235 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2, 0, 0,
4236 pbn_b0_2_1843200 },
4237 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
4238 PCI_SUBVENDOR_ID_CONNECT_TECH,
4239 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0,
4240 pbn_b0_4_1843200 },
Yoichi Yuasa85d14942006-02-08 21:46:24 +00004241 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
4242 PCI_VENDOR_ID_AFAVLAB,
4243 PCI_SUBDEVICE_ID_AFAVLAB_P061, 0, 0,
4244 pbn_b0_4_1152000 },
Gareth Howlett26e92862006-01-04 17:00:42 +00004245 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
4246 PCI_SUBVENDOR_ID_CONNECT_TECH,
4247 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0,
4248 pbn_b0_2_1843200_200 },
4249 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
4250 PCI_SUBVENDOR_ID_CONNECT_TECH,
4251 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232, 0, 0,
4252 pbn_b0_4_1843200_200 },
4253 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
4254 PCI_SUBVENDOR_ID_CONNECT_TECH,
4255 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232, 0, 0,
4256 pbn_b0_8_1843200_200 },
4257 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
4258 PCI_SUBVENDOR_ID_CONNECT_TECH,
4259 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1, 0, 0,
4260 pbn_b0_2_1843200_200 },
4261 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
4262 PCI_SUBVENDOR_ID_CONNECT_TECH,
4263 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2, 0, 0,
4264 pbn_b0_4_1843200_200 },
4265 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
4266 PCI_SUBVENDOR_ID_CONNECT_TECH,
4267 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4, 0, 0,
4268 pbn_b0_8_1843200_200 },
4269 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
4270 PCI_SUBVENDOR_ID_CONNECT_TECH,
4271 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2, 0, 0,
4272 pbn_b0_2_1843200_200 },
4273 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
4274 PCI_SUBVENDOR_ID_CONNECT_TECH,
4275 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4, 0, 0,
4276 pbn_b0_4_1843200_200 },
4277 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
4278 PCI_SUBVENDOR_ID_CONNECT_TECH,
4279 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8, 0, 0,
4280 pbn_b0_8_1843200_200 },
4281 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
4282 PCI_SUBVENDOR_ID_CONNECT_TECH,
4283 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485, 0, 0,
4284 pbn_b0_2_1843200_200 },
4285 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
4286 PCI_SUBVENDOR_ID_CONNECT_TECH,
4287 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485, 0, 0,
4288 pbn_b0_4_1843200_200 },
4289 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
4290 PCI_SUBVENDOR_ID_CONNECT_TECH,
4291 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0,
4292 pbn_b0_8_1843200_200 },
Benjamin Herrenschmidtc68d2b12009-10-26 16:50:05 -07004293 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
4294 PCI_VENDOR_ID_IBM, PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT,
4295 0, 0, pbn_exar_ibm_saturn },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004296
4297 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
Alan Cox5756ee92008-02-08 04:18:51 -08004298 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004299 pbn_b2_bt_1_115200 },
4300 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM2,
Alan Cox5756ee92008-02-08 04:18:51 -08004301 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004302 pbn_b2_bt_2_115200 },
4303 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM422,
Alan Cox5756ee92008-02-08 04:18:51 -08004304 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004305 pbn_b2_bt_4_115200 },
4306 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM232,
Alan Cox5756ee92008-02-08 04:18:51 -08004307 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004308 pbn_b2_bt_2_115200 },
4309 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM4,
Alan Cox5756ee92008-02-08 04:18:51 -08004310 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004311 pbn_b2_bt_4_115200 },
4312 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8,
Alan Cox5756ee92008-02-08 04:18:51 -08004313 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004314 pbn_b2_8_115200 },
Flavio Leitnere65f0f82009-01-02 13:50:43 +00004315 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_7803,
4316 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4317 pbn_b2_8_460800 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004318 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM8,
4319 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4320 pbn_b2_8_115200 },
4321
4322 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_GTEK_SERIAL2,
4323 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4324 pbn_b2_bt_2_115200 },
4325 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM200,
4326 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4327 pbn_b2_bt_2_921600 },
4328 /*
4329 * VScom SPCOM800, from sl@s.pl
4330 */
Alan Cox5756ee92008-02-08 04:18:51 -08004331 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM800,
4332 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004333 pbn_b2_8_921600 },
4334 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_1077,
Alan Cox5756ee92008-02-08 04:18:51 -08004335 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004336 pbn_b2_4_921600 },
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07004337 /* Unknown card - subdevice 0x1584 */
4338 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4339 PCI_VENDOR_ID_PLX,
4340 PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0,
Scott Ashcroftd13402a2013-03-03 21:35:06 +00004341 pbn_b2_4_115200 },
4342 /* Unknown card - subdevice 0x1588 */
4343 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4344 PCI_VENDOR_ID_PLX,
4345 PCI_SUBDEVICE_ID_UNKNOWN_0x1588, 0, 0,
4346 pbn_b2_8_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004347 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4348 PCI_SUBVENDOR_ID_KEYSPAN,
4349 PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0,
4350 pbn_panacom },
4351 { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_QUADMODEM,
4352 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4353 pbn_panacom4 },
4354 { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_DUALMODEM,
4355 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4356 pbn_panacom2 },
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08004357 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
4358 PCI_VENDOR_ID_ESDGMBH,
4359 PCI_DEVICE_ID_ESDGMBH_CPCIASIO4, 0, 0,
4360 pbn_b2_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004361 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4362 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08004363 PCI_SUBDEVICE_ID_CHASE_PCIFAST4, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004364 pbn_b2_4_460800 },
4365 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4366 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08004367 PCI_SUBDEVICE_ID_CHASE_PCIFAST8, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004368 pbn_b2_8_460800 },
4369 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4370 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08004371 PCI_SUBDEVICE_ID_CHASE_PCIFAST16, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004372 pbn_b2_16_460800 },
4373 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4374 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08004375 PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004376 pbn_b2_16_460800 },
4377 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4378 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
Alan Cox5756ee92008-02-08 04:18:51 -08004379 PCI_SUBDEVICE_ID_CHASE_PCIRAS4, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004380 pbn_b2_4_460800 },
4381 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4382 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
Alan Cox5756ee92008-02-08 04:18:51 -08004383 PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004384 pbn_b2_8_460800 },
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01004385 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4386 PCI_SUBVENDOR_ID_EXSYS,
4387 PCI_SUBDEVICE_ID_EXSYS_4055, 0, 0,
Shawn Bohreree4cd1b2012-05-28 15:20:47 -05004388 pbn_b2_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004389 /*
4390 * Megawolf Romulus PCI Serial Card, from Mike Hudson
4391 * (Exoray@isys.ca)
4392 */
4393 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_ROMULUS,
4394 0x10b5, 0x106a, 0, 0,
4395 pbn_plx_romulus },
Alan Cox55c7c0f2012-11-29 09:03:00 +10304396 /*
Mike Skoog1bc8cde2014-10-16 13:10:01 -07004397 * EndRun Technologies. PCI express device range.
4398 * EndRun PTP/1588 has 2 Native UARTs.
4399 */
4400 { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588,
4401 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4402 pbn_endrun_2_4000000 },
4403 /*
Alan Cox55c7c0f2012-11-29 09:03:00 +10304404 * Quatech cards. These actually have configurable clocks but for
4405 * now we just use the default.
4406 *
4407 * 100 series are RS232, 200 series RS422,
4408 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07004409 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC100,
4410 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4411 pbn_b1_4_115200 },
4412 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100,
4413 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4414 pbn_b1_2_115200 },
Alan Cox55c7c0f2012-11-29 09:03:00 +10304415 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100E,
4416 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4417 pbn_b2_2_115200 },
4418 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC200,
4419 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4420 pbn_b1_2_115200 },
4421 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC200E,
4422 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4423 pbn_b2_2_115200 },
4424 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC200,
4425 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4426 pbn_b1_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004427 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100D,
4428 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4429 pbn_b1_8_115200 },
4430 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100M,
4431 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4432 pbn_b1_8_115200 },
Alan Cox55c7c0f2012-11-29 09:03:00 +10304433 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSCP100,
4434 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4435 pbn_b1_4_115200 },
4436 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSCP100,
4437 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4438 pbn_b1_2_115200 },
4439 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSCP200,
4440 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4441 pbn_b1_4_115200 },
4442 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSCP200,
4443 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4444 pbn_b1_2_115200 },
4445 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSCLP100,
4446 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4447 pbn_b2_4_115200 },
4448 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSCLP100,
4449 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4450 pbn_b2_2_115200 },
4451 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SSCLP100,
4452 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4453 pbn_b2_1_115200 },
4454 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSCLP200,
4455 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4456 pbn_b2_4_115200 },
4457 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSCLP200,
4458 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4459 pbn_b2_2_115200 },
4460 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SSCLP200,
4461 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4462 pbn_b2_1_115200 },
4463 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESCLP100,
4464 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4465 pbn_b0_8_115200 },
4466
Linus Torvalds1da177e2005-04-16 15:20:36 -07004467 { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_OXSEMI_16PCI954,
Alan Cox5756ee92008-02-08 04:18:51 -08004468 PCI_VENDOR_ID_SPECIALIX, PCI_SUBDEVICE_ID_SPECIALIX_SPEED4,
4469 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004470 pbn_b0_4_921600 },
4471 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
Alan Cox5756ee92008-02-08 04:18:51 -08004472 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL,
4473 0, 0,
Andrey Paninfbc0dc02005-07-18 11:38:09 +01004474 pbn_b0_4_1152000 },
Mikulas Patockac9bd9d02010-10-26 14:20:48 -04004475 { PCI_VENDOR_ID_OXSEMI, 0x9505,
4476 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4477 pbn_b0_bt_2_921600 },
David Ransondb1de152005-07-27 11:43:55 -07004478
4479 /*
4480 * The below card is a little controversial since it is the
4481 * subject of a PCI vendor/device ID clash. (See
4482 * www.ussg.iu.edu/hypermail/linux/kernel/0303.1/0516.html).
4483 * For now just used the hex ID 0x950a.
4484 */
4485 { PCI_VENDOR_ID_OXSEMI, 0x950a,
Flavio Leitner26e82202012-09-21 21:04:34 -03004486 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_00,
4487 0, 0, pbn_b0_2_115200 },
4488 { PCI_VENDOR_ID_OXSEMI, 0x950a,
4489 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_30,
4490 0, 0, pbn_b0_2_115200 },
Niels de Vos39aced62009-01-02 13:46:58 +00004491 { PCI_VENDOR_ID_OXSEMI, 0x950a,
David Ransondb1de152005-07-27 11:43:55 -07004492 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4493 pbn_b0_2_1130000 },
Andre Przywara70fd8fd2009-06-11 12:41:57 +01004494 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_C950,
4495 PCI_VENDOR_ID_OXSEMI, PCI_SUBDEVICE_ID_OXSEMI_C950, 0, 0,
4496 pbn_b0_1_921600 },
Andrey Paninfbc0dc02005-07-18 11:38:09 +01004497 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004498 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4499 pbn_b0_4_115200 },
4500 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952,
4501 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4502 pbn_b0_bt_2_921600 },
Lytochkin Borise8470032010-07-26 10:02:26 +04004503 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI958,
4504 PCI_ANY_ID , PCI_ANY_ID, 0, 0,
4505 pbn_b2_8_1152000 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004506
4507 /*
Lee Howard7106b4e2008-10-21 13:48:58 +01004508 * Oxford Semiconductor Inc. Tornado PCI express device range.
4509 */
4510 { PCI_VENDOR_ID_OXSEMI, 0xc101, /* OXPCIe952 1 Legacy UART */
4511 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4512 pbn_b0_1_4000000 },
4513 { PCI_VENDOR_ID_OXSEMI, 0xc105, /* OXPCIe952 1 Legacy UART */
4514 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4515 pbn_b0_1_4000000 },
4516 { PCI_VENDOR_ID_OXSEMI, 0xc11b, /* OXPCIe952 1 Native UART */
4517 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4518 pbn_oxsemi_1_4000000 },
4519 { PCI_VENDOR_ID_OXSEMI, 0xc11f, /* OXPCIe952 1 Native UART */
4520 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4521 pbn_oxsemi_1_4000000 },
4522 { PCI_VENDOR_ID_OXSEMI, 0xc120, /* OXPCIe952 1 Legacy UART */
4523 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4524 pbn_b0_1_4000000 },
4525 { PCI_VENDOR_ID_OXSEMI, 0xc124, /* OXPCIe952 1 Legacy UART */
4526 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4527 pbn_b0_1_4000000 },
4528 { PCI_VENDOR_ID_OXSEMI, 0xc138, /* OXPCIe952 1 Native UART */
4529 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4530 pbn_oxsemi_1_4000000 },
4531 { PCI_VENDOR_ID_OXSEMI, 0xc13d, /* OXPCIe952 1 Native UART */
4532 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4533 pbn_oxsemi_1_4000000 },
4534 { PCI_VENDOR_ID_OXSEMI, 0xc140, /* OXPCIe952 1 Legacy UART */
4535 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4536 pbn_b0_1_4000000 },
4537 { PCI_VENDOR_ID_OXSEMI, 0xc141, /* OXPCIe952 1 Legacy UART */
4538 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4539 pbn_b0_1_4000000 },
4540 { PCI_VENDOR_ID_OXSEMI, 0xc144, /* OXPCIe952 1 Legacy UART */
4541 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4542 pbn_b0_1_4000000 },
4543 { PCI_VENDOR_ID_OXSEMI, 0xc145, /* OXPCIe952 1 Legacy UART */
4544 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4545 pbn_b0_1_4000000 },
4546 { PCI_VENDOR_ID_OXSEMI, 0xc158, /* OXPCIe952 2 Native UART */
4547 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4548 pbn_oxsemi_2_4000000 },
4549 { PCI_VENDOR_ID_OXSEMI, 0xc15d, /* OXPCIe952 2 Native UART */
4550 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4551 pbn_oxsemi_2_4000000 },
4552 { PCI_VENDOR_ID_OXSEMI, 0xc208, /* OXPCIe954 4 Native UART */
4553 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4554 pbn_oxsemi_4_4000000 },
4555 { PCI_VENDOR_ID_OXSEMI, 0xc20d, /* OXPCIe954 4 Native UART */
4556 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4557 pbn_oxsemi_4_4000000 },
4558 { PCI_VENDOR_ID_OXSEMI, 0xc308, /* OXPCIe958 8 Native UART */
4559 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4560 pbn_oxsemi_8_4000000 },
4561 { PCI_VENDOR_ID_OXSEMI, 0xc30d, /* OXPCIe958 8 Native UART */
4562 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4563 pbn_oxsemi_8_4000000 },
4564 { PCI_VENDOR_ID_OXSEMI, 0xc40b, /* OXPCIe200 1 Native UART */
4565 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4566 pbn_oxsemi_1_4000000 },
4567 { PCI_VENDOR_ID_OXSEMI, 0xc40f, /* OXPCIe200 1 Native UART */
4568 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4569 pbn_oxsemi_1_4000000 },
4570 { PCI_VENDOR_ID_OXSEMI, 0xc41b, /* OXPCIe200 1 Native UART */
4571 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4572 pbn_oxsemi_1_4000000 },
4573 { PCI_VENDOR_ID_OXSEMI, 0xc41f, /* OXPCIe200 1 Native UART */
4574 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4575 pbn_oxsemi_1_4000000 },
4576 { PCI_VENDOR_ID_OXSEMI, 0xc42b, /* OXPCIe200 1 Native UART */
4577 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4578 pbn_oxsemi_1_4000000 },
4579 { PCI_VENDOR_ID_OXSEMI, 0xc42f, /* OXPCIe200 1 Native UART */
4580 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4581 pbn_oxsemi_1_4000000 },
4582 { PCI_VENDOR_ID_OXSEMI, 0xc43b, /* OXPCIe200 1 Native UART */
4583 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4584 pbn_oxsemi_1_4000000 },
4585 { PCI_VENDOR_ID_OXSEMI, 0xc43f, /* OXPCIe200 1 Native UART */
4586 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4587 pbn_oxsemi_1_4000000 },
4588 { PCI_VENDOR_ID_OXSEMI, 0xc44b, /* OXPCIe200 1 Native UART */
4589 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4590 pbn_oxsemi_1_4000000 },
4591 { PCI_VENDOR_ID_OXSEMI, 0xc44f, /* OXPCIe200 1 Native UART */
4592 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4593 pbn_oxsemi_1_4000000 },
4594 { PCI_VENDOR_ID_OXSEMI, 0xc45b, /* OXPCIe200 1 Native UART */
4595 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4596 pbn_oxsemi_1_4000000 },
4597 { PCI_VENDOR_ID_OXSEMI, 0xc45f, /* OXPCIe200 1 Native UART */
4598 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4599 pbn_oxsemi_1_4000000 },
4600 { PCI_VENDOR_ID_OXSEMI, 0xc46b, /* OXPCIe200 1 Native UART */
4601 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4602 pbn_oxsemi_1_4000000 },
4603 { PCI_VENDOR_ID_OXSEMI, 0xc46f, /* OXPCIe200 1 Native UART */
4604 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4605 pbn_oxsemi_1_4000000 },
4606 { PCI_VENDOR_ID_OXSEMI, 0xc47b, /* OXPCIe200 1 Native UART */
4607 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4608 pbn_oxsemi_1_4000000 },
4609 { PCI_VENDOR_ID_OXSEMI, 0xc47f, /* OXPCIe200 1 Native UART */
4610 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4611 pbn_oxsemi_1_4000000 },
4612 { PCI_VENDOR_ID_OXSEMI, 0xc48b, /* OXPCIe200 1 Native UART */
4613 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4614 pbn_oxsemi_1_4000000 },
4615 { PCI_VENDOR_ID_OXSEMI, 0xc48f, /* OXPCIe200 1 Native UART */
4616 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4617 pbn_oxsemi_1_4000000 },
4618 { PCI_VENDOR_ID_OXSEMI, 0xc49b, /* OXPCIe200 1 Native UART */
4619 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4620 pbn_oxsemi_1_4000000 },
4621 { PCI_VENDOR_ID_OXSEMI, 0xc49f, /* OXPCIe200 1 Native UART */
4622 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4623 pbn_oxsemi_1_4000000 },
4624 { PCI_VENDOR_ID_OXSEMI, 0xc4ab, /* OXPCIe200 1 Native UART */
4625 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4626 pbn_oxsemi_1_4000000 },
4627 { PCI_VENDOR_ID_OXSEMI, 0xc4af, /* OXPCIe200 1 Native UART */
4628 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4629 pbn_oxsemi_1_4000000 },
4630 { PCI_VENDOR_ID_OXSEMI, 0xc4bb, /* OXPCIe200 1 Native UART */
4631 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4632 pbn_oxsemi_1_4000000 },
4633 { PCI_VENDOR_ID_OXSEMI, 0xc4bf, /* OXPCIe200 1 Native UART */
4634 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4635 pbn_oxsemi_1_4000000 },
4636 { PCI_VENDOR_ID_OXSEMI, 0xc4cb, /* OXPCIe200 1 Native UART */
4637 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4638 pbn_oxsemi_1_4000000 },
4639 { PCI_VENDOR_ID_OXSEMI, 0xc4cf, /* OXPCIe200 1 Native UART */
4640 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4641 pbn_oxsemi_1_4000000 },
Lee Howardb80de362008-10-21 13:50:14 +01004642 /*
4643 * Mainpine Inc. IQ Express "Rev3" utilizing OxSemi Tornado
4644 */
4645 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 1 Port V.34 Super-G3 Fax */
4646 PCI_VENDOR_ID_MAINPINE, 0x4001, 0, 0,
4647 pbn_oxsemi_1_4000000 },
4648 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 2 Port V.34 Super-G3 Fax */
4649 PCI_VENDOR_ID_MAINPINE, 0x4002, 0, 0,
4650 pbn_oxsemi_2_4000000 },
4651 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 4 Port V.34 Super-G3 Fax */
4652 PCI_VENDOR_ID_MAINPINE, 0x4004, 0, 0,
4653 pbn_oxsemi_4_4000000 },
4654 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 8 Port V.34 Super-G3 Fax */
4655 PCI_VENDOR_ID_MAINPINE, 0x4008, 0, 0,
4656 pbn_oxsemi_8_4000000 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05004657
4658 /*
4659 * Digi/IBM PCIe 2-port Async EIA-232 Adapter utilizing OxSemi Tornado
4660 */
4661 { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM,
4662 PCI_SUBVENDOR_ID_IBM, PCI_ANY_ID, 0, 0,
4663 pbn_oxsemi_2_4000000 },
4664
Lee Howard7106b4e2008-10-21 13:48:58 +01004665 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07004666 * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards,
4667 * from skokodyn@yahoo.com
4668 */
4669 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
4670 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO232, 0, 0,
4671 pbn_sbsxrsio },
4672 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
4673 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO422, 0, 0,
4674 pbn_sbsxrsio },
4675 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
4676 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL232, 0, 0,
4677 pbn_sbsxrsio },
4678 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
4679 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL422, 0, 0,
4680 pbn_sbsxrsio },
4681
4682 /*
4683 * Digitan DS560-558, from jimd@esoft.com
4684 */
4685 { PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_ATT_VENUS_MODEM,
Alan Cox5756ee92008-02-08 04:18:51 -08004686 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004687 pbn_b1_1_115200 },
4688
4689 /*
4690 * Titan Electronic cards
4691 * The 400L and 800L have a custom setup quirk.
4692 */
4693 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100,
Alan Cox5756ee92008-02-08 04:18:51 -08004694 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004695 pbn_b0_1_921600 },
4696 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200,
Alan Cox5756ee92008-02-08 04:18:51 -08004697 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004698 pbn_b0_2_921600 },
4699 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400,
Alan Cox5756ee92008-02-08 04:18:51 -08004700 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004701 pbn_b0_4_921600 },
4702 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800B,
Alan Cox5756ee92008-02-08 04:18:51 -08004703 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004704 pbn_b0_4_921600 },
4705 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100L,
4706 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4707 pbn_b1_1_921600 },
4708 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200L,
4709 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4710 pbn_b1_bt_2_921600 },
4711 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400L,
4712 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4713 pbn_b0_bt_4_921600 },
4714 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800L,
4715 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4716 pbn_b0_bt_8_921600 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02004717 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200I,
4718 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4719 pbn_b4_bt_2_921600 },
4720 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400I,
4721 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4722 pbn_b4_bt_4_921600 },
4723 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800I,
4724 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4725 pbn_b4_bt_8_921600 },
4726 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400EH,
4727 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4728 pbn_b0_4_921600 },
4729 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EH,
4730 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4731 pbn_b0_4_921600 },
4732 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EHB,
4733 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4734 pbn_b0_4_921600 },
4735 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100E,
4736 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4737 pbn_oxsemi_1_4000000 },
4738 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200E,
4739 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4740 pbn_oxsemi_2_4000000 },
4741 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400E,
4742 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4743 pbn_oxsemi_4_4000000 },
4744 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800E,
4745 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4746 pbn_oxsemi_8_4000000 },
4747 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EI,
4748 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4749 pbn_oxsemi_2_4000000 },
4750 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EISI,
4751 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4752 pbn_oxsemi_2_4000000 },
Yegor Yefremov48c02472013-12-09 12:11:15 +01004753 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200V3,
4754 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4755 pbn_b0_bt_2_921600 },
Yegor Yefremov1e9deb12011-12-27 15:47:37 +01004756 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400V3,
4757 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4758 pbn_b0_4_921600 },
4759 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_410V3,
4760 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4761 pbn_b0_4_921600 },
4762 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800V3,
4763 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4764 pbn_b0_4_921600 },
4765 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800V3B,
4766 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4767 pbn_b0_4_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004768
4769 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550,
4770 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4771 pbn_b2_1_460800 },
4772 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_650,
4773 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4774 pbn_b2_1_460800 },
4775 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_850,
4776 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4777 pbn_b2_1_460800 },
4778 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_550,
4779 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4780 pbn_b2_bt_2_921600 },
4781 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_650,
4782 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4783 pbn_b2_bt_2_921600 },
4784 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_850,
4785 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4786 pbn_b2_bt_2_921600 },
4787 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_550,
4788 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4789 pbn_b2_bt_4_921600 },
4790 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_650,
4791 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4792 pbn_b2_bt_4_921600 },
4793 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_850,
4794 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4795 pbn_b2_bt_4_921600 },
4796 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_550,
4797 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4798 pbn_b0_1_921600 },
4799 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_650,
4800 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4801 pbn_b0_1_921600 },
4802 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_850,
4803 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4804 pbn_b0_1_921600 },
4805 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_550,
4806 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4807 pbn_b0_bt_2_921600 },
4808 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_650,
4809 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4810 pbn_b0_bt_2_921600 },
4811 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_850,
4812 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4813 pbn_b0_bt_2_921600 },
4814 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_550,
4815 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4816 pbn_b0_bt_4_921600 },
4817 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_650,
4818 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4819 pbn_b0_bt_4_921600 },
4820 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850,
4821 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4822 pbn_b0_bt_4_921600 },
Andrey Panin3ec9c592006-02-02 20:15:09 +00004823 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_550,
4824 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4825 pbn_b0_bt_8_921600 },
4826 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_650,
4827 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4828 pbn_b0_bt_8_921600 },
4829 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_850,
4830 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4831 pbn_b0_bt_8_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004832
4833 /*
4834 * Computone devices submitted by Doug McNash dmcnash@computone.com
4835 */
4836 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
4837 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG4,
4838 0, 0, pbn_computone_4 },
4839 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
4840 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG8,
4841 0, 0, pbn_computone_8 },
4842 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
4843 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG6,
4844 0, 0, pbn_computone_6 },
4845
4846 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI95N,
4847 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4848 pbn_oxsemi },
4849 { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
4850 PCI_VENDOR_ID_TIMEDIA, PCI_ANY_ID, 0, 0,
4851 pbn_b0_bt_1_921600 },
4852
4853 /*
Stephen Chiversabd7bac2013-01-28 19:49:20 +11004854 * SUNIX (TIMEDIA)
4855 */
4856 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
4857 PCI_VENDOR_ID_SUNIX, PCI_ANY_ID,
4858 PCI_CLASS_COMMUNICATION_SERIAL << 8, 0xffff00,
4859 pbn_b0_bt_1_921600 },
4860
4861 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
4862 PCI_VENDOR_ID_SUNIX, PCI_ANY_ID,
4863 PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00,
4864 pbn_b0_bt_1_921600 },
4865
4866 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07004867 * AFAVLAB serial card, from Harald Welte <laforge@gnumonks.org>
4868 */
4869 { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P028,
4870 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4871 pbn_b0_bt_8_115200 },
4872 { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P030,
4873 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4874 pbn_b0_bt_8_115200 },
4875
4876 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_DSERIAL,
4877 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4878 pbn_b0_bt_2_115200 },
4879 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_A,
4880 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4881 pbn_b0_bt_2_115200 },
4882 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B,
4883 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4884 pbn_b0_bt_2_115200 },
Lennert Buytenhekb87e5e22009-11-11 14:26:42 -08004885 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_A,
4886 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4887 pbn_b0_bt_2_115200 },
4888 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_B,
4889 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4890 pbn_b0_bt_2_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004891 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A,
4892 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4893 pbn_b0_bt_4_460800 },
4894 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_B,
4895 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4896 pbn_b0_bt_4_460800 },
4897 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_PLUS,
4898 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4899 pbn_b0_bt_2_460800 },
4900 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_A,
4901 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4902 pbn_b0_bt_2_460800 },
4903 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_B,
4904 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4905 pbn_b0_bt_2_460800 },
4906 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_SSERIAL,
4907 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4908 pbn_b0_bt_1_115200 },
4909 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_650,
4910 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4911 pbn_b0_bt_1_460800 },
4912
4913 /*
Russell King1fb8cac2006-12-13 14:45:46 +00004914 * Korenix Jetcard F0/F1 cards (JC1204, JC1208, JC1404, JC1408).
4915 * Cards are identified by their subsystem vendor IDs, which
4916 * (in hex) match the model number.
4917 *
4918 * Note that JC140x are RS422/485 cards which require ox950
4919 * ACR = 0x10, and as such are not currently fully supported.
4920 */
4921 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
4922 0x1204, 0x0004, 0, 0,
4923 pbn_b0_4_921600 },
4924 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
4925 0x1208, 0x0004, 0, 0,
4926 pbn_b0_4_921600 },
4927/* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
4928 0x1402, 0x0002, 0, 0,
4929 pbn_b0_2_921600 }, */
4930/* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
4931 0x1404, 0x0004, 0, 0,
4932 pbn_b0_4_921600 }, */
4933 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF1,
4934 0x1208, 0x0004, 0, 0,
4935 pbn_b0_4_921600 },
4936
Kiros Yeh2a52fcb2009-12-21 16:26:48 -08004937 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2,
4938 0x1204, 0x0004, 0, 0,
4939 pbn_b0_4_921600 },
4940 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2,
4941 0x1208, 0x0004, 0, 0,
4942 pbn_b0_4_921600 },
4943 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF3,
4944 0x1208, 0x0004, 0, 0,
4945 pbn_b0_4_921600 },
Russell King1fb8cac2006-12-13 14:45:46 +00004946 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07004947 * Dell Remote Access Card 4 - Tim_T_Murphy@Dell.com
4948 */
4949 { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RAC4,
4950 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4951 pbn_b1_1_1382400 },
4952
4953 /*
4954 * Dell Remote Access Card III - Tim_T_Murphy@Dell.com
4955 */
4956 { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RACIII,
4957 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4958 pbn_b1_1_1382400 },
4959
4960 /*
4961 * RAStel 2 port modem, gerg@moreton.com.au
4962 */
4963 { PCI_VENDOR_ID_MORETON, PCI_DEVICE_ID_RASTEL_2PORT,
4964 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4965 pbn_b2_bt_2_115200 },
4966
4967 /*
4968 * EKF addition for i960 Boards form EKF with serial port
4969 */
4970 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80960_RP,
4971 0xE4BF, PCI_ANY_ID, 0, 0,
4972 pbn_intel_i960 },
4973
4974 /*
4975 * Xircom Cardbus/Ethernet combos
4976 */
4977 { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_X3201_MDM,
4978 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4979 pbn_b0_1_115200 },
4980 /*
4981 * Xircom RBM56G cardbus modem - Dirk Arnold (temp entry)
4982 */
4983 { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_RBM56G,
4984 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4985 pbn_b0_1_115200 },
4986
4987 /*
4988 * Untested PCI modems, sent in from various folks...
4989 */
4990
4991 /*
4992 * Elsa Model 56K PCI Modem, from Andreas Rath <arh@01019freenet.de>
4993 */
4994 { PCI_VENDOR_ID_ROCKWELL, 0x1004,
4995 0x1048, 0x1500, 0, 0,
4996 pbn_b1_1_115200 },
4997
4998 { PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
4999 0xFF00, 0, 0, 0,
5000 pbn_sgi_ioc3 },
5001
5002 /*
5003 * HP Diva card
5004 */
5005 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
5006 PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_RMP3, 0, 0,
5007 pbn_b1_1_115200 },
5008 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
5009 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5010 pbn_b0_5_115200 },
5011 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
5012 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5013 pbn_b2_1_115200 },
5014
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00005015 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,
5016 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5017 pbn_b3_2_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07005018 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM4,
5019 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5020 pbn_b3_4_115200 },
5021 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM8,
5022 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5023 pbn_b3_8_115200 },
5024
5025 /*
5026 * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
5027 */
5028 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
5029 PCI_ANY_ID, PCI_ANY_ID,
5030 0,
5031 0, pbn_exar_XR17C152 },
5032 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
5033 PCI_ANY_ID, PCI_ANY_ID,
5034 0,
5035 0, pbn_exar_XR17C154 },
5036 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
5037 PCI_ANY_ID, PCI_ANY_ID,
5038 0,
5039 0, pbn_exar_XR17C158 },
Matt Schultedc96efb2012-11-19 09:12:04 -06005040 /*
Soeren Grunewald96a5d182015-04-28 16:29:49 +02005041 * Exar Corp. XR17V[48]35[248] Dual/Quad/Octal/Hexa PCIe UARTs
Matt Schultedc96efb2012-11-19 09:12:04 -06005042 */
5043 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V352,
5044 PCI_ANY_ID, PCI_ANY_ID,
5045 0,
5046 0, pbn_exar_XR17V352 },
5047 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V354,
5048 PCI_ANY_ID, PCI_ANY_ID,
5049 0,
5050 0, pbn_exar_XR17V354 },
5051 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V358,
5052 PCI_ANY_ID, PCI_ANY_ID,
5053 0,
5054 0, pbn_exar_XR17V358 },
Soeren Grunewaldbe32c0c2015-06-11 09:25:04 +02005055 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V4358,
5056 PCI_ANY_ID, PCI_ANY_ID,
5057 0,
5058 0, pbn_exar_XR17V4358 },
Soeren Grunewald96a5d182015-04-28 16:29:49 +02005059 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V8358,
5060 PCI_ANY_ID, PCI_ANY_ID,
5061 0,
5062 0, pbn_exar_XR17V8358 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07005063 /*
Adam Lee89c043a2015-08-03 13:28:13 +08005064 * Pericom PI7C9X795[1248] Uno/Dual/Quad/Octal UART
5065 */
5066 { PCI_VENDOR_ID_PERICOM, PCI_DEVICE_ID_PERICOM_PI7C9X7951,
5067 PCI_ANY_ID, PCI_ANY_ID,
5068 0,
5069 0, pbn_pericom_PI7C9X7951 },
5070 { PCI_VENDOR_ID_PERICOM, PCI_DEVICE_ID_PERICOM_PI7C9X7952,
5071 PCI_ANY_ID, PCI_ANY_ID,
5072 0,
5073 0, pbn_pericom_PI7C9X7952 },
5074 { PCI_VENDOR_ID_PERICOM, PCI_DEVICE_ID_PERICOM_PI7C9X7954,
5075 PCI_ANY_ID, PCI_ANY_ID,
5076 0,
5077 0, pbn_pericom_PI7C9X7954 },
5078 { PCI_VENDOR_ID_PERICOM, PCI_DEVICE_ID_PERICOM_PI7C9X7958,
5079 PCI_ANY_ID, PCI_ANY_ID,
5080 0,
5081 0, pbn_pericom_PI7C9X7958 },
5082 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07005083 * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke)
5084 */
5085 { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560,
5086 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5087 pbn_b0_1_115200 },
Niels de Vos84f8c6f2007-08-22 14:01:14 -07005088 /*
5089 * ITE
5090 */
5091 { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
5092 PCI_ANY_ID, PCI_ANY_ID,
5093 0, 0,
5094 pbn_b1_bt_1_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07005095
5096 /*
Peter Horton737c1752006-08-26 09:07:36 +01005097 * IntaShield IS-200
5098 */
5099 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200,
5100 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */
5101 pbn_b2_2_115200 },
Ignacio García Pérez4b6f6ce2008-05-23 13:04:28 -07005102 /*
5103 * IntaShield IS-400
5104 */
5105 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
5106 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
5107 pbn_b2_4_115200 },
Peter Horton737c1752006-08-26 09:07:36 +01005108 /*
Thomas Hoehn48212002007-02-10 01:46:05 -08005109 * Perle PCI-RAS cards
5110 */
5111 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
5112 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS4,
5113 0, 0, pbn_b2_4_921600 },
5114 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
5115 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8,
5116 0, 0, pbn_b2_8_921600 },
Alan Coxbf0df632007-10-16 01:24:00 -07005117
5118 /*
5119 * Mainpine series cards: Fairly standard layout but fools
5120 * parts of the autodetect in some cases and uses otherwise
5121 * unmatched communications subclasses in the PCI Express case
5122 */
5123
5124 { /* RockForceDUO */
5125 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5126 PCI_VENDOR_ID_MAINPINE, 0x0200,
5127 0, 0, pbn_b0_2_115200 },
5128 { /* RockForceQUATRO */
5129 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5130 PCI_VENDOR_ID_MAINPINE, 0x0300,
5131 0, 0, pbn_b0_4_115200 },
5132 { /* RockForceDUO+ */
5133 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5134 PCI_VENDOR_ID_MAINPINE, 0x0400,
5135 0, 0, pbn_b0_2_115200 },
5136 { /* RockForceQUATRO+ */
5137 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5138 PCI_VENDOR_ID_MAINPINE, 0x0500,
5139 0, 0, pbn_b0_4_115200 },
5140 { /* RockForce+ */
5141 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5142 PCI_VENDOR_ID_MAINPINE, 0x0600,
5143 0, 0, pbn_b0_2_115200 },
5144 { /* RockForce+ */
5145 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5146 PCI_VENDOR_ID_MAINPINE, 0x0700,
5147 0, 0, pbn_b0_4_115200 },
5148 { /* RockForceOCTO+ */
5149 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5150 PCI_VENDOR_ID_MAINPINE, 0x0800,
5151 0, 0, pbn_b0_8_115200 },
5152 { /* RockForceDUO+ */
5153 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5154 PCI_VENDOR_ID_MAINPINE, 0x0C00,
5155 0, 0, pbn_b0_2_115200 },
5156 { /* RockForceQUARTRO+ */
5157 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5158 PCI_VENDOR_ID_MAINPINE, 0x0D00,
5159 0, 0, pbn_b0_4_115200 },
5160 { /* RockForceOCTO+ */
5161 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5162 PCI_VENDOR_ID_MAINPINE, 0x1D00,
5163 0, 0, pbn_b0_8_115200 },
5164 { /* RockForceD1 */
5165 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5166 PCI_VENDOR_ID_MAINPINE, 0x2000,
5167 0, 0, pbn_b0_1_115200 },
5168 { /* RockForceF1 */
5169 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5170 PCI_VENDOR_ID_MAINPINE, 0x2100,
5171 0, 0, pbn_b0_1_115200 },
5172 { /* RockForceD2 */
5173 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5174 PCI_VENDOR_ID_MAINPINE, 0x2200,
5175 0, 0, pbn_b0_2_115200 },
5176 { /* RockForceF2 */
5177 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5178 PCI_VENDOR_ID_MAINPINE, 0x2300,
5179 0, 0, pbn_b0_2_115200 },
5180 { /* RockForceD4 */
5181 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5182 PCI_VENDOR_ID_MAINPINE, 0x2400,
5183 0, 0, pbn_b0_4_115200 },
5184 { /* RockForceF4 */
5185 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5186 PCI_VENDOR_ID_MAINPINE, 0x2500,
5187 0, 0, pbn_b0_4_115200 },
5188 { /* RockForceD8 */
5189 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5190 PCI_VENDOR_ID_MAINPINE, 0x2600,
5191 0, 0, pbn_b0_8_115200 },
5192 { /* RockForceF8 */
5193 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5194 PCI_VENDOR_ID_MAINPINE, 0x2700,
5195 0, 0, pbn_b0_8_115200 },
5196 { /* IQ Express D1 */
5197 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5198 PCI_VENDOR_ID_MAINPINE, 0x3000,
5199 0, 0, pbn_b0_1_115200 },
5200 { /* IQ Express F1 */
5201 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5202 PCI_VENDOR_ID_MAINPINE, 0x3100,
5203 0, 0, pbn_b0_1_115200 },
5204 { /* IQ Express D2 */
5205 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5206 PCI_VENDOR_ID_MAINPINE, 0x3200,
5207 0, 0, pbn_b0_2_115200 },
5208 { /* IQ Express F2 */
5209 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5210 PCI_VENDOR_ID_MAINPINE, 0x3300,
5211 0, 0, pbn_b0_2_115200 },
5212 { /* IQ Express D4 */
5213 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5214 PCI_VENDOR_ID_MAINPINE, 0x3400,
5215 0, 0, pbn_b0_4_115200 },
5216 { /* IQ Express F4 */
5217 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5218 PCI_VENDOR_ID_MAINPINE, 0x3500,
5219 0, 0, pbn_b0_4_115200 },
5220 { /* IQ Express D8 */
5221 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5222 PCI_VENDOR_ID_MAINPINE, 0x3C00,
5223 0, 0, pbn_b0_8_115200 },
5224 { /* IQ Express F8 */
5225 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
5226 PCI_VENDOR_ID_MAINPINE, 0x3D00,
5227 0, 0, pbn_b0_8_115200 },
5228
5229
Thomas Hoehn48212002007-02-10 01:46:05 -08005230 /*
Olof Johanssonaa798502007-08-22 14:01:55 -07005231 * PA Semi PA6T-1682M on-chip UART
5232 */
5233 { PCI_VENDOR_ID_PASEMI, 0xa004,
5234 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5235 pbn_pasemi_1682M },
5236
5237 /*
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01005238 * National Instruments
5239 */
Will Page04bf7e72009-04-06 17:32:15 +01005240 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI23216,
5241 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5242 pbn_b1_16_115200 },
5243 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2328,
5244 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5245 pbn_b1_8_115200 },
5246 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2324,
5247 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5248 pbn_b1_bt_4_115200 },
5249 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2322,
5250 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5251 pbn_b1_bt_2_115200 },
5252 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2324I,
5253 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5254 pbn_b1_bt_4_115200 },
5255 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2322I,
5256 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5257 pbn_b1_bt_2_115200 },
5258 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_23216,
5259 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5260 pbn_b1_16_115200 },
5261 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2328,
5262 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5263 pbn_b1_8_115200 },
5264 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2324,
5265 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5266 pbn_b1_bt_4_115200 },
5267 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2322,
5268 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5269 pbn_b1_bt_2_115200 },
5270 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8422_2324,
5271 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5272 pbn_b1_bt_4_115200 },
5273 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8422_2322,
5274 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5275 pbn_b1_bt_2_115200 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01005276 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2322,
5277 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5278 pbn_ni8430_2 },
5279 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2322,
5280 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5281 pbn_ni8430_2 },
5282 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2324,
5283 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5284 pbn_ni8430_4 },
5285 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2324,
5286 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5287 pbn_ni8430_4 },
5288 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2328,
5289 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5290 pbn_ni8430_8 },
5291 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2328,
5292 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5293 pbn_ni8430_8 },
5294 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_23216,
5295 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5296 pbn_ni8430_16 },
5297 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_23216,
5298 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5299 pbn_ni8430_16 },
5300 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8432_2322,
5301 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5302 pbn_ni8430_2 },
5303 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8432_2322,
5304 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5305 pbn_ni8430_2 },
5306 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8432_2324,
5307 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5308 pbn_ni8430_4 },
5309 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8432_2324,
5310 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5311 pbn_ni8430_4 },
5312
5313 /*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08005314 * ADDI-DATA GmbH communication cards <info@addi-data.com>
5315 */
5316 { PCI_VENDOR_ID_ADDIDATA,
5317 PCI_DEVICE_ID_ADDIDATA_APCI7500,
5318 PCI_ANY_ID,
5319 PCI_ANY_ID,
5320 0,
5321 0,
5322 pbn_b0_4_115200 },
5323
5324 { PCI_VENDOR_ID_ADDIDATA,
5325 PCI_DEVICE_ID_ADDIDATA_APCI7420,
5326 PCI_ANY_ID,
5327 PCI_ANY_ID,
5328 0,
5329 0,
5330 pbn_b0_2_115200 },
5331
5332 { PCI_VENDOR_ID_ADDIDATA,
5333 PCI_DEVICE_ID_ADDIDATA_APCI7300,
5334 PCI_ANY_ID,
5335 PCI_ANY_ID,
5336 0,
5337 0,
5338 pbn_b0_1_115200 },
5339
Ian Abbott086231f2013-07-16 16:14:39 +01005340 { PCI_VENDOR_ID_AMCC,
Ian Abbott57c1f0e2013-07-16 16:14:40 +01005341 PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800,
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08005342 PCI_ANY_ID,
5343 PCI_ANY_ID,
5344 0,
5345 0,
5346 pbn_b1_8_115200 },
5347
5348 { PCI_VENDOR_ID_ADDIDATA,
5349 PCI_DEVICE_ID_ADDIDATA_APCI7500_2,
5350 PCI_ANY_ID,
5351 PCI_ANY_ID,
5352 0,
5353 0,
5354 pbn_b0_4_115200 },
5355
5356 { PCI_VENDOR_ID_ADDIDATA,
5357 PCI_DEVICE_ID_ADDIDATA_APCI7420_2,
5358 PCI_ANY_ID,
5359 PCI_ANY_ID,
5360 0,
5361 0,
5362 pbn_b0_2_115200 },
5363
5364 { PCI_VENDOR_ID_ADDIDATA,
5365 PCI_DEVICE_ID_ADDIDATA_APCI7300_2,
5366 PCI_ANY_ID,
5367 PCI_ANY_ID,
5368 0,
5369 0,
5370 pbn_b0_1_115200 },
5371
5372 { PCI_VENDOR_ID_ADDIDATA,
5373 PCI_DEVICE_ID_ADDIDATA_APCI7500_3,
5374 PCI_ANY_ID,
5375 PCI_ANY_ID,
5376 0,
5377 0,
5378 pbn_b0_4_115200 },
5379
5380 { PCI_VENDOR_ID_ADDIDATA,
5381 PCI_DEVICE_ID_ADDIDATA_APCI7420_3,
5382 PCI_ANY_ID,
5383 PCI_ANY_ID,
5384 0,
5385 0,
5386 pbn_b0_2_115200 },
5387
5388 { PCI_VENDOR_ID_ADDIDATA,
5389 PCI_DEVICE_ID_ADDIDATA_APCI7300_3,
5390 PCI_ANY_ID,
5391 PCI_ANY_ID,
5392 0,
5393 0,
5394 pbn_b0_1_115200 },
5395
5396 { PCI_VENDOR_ID_ADDIDATA,
5397 PCI_DEVICE_ID_ADDIDATA_APCI7800_3,
5398 PCI_ANY_ID,
5399 PCI_ANY_ID,
5400 0,
5401 0,
5402 pbn_b0_8_115200 },
5403
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07005404 { PCI_VENDOR_ID_ADDIDATA,
5405 PCI_DEVICE_ID_ADDIDATA_APCIe7500,
5406 PCI_ANY_ID,
5407 PCI_ANY_ID,
5408 0,
5409 0,
5410 pbn_ADDIDATA_PCIe_4_3906250 },
5411
5412 { PCI_VENDOR_ID_ADDIDATA,
5413 PCI_DEVICE_ID_ADDIDATA_APCIe7420,
5414 PCI_ANY_ID,
5415 PCI_ANY_ID,
5416 0,
5417 0,
5418 pbn_ADDIDATA_PCIe_2_3906250 },
5419
5420 { PCI_VENDOR_ID_ADDIDATA,
5421 PCI_DEVICE_ID_ADDIDATA_APCIe7300,
5422 PCI_ANY_ID,
5423 PCI_ANY_ID,
5424 0,
5425 0,
5426 pbn_ADDIDATA_PCIe_1_3906250 },
5427
5428 { PCI_VENDOR_ID_ADDIDATA,
5429 PCI_DEVICE_ID_ADDIDATA_APCIe7800,
5430 PCI_ANY_ID,
5431 PCI_ANY_ID,
5432 0,
5433 0,
5434 pbn_ADDIDATA_PCIe_8_3906250 },
5435
Jiri Slaby25cf9bc2009-01-15 13:30:34 +00005436 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
5437 PCI_VENDOR_ID_IBM, 0x0299,
5438 0, 0, pbn_b0_bt_2_115200 },
5439
Stefan Seyfried972ce082013-07-01 09:14:21 +02005440 /*
5441 * other NetMos 9835 devices are most likely handled by the
5442 * parport_serial driver, check drivers/parport/parport_serial.c
5443 * before adding them here.
5444 */
5445
Michael Bueschc4285b42009-06-30 11:41:21 -07005446 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901,
5447 0xA000, 0x1000,
5448 0, 0, pbn_b0_1_115200 },
5449
Nicos Gollan7808edc2011-05-05 21:00:37 +02005450 /* the 9901 is a rebranded 9912 */
5451 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
5452 0xA000, 0x1000,
5453 0, 0, pbn_b0_1_115200 },
5454
5455 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
5456 0xA000, 0x1000,
5457 0, 0, pbn_b0_1_115200 },
5458
5459 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9904,
5460 0xA000, 0x1000,
5461 0, 0, pbn_b0_1_115200 },
5462
5463 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
5464 0xA000, 0x1000,
5465 0, 0, pbn_b0_1_115200 },
5466
5467 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
5468 0xA000, 0x3002,
5469 0, 0, pbn_NETMOS9900_2s_115200 },
5470
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08005471 /*
Eric Smith44178172011-07-11 22:53:13 -06005472 * Best Connectivity and Rosewill PCI Multi I/O cards
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08005473 */
5474
5475 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
5476 0xA000, 0x1000,
5477 0, 0, pbn_b0_1_115200 },
5478
5479 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
Eric Smith44178172011-07-11 22:53:13 -06005480 0xA000, 0x3002,
5481 0, 0, pbn_b0_bt_2_115200 },
5482
5483 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08005484 0xA000, 0x3004,
5485 0, 0, pbn_b0_bt_4_115200 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08005486 /* Intel CE4100 */
5487 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
5488 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5489 pbn_ce4100_1_115200 },
Heikki Krogerusb15e5692013-09-27 10:52:59 +03005490 /* Intel BayTrail */
5491 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT_UART1,
5492 PCI_ANY_ID, PCI_ANY_ID,
5493 PCI_CLASS_COMMUNICATION_SERIAL << 8, 0xff0000,
5494 pbn_byt },
5495 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT_UART2,
5496 PCI_ANY_ID, PCI_ANY_ID,
5497 PCI_CLASS_COMMUNICATION_SERIAL << 8, 0xff0000,
5498 pbn_byt },
Alan Cox29897082014-08-19 20:29:23 +03005499 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW_UART1,
5500 PCI_ANY_ID, PCI_ANY_ID,
5501 PCI_CLASS_COMMUNICATION_SERIAL << 8, 0xff0000,
5502 pbn_byt },
5503 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW_UART2,
5504 PCI_ANY_ID, PCI_ANY_ID,
5505 PCI_CLASS_COMMUNICATION_SERIAL << 8, 0xff0000,
5506 pbn_byt },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08005507
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04005508 /*
Bryan O'Donoghue1ede7dc2014-09-23 01:21:11 +01005509 * Intel Quark x1000
5510 */
5511 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_QRK_UART,
5512 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5513 pbn_qrk },
5514 /*
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04005515 * Cronyx Omega PCI
5516 */
5517 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
5518 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5519 pbn_omegapci },
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08005520
5521 /*
Stephen Hurdebebd492013-01-17 14:14:53 -08005522 * Broadcom TruManage
5523 */
5524 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BROADCOM_TRUMANAGE,
5525 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5526 pbn_brcm_trumanage },
5527
5528 /*
Alan Cox66835492012-08-16 12:01:33 +01005529 * AgeStar as-prs2-009
5530 */
5531 { PCI_VENDOR_ID_AGESTAR, PCI_DEVICE_ID_AGESTAR_9375,
5532 PCI_ANY_ID, PCI_ANY_ID,
5533 0, 0, pbn_b0_bt_2_115200 },
Alan Cox27788c52012-09-04 16:21:06 +01005534
5535 /*
5536 * WCH CH353 series devices: The 2S1P is handled by parport_serial
5537 * so not listed here.
5538 */
5539 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH353_4S,
5540 PCI_ANY_ID, PCI_ANY_ID,
5541 0, 0, pbn_b0_bt_4_115200 },
5542
5543 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH353_2S1PF,
5544 PCI_ANY_ID, PCI_ANY_ID,
5545 0, 0, pbn_b0_bt_2_115200 },
5546
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03005547 { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S,
5548 PCI_ANY_ID, PCI_ANY_ID,
5549 0, 0, pbn_wch384_4 },
5550
Alan Cox66835492012-08-16 12:01:33 +01005551 /*
Matt Schulte14faa8c2012-11-21 10:35:15 -06005552 * Commtech, Inc. Fastcom adapters
5553 */
5554 { PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4222PCI335,
5555 PCI_ANY_ID, PCI_ANY_ID,
5556 0,
5557 0, pbn_b0_2_1152000_200 },
5558 { PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4224PCI335,
5559 PCI_ANY_ID, PCI_ANY_ID,
5560 0,
5561 0, pbn_b0_4_1152000_200 },
5562 { PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_2324PCI335,
5563 PCI_ANY_ID, PCI_ANY_ID,
5564 0,
5565 0, pbn_b0_4_1152000_200 },
5566 { PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_2328PCI335,
5567 PCI_ANY_ID, PCI_ANY_ID,
5568 0,
5569 0, pbn_b0_8_1152000_200 },
5570 { PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4222PCIE,
5571 PCI_ANY_ID, PCI_ANY_ID,
5572 0,
5573 0, pbn_exar_XR17V352 },
5574 { PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4224PCIE,
5575 PCI_ANY_ID, PCI_ANY_ID,
5576 0,
5577 0, pbn_exar_XR17V354 },
5578 { PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4228PCIE,
5579 PCI_ANY_ID, PCI_ANY_ID,
5580 0,
5581 0, pbn_exar_XR17V358 },
5582
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07005583 /* Fintek PCI serial cards */
5584 { PCI_DEVICE(0x1c29, 0x1104), .driver_data = pbn_fintek_4 },
5585 { PCI_DEVICE(0x1c29, 0x1108), .driver_data = pbn_fintek_8 },
5586 { PCI_DEVICE(0x1c29, 0x1112), .driver_data = pbn_fintek_12 },
5587
Matt Schulte14faa8c2012-11-21 10:35:15 -06005588 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07005589 * These entries match devices with class COMMUNICATION_SERIAL,
5590 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
5591 */
5592 { PCI_ANY_ID, PCI_ANY_ID,
5593 PCI_ANY_ID, PCI_ANY_ID,
5594 PCI_CLASS_COMMUNICATION_SERIAL << 8,
5595 0xffff00, pbn_default },
5596 { PCI_ANY_ID, PCI_ANY_ID,
5597 PCI_ANY_ID, PCI_ANY_ID,
5598 PCI_CLASS_COMMUNICATION_MODEM << 8,
5599 0xffff00, pbn_default },
5600 { PCI_ANY_ID, PCI_ANY_ID,
5601 PCI_ANY_ID, PCI_ANY_ID,
5602 PCI_CLASS_COMMUNICATION_MULTISERIAL << 8,
5603 0xffff00, pbn_default },
5604 { 0, }
5605};
5606
Michael Reed28071902011-05-31 12:06:28 -05005607static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
5608 pci_channel_state_t state)
5609{
5610 struct serial_private *priv = pci_get_drvdata(dev);
5611
5612 if (state == pci_channel_io_perm_failure)
5613 return PCI_ERS_RESULT_DISCONNECT;
5614
5615 if (priv)
5616 pciserial_suspend_ports(priv);
5617
5618 pci_disable_device(dev);
5619
5620 return PCI_ERS_RESULT_NEED_RESET;
5621}
5622
5623static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
5624{
5625 int rc;
5626
5627 rc = pci_enable_device(dev);
5628
5629 if (rc)
5630 return PCI_ERS_RESULT_DISCONNECT;
5631
5632 pci_restore_state(dev);
5633 pci_save_state(dev);
5634
5635 return PCI_ERS_RESULT_RECOVERED;
5636}
5637
5638static void serial8250_io_resume(struct pci_dev *dev)
5639{
5640 struct serial_private *priv = pci_get_drvdata(dev);
5641
5642 if (priv)
5643 pciserial_resume_ports(priv);
5644}
5645
Stephen Hemminger1d352032012-09-07 09:33:17 -07005646static const struct pci_error_handlers serial8250_err_handler = {
Michael Reed28071902011-05-31 12:06:28 -05005647 .error_detected = serial8250_io_error_detected,
5648 .slot_reset = serial8250_io_slot_reset,
5649 .resume = serial8250_io_resume,
5650};
5651
Linus Torvalds1da177e2005-04-16 15:20:36 -07005652static struct pci_driver serial_pci_driver = {
5653 .name = "serial",
5654 .probe = pciserial_init_one,
Bill Pemberton2d47b712012-11-19 13:21:34 -05005655 .remove = pciserial_remove_one,
Andy Shevchenko61702c32015-02-02 14:53:26 +02005656 .driver = {
5657 .pm = &pciserial_pm_ops,
5658 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07005659 .id_table = serial_pci_tbl,
Michael Reed28071902011-05-31 12:06:28 -05005660 .err_handler = &serial8250_err_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07005661};
5662
Wei Yongjun15a12e82012-10-26 23:04:22 +08005663module_pci_driver(serial_pci_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -07005664
5665MODULE_LICENSE("GPL");
5666MODULE_DESCRIPTION("Generic 8250/16x50 PCI serial probe module");
5667MODULE_DEVICE_TABLE(pci, serial_pci_tbl);