blob: e8b5469e9dfa1267cba98d60fbad0dfee49bcfc6 [file] [log] [blame]
Greg Kroah-Hartmane3b3d0f2017-11-06 18:11:51 +01001// SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * Probe module for 8250/16550-type PCI serial ports.
4 *
5 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
6 *
7 * Copyright (C) 2001 Russell King, All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07009#undef DEBUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/pci.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/string.h>
13#include <linux/kernel.h>
14#include <linux/slab.h>
15#include <linux/delay.h>
16#include <linux/tty.h>
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -070017#include <linux/serial_reg.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/serial_core.h>
19#include <linux/8250_pci.h>
20#include <linux/bitops.h>
21
22#include <asm/byteorder.h>
23#include <asm/io.h>
24
25#include "8250.h"
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 * init function returns:
29 * > 0 - number of ports
30 * = 0 - use board->num_ports
31 * < 0 - error
32 */
33struct pci_serial_quirk {
34 u32 vendor;
35 u32 device;
36 u32 subvendor;
37 u32 subdevice;
Frédéric Brière5bf8f502011-05-29 15:08:03 -040038 int (*probe)(struct pci_dev *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 int (*init)(struct pci_dev *dev);
Russell King975a1a7d2009-01-02 13:44:27 +000040 int (*setup)(struct serial_private *,
41 const struct pciserial_board *,
Alan Cox2655a2c2012-07-12 12:59:50 +010042 struct uart_8250_port *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 void (*exit)(struct pci_dev *dev);
44};
45
Ji-Ze Hong (Peter Hong)68e26a82019-08-16 13:27:29 +080046struct f815xxa_data {
47 spinlock_t lock;
48 int idx;
49};
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051struct serial_private {
Russell King70db3d92005-07-27 11:34:27 +010052 struct pci_dev *dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 unsigned int nr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 struct pci_serial_quirk *quirk;
Gabriel Krisman Bertazif209fa02016-11-28 19:34:42 -020055 const struct pciserial_board *board;
Gustavo A. R. Silva02042a42020-02-12 18:44:26 -060056 int line[];
Linus Torvalds1da177e2005-04-16 15:20:36 -070057};
58
Randy Wrighte0e24202021-05-14 10:26:54 -060059#define PCI_DEVICE_ID_HPE_PCI_SERIAL 0x37e
60
Ralf Ramsauer84284132019-08-12 13:21:52 +020061static const struct pci_device_id pci_use_msi[] = {
62 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
63 0xA000, 0x1000) },
64 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
65 0xA000, 0x1000) },
66 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
67 0xA000, 0x1000) },
Randy Wrighte0e24202021-05-14 10:26:54 -060068 { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL,
69 PCI_ANY_ID, PCI_ANY_ID) },
Ralf Ramsauer84284132019-08-12 13:21:52 +020070 { }
71};
72
Nicos Gollan7808edc2011-05-05 21:00:37 +020073static int pci_default_setup(struct serial_private*,
Alan Cox2655a2c2012-07-12 12:59:50 +010074 const struct pciserial_board*, struct uart_8250_port *, int);
Nicos Gollan7808edc2011-05-05 21:00:37 +020075
Linus Torvalds1da177e2005-04-16 15:20:36 -070076static void moan_device(const char *str, struct pci_dev *dev)
77{
Andy Shevchenko11773842021-10-22 16:51:47 +030078 pci_err(dev, "%s\n"
Joe Perchesad361c92009-07-06 13:05:40 -070079 "Please send the output of lspci -vv, this\n"
80 "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n"
81 "manufacturer and name of serial board or\n"
Russell Kingf2e0ea82015-03-06 10:49:21 +000082 "modem board to <linux-serial@vger.kernel.org>.\n",
Andy Shevchenko11773842021-10-22 16:51:47 +030083 str, dev->vendor, dev->device,
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 dev->subsystem_vendor, dev->subsystem_device);
85}
86
87static int
Alan Cox2655a2c2012-07-12 12:59:50 +010088setup_port(struct serial_private *priv, struct uart_8250_port *port,
Greg Kroah-Hartman3a96e972021-07-26 15:07:17 +020089 u8 bar, unsigned int offset, int regshift)
Linus Torvalds1da177e2005-04-16 15:20:36 -070090{
Russell King70db3d92005-07-27 11:34:27 +010091 struct pci_dev *dev = priv->dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092
Denis Efremovc9c13ba2019-09-28 02:43:08 +030093 if (bar >= PCI_STD_NUM_BARS)
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 return -EINVAL;
95
96 if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
Andy Shevchenko3f64b1d2016-02-15 18:01:51 +020097 if (!pcim_iomap(dev, bar, 0) && !pcim_iomap_table(dev))
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 return -ENOMEM;
99
Alan Cox2655a2c2012-07-12 12:59:50 +0100100 port->port.iotype = UPIO_MEM;
101 port->port.iobase = 0;
Aaron Sierra398a9db2014-10-30 19:49:45 -0500102 port->port.mapbase = pci_resource_start(dev, bar) + offset;
Andy Shevchenko3f64b1d2016-02-15 18:01:51 +0200103 port->port.membase = pcim_iomap_table(dev)[bar] + offset;
Alan Cox2655a2c2012-07-12 12:59:50 +0100104 port->port.regshift = regshift;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 } else {
Alan Cox2655a2c2012-07-12 12:59:50 +0100106 port->port.iotype = UPIO_PORT;
Aaron Sierra398a9db2014-10-30 19:49:45 -0500107 port->port.iobase = pci_resource_start(dev, bar) + offset;
Alan Cox2655a2c2012-07-12 12:59:50 +0100108 port->port.mapbase = 0;
109 port->port.membase = NULL;
110 port->port.regshift = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 }
112 return 0;
113}
114
115/*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -0800116 * ADDI-DATA GmbH communication cards <info@addi-data.com>
117 */
118static int addidata_apci7800_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000119 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100120 struct uart_8250_port *port, int idx)
Krauth.Julien02c9b5c2008-02-04 22:27:49 -0800121{
122 unsigned int bar = 0, offset = board->first_offset;
123 bar = FL_GET_BASE(board->flags);
124
125 if (idx < 2) {
126 offset += idx * board->uart_offset;
127 } else if ((idx >= 2) && (idx < 4)) {
128 bar += 1;
129 offset += ((idx - 2) * board->uart_offset);
130 } else if ((idx >= 4) && (idx < 6)) {
131 bar += 2;
132 offset += ((idx - 4) * board->uart_offset);
133 } else if (idx >= 6) {
134 bar += 3;
135 offset += ((idx - 6) * board->uart_offset);
136 }
137
138 return setup_port(priv, port, bar, offset, board->reg_shift);
139}
140
141/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 * AFAVLAB uses a different mixture of BARs and offsets
143 * Not that ugly ;) -- HW
144 */
145static int
Russell King975a1a7d2009-01-02 13:44:27 +0000146afavlab_setup(struct serial_private *priv, const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100147 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148{
149 unsigned int bar, offset = board->first_offset;
Alan Cox5756ee92008-02-08 04:18:51 -0800150
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 bar = FL_GET_BASE(board->flags);
152 if (idx < 4)
153 bar += idx;
154 else {
155 bar = 4;
156 offset += (idx - 4) * board->uart_offset;
157 }
158
Russell King70db3d92005-07-27 11:34:27 +0100159 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160}
161
162/*
163 * HP's Remote Management Console. The Diva chip came in several
164 * different versions. N-class, L2000 and A500 have two Diva chips, each
165 * with 3 UARTs (the third UART on the second chip is unused). Superdome
166 * and Keystone have one Diva chip with 3 UARTs. Some later machines have
167 * one Diva chip, but it has been expanded to 5 UARTs.
168 */
Russell King61a116e2006-07-03 15:22:35 +0100169static int pci_hp_diva_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170{
171 int rc = 0;
172
173 switch (dev->subsystem_device) {
174 case PCI_DEVICE_ID_HP_DIVA_TOSCA1:
175 case PCI_DEVICE_ID_HP_DIVA_HALFDOME:
176 case PCI_DEVICE_ID_HP_DIVA_KEYSTONE:
177 case PCI_DEVICE_ID_HP_DIVA_EVEREST:
178 rc = 3;
179 break;
180 case PCI_DEVICE_ID_HP_DIVA_TOSCA2:
181 rc = 2;
182 break;
183 case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
184 rc = 4;
185 break;
186 case PCI_DEVICE_ID_HP_DIVA_POWERBAR:
Justin Chen551f8f02005-10-24 22:16:38 +0100187 case PCI_DEVICE_ID_HP_DIVA_HURRICANE:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 rc = 1;
189 break;
190 }
191
192 return rc;
193}
194
195/*
196 * HP's Diva chip puts the 4th/5th serial port further out, and
197 * some serial ports are supposed to be hidden on certain models.
198 */
199static int
Russell King975a1a7d2009-01-02 13:44:27 +0000200pci_hp_diva_setup(struct serial_private *priv,
201 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100202 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203{
204 unsigned int offset = board->first_offset;
205 unsigned int bar = FL_GET_BASE(board->flags);
206
Russell King70db3d92005-07-27 11:34:27 +0100207 switch (priv->dev->subsystem_device) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
209 if (idx == 3)
210 idx++;
211 break;
212 case PCI_DEVICE_ID_HP_DIVA_EVEREST:
213 if (idx > 0)
214 idx++;
215 if (idx > 2)
216 idx++;
217 break;
218 }
219 if (idx > 2)
220 offset = 0x18;
221
222 offset += idx * board->uart_offset;
223
Russell King70db3d92005-07-27 11:34:27 +0100224 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225}
226
227/*
228 * Added for EKF Intel i960 serial boards
229 */
Russell King61a116e2006-07-03 15:22:35 +0100230static int pci_inteli960ni_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231{
Heikki Krogerus0a0d4122015-01-12 13:47:46 +0200232 u32 oldval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233
234 if (!(dev->subsystem_device & 0x1000))
235 return -ENODEV;
236
237 /* is firmware started? */
Heikki Krogerus0a0d4122015-01-12 13:47:46 +0200238 pci_read_config_dword(dev, 0x44, &oldval);
Alan Cox5756ee92008-02-08 04:18:51 -0800239 if (oldval == 0x00001000L) { /* RESET value */
Andy Shevchenko11773842021-10-22 16:51:47 +0300240 pci_dbg(dev, "Local i960 firmware missing\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 return -ENODEV;
242 }
243 return 0;
244}
245
246/*
247 * Some PCI serial cards using the PLX 9050 PCI interface chip require
248 * that the card interrupt be explicitly enabled or disabled. This
249 * seems to be mainly needed on card using the PLX which also use I/O
250 * mapped memory.
251 */
Russell King61a116e2006-07-03 15:22:35 +0100252static int pci_plx9050_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253{
254 u8 irq_config;
255 void __iomem *p;
256
257 if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0) {
258 moan_device("no memory in bar 0", dev);
259 return 0;
260 }
261
262 irq_config = 0x41;
Bjorn Helgaasadd7b582005-10-24 22:11:57 +0100263 if (dev->vendor == PCI_VENDOR_ID_PANACOM ||
Alan Cox5756ee92008-02-08 04:18:51 -0800264 dev->subsystem_vendor == PCI_SUBVENDOR_ID_EXSYS)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 irq_config = 0x43;
Alan Cox5756ee92008-02-08 04:18:51 -0800266
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267 if ((dev->vendor == PCI_VENDOR_ID_PLX) &&
Alan Cox5756ee92008-02-08 04:18:51 -0800268 (dev->device == PCI_DEVICE_ID_PLX_ROMULUS))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269 /*
270 * As the megawolf cards have the int pins active
271 * high, and have 2 UART chips, both ints must be
272 * enabled on the 9050. Also, the UARTS are set in
273 * 16450 mode by default, so we have to enable the
274 * 16C950 'enhanced' mode so that we can use the
275 * deep FIFOs
276 */
277 irq_config = 0x5b;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278 /*
279 * enable/disable interrupts
280 */
Christoph Hellwig4bdc0d62020-01-06 09:43:50 +0100281 p = ioremap(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 if (p == NULL)
283 return -ENOMEM;
284 writel(irq_config, p + 0x4c);
285
286 /*
287 * Read the register back to ensure that it took effect.
288 */
289 readl(p + 0x4c);
290 iounmap(p);
291
292 return 0;
293}
294
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500295static void pci_plx9050_exit(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296{
297 u8 __iomem *p;
298
299 if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0)
300 return;
301
302 /*
303 * disable interrupts
304 */
Christoph Hellwig4bdc0d62020-01-06 09:43:50 +0100305 p = ioremap(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306 if (p != NULL) {
307 writel(0, p + 0x4c);
308
309 /*
310 * Read the register back to ensure that it took effect.
311 */
312 readl(p + 0x4c);
313 iounmap(p);
314 }
315}
316
Will Page04bf7e72009-04-06 17:32:15 +0100317#define NI8420_INT_ENABLE_REG 0x38
318#define NI8420_INT_ENABLE_BIT 0x2000
319
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500320static void pci_ni8420_exit(struct pci_dev *dev)
Will Page04bf7e72009-04-06 17:32:15 +0100321{
322 void __iomem *p;
Will Page04bf7e72009-04-06 17:32:15 +0100323 unsigned int bar = 0;
324
325 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
326 moan_device("no memory in bar", dev);
327 return;
328 }
329
Aaron Sierra398a9db2014-10-30 19:49:45 -0500330 p = pci_ioremap_bar(dev, bar);
Will Page04bf7e72009-04-06 17:32:15 +0100331 if (p == NULL)
332 return;
333
334 /* Disable the CPU Interrupt */
335 writel(readl(p + NI8420_INT_ENABLE_REG) & ~(NI8420_INT_ENABLE_BIT),
336 p + NI8420_INT_ENABLE_REG);
337 iounmap(p);
338}
339
340
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100341/* MITE registers */
342#define MITE_IOWBSR1 0xc4
343#define MITE_IOWCR1 0xf4
344#define MITE_LCIMR1 0x08
345#define MITE_LCIMR2 0x10
346
347#define MITE_LCIMR2_CLR_CPU_IE (1 << 30)
348
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500349static void pci_ni8430_exit(struct pci_dev *dev)
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100350{
351 void __iomem *p;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100352 unsigned int bar = 0;
353
354 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
355 moan_device("no memory in bar", dev);
356 return;
357 }
358
Aaron Sierra398a9db2014-10-30 19:49:45 -0500359 p = pci_ioremap_bar(dev, bar);
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100360 if (p == NULL)
361 return;
362
363 /* Disable the CPU Interrupt */
364 writel(MITE_LCIMR2_CLR_CPU_IE, p + MITE_LCIMR2);
365 iounmap(p);
366}
367
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368/* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */
369static int
Russell King975a1a7d2009-01-02 13:44:27 +0000370sbs_setup(struct serial_private *priv, const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100371 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372{
373 unsigned int bar, offset = board->first_offset;
374
375 bar = 0;
376
377 if (idx < 4) {
378 /* first four channels map to 0, 0x100, 0x200, 0x300 */
379 offset += idx * board->uart_offset;
380 } else if (idx < 8) {
381 /* last four channels map to 0x1000, 0x1100, 0x1200, 0x1300 */
382 offset += idx * board->uart_offset + 0xC00;
383 } else /* we have only 8 ports on PMC-OCTALPRO */
384 return 1;
385
Russell King70db3d92005-07-27 11:34:27 +0100386 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387}
388
389/*
390* This does initialization for PMC OCTALPRO cards:
391* maps the device memory, resets the UARTs (needed, bc
392* if the module is removed and inserted again, the card
393* is in the sleep mode) and enables global interrupt.
394*/
395
396/* global control register offset for SBS PMC-OctalPro */
397#define OCT_REG_CR_OFF 0x500
398
Russell King61a116e2006-07-03 15:22:35 +0100399static int sbs_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400{
401 u8 __iomem *p;
402
Arjan van de Ven24ed3ab2009-06-24 18:34:58 +0100403 p = pci_ioremap_bar(dev, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404
405 if (p == NULL)
406 return -ENOMEM;
407 /* Set bit-4 Control Register (UART RESET) in to reset the uarts */
Alan Cox5756ee92008-02-08 04:18:51 -0800408 writeb(0x10, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 udelay(50);
Alan Cox5756ee92008-02-08 04:18:51 -0800410 writeb(0x0, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411
412 /* Set bit-2 (INTENABLE) of Control Register */
413 writeb(0x4, p + OCT_REG_CR_OFF);
414 iounmap(p);
415
416 return 0;
417}
418
419/*
420 * Disables the global interrupt of PMC-OctalPro
421 */
422
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500423static void sbs_exit(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424{
425 u8 __iomem *p;
426
Arjan van de Ven24ed3ab2009-06-24 18:34:58 +0100427 p = pci_ioremap_bar(dev, 0);
Alan Cox5756ee92008-02-08 04:18:51 -0800428 /* FIXME: What if resource_len < OCT_REG_CR_OFF */
429 if (p != NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 writeb(0, p + OCT_REG_CR_OFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 iounmap(p);
432}
433
434/*
435 * SIIG serial cards have an PCI interface chip which also controls
436 * the UART clocking frequency. Each UART can be clocked independently
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300437 * (except cards equipped with 4 UARTs) and initial clocking settings
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438 * are stored in the EEPROM chip. It can cause problems because this
439 * version of serial driver doesn't support differently clocked UART's
440 * on single PCI card. To prevent this, initialization functions set
441 * high frequency clocking for all UART's on given card. It is safe (I
442 * hope) because it doesn't touch EEPROM settings to prevent conflicts
443 * with other OSes (like M$ DOS).
444 *
445 * SIIG support added by Andrey Panin <pazke@donpac.ru>, 10/1999
Alan Cox5756ee92008-02-08 04:18:51 -0800446 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 * There is two family of SIIG serial cards with different PCI
448 * interface chip and different configuration methods:
449 * - 10x cards have control registers in IO and/or memory space;
450 * - 20x cards have control registers in standard PCI configuration space.
451 *
Russell King67d74b82005-07-27 11:33:03 +0100452 * Note: all 10x cards have PCI device ids 0x10..
453 * all 20x cards have PCI device ids 0x20..
454 *
Andrey Paninfbc0dc02005-07-18 11:38:09 +0100455 * There are also Quartet Serial cards which use Oxford Semiconductor
456 * 16954 quad UART PCI chip clocked by 18.432 MHz quartz.
457 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 * Note: some SIIG cards are probed by the parport_serial object.
459 */
460
461#define PCI_DEVICE_ID_SIIG_1S_10x (PCI_DEVICE_ID_SIIG_1S_10x_550 & 0xfffc)
462#define PCI_DEVICE_ID_SIIG_2S_10x (PCI_DEVICE_ID_SIIG_2S_10x_550 & 0xfff8)
463
464static int pci_siig10x_init(struct pci_dev *dev)
465{
466 u16 data;
467 void __iomem *p;
468
469 switch (dev->device & 0xfff8) {
470 case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */
471 data = 0xffdf;
472 break;
473 case PCI_DEVICE_ID_SIIG_2S_10x: /* 2S, 2S1P */
474 data = 0xf7ff;
475 break;
476 default: /* 1S1P, 4S */
477 data = 0xfffb;
478 break;
479 }
480
Christoph Hellwig4bdc0d62020-01-06 09:43:50 +0100481 p = ioremap(pci_resource_start(dev, 0), 0x80);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 if (p == NULL)
483 return -ENOMEM;
484
485 writew(readw(p + 0x28) & data, p + 0x28);
486 readw(p + 0x28);
487 iounmap(p);
488 return 0;
489}
490
491#define PCI_DEVICE_ID_SIIG_2S_20x (PCI_DEVICE_ID_SIIG_2S_20x_550 & 0xfffc)
492#define PCI_DEVICE_ID_SIIG_2S1P_20x (PCI_DEVICE_ID_SIIG_2S1P_20x_550 & 0xfffc)
493
494static int pci_siig20x_init(struct pci_dev *dev)
495{
496 u8 data;
497
498 /* Change clock frequency for the first UART. */
499 pci_read_config_byte(dev, 0x6f, &data);
500 pci_write_config_byte(dev, 0x6f, data & 0xef);
501
502 /* If this card has 2 UART, we have to do the same with second UART. */
503 if (((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S_20x) ||
504 ((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S1P_20x)) {
505 pci_read_config_byte(dev, 0x73, &data);
506 pci_write_config_byte(dev, 0x73, data & 0xef);
507 }
508 return 0;
509}
510
Russell King67d74b82005-07-27 11:33:03 +0100511static int pci_siig_init(struct pci_dev *dev)
512{
513 unsigned int type = dev->device & 0xff00;
514
515 if (type == 0x1000)
516 return pci_siig10x_init(dev);
Andy Shevchenko0187f882021-10-22 16:51:46 +0300517 if (type == 0x2000)
Russell King67d74b82005-07-27 11:33:03 +0100518 return pci_siig20x_init(dev);
519
520 moan_device("Unknown SIIG card", dev);
521 return -ENODEV;
522}
523
Andrey Panin3ec9c592006-02-02 20:15:09 +0000524static int pci_siig_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000525 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100526 struct uart_8250_port *port, int idx)
Andrey Panin3ec9c592006-02-02 20:15:09 +0000527{
528 unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0;
529
530 if (idx > 3) {
531 bar = 4;
532 offset = (idx - 4) * 8;
533 }
534
535 return setup_port(priv, port, bar, offset, 0);
536}
537
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538/*
539 * Timedia has an explosion of boards, and to avoid the PCI table from
540 * growing *huge*, we use this function to collapse some 70 entries
541 * in the PCI table into one, for sanity's and compactness's sake.
542 */
Helge Dellere9422e02006-08-29 21:57:29 +0200543static const unsigned short timedia_single_port[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 0x4025, 0x4027, 0x4028, 0x5025, 0x5027, 0
545};
546
Helge Dellere9422e02006-08-29 21:57:29 +0200547static const unsigned short timedia_dual_port[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
Alan Cox5756ee92008-02-08 04:18:51 -0800549 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079,
550 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079,
552 0xD079, 0
553};
554
Helge Dellere9422e02006-08-29 21:57:29 +0200555static const unsigned short timedia_quad_port[] = {
Alan Cox5756ee92008-02-08 04:18:51 -0800556 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157,
557 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
559 0xB157, 0
560};
561
Helge Dellere9422e02006-08-29 21:57:29 +0200562static const unsigned short timedia_eight_port[] = {
Alan Cox5756ee92008-02-08 04:18:51 -0800563 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
565};
566
Arjan van de Vencb3592b2005-11-28 21:04:11 +0000567static const struct timedia_struct {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 int num;
Helge Dellere9422e02006-08-29 21:57:29 +0200569 const unsigned short *ids;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570} timedia_data[] = {
571 { 1, timedia_single_port },
572 { 2, timedia_dual_port },
573 { 4, timedia_quad_port },
Helge Dellere9422e02006-08-29 21:57:29 +0200574 { 8, timedia_eight_port }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575};
576
Frédéric Brièreb9b24552011-05-29 15:08:04 -0400577/*
578 * There are nearly 70 different Timedia/SUNIX PCI serial devices. Instead of
579 * listing them individually, this driver merely grabs them all with
580 * PCI_ANY_ID. Some of these devices, however, also feature a parallel port,
581 * and should be left free to be claimed by parport_serial instead.
582 */
583static int pci_timedia_probe(struct pci_dev *dev)
584{
585 /*
586 * Check the third digit of the subdevice ID
587 * (0,2,3,5,6: serial only -- 7,8,9: serial + parallel)
588 */
589 if ((dev->subsystem_device & 0x00f0) >= 0x70) {
Andy Shevchenko11773842021-10-22 16:51:47 +0300590 pci_info(dev, "ignoring Timedia subdevice %04x for parport_serial\n",
591 dev->subsystem_device);
Frédéric Brièreb9b24552011-05-29 15:08:04 -0400592 return -ENODEV;
593 }
594
595 return 0;
596}
597
Russell King61a116e2006-07-03 15:22:35 +0100598static int pci_timedia_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599{
Helge Dellere9422e02006-08-29 21:57:29 +0200600 const unsigned short *ids;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 int i, j;
602
Helge Dellere9422e02006-08-29 21:57:29 +0200603 for (i = 0; i < ARRAY_SIZE(timedia_data); i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 ids = timedia_data[i].ids;
605 for (j = 0; ids[j]; j++)
606 if (dev->subsystem_device == ids[j])
607 return timedia_data[i].num;
608 }
609 return 0;
610}
611
612/*
613 * Timedia/SUNIX uses a mixture of BARs and offsets
614 * Ugh, this is ugly as all hell --- TYT
615 */
616static int
Russell King975a1a7d2009-01-02 13:44:27 +0000617pci_timedia_setup(struct serial_private *priv,
618 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100619 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620{
621 unsigned int bar = 0, offset = board->first_offset;
622
623 switch (idx) {
624 case 0:
625 bar = 0;
626 break;
627 case 1:
628 offset = board->uart_offset;
629 bar = 0;
630 break;
631 case 2:
632 bar = 1;
633 break;
634 case 3:
635 offset = board->uart_offset;
Gustavo A. R. Silvadf561f662020-08-23 17:36:59 -0500636 fallthrough;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 case 4: /* BAR 2 */
638 case 5: /* BAR 3 */
639 case 6: /* BAR 4 */
640 case 7: /* BAR 5 */
641 bar = idx - 2;
642 }
643
Russell King70db3d92005-07-27 11:34:27 +0100644 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645}
646
647/*
648 * Some Titan cards are also a little weird
649 */
650static int
Russell King70db3d92005-07-27 11:34:27 +0100651titan_400l_800l_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +0000652 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100653 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654{
655 unsigned int bar, offset = board->first_offset;
656
657 switch (idx) {
658 case 0:
659 bar = 1;
660 break;
661 case 1:
662 bar = 2;
663 break;
664 default:
665 bar = 4;
666 offset = (idx - 2) * board->uart_offset;
667 }
668
Russell King70db3d92005-07-27 11:34:27 +0100669 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670}
671
Russell King61a116e2006-07-03 15:22:35 +0100672static int pci_xircom_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673{
674 msleep(100);
675 return 0;
676}
677
Will Page04bf7e72009-04-06 17:32:15 +0100678static int pci_ni8420_init(struct pci_dev *dev)
679{
680 void __iomem *p;
Will Page04bf7e72009-04-06 17:32:15 +0100681 unsigned int bar = 0;
682
683 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
684 moan_device("no memory in bar", dev);
685 return 0;
686 }
687
Aaron Sierra398a9db2014-10-30 19:49:45 -0500688 p = pci_ioremap_bar(dev, bar);
Will Page04bf7e72009-04-06 17:32:15 +0100689 if (p == NULL)
690 return -ENOMEM;
691
692 /* Enable CPU Interrupt */
693 writel(readl(p + NI8420_INT_ENABLE_REG) | NI8420_INT_ENABLE_BIT,
694 p + NI8420_INT_ENABLE_REG);
695
696 iounmap(p);
697 return 0;
698}
699
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100700#define MITE_IOWBSR1_WSIZE 0xa
701#define MITE_IOWBSR1_WIN_OFFSET 0x800
702#define MITE_IOWBSR1_WENAB (1 << 7)
703#define MITE_LCIMR1_IO_IE_0 (1 << 24)
704#define MITE_LCIMR2_SET_CPU_IE (1 << 31)
705#define MITE_IOWCR1_RAMSEL_MASK 0xfffffffe
706
707static int pci_ni8430_init(struct pci_dev *dev)
708{
709 void __iomem *p;
Aaron Sierra398a9db2014-10-30 19:49:45 -0500710 struct pci_bus_region region;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100711 u32 device_window;
712 unsigned int bar = 0;
713
714 if ((pci_resource_flags(dev, bar) & IORESOURCE_MEM) == 0) {
715 moan_device("no memory in bar", dev);
716 return 0;
717 }
718
Aaron Sierra398a9db2014-10-30 19:49:45 -0500719 p = pci_ioremap_bar(dev, bar);
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100720 if (p == NULL)
721 return -ENOMEM;
722
Aaron Sierra398a9db2014-10-30 19:49:45 -0500723 /*
724 * Set device window address and size in BAR0, while acknowledging that
725 * the resource structure may contain a translated address that differs
726 * from the address the device responds to.
727 */
728 pcibios_resource_to_bus(dev->bus, &region, &dev->resource[bar]);
729 device_window = ((region.start + MITE_IOWBSR1_WIN_OFFSET) & 0xffffff00)
Anton Wuerfel6d7c1572016-01-14 16:08:11 +0100730 | MITE_IOWBSR1_WENAB | MITE_IOWBSR1_WSIZE;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100731 writel(device_window, p + MITE_IOWBSR1);
732
733 /* Set window access to go to RAMSEL IO address space */
734 writel((readl(p + MITE_IOWCR1) & MITE_IOWCR1_RAMSEL_MASK),
735 p + MITE_IOWCR1);
736
737 /* Enable IO Bus Interrupt 0 */
738 writel(MITE_LCIMR1_IO_IE_0, p + MITE_LCIMR1);
739
740 /* Enable CPU Interrupt */
741 writel(MITE_LCIMR2_SET_CPU_IE, p + MITE_LCIMR2);
742
743 iounmap(p);
744 return 0;
745}
746
747/* UART Port Control Register */
Je Yen Tam27ed14d2019-11-27 15:53:01 +0800748#define NI8430_PORTCON 0x0f
749#define NI8430_PORTCON_TXVR_ENABLE (1 << 3)
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100750
751static int
Alan Coxbf538fe2009-04-06 17:35:42 +0100752pci_ni8430_setup(struct serial_private *priv,
753 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100754 struct uart_8250_port *port, int idx)
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100755{
Aaron Sierra398a9db2014-10-30 19:49:45 -0500756 struct pci_dev *dev = priv->dev;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100757 void __iomem *p;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100758 unsigned int bar, offset = board->first_offset;
759
760 if (idx >= board->num_ports)
761 return 1;
762
763 bar = FL_GET_BASE(board->flags);
764 offset += idx * board->uart_offset;
765
Aaron Sierra398a9db2014-10-30 19:49:45 -0500766 p = pci_ioremap_bar(dev, bar);
Aaron Sierra5d14bba2014-10-30 19:49:52 -0500767 if (!p)
768 return -ENOMEM;
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100769
Joe Perches7c9d4402011-06-23 11:39:20 -0700770 /* enable the transceiver */
Je Yen Tam27ed14d2019-11-27 15:53:01 +0800771 writeb(readb(p + offset + NI8430_PORTCON) | NI8430_PORTCON_TXVR_ENABLE,
772 p + offset + NI8430_PORTCON);
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100773
774 iounmap(p);
775
776 return setup_port(priv, port, bar, offset, board->reg_shift);
777}
778
Nicos Gollan7808edc2011-05-05 21:00:37 +0200779static int pci_netmos_9900_setup(struct serial_private *priv,
780 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +0100781 struct uart_8250_port *port, int idx)
Nicos Gollan7808edc2011-05-05 21:00:37 +0200782{
783 unsigned int bar;
784
Dmitry Eremin-Solenikov333c0852014-02-11 14:18:13 +0400785 if ((priv->dev->device != PCI_DEVICE_ID_NETMOS_9865) &&
786 (priv->dev->subsystem_device & 0xff00) == 0x3000) {
Nicos Gollan7808edc2011-05-05 21:00:37 +0200787 /* netmos apparently orders BARs by datasheet layout, so serial
788 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
789 */
790 bar = 3 * idx;
791
792 return setup_port(priv, port, bar, 0, board->reg_shift);
Nicos Gollan7808edc2011-05-05 21:00:37 +0200793 }
Andy Shevchenko0187f882021-10-22 16:51:46 +0300794
795 return pci_default_setup(priv, board, port, idx);
Nicos Gollan7808edc2011-05-05 21:00:37 +0200796}
797
798/* the 99xx series comes with a range of device IDs and a variety
799 * of capabilities:
800 *
801 * 9900 has varying capabilities and can cascade to sub-controllers
802 * (cascading should be purely internal)
803 * 9904 is hardwired with 4 serial ports
804 * 9912 and 9922 are hardwired with 2 serial ports
805 */
806static int pci_netmos_9900_numports(struct pci_dev *dev)
807{
808 unsigned int c = dev->class;
809 unsigned int pi;
810 unsigned short sub_serports;
811
Anton Wuerfel149a44c2016-01-14 16:08:17 +0100812 pi = c & 0xff;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200813
Anton Wuerfelc2f5fde2016-01-14 16:08:14 +0100814 if (pi == 2)
Nicos Gollan7808edc2011-05-05 21:00:37 +0200815 return 1;
Anton Wuerfelc2f5fde2016-01-14 16:08:14 +0100816
817 if ((pi == 0) && (dev->device == PCI_DEVICE_ID_NETMOS_9900)) {
Nicos Gollan7808edc2011-05-05 21:00:37 +0200818 /* two possibilities: 0x30ps encodes number of parallel and
819 * serial ports, or 0x1000 indicates *something*. This is not
820 * immediately obvious, since the 2s1p+4s configuration seems
821 * to offer all functionality on functions 0..2, while still
822 * advertising the same function 3 as the 4s+2s1p config.
823 */
824 sub_serports = dev->subsystem_device & 0xf;
Anton Wuerfelc2f5fde2016-01-14 16:08:14 +0100825 if (sub_serports > 0)
Nicos Gollan7808edc2011-05-05 21:00:37 +0200826 return sub_serports;
Anton Wuerfelc2f5fde2016-01-14 16:08:14 +0100827
Andy Shevchenko11773842021-10-22 16:51:47 +0300828 pci_err(dev, "NetMos/Mostech serial driver ignoring port on ambiguous config.\n");
Anton Wuerfelc2f5fde2016-01-14 16:08:14 +0100829 return 0;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200830 }
831
832 moan_device("unknown NetMos/Mostech program interface", dev);
833 return 0;
834}
Shawn Bohrer46a0fac2009-04-06 17:32:07 +0100835
Russell King61a116e2006-07-03 15:22:35 +0100836static int pci_netmos_init(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837{
838 /* subdevice 0x00PS means <P> parallel, <S> serial */
839 unsigned int num_serial = dev->subsystem_device & 0xf;
840
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -0800841 if ((dev->device == PCI_DEVICE_ID_NETMOS_9901) ||
842 (dev->device == PCI_DEVICE_ID_NETMOS_9865))
Michael Bueschc4285b42009-06-30 11:41:21 -0700843 return 0;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200844
Jiri Slaby25cf9bc2009-01-15 13:30:34 +0000845 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
846 dev->subsystem_device == 0x0299)
847 return 0;
848
Nicos Gollan7808edc2011-05-05 21:00:37 +0200849 switch (dev->device) { /* FALLTHROUGH on all */
Anton Wuerfelb3d67932016-01-14 16:08:23 +0100850 case PCI_DEVICE_ID_NETMOS_9904:
851 case PCI_DEVICE_ID_NETMOS_9912:
852 case PCI_DEVICE_ID_NETMOS_9922:
853 case PCI_DEVICE_ID_NETMOS_9900:
854 num_serial = pci_netmos_9900_numports(dev);
855 break;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200856
Anton Wuerfelb3d67932016-01-14 16:08:23 +0100857 default:
858 break;
Nicos Gollan7808edc2011-05-05 21:00:37 +0200859 }
860
Anton Wuerfel829b0002016-01-14 16:08:22 +0100861 if (num_serial == 0) {
862 moan_device("unknown NetMos/Mostech device", dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863 return -ENODEV;
Anton Wuerfel829b0002016-01-14 16:08:22 +0100864 }
Nicos Gollan7808edc2011-05-05 21:00:37 +0200865
Linus Torvalds1da177e2005-04-16 15:20:36 -0700866 return num_serial;
867}
868
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700869/*
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700870 * These chips are available with optionally one parallel port and up to
871 * two serial ports. Unfortunately they all have the same product id.
872 *
873 * Basic configuration is done over a region of 32 I/O ports. The base
874 * ioport is called INTA or INTC, depending on docs/other drivers.
875 *
876 * The region of the 32 I/O ports is configured in POSIO0R...
877 */
878
879/* registers */
880#define ITE_887x_MISCR 0x9c
881#define ITE_887x_INTCBAR 0x78
882#define ITE_887x_UARTBAR 0x7c
883#define ITE_887x_PS0BAR 0x10
884#define ITE_887x_POSIO0 0x60
885
886/* I/O space size */
887#define ITE_887x_IOSIZE 32
888/* I/O space size (bits 26-24; 8 bytes = 011b) */
889#define ITE_887x_POSIO_IOSIZE_8 (3 << 24)
890/* I/O space size (bits 26-24; 32 bytes = 101b) */
891#define ITE_887x_POSIO_IOSIZE_32 (5 << 24)
892/* Decoding speed (1 = slow, 2 = medium, 3 = fast) */
893#define ITE_887x_POSIO_SPEED (3 << 29)
894/* enable IO_Space bit */
895#define ITE_887x_POSIO_ENABLE (1 << 31)
896
Andy Shevchenko35b4f172021-10-22 16:51:45 +0300897/* inta_addr are the configuration addresses of the ITE */
898static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0, 0x200, 0x280 };
Ralf Baechlef79abb82007-08-30 23:56:31 -0700899static int pci_ite887x_init(struct pci_dev *dev)
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700900{
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700901 int ret, i, type;
902 struct resource *iobase = NULL;
903 u32 miscr, uartbar, ioport;
904
905 /* search for the base-ioport */
Andy Shevchenko35b4f172021-10-22 16:51:45 +0300906 for (i = 0; i < ARRAY_SIZE(inta_addr); i++) {
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700907 iobase = request_region(inta_addr[i], ITE_887x_IOSIZE,
908 "ite887x");
909 if (iobase != NULL) {
910 /* write POSIO0R - speed | size | ioport */
911 pci_write_config_dword(dev, ITE_887x_POSIO0,
912 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
913 ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
914 /* write INTCBAR - ioport */
Alan Cox5756ee92008-02-08 04:18:51 -0800915 pci_write_config_dword(dev, ITE_887x_INTCBAR,
916 inta_addr[i]);
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700917 ret = inb(inta_addr[i]);
918 if (ret != 0xff) {
919 /* ioport connected */
920 break;
921 }
922 release_region(iobase->start, ITE_887x_IOSIZE);
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700923 }
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700924 }
925
Andy Shevchenko35b4f172021-10-22 16:51:45 +0300926 if (i == ARRAY_SIZE(inta_addr)) {
Andy Shevchenko11773842021-10-22 16:51:47 +0300927 pci_err(dev, "could not find iobase\n");
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700928 return -ENODEV;
929 }
930
931 /* start of undocumented type checking (see parport_pc.c) */
932 type = inb(iobase->start + 0x18) & 0x0f;
933
934 switch (type) {
935 case 0x2: /* ITE8871 (1P) */
936 case 0xa: /* ITE8875 (1P) */
937 ret = 0;
938 break;
939 case 0xe: /* ITE8872 (2S1P) */
940 ret = 2;
941 break;
942 case 0x6: /* ITE8873 (1S) */
943 ret = 1;
944 break;
945 case 0x8: /* ITE8874 (2S) */
946 ret = 2;
947 break;
948 default:
949 moan_device("Unknown ITE887x", dev);
950 ret = -ENODEV;
951 }
952
953 /* configure all serial ports */
954 for (i = 0; i < ret; i++) {
955 /* read the I/O port from the device */
956 pci_read_config_dword(dev, ITE_887x_PS0BAR + (0x4 * (i + 1)),
957 &ioport);
958 ioport &= 0x0000FF00; /* the actual base address */
959 pci_write_config_dword(dev, ITE_887x_POSIO0 + (0x4 * (i + 1)),
960 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
961 ITE_887x_POSIO_IOSIZE_8 | ioport);
962
963 /* write the ioport to the UARTBAR */
964 pci_read_config_dword(dev, ITE_887x_UARTBAR, &uartbar);
965 uartbar &= ~(0xffff << (16 * i)); /* clear half the reg */
966 uartbar |= (ioport << (16 * i)); /* set the ioport */
967 pci_write_config_dword(dev, ITE_887x_UARTBAR, uartbar);
968
969 /* get current config */
970 pci_read_config_dword(dev, ITE_887x_MISCR, &miscr);
971 /* disable interrupts (UARTx_Routing[3:0]) */
972 miscr &= ~(0xf << (12 - 4 * i));
973 /* activate the UART (UARTx_En) */
974 miscr |= 1 << (23 - i);
975 /* write new config with activated UART */
976 pci_write_config_dword(dev, ITE_887x_MISCR, miscr);
977 }
978
979 if (ret <= 0) {
980 /* the device has no UARTs if we get here */
981 release_region(iobase->start, ITE_887x_IOSIZE);
982 }
983
984 return ret;
985}
986
Bill Pembertonae8d8a12012-11-19 13:26:18 -0500987static void pci_ite887x_exit(struct pci_dev *dev)
Niels de Vos84f8c6f2007-08-22 14:01:14 -0700988{
989 u32 ioport;
990 /* the ioport is bit 0-15 in POSIO0R */
991 pci_read_config_dword(dev, ITE_887x_POSIO0, &ioport);
992 ioport &= 0xffff;
993 release_region(ioport, ITE_887x_IOSIZE);
994}
995
Russell King9f2a0362009-01-02 13:44:20 +0000996/*
Mike Skoog1bc8cde2014-10-16 13:10:01 -0700997 * EndRun Technologies.
998 * Determine the number of ports available on the device.
999 */
1000#define PCI_VENDOR_ID_ENDRUN 0x7401
1001#define PCI_DEVICE_ID_ENDRUN_1588 0xe100
1002
1003static int pci_endrun_init(struct pci_dev *dev)
1004{
1005 u8 __iomem *p;
1006 unsigned long deviceID;
1007 unsigned int number_uarts = 0;
1008
1009 /* EndRun device is all 0xexxx */
1010 if (dev->vendor == PCI_VENDOR_ID_ENDRUN &&
1011 (dev->device & 0xf000) != 0xe000)
1012 return 0;
1013
1014 p = pci_iomap(dev, 0, 5);
1015 if (p == NULL)
1016 return -ENOMEM;
1017
1018 deviceID = ioread32(p);
1019 /* EndRun device */
1020 if (deviceID == 0x07000200) {
1021 number_uarts = ioread8(p + 4);
Andy Shevchenko11773842021-10-22 16:51:47 +03001022 pci_dbg(dev, "%d ports detected on EndRun PCI Express device\n", number_uarts);
Mike Skoog1bc8cde2014-10-16 13:10:01 -07001023 }
1024 pci_iounmap(dev, p);
1025 return number_uarts;
1026}
1027
1028/*
Russell King9f2a0362009-01-02 13:44:20 +00001029 * Oxford Semiconductor Inc.
1030 * Check that device is part of the Tornado range of devices, then determine
1031 * the number of ports available on the device.
1032 */
1033static int pci_oxsemi_tornado_init(struct pci_dev *dev)
1034{
1035 u8 __iomem *p;
1036 unsigned long deviceID;
1037 unsigned int number_uarts = 0;
1038
1039 /* OxSemi Tornado devices are all 0xCxxx */
1040 if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
1041 (dev->device & 0xF000) != 0xC000)
1042 return 0;
1043
1044 p = pci_iomap(dev, 0, 5);
1045 if (p == NULL)
1046 return -ENOMEM;
1047
1048 deviceID = ioread32(p);
1049 /* Tornado device */
1050 if (deviceID == 0x07000200) {
1051 number_uarts = ioread8(p + 4);
Andy Shevchenko11773842021-10-22 16:51:47 +03001052 pci_dbg(dev, "%d ports detected on Oxford PCI Express device\n", number_uarts);
Russell King9f2a0362009-01-02 13:44:20 +00001053 }
1054 pci_iounmap(dev, p);
1055 return number_uarts;
1056}
1057
Alan Coxeb26dfe2012-07-12 13:00:31 +01001058static int pci_asix_setup(struct serial_private *priv,
Russell King975a1a7d2009-01-02 13:44:27 +00001059 const struct pciserial_board *board,
Alan Coxeb26dfe2012-07-12 13:00:31 +01001060 struct uart_8250_port *port, int idx)
1061{
1062 port->bugs |= UART_BUG_PARITY;
1063 return pci_default_setup(priv, board, port, idx);
1064}
1065
Alan Cox55c7c0f2012-11-29 09:03:00 +10301066#define QPCR_TEST_FOR1 0x3F
1067#define QPCR_TEST_GET1 0x00
1068#define QPCR_TEST_FOR2 0x40
1069#define QPCR_TEST_GET2 0x40
1070#define QPCR_TEST_FOR3 0x80
1071#define QPCR_TEST_GET3 0x40
1072#define QPCR_TEST_FOR4 0xC0
1073#define QPCR_TEST_GET4 0x80
1074
1075#define QOPR_CLOCK_X1 0x0000
1076#define QOPR_CLOCK_X2 0x0001
1077#define QOPR_CLOCK_X4 0x0002
1078#define QOPR_CLOCK_X8 0x0003
1079#define QOPR_CLOCK_RATE_MASK 0x0003
1080
Andy Shevchenko42902422021-10-26 16:34:51 +03001081/* Quatech devices have their own extra interface features */
1082static struct pci_device_id quatech_cards[] = {
1083 { PCI_DEVICE_DATA(QUATECH, QSC100, 1) },
1084 { PCI_DEVICE_DATA(QUATECH, DSC100, 1) },
1085 { PCI_DEVICE_DATA(QUATECH, DSC100E, 0) },
1086 { PCI_DEVICE_DATA(QUATECH, DSC200, 1) },
1087 { PCI_DEVICE_DATA(QUATECH, DSC200E, 0) },
1088 { PCI_DEVICE_DATA(QUATECH, ESC100D, 1) },
1089 { PCI_DEVICE_DATA(QUATECH, ESC100M, 1) },
1090 { PCI_DEVICE_DATA(QUATECH, QSCP100, 1) },
1091 { PCI_DEVICE_DATA(QUATECH, DSCP100, 1) },
1092 { PCI_DEVICE_DATA(QUATECH, QSCP200, 1) },
1093 { PCI_DEVICE_DATA(QUATECH, DSCP200, 1) },
1094 { PCI_DEVICE_DATA(QUATECH, ESCLP100, 0) },
1095 { PCI_DEVICE_DATA(QUATECH, QSCLP100, 0) },
1096 { PCI_DEVICE_DATA(QUATECH, DSCLP100, 0) },
1097 { PCI_DEVICE_DATA(QUATECH, SSCLP100, 0) },
1098 { PCI_DEVICE_DATA(QUATECH, QSCLP200, 0) },
1099 { PCI_DEVICE_DATA(QUATECH, DSCLP200, 0) },
1100 { PCI_DEVICE_DATA(QUATECH, SSCLP200, 0) },
1101 { PCI_DEVICE_DATA(QUATECH, SPPXP_100, 0) },
Alan Cox55c7c0f2012-11-29 09:03:00 +10301102 { 0, }
1103};
1104
Alan Cox55c7c0f2012-11-29 09:03:00 +10301105static int pci_quatech_rqopr(struct uart_8250_port *port)
1106{
1107 unsigned long base = port->port.iobase;
1108 u8 LCR, val;
1109
1110 LCR = inb(base + UART_LCR);
1111 outb(0xBF, base + UART_LCR);
1112 val = inb(base + UART_SCR);
1113 outb(LCR, base + UART_LCR);
1114 return val;
1115}
1116
1117static void pci_quatech_wqopr(struct uart_8250_port *port, u8 qopr)
1118{
1119 unsigned long base = port->port.iobase;
Jiri Slaby17b27202016-06-23 13:34:22 +02001120 u8 LCR;
Alan Cox55c7c0f2012-11-29 09:03:00 +10301121
1122 LCR = inb(base + UART_LCR);
1123 outb(0xBF, base + UART_LCR);
Jiri Slaby17b27202016-06-23 13:34:22 +02001124 inb(base + UART_SCR);
Alan Cox55c7c0f2012-11-29 09:03:00 +10301125 outb(qopr, base + UART_SCR);
1126 outb(LCR, base + UART_LCR);
1127}
1128
1129static int pci_quatech_rqmcr(struct uart_8250_port *port)
1130{
1131 unsigned long base = port->port.iobase;
1132 u8 LCR, val, qmcr;
1133
1134 LCR = inb(base + UART_LCR);
1135 outb(0xBF, base + UART_LCR);
1136 val = inb(base + UART_SCR);
1137 outb(val | 0x10, base + UART_SCR);
1138 qmcr = inb(base + UART_MCR);
1139 outb(val, base + UART_SCR);
1140 outb(LCR, base + UART_LCR);
1141
1142 return qmcr;
1143}
1144
1145static void pci_quatech_wqmcr(struct uart_8250_port *port, u8 qmcr)
1146{
1147 unsigned long base = port->port.iobase;
1148 u8 LCR, val;
1149
1150 LCR = inb(base + UART_LCR);
1151 outb(0xBF, base + UART_LCR);
1152 val = inb(base + UART_SCR);
1153 outb(val | 0x10, base + UART_SCR);
1154 outb(qmcr, base + UART_MCR);
1155 outb(val, base + UART_SCR);
1156 outb(LCR, base + UART_LCR);
1157}
1158
1159static int pci_quatech_has_qmcr(struct uart_8250_port *port)
1160{
1161 unsigned long base = port->port.iobase;
1162 u8 LCR, val;
1163
1164 LCR = inb(base + UART_LCR);
1165 outb(0xBF, base + UART_LCR);
1166 val = inb(base + UART_SCR);
1167 if (val & 0x20) {
1168 outb(0x80, UART_LCR);
1169 if (!(inb(UART_SCR) & 0x20)) {
1170 outb(LCR, base + UART_LCR);
1171 return 1;
1172 }
1173 }
1174 return 0;
1175}
1176
1177static int pci_quatech_test(struct uart_8250_port *port)
1178{
Anton Wuerfel1a33e342016-01-14 16:08:10 +01001179 u8 reg, qopr;
1180
1181 qopr = pci_quatech_rqopr(port);
Alan Cox55c7c0f2012-11-29 09:03:00 +10301182 pci_quatech_wqopr(port, qopr & QPCR_TEST_FOR1);
1183 reg = pci_quatech_rqopr(port) & 0xC0;
1184 if (reg != QPCR_TEST_GET1)
1185 return -EINVAL;
1186 pci_quatech_wqopr(port, (qopr & QPCR_TEST_FOR1)|QPCR_TEST_FOR2);
1187 reg = pci_quatech_rqopr(port) & 0xC0;
1188 if (reg != QPCR_TEST_GET2)
1189 return -EINVAL;
1190 pci_quatech_wqopr(port, (qopr & QPCR_TEST_FOR1)|QPCR_TEST_FOR3);
1191 reg = pci_quatech_rqopr(port) & 0xC0;
1192 if (reg != QPCR_TEST_GET3)
1193 return -EINVAL;
1194 pci_quatech_wqopr(port, (qopr & QPCR_TEST_FOR1)|QPCR_TEST_FOR4);
1195 reg = pci_quatech_rqopr(port) & 0xC0;
1196 if (reg != QPCR_TEST_GET4)
1197 return -EINVAL;
1198
1199 pci_quatech_wqopr(port, qopr);
1200 return 0;
1201}
1202
1203static int pci_quatech_clock(struct uart_8250_port *port)
1204{
1205 u8 qopr, reg, set;
1206 unsigned long clock;
1207
1208 if (pci_quatech_test(port) < 0)
1209 return 1843200;
1210
1211 qopr = pci_quatech_rqopr(port);
1212
1213 pci_quatech_wqopr(port, qopr & ~QOPR_CLOCK_X8);
1214 reg = pci_quatech_rqopr(port);
1215 if (reg & QOPR_CLOCK_X8) {
1216 clock = 1843200;
1217 goto out;
1218 }
1219 pci_quatech_wqopr(port, qopr | QOPR_CLOCK_X8);
1220 reg = pci_quatech_rqopr(port);
1221 if (!(reg & QOPR_CLOCK_X8)) {
1222 clock = 1843200;
1223 goto out;
1224 }
1225 reg &= QOPR_CLOCK_X8;
1226 if (reg == QOPR_CLOCK_X2) {
1227 clock = 3685400;
1228 set = QOPR_CLOCK_X2;
1229 } else if (reg == QOPR_CLOCK_X4) {
1230 clock = 7372800;
1231 set = QOPR_CLOCK_X4;
1232 } else if (reg == QOPR_CLOCK_X8) {
1233 clock = 14745600;
1234 set = QOPR_CLOCK_X8;
1235 } else {
1236 clock = 1843200;
1237 set = QOPR_CLOCK_X1;
1238 }
1239 qopr &= ~QOPR_CLOCK_RATE_MASK;
1240 qopr |= set;
1241
1242out:
1243 pci_quatech_wqopr(port, qopr);
1244 return clock;
1245}
1246
1247static int pci_quatech_rs422(struct uart_8250_port *port)
1248{
1249 u8 qmcr;
1250 int rs422 = 0;
1251
1252 if (!pci_quatech_has_qmcr(port))
1253 return 0;
1254 qmcr = pci_quatech_rqmcr(port);
1255 pci_quatech_wqmcr(port, 0xFF);
1256 if (pci_quatech_rqmcr(port))
1257 rs422 = 1;
1258 pci_quatech_wqmcr(port, qmcr);
1259 return rs422;
1260}
1261
1262static int pci_quatech_init(struct pci_dev *dev)
1263{
Andy Shevchenko42902422021-10-26 16:34:51 +03001264 const struct pci_device_id *match;
1265 bool amcc = false;
1266
1267 match = pci_match_id(quatech_cards, dev);
1268 if (match)
1269 amcc = match->driver_data;
1270 else
1271 pci_err(dev, "unknown port type '0x%04X'.\n", dev->device);
1272
1273 if (amcc) {
Alan Cox55c7c0f2012-11-29 09:03:00 +10301274 unsigned long base = pci_resource_start(dev, 0);
1275 if (base) {
1276 u32 tmp;
Anton Wuerfel1a33e342016-01-14 16:08:10 +01001277
Jonathan Woithe9c5320f2013-12-09 16:33:08 +10301278 outl(inl(base + 0x38) | 0x00002000, base + 0x38);
Alan Cox55c7c0f2012-11-29 09:03:00 +10301279 tmp = inl(base + 0x3c);
1280 outl(tmp | 0x01000000, base + 0x3c);
Colin Ian King4b953912021-12-05 23:28:22 +00001281 outl(tmp & ~0x01000000, base + 0x3c);
Alan Cox55c7c0f2012-11-29 09:03:00 +10301282 }
1283 }
1284 return 0;
1285}
1286
1287static int pci_quatech_setup(struct serial_private *priv,
1288 const struct pciserial_board *board,
1289 struct uart_8250_port *port, int idx)
1290{
1291 /* Needed by pci_quatech calls below */
1292 port->port.iobase = pci_resource_start(priv->dev, FL_GET_BASE(board->flags));
1293 /* Set up the clocking */
1294 port->port.uartclk = pci_quatech_clock(port);
1295 /* For now just warn about RS422 */
1296 if (pci_quatech_rs422(port))
Andy Shevchenko11773842021-10-22 16:51:47 +03001297 pci_warn(priv->dev, "software control of RS422 features not currently supported.\n");
Alan Cox55c7c0f2012-11-29 09:03:00 +10301298 return pci_default_setup(priv, board, port, idx);
1299}
1300
Alan Coxeb26dfe2012-07-12 13:00:31 +01001301static int pci_default_setup(struct serial_private *priv,
Russell King70db3d92005-07-27 11:34:27 +01001302 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001303 struct uart_8250_port *port, int idx)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001304{
1305 unsigned int bar, offset = board->first_offset, maxnr;
1306
1307 bar = FL_GET_BASE(board->flags);
1308 if (board->flags & FL_BASE_BARS)
1309 bar += idx;
1310 else
1311 offset += idx * board->uart_offset;
1312
Greg Kroah-Hartman2427ddd2006-06-12 17:07:52 -07001313 maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >>
1314 (board->reg_shift + 3);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001315
1316 if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
1317 return 1;
Alan Cox5756ee92008-02-08 04:18:51 -08001318
Russell King70db3d92005-07-27 11:34:27 +01001319 return setup_port(priv, port, bar, offset, board->reg_shift);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001320}
Angelo Butti5c31ef92016-11-07 16:39:03 +01001321
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001322static int
1323ce4100_serial_setup(struct serial_private *priv,
1324 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001325 struct uart_8250_port *port, int idx)
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001326{
1327 int ret;
1328
Maxime Bizon08ec2122012-10-19 10:45:07 +02001329 ret = setup_port(priv, port, idx, 0, board->reg_shift);
Alan Cox2655a2c2012-07-12 12:59:50 +01001330 port->port.iotype = UPIO_MEM32;
1331 port->port.type = PORT_XSCALE;
1332 port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1333 port->port.regshift = 2;
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001334
1335 return ret;
1336}
1337
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001338static int
1339pci_omegapci_setup(struct serial_private *priv,
Alan Cox1798ca12011-05-24 12:35:48 +01001340 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001341 struct uart_8250_port *port, int idx)
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001342{
1343 return setup_port(priv, port, 2, idx * 8, 0);
1344}
1345
Stephen Hurdebebd492013-01-17 14:14:53 -08001346static int
1347pci_brcm_trumanage_setup(struct serial_private *priv,
1348 const struct pciserial_board *board,
1349 struct uart_8250_port *port, int idx)
1350{
1351 int ret = pci_default_setup(priv, board, port, idx);
1352
1353 port->port.type = PORT_BRCM_TRUMANAGE;
1354 port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1355 return ret;
1356}
1357
Peter Hungfecf27a2015-07-28 11:59:24 +08001358/* RTS will control by MCR if this bit is 0 */
1359#define FINTEK_RTS_CONTROL_BY_HW BIT(4)
1360/* only worked with FINTEK_RTS_CONTROL_BY_HW on */
1361#define FINTEK_RTS_INVERT BIT(5)
1362
1363/* We should do proper H/W transceiver setting before change to RS485 mode */
1364static int pci_fintek_rs485_config(struct uart_port *port,
1365 struct serial_rs485 *rs485)
1366{
Geliang Tang30c6c352015-12-27 22:29:42 +08001367 struct pci_dev *pci_dev = to_pci_dev(port->dev);
Peter Hungfecf27a2015-07-28 11:59:24 +08001368 u8 setting;
1369 u8 *index = (u8 *) port->private_data;
Peter Hungfecf27a2015-07-28 11:59:24 +08001370
1371 pci_read_config_byte(pci_dev, 0x40 + 8 * *index + 7, &setting);
1372
Peter Hungd3159452015-08-05 14:44:53 +08001373 if (!rs485)
1374 rs485 = &port->rs485;
1375 else if (rs485->flags & SER_RS485_ENABLED)
Peter Hungfecf27a2015-07-28 11:59:24 +08001376 memset(rs485->padding, 0, sizeof(rs485->padding));
1377 else
1378 memset(rs485, 0, sizeof(*rs485));
1379
1380 /* F81504/508/512 not support RTS delay before or after send */
1381 rs485->flags &= SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND;
1382
1383 if (rs485->flags & SER_RS485_ENABLED) {
1384 /* Enable RTS H/W control mode */
1385 setting |= FINTEK_RTS_CONTROL_BY_HW;
1386
1387 if (rs485->flags & SER_RS485_RTS_ON_SEND) {
1388 /* RTS driving high on TX */
1389 setting &= ~FINTEK_RTS_INVERT;
1390 } else {
1391 /* RTS driving low on TX */
1392 setting |= FINTEK_RTS_INVERT;
1393 }
1394
1395 rs485->delay_rts_after_send = 0;
1396 rs485->delay_rts_before_send = 0;
1397 } else {
1398 /* Disable RTS H/W control mode */
1399 setting &= ~(FINTEK_RTS_CONTROL_BY_HW | FINTEK_RTS_INVERT);
1400 }
1401
1402 pci_write_config_byte(pci_dev, 0x40 + 8 * *index + 7, setting);
Peter Hungd3159452015-08-05 14:44:53 +08001403
1404 if (rs485 != &port->rs485)
1405 port->rs485 = *rs485;
1406
Peter Hungfecf27a2015-07-28 11:59:24 +08001407 return 0;
1408}
1409
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001410static int pci_fintek_setup(struct serial_private *priv,
1411 const struct pciserial_board *board,
1412 struct uart_8250_port *port, int idx)
1413{
1414 struct pci_dev *pdev = priv->dev;
Peter Hungfecf27a2015-07-28 11:59:24 +08001415 u8 *data;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001416 u8 config_base;
Peter Hung6a8bc232015-04-01 14:00:21 +08001417 u16 iobase;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001418
Peter Hung6a8bc232015-04-01 14:00:21 +08001419 config_base = 0x40 + 0x08 * idx;
1420
1421 /* Get the io address from configuration space */
1422 pci_read_config_word(pdev, config_base + 4, &iobase);
1423
Andy Shevchenko11773842021-10-22 16:51:47 +03001424 pci_dbg(pdev, "idx=%d iobase=0x%x", idx, iobase);
Peter Hung6a8bc232015-04-01 14:00:21 +08001425
1426 port->port.iotype = UPIO_PORT;
1427 port->port.iobase = iobase;
Peter Hungfecf27a2015-07-28 11:59:24 +08001428 port->port.rs485_config = pci_fintek_rs485_config;
1429
1430 data = devm_kzalloc(&pdev->dev, sizeof(u8), GFP_KERNEL);
1431 if (!data)
1432 return -ENOMEM;
1433
1434 /* preserve index in PCI configuration space */
1435 *data = idx;
1436 port->port.private_data = data;
Peter Hung6a8bc232015-04-01 14:00:21 +08001437
1438 return 0;
1439}
1440
1441static int pci_fintek_init(struct pci_dev *dev)
1442{
1443 unsigned long iobase;
1444 u32 max_port, i;
Ji-Ze Hong (Peter Hong)6def0472016-12-23 09:41:20 +08001445 resource_size_t bar_data[3];
Peter Hung6a8bc232015-04-01 14:00:21 +08001446 u8 config_base;
Peter Hungd3159452015-08-05 14:44:53 +08001447 struct serial_private *priv = pci_get_drvdata(dev);
1448 struct uart_8250_port *port;
Peter Hung6a8bc232015-04-01 14:00:21 +08001449
Ji-Ze Hong (Peter Hong)6def0472016-12-23 09:41:20 +08001450 if (!(pci_resource_flags(dev, 5) & IORESOURCE_IO) ||
1451 !(pci_resource_flags(dev, 4) & IORESOURCE_IO) ||
1452 !(pci_resource_flags(dev, 3) & IORESOURCE_IO))
1453 return -ENODEV;
1454
Peter Hung6a8bc232015-04-01 14:00:21 +08001455 switch (dev->device) {
1456 case 0x1104: /* 4 ports */
1457 case 0x1108: /* 8 ports */
1458 max_port = dev->device & 0xff;
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001459 break;
Peter Hung6a8bc232015-04-01 14:00:21 +08001460 case 0x1112: /* 12 ports */
1461 max_port = 12;
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001462 break;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001463 default:
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001464 return -EINVAL;
1465 }
1466
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001467 /* Get the io address dispatch from the BIOS */
Ji-Ze Hong (Peter Hong)6def0472016-12-23 09:41:20 +08001468 bar_data[0] = pci_resource_start(dev, 5);
1469 bar_data[1] = pci_resource_start(dev, 4);
1470 bar_data[2] = pci_resource_start(dev, 3);
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001471
Peter Hung6a8bc232015-04-01 14:00:21 +08001472 for (i = 0; i < max_port; ++i) {
1473 /* UART0 configuration offset start from 0x40 */
1474 config_base = 0x40 + 0x08 * i;
Peter Hungcb8ee9f2014-11-19 13:22:27 +08001475
Peter Hung6a8bc232015-04-01 14:00:21 +08001476 /* Calculate Real IO Port */
1477 iobase = (bar_data[i / 4] & 0xffffffe0) + (i % 4) * 8;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001478
Peter Hung6a8bc232015-04-01 14:00:21 +08001479 /* Enable UART I/O port */
1480 pci_write_config_byte(dev, config_base + 0x00, 0x01);
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001481
Peter Hung6a8bc232015-04-01 14:00:21 +08001482 /* Select 128-byte FIFO and 8x FIFO threshold */
1483 pci_write_config_byte(dev, config_base + 0x01, 0x33);
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001484
Peter Hung6a8bc232015-04-01 14:00:21 +08001485 /* LSB UART */
1486 pci_write_config_byte(dev, config_base + 0x04,
1487 (u8)(iobase & 0xff));
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001488
Peter Hung6a8bc232015-04-01 14:00:21 +08001489 /* MSB UART */
1490 pci_write_config_byte(dev, config_base + 0x05,
1491 (u8)((iobase & 0xff00) >> 8));
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001492
Peter Hung6a8bc232015-04-01 14:00:21 +08001493 pci_write_config_byte(dev, config_base + 0x06, dev->irq);
Peter Hungfecf27a2015-07-28 11:59:24 +08001494
Peter Hungd3159452015-08-05 14:44:53 +08001495 if (priv) {
1496 /* re-apply RS232/485 mode when
1497 * pciserial_resume_ports()
1498 */
1499 port = serial8250_get_port(priv->line[i]);
1500 pci_fintek_rs485_config(&port->port, NULL);
1501 } else {
1502 /* First init without port data
1503 * force init to RS232 Mode
1504 */
1505 pci_write_config_byte(dev, config_base + 0x07, 0x01);
1506 }
Peter Hung6a8bc232015-04-01 14:00:21 +08001507 }
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001508
Peter Hung6a8bc232015-04-01 14:00:21 +08001509 return max_port;
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07001510}
1511
Ji-Ze Hong (Peter Hong)68e26a82019-08-16 13:27:29 +08001512static void f815xxa_mem_serial_out(struct uart_port *p, int offset, int value)
1513{
1514 struct f815xxa_data *data = p->private_data;
1515 unsigned long flags;
1516
1517 spin_lock_irqsave(&data->lock, flags);
1518 writeb(value, p->membase + offset);
1519 readb(p->membase + UART_SCR); /* Dummy read for flush pcie tx queue */
1520 spin_unlock_irqrestore(&data->lock, flags);
1521}
1522
1523static int pci_fintek_f815xxa_setup(struct serial_private *priv,
1524 const struct pciserial_board *board,
1525 struct uart_8250_port *port, int idx)
1526{
1527 struct pci_dev *pdev = priv->dev;
1528 struct f815xxa_data *data;
1529
1530 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
1531 if (!data)
1532 return -ENOMEM;
1533
1534 data->idx = idx;
1535 spin_lock_init(&data->lock);
1536
1537 port->port.private_data = data;
1538 port->port.iotype = UPIO_MEM;
1539 port->port.flags |= UPF_IOREMAP;
1540 port->port.mapbase = pci_resource_start(pdev, 0) + 8 * idx;
1541 port->port.serial_out = f815xxa_mem_serial_out;
1542
1543 return 0;
1544}
1545
1546static int pci_fintek_f815xxa_init(struct pci_dev *dev)
1547{
1548 u32 max_port, i;
1549 int config_base;
1550
1551 if (!(pci_resource_flags(dev, 0) & IORESOURCE_MEM))
1552 return -ENODEV;
1553
1554 switch (dev->device) {
1555 case 0x1204: /* 4 ports */
1556 case 0x1208: /* 8 ports */
1557 max_port = dev->device & 0xff;
1558 break;
1559 case 0x1212: /* 12 ports */
1560 max_port = 12;
1561 break;
1562 default:
1563 return -EINVAL;
1564 }
1565
1566 /* Set to mmio decode */
1567 pci_write_config_byte(dev, 0x209, 0x40);
1568
1569 for (i = 0; i < max_port; ++i) {
1570 /* UART0 configuration offset start from 0x2A0 */
1571 config_base = 0x2A0 + 0x08 * i;
1572
1573 /* Select 128-byte FIFO and 8x FIFO threshold */
1574 pci_write_config_byte(dev, config_base + 0x01, 0x33);
1575
1576 /* Enable UART I/O port */
1577 pci_write_config_byte(dev, config_base + 0, 0x01);
1578 }
1579
1580 return max_port;
1581}
1582
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001583static int skip_tx_en_setup(struct serial_private *priv,
1584 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001585 struct uart_8250_port *port, int idx)
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001586{
Andy Shevchenkoc7ac15c2017-07-25 20:39:58 +03001587 port->port.quirks |= UPQ_NO_TXEN_TEST;
Andy Shevchenko11773842021-10-22 16:51:47 +03001588 pci_dbg(priv->dev,
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07001589 "serial8250: skipping TxEn test for device [%04x:%04x] subsystem [%04x:%04x]\n",
1590 priv->dev->vendor, priv->dev->device,
1591 priv->dev->subsystem_vendor, priv->dev->subsystem_device);
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001592
1593 return pci_default_setup(priv, board, port, idx);
1594}
1595
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -07001596static void kt_handle_break(struct uart_port *p)
1597{
Andy Shevchenkob1261c82014-07-14 14:26:14 +03001598 struct uart_8250_port *up = up_to_u8250p(p);
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -07001599 /*
1600 * On receipt of a BI, serial device in Intel ME (Intel
1601 * management engine) needs to have its fifos cleared for sane
1602 * SOL (Serial Over Lan) output.
1603 */
1604 serial8250_clear_and_reinit_fifos(up);
1605}
1606
1607static unsigned int kt_serial_in(struct uart_port *p, int offset)
1608{
Andy Shevchenkob1261c82014-07-14 14:26:14 +03001609 struct uart_8250_port *up = up_to_u8250p(p);
Sudhakar Mamillapalli0ad372b2012-04-10 14:10:58 -07001610 unsigned int val;
1611
1612 /*
1613 * When the Intel ME (management engine) gets reset its serial
1614 * port registers could return 0 momentarily. Functions like
1615 * serial8250_console_write, read and save the IER, perform
1616 * some operation and then restore it. In order to avoid
1617 * setting IER register inadvertently to 0, if the value read
1618 * is 0, double check with ier value in uart_8250_port and use
1619 * that instead. up->ier should be the same value as what is
1620 * currently configured.
1621 */
1622 val = inb(p->iobase + offset);
1623 if (offset == UART_IER) {
1624 if (val == 0)
1625 val = up->ier;
1626 }
1627 return val;
1628}
1629
Dan Williamsbc02d152012-04-06 11:49:50 -07001630static int kt_serial_setup(struct serial_private *priv,
1631 const struct pciserial_board *board,
Alan Cox2655a2c2012-07-12 12:59:50 +01001632 struct uart_8250_port *port, int idx)
Dan Williamsbc02d152012-04-06 11:49:50 -07001633{
Alan Cox2655a2c2012-07-12 12:59:50 +01001634 port->port.flags |= UPF_BUG_THRE;
1635 port->port.serial_in = kt_serial_in;
1636 port->port.handle_break = kt_handle_break;
Dan Williamsbc02d152012-04-06 11:49:50 -07001637 return skip_tx_en_setup(priv, board, port, idx);
1638}
1639
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09001640static int pci_eg20t_init(struct pci_dev *dev)
1641{
1642#if defined(CONFIG_SERIAL_PCH_UART) || defined(CONFIG_SERIAL_PCH_UART_MODULE)
1643 return -ENODEV;
1644#else
1645 return 0;
1646#endif
1647}
1648
Matt Schultedc96efb2012-11-19 09:12:04 -06001649static int
Guainluca Anzolin6971c632012-09-04 15:56:12 +01001650pci_wch_ch353_setup(struct serial_private *priv,
Anton Wuerfel6d7c1572016-01-14 16:08:11 +01001651 const struct pciserial_board *board,
1652 struct uart_8250_port *port, int idx)
Guainluca Anzolin6971c632012-09-04 15:56:12 +01001653{
1654 port->port.flags |= UPF_FIXED_TYPE;
1655 port->port.type = PORT_16550A;
Søren Holm06315342011-09-02 22:55:37 +02001656 return pci_default_setup(priv, board, port, idx);
1657}
1658
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03001659static int
Alexandr Petrenko55c368c2016-05-23 10:04:54 +03001660pci_wch_ch355_setup(struct serial_private *priv,
1661 const struct pciserial_board *board,
1662 struct uart_8250_port *port, int idx)
1663{
1664 port->port.flags |= UPF_FIXED_TYPE;
1665 port->port.type = PORT_16550A;
1666 return pci_default_setup(priv, board, port, idx);
1667}
1668
1669static int
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03001670pci_wch_ch38x_setup(struct serial_private *priv,
Anton Wuerfel6d7c1572016-01-14 16:08:11 +01001671 const struct pciserial_board *board,
1672 struct uart_8250_port *port, int idx)
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03001673{
1674 port->port.flags |= UPF_FIXED_TYPE;
1675 port->port.type = PORT_16850;
1676 return pci_default_setup(priv, board, port, idx);
1677}
1678
Du Huanpeng04b6ff52020-08-22 09:47:28 +08001679
1680#define CH384_XINT_ENABLE_REG 0xEB
1681#define CH384_XINT_ENABLE_BIT 0x02
1682
1683static int pci_wch_ch38x_init(struct pci_dev *dev)
1684{
1685 int max_port;
1686 unsigned long iobase;
1687
1688
1689 switch (dev->device) {
1690 case 0x3853: /* 8 ports */
1691 max_port = 8;
1692 break;
1693 default:
1694 return -EINVAL;
1695 }
1696
1697 iobase = pci_resource_start(dev, 0);
1698 outb(CH384_XINT_ENABLE_BIT, iobase + CH384_XINT_ENABLE_REG);
1699
1700 return max_port;
1701}
1702
1703static void pci_wch_ch38x_exit(struct pci_dev *dev)
1704{
1705 unsigned long iobase;
1706
1707 iobase = pci_resource_start(dev, 0);
1708 outb(0x0, iobase + CH384_XINT_ENABLE_REG);
1709}
1710
1711
Kai-Heng Feng8515dbc2019-08-10 03:01:29 +08001712static int
1713pci_sunix_setup(struct serial_private *priv,
1714 const struct pciserial_board *board,
1715 struct uart_8250_port *port, int idx)
1716{
1717 int bar;
1718 int offset;
1719
1720 port->port.flags |= UPF_FIXED_TYPE;
1721 port->port.type = PORT_SUNIX;
1722
1723 if (idx < 4) {
1724 bar = 0;
1725 offset = idx * board->uart_offset;
1726 } else {
1727 bar = 1;
1728 idx -= 4;
1729 idx = div_s64_rem(idx, 4, &offset);
1730 offset = idx * 64 + offset * board->uart_offset;
1731 }
1732
1733 return setup_port(priv, port, bar, offset, 0);
1734}
1735
Kai-Heng Fengd193db72019-08-17 00:51:24 +08001736static int
1737pci_moxa_setup(struct serial_private *priv,
1738 const struct pciserial_board *board,
1739 struct uart_8250_port *port, int idx)
1740{
1741 unsigned int bar = FL_GET_BASE(board->flags);
1742 int offset;
1743
1744 if (board->num_ports == 4 && idx == 3)
1745 offset = 7 * board->uart_offset;
1746 else
1747 offset = idx * board->uart_offset;
1748
1749 return setup_port(priv, port, bar, offset, 0);
1750}
1751
Linus Torvalds1da177e2005-04-16 15:20:36 -07001752#define PCI_VENDOR_ID_SBSMODULARIO 0x124B
1753#define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B
1754#define PCI_DEVICE_ID_OCTPRO 0x0001
1755#define PCI_SUBDEVICE_ID_OCTPRO232 0x0108
1756#define PCI_SUBDEVICE_ID_OCTPRO422 0x0208
1757#define PCI_SUBDEVICE_ID_POCTAL232 0x0308
1758#define PCI_SUBDEVICE_ID_POCTAL422 0x0408
Flavio Leitner26e82202012-09-21 21:04:34 -03001759#define PCI_SUBDEVICE_ID_SIIG_DUAL_00 0x2500
1760#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 0x2530
Michael Bramer78d70d42009-01-27 11:51:16 +00001761#define PCI_VENDOR_ID_ADVANTECH 0x13fe
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001762#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66
Michael Bramer78d70d42009-01-27 11:51:16 +00001763#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620
Thomee Wright0c6d7742014-05-19 20:30:51 +00001764#define PCI_DEVICE_ID_ADVANTECH_PCI3618 0x3618
1765#define PCI_DEVICE_ID_ADVANTECH_PCIf618 0xf618
Yegor Yefremov66169ad2010-06-04 09:58:18 +02001766#define PCI_DEVICE_ID_TITAN_200I 0x8028
1767#define PCI_DEVICE_ID_TITAN_400I 0x8048
1768#define PCI_DEVICE_ID_TITAN_800I 0x8088
1769#define PCI_DEVICE_ID_TITAN_800EH 0xA007
1770#define PCI_DEVICE_ID_TITAN_800EHB 0xA008
1771#define PCI_DEVICE_ID_TITAN_400EH 0xA009
1772#define PCI_DEVICE_ID_TITAN_100E 0xA010
1773#define PCI_DEVICE_ID_TITAN_200E 0xA012
1774#define PCI_DEVICE_ID_TITAN_400E 0xA013
1775#define PCI_DEVICE_ID_TITAN_800E 0xA014
1776#define PCI_DEVICE_ID_TITAN_200EI 0xA016
1777#define PCI_DEVICE_ID_TITAN_200EISI 0xA017
Yegor Yefremov48c02472013-12-09 12:11:15 +01001778#define PCI_DEVICE_ID_TITAN_200V3 0xA306
Yegor Yefremov1e9deb12011-12-27 15:47:37 +01001779#define PCI_DEVICE_ID_TITAN_400V3 0xA310
1780#define PCI_DEVICE_ID_TITAN_410V3 0xA312
1781#define PCI_DEVICE_ID_TITAN_800V3 0xA314
1782#define PCI_DEVICE_ID_TITAN_800V3B 0xA315
Lytochkin Borise8470032010-07-26 10:02:26 +04001783#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538
Scott Kilauaa273ae2011-05-11 15:41:59 -05001784#define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04001785#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001
Dan Williamsbc02d152012-04-06 11:49:50 -07001786#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d
Alan Cox27788c52012-09-04 16:21:06 +01001787#define PCI_VENDOR_ID_WCH 0x4348
Wang YanQing8b5c9132013-03-05 23:16:48 +08001788#define PCI_DEVICE_ID_WCH_CH352_2S 0x3253
Alan Cox27788c52012-09-04 16:21:06 +01001789#define PCI_DEVICE_ID_WCH_CH353_4S 0x3453
1790#define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046
Ezequiel Garciafeb58142014-05-24 15:24:51 -03001791#define PCI_DEVICE_ID_WCH_CH353_1S1P 0x5053
Alan Cox27788c52012-09-04 16:21:06 +01001792#define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053
Alexandr Petrenko55c368c2016-05-23 10:04:54 +03001793#define PCI_DEVICE_ID_WCH_CH355_4S 0x7173
Alan Cox66835492012-08-16 12:01:33 +01001794#define PCI_VENDOR_ID_AGESTAR 0x5372
1795#define PCI_DEVICE_ID_AGESTAR_9375 0x6872
Alan Coxeb26dfe2012-07-12 13:00:31 +01001796#define PCI_VENDOR_ID_ASIX 0x9710
Stephen Hurdebebd492013-01-17 14:14:53 -08001797#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a
Ian Abbott57c1f0e2013-07-16 16:14:40 +01001798#define PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800 0x818e
Matt Schulte14faa8c2012-11-21 10:35:15 -06001799
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03001800#define PCIE_VENDOR_ID_WCH 0x1c00
1801#define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03001802#define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470
Du Huanpeng04b6ff52020-08-22 09:47:28 +08001803#define PCIE_DEVICE_ID_WCH_CH384_8S 0x3853
Jeremy McNicoll7dde5572016-02-02 13:00:45 -08001804#define PCIE_DEVICE_ID_WCH_CH382_2S 0x3253
Linus Torvalds1da177e2005-04-16 15:20:36 -07001805
Kai-Heng Fengd193db72019-08-17 00:51:24 +08001806#define PCI_DEVICE_ID_MOXA_CP102E 0x1024
1807#define PCI_DEVICE_ID_MOXA_CP102EL 0x1025
1808#define PCI_DEVICE_ID_MOXA_CP104EL_A 0x1045
1809#define PCI_DEVICE_ID_MOXA_CP114EL 0x1144
1810#define PCI_DEVICE_ID_MOXA_CP116E_A_A 0x1160
1811#define PCI_DEVICE_ID_MOXA_CP116E_A_B 0x1161
1812#define PCI_DEVICE_ID_MOXA_CP118EL_A 0x1182
1813#define PCI_DEVICE_ID_MOXA_CP118E_A_I 0x1183
1814#define PCI_DEVICE_ID_MOXA_CP132EL 0x1322
1815#define PCI_DEVICE_ID_MOXA_CP134EL_A 0x1342
1816#define PCI_DEVICE_ID_MOXA_CP138E_A 0x1381
1817#define PCI_DEVICE_ID_MOXA_CP168EL_A 0x1683
Jimi Damonc8d19242016-07-20 17:00:40 -07001818
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001819/* Unknown vendors/cards - this should not be in linux/pci_ids.h */
1820#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
Scott Ashcroftd13402a2013-03-03 21:35:06 +00001821#define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07001822
Linus Torvalds1da177e2005-04-16 15:20:36 -07001823/*
1824 * Master list of serial port init/setup/exit quirks.
1825 * This does not describe the general nature of the port.
1826 * (ie, baud base, number and location of ports, etc)
1827 *
1828 * This list is ordered alphabetically by vendor then device.
1829 * Specific entries must come before more generic entries.
1830 */
Geert Uytterhoevenc3ae3dc2020-12-11 14:39:07 +01001831static struct pci_serial_quirk pci_serial_quirks[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001832 /*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08001833 * ADDI-DATA GmbH communication cards <info@addi-data.com>
1834 */
1835 {
Ian Abbott086231f2013-07-16 16:14:39 +01001836 .vendor = PCI_VENDOR_ID_AMCC,
Ian Abbott57c1f0e2013-07-16 16:14:40 +01001837 .device = PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800,
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08001838 .subvendor = PCI_ANY_ID,
1839 .subdevice = PCI_ANY_ID,
1840 .setup = addidata_apci7800_setup,
1841 },
1842 /*
Russell King61a116e2006-07-03 15:22:35 +01001843 * AFAVLAB cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07001844 * It is not clear whether this applies to all products.
1845 */
1846 {
1847 .vendor = PCI_VENDOR_ID_AFAVLAB,
1848 .device = PCI_ANY_ID,
1849 .subvendor = PCI_ANY_ID,
1850 .subdevice = PCI_ANY_ID,
1851 .setup = afavlab_setup,
1852 },
1853 /*
1854 * HP Diva
1855 */
1856 {
1857 .vendor = PCI_VENDOR_ID_HP,
1858 .device = PCI_DEVICE_ID_HP_DIVA,
1859 .subvendor = PCI_ANY_ID,
1860 .subdevice = PCI_ANY_ID,
1861 .init = pci_hp_diva_init,
1862 .setup = pci_hp_diva_setup,
1863 },
1864 /*
Randy Wrighte0e24202021-05-14 10:26:54 -06001865 * HPE PCI serial device
1866 */
1867 {
1868 .vendor = PCI_VENDOR_ID_HP_3PAR,
1869 .device = PCI_DEVICE_ID_HPE_PCI_SERIAL,
1870 .subvendor = PCI_ANY_ID,
1871 .subdevice = PCI_ANY_ID,
1872 .setup = pci_hp_diva_setup,
1873 },
1874 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07001875 * Intel
1876 */
1877 {
1878 .vendor = PCI_VENDOR_ID_INTEL,
1879 .device = PCI_DEVICE_ID_INTEL_80960_RP,
1880 .subvendor = 0xe4bf,
1881 .subdevice = PCI_ANY_ID,
1882 .init = pci_inteli960ni_init,
1883 .setup = pci_default_setup,
1884 },
Mauro Carvalho Chehabb6adea32009-02-20 15:38:52 -08001885 {
1886 .vendor = PCI_VENDOR_ID_INTEL,
1887 .device = PCI_DEVICE_ID_INTEL_8257X_SOL,
1888 .subvendor = PCI_ANY_ID,
1889 .subdevice = PCI_ANY_ID,
1890 .setup = skip_tx_en_setup,
1891 },
1892 {
1893 .vendor = PCI_VENDOR_ID_INTEL,
1894 .device = PCI_DEVICE_ID_INTEL_82573L_SOL,
1895 .subvendor = PCI_ANY_ID,
1896 .subdevice = PCI_ANY_ID,
1897 .setup = skip_tx_en_setup,
1898 },
1899 {
1900 .vendor = PCI_VENDOR_ID_INTEL,
1901 .device = PCI_DEVICE_ID_INTEL_82573E_SOL,
1902 .subvendor = PCI_ANY_ID,
1903 .subdevice = PCI_ANY_ID,
1904 .setup = skip_tx_en_setup,
1905 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08001906 {
1907 .vendor = PCI_VENDOR_ID_INTEL,
1908 .device = PCI_DEVICE_ID_INTEL_CE4100_UART,
1909 .subvendor = PCI_ANY_ID,
1910 .subdevice = PCI_ANY_ID,
1911 .setup = ce4100_serial_setup,
1912 },
Dan Williamsbc02d152012-04-06 11:49:50 -07001913 {
1914 .vendor = PCI_VENDOR_ID_INTEL,
1915 .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT,
1916 .subvendor = PCI_ANY_ID,
1917 .subdevice = PCI_ANY_ID,
1918 .setup = kt_serial_setup,
1919 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001920 /*
Niels de Vos84f8c6f2007-08-22 14:01:14 -07001921 * ITE
1922 */
1923 {
1924 .vendor = PCI_VENDOR_ID_ITE,
1925 .device = PCI_DEVICE_ID_ITE_8872,
1926 .subvendor = PCI_ANY_ID,
1927 .subdevice = PCI_ANY_ID,
1928 .init = pci_ite887x_init,
1929 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001930 .exit = pci_ite887x_exit,
Niels de Vos84f8c6f2007-08-22 14:01:14 -07001931 },
1932 /*
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01001933 * National Instruments
1934 */
1935 {
1936 .vendor = PCI_VENDOR_ID_NI,
Will Page04bf7e72009-04-06 17:32:15 +01001937 .device = PCI_DEVICE_ID_NI_PCI23216,
1938 .subvendor = PCI_ANY_ID,
1939 .subdevice = PCI_ANY_ID,
1940 .init = pci_ni8420_init,
1941 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001942 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001943 },
1944 {
1945 .vendor = PCI_VENDOR_ID_NI,
1946 .device = PCI_DEVICE_ID_NI_PCI2328,
1947 .subvendor = PCI_ANY_ID,
1948 .subdevice = PCI_ANY_ID,
1949 .init = pci_ni8420_init,
1950 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001951 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001952 },
1953 {
1954 .vendor = PCI_VENDOR_ID_NI,
1955 .device = PCI_DEVICE_ID_NI_PCI2324,
1956 .subvendor = PCI_ANY_ID,
1957 .subdevice = PCI_ANY_ID,
1958 .init = pci_ni8420_init,
1959 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001960 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001961 },
1962 {
1963 .vendor = PCI_VENDOR_ID_NI,
1964 .device = PCI_DEVICE_ID_NI_PCI2322,
1965 .subvendor = PCI_ANY_ID,
1966 .subdevice = PCI_ANY_ID,
1967 .init = pci_ni8420_init,
1968 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001969 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001970 },
1971 {
1972 .vendor = PCI_VENDOR_ID_NI,
1973 .device = PCI_DEVICE_ID_NI_PCI2324I,
1974 .subvendor = PCI_ANY_ID,
1975 .subdevice = PCI_ANY_ID,
1976 .init = pci_ni8420_init,
1977 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001978 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001979 },
1980 {
1981 .vendor = PCI_VENDOR_ID_NI,
1982 .device = PCI_DEVICE_ID_NI_PCI2322I,
1983 .subvendor = PCI_ANY_ID,
1984 .subdevice = PCI_ANY_ID,
1985 .init = pci_ni8420_init,
1986 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001987 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001988 },
1989 {
1990 .vendor = PCI_VENDOR_ID_NI,
1991 .device = PCI_DEVICE_ID_NI_PXI8420_23216,
1992 .subvendor = PCI_ANY_ID,
1993 .subdevice = PCI_ANY_ID,
1994 .init = pci_ni8420_init,
1995 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05001996 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01001997 },
1998 {
1999 .vendor = PCI_VENDOR_ID_NI,
2000 .device = PCI_DEVICE_ID_NI_PXI8420_2328,
2001 .subvendor = PCI_ANY_ID,
2002 .subdevice = PCI_ANY_ID,
2003 .init = pci_ni8420_init,
2004 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002005 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002006 },
2007 {
2008 .vendor = PCI_VENDOR_ID_NI,
2009 .device = PCI_DEVICE_ID_NI_PXI8420_2324,
2010 .subvendor = PCI_ANY_ID,
2011 .subdevice = PCI_ANY_ID,
2012 .init = pci_ni8420_init,
2013 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002014 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002015 },
2016 {
2017 .vendor = PCI_VENDOR_ID_NI,
2018 .device = PCI_DEVICE_ID_NI_PXI8420_2322,
2019 .subvendor = PCI_ANY_ID,
2020 .subdevice = PCI_ANY_ID,
2021 .init = pci_ni8420_init,
2022 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002023 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002024 },
2025 {
2026 .vendor = PCI_VENDOR_ID_NI,
2027 .device = PCI_DEVICE_ID_NI_PXI8422_2324,
2028 .subvendor = PCI_ANY_ID,
2029 .subdevice = PCI_ANY_ID,
2030 .init = pci_ni8420_init,
2031 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002032 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002033 },
2034 {
2035 .vendor = PCI_VENDOR_ID_NI,
2036 .device = PCI_DEVICE_ID_NI_PXI8422_2322,
2037 .subvendor = PCI_ANY_ID,
2038 .subdevice = PCI_ANY_ID,
2039 .init = pci_ni8420_init,
2040 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002041 .exit = pci_ni8420_exit,
Will Page04bf7e72009-04-06 17:32:15 +01002042 },
2043 {
2044 .vendor = PCI_VENDOR_ID_NI,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002045 .device = PCI_ANY_ID,
2046 .subvendor = PCI_ANY_ID,
2047 .subdevice = PCI_ANY_ID,
2048 .init = pci_ni8430_init,
2049 .setup = pci_ni8430_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002050 .exit = pci_ni8430_exit,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002051 },
Alan Cox55c7c0f2012-11-29 09:03:00 +10302052 /* Quatech */
2053 {
2054 .vendor = PCI_VENDOR_ID_QUATECH,
2055 .device = PCI_ANY_ID,
2056 .subvendor = PCI_ANY_ID,
2057 .subdevice = PCI_ANY_ID,
2058 .init = pci_quatech_init,
2059 .setup = pci_quatech_setup,
Alan Cox55c7c0f2012-11-29 09:03:00 +10302060 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002061 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002062 * Panacom
2063 */
2064 {
2065 .vendor = PCI_VENDOR_ID_PANACOM,
2066 .device = PCI_DEVICE_ID_PANACOM_QUADMODEM,
2067 .subvendor = PCI_ANY_ID,
2068 .subdevice = PCI_ANY_ID,
2069 .init = pci_plx9050_init,
2070 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002071 .exit = pci_plx9050_exit,
Alan Cox5756ee92008-02-08 04:18:51 -08002072 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002073 {
2074 .vendor = PCI_VENDOR_ID_PANACOM,
2075 .device = PCI_DEVICE_ID_PANACOM_DUALMODEM,
2076 .subvendor = PCI_ANY_ID,
2077 .subdevice = PCI_ANY_ID,
2078 .init = pci_plx9050_init,
2079 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002080 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002081 },
2082 /*
2083 * PLX
2084 */
2085 {
2086 .vendor = PCI_VENDOR_ID_PLX,
2087 .device = PCI_DEVICE_ID_PLX_9050,
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01002088 .subvendor = PCI_SUBVENDOR_ID_EXSYS,
2089 .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055,
2090 .init = pci_plx9050_init,
2091 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002092 .exit = pci_plx9050_exit,
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01002093 },
2094 {
2095 .vendor = PCI_VENDOR_ID_PLX,
2096 .device = PCI_DEVICE_ID_PLX_9050,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002097 .subvendor = PCI_SUBVENDOR_ID_KEYSPAN,
2098 .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2,
2099 .init = pci_plx9050_init,
2100 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002101 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002102 },
2103 {
2104 .vendor = PCI_VENDOR_ID_PLX,
2105 .device = PCI_DEVICE_ID_PLX_ROMULUS,
2106 .subvendor = PCI_VENDOR_ID_PLX,
2107 .subdevice = PCI_DEVICE_ID_PLX_ROMULUS,
2108 .init = pci_plx9050_init,
2109 .setup = pci_default_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002110 .exit = pci_plx9050_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002111 },
Andy Shevchenkofcfd3c02021-11-22 15:35:10 +02002112 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002113 * SBS Technologies, Inc., PMC-OCTALPRO 232
2114 */
2115 {
2116 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
2117 .device = PCI_DEVICE_ID_OCTPRO,
2118 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
2119 .subdevice = PCI_SUBDEVICE_ID_OCTPRO232,
2120 .init = sbs_init,
2121 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002122 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002123 },
2124 /*
2125 * SBS Technologies, Inc., PMC-OCTALPRO 422
2126 */
2127 {
2128 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
2129 .device = PCI_DEVICE_ID_OCTPRO,
2130 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
2131 .subdevice = PCI_SUBDEVICE_ID_OCTPRO422,
2132 .init = sbs_init,
2133 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002134 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002135 },
2136 /*
2137 * SBS Technologies, Inc., P-Octal 232
2138 */
2139 {
2140 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
2141 .device = PCI_DEVICE_ID_OCTPRO,
2142 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
2143 .subdevice = PCI_SUBDEVICE_ID_POCTAL232,
2144 .init = sbs_init,
2145 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002146 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002147 },
2148 /*
2149 * SBS Technologies, Inc., P-Octal 422
2150 */
2151 {
2152 .vendor = PCI_VENDOR_ID_SBSMODULARIO,
2153 .device = PCI_DEVICE_ID_OCTPRO,
2154 .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
2155 .subdevice = PCI_SUBDEVICE_ID_POCTAL422,
2156 .init = sbs_init,
2157 .setup = sbs_setup,
Bill Pemberton2d47b712012-11-19 13:21:34 -05002158 .exit = sbs_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002159 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002160 /*
Russell King61a116e2006-07-03 15:22:35 +01002161 * SIIG cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07002162 */
2163 {
2164 .vendor = PCI_VENDOR_ID_SIIG,
Russell King67d74b82005-07-27 11:33:03 +01002165 .device = PCI_ANY_ID,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002166 .subvendor = PCI_ANY_ID,
2167 .subdevice = PCI_ANY_ID,
Russell King67d74b82005-07-27 11:33:03 +01002168 .init = pci_siig_init,
Andrey Panin3ec9c592006-02-02 20:15:09 +00002169 .setup = pci_siig_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002170 },
2171 /*
2172 * Titan cards
2173 */
2174 {
2175 .vendor = PCI_VENDOR_ID_TITAN,
2176 .device = PCI_DEVICE_ID_TITAN_400L,
2177 .subvendor = PCI_ANY_ID,
2178 .subdevice = PCI_ANY_ID,
2179 .setup = titan_400l_800l_setup,
2180 },
2181 {
2182 .vendor = PCI_VENDOR_ID_TITAN,
2183 .device = PCI_DEVICE_ID_TITAN_800L,
2184 .subvendor = PCI_ANY_ID,
2185 .subdevice = PCI_ANY_ID,
2186 .setup = titan_400l_800l_setup,
2187 },
2188 /*
2189 * Timedia cards
2190 */
2191 {
2192 .vendor = PCI_VENDOR_ID_TIMEDIA,
2193 .device = PCI_DEVICE_ID_TIMEDIA_1889,
2194 .subvendor = PCI_VENDOR_ID_TIMEDIA,
2195 .subdevice = PCI_ANY_ID,
Frédéric Brièreb9b24552011-05-29 15:08:04 -04002196 .probe = pci_timedia_probe,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002197 .init = pci_timedia_init,
2198 .setup = pci_timedia_setup,
2199 },
2200 {
2201 .vendor = PCI_VENDOR_ID_TIMEDIA,
2202 .device = PCI_ANY_ID,
2203 .subvendor = PCI_ANY_ID,
2204 .subdevice = PCI_ANY_ID,
2205 .setup = pci_timedia_setup,
2206 },
2207 /*
Kai-Heng Feng8515dbc2019-08-10 03:01:29 +08002208 * Sunix PCI serial boards
Stephen Chiversabd7bac2013-01-28 19:49:20 +11002209 */
2210 {
2211 .vendor = PCI_VENDOR_ID_SUNIX,
2212 .device = PCI_DEVICE_ID_SUNIX_1999,
2213 .subvendor = PCI_VENDOR_ID_SUNIX,
2214 .subdevice = PCI_ANY_ID,
Kai-Heng Feng8515dbc2019-08-10 03:01:29 +08002215 .setup = pci_sunix_setup,
Stephen Chiversabd7bac2013-01-28 19:49:20 +11002216 },
2217 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002218 * Xircom cards
2219 */
2220 {
2221 .vendor = PCI_VENDOR_ID_XIRCOM,
2222 .device = PCI_DEVICE_ID_XIRCOM_X3201_MDM,
2223 .subvendor = PCI_ANY_ID,
2224 .subdevice = PCI_ANY_ID,
2225 .init = pci_xircom_init,
2226 .setup = pci_default_setup,
2227 },
2228 /*
Russell King61a116e2006-07-03 15:22:35 +01002229 * Netmos cards - these may be called via parport_serial
Linus Torvalds1da177e2005-04-16 15:20:36 -07002230 */
2231 {
2232 .vendor = PCI_VENDOR_ID_NETMOS,
2233 .device = PCI_ANY_ID,
2234 .subvendor = PCI_ANY_ID,
2235 .subdevice = PCI_ANY_ID,
2236 .init = pci_netmos_init,
Nicos Gollan7808edc2011-05-05 21:00:37 +02002237 .setup = pci_netmos_9900_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002238 },
2239 /*
Mike Skoog1bc8cde2014-10-16 13:10:01 -07002240 * EndRun Technologies
2241 */
2242 {
2243 .vendor = PCI_VENDOR_ID_ENDRUN,
2244 .device = PCI_ANY_ID,
2245 .subvendor = PCI_ANY_ID,
2246 .subdevice = PCI_ANY_ID,
2247 .init = pci_endrun_init,
2248 .setup = pci_default_setup,
2249 },
2250 /*
Scott Kilauaa273ae2011-05-11 15:41:59 -05002251 * For Oxford Semiconductor Tornado based devices
Russell King9f2a0362009-01-02 13:44:20 +00002252 */
2253 {
2254 .vendor = PCI_VENDOR_ID_OXSEMI,
2255 .device = PCI_ANY_ID,
2256 .subvendor = PCI_ANY_ID,
2257 .subdevice = PCI_ANY_ID,
2258 .init = pci_oxsemi_tornado_init,
2259 .setup = pci_default_setup,
2260 },
2261 {
2262 .vendor = PCI_VENDOR_ID_MAINPINE,
2263 .device = PCI_ANY_ID,
2264 .subvendor = PCI_ANY_ID,
2265 .subdevice = PCI_ANY_ID,
2266 .init = pci_oxsemi_tornado_init,
2267 .setup = pci_default_setup,
2268 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05002269 {
2270 .vendor = PCI_VENDOR_ID_DIGI,
2271 .device = PCIE_DEVICE_ID_NEO_2_OX_IBM,
2272 .subvendor = PCI_SUBVENDOR_ID_IBM,
2273 .subdevice = PCI_ANY_ID,
2274 .init = pci_oxsemi_tornado_init,
2275 .setup = pci_default_setup,
2276 },
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002277 {
2278 .vendor = PCI_VENDOR_ID_INTEL,
2279 .device = 0x8811,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002280 .subvendor = PCI_ANY_ID,
2281 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002282 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002283 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002284 },
2285 {
2286 .vendor = PCI_VENDOR_ID_INTEL,
2287 .device = 0x8812,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002288 .subvendor = PCI_ANY_ID,
2289 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002290 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002291 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002292 },
2293 {
2294 .vendor = PCI_VENDOR_ID_INTEL,
2295 .device = 0x8813,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002296 .subvendor = PCI_ANY_ID,
2297 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002298 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002299 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002300 },
2301 {
2302 .vendor = PCI_VENDOR_ID_INTEL,
2303 .device = 0x8814,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002304 .subvendor = PCI_ANY_ID,
2305 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002306 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002307 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002308 },
2309 {
2310 .vendor = 0x10DB,
2311 .device = 0x8027,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002312 .subvendor = PCI_ANY_ID,
2313 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002314 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002315 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002316 },
2317 {
2318 .vendor = 0x10DB,
2319 .device = 0x8028,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002320 .subvendor = PCI_ANY_ID,
2321 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002322 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002323 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002324 },
2325 {
2326 .vendor = 0x10DB,
2327 .device = 0x8029,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002328 .subvendor = PCI_ANY_ID,
2329 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002330 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002331 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002332 },
2333 {
2334 .vendor = 0x10DB,
2335 .device = 0x800C,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002336 .subvendor = PCI_ANY_ID,
2337 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002338 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002339 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002340 },
2341 {
2342 .vendor = 0x10DB,
2343 .device = 0x800D,
Arnaud Patardaaa10eb2012-04-25 12:17:24 +02002344 .subvendor = PCI_ANY_ID,
2345 .subdevice = PCI_ANY_ID,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002346 .init = pci_eg20t_init,
Tomoya MORINAGA64d91cf2011-10-07 13:39:49 +09002347 .setup = pci_default_setup,
Tomoya MORINAGAeb7073d2011-06-02 11:31:29 +09002348 },
Russell King9f2a0362009-01-02 13:44:20 +00002349 /*
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002350 * Cronyx Omega PCI (PLX-chip based)
2351 */
2352 {
2353 .vendor = PCI_VENDOR_ID_PLX,
2354 .device = PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
2355 .subvendor = PCI_ANY_ID,
2356 .subdevice = PCI_ANY_ID,
2357 .setup = pci_omegapci_setup,
Alan Coxeb26dfe2012-07-12 13:00:31 +01002358 },
Ezequiel Garciafeb58142014-05-24 15:24:51 -03002359 /* WCH CH353 1S1P card (16550 clone) */
2360 {
2361 .vendor = PCI_VENDOR_ID_WCH,
2362 .device = PCI_DEVICE_ID_WCH_CH353_1S1P,
2363 .subvendor = PCI_ANY_ID,
2364 .subdevice = PCI_ANY_ID,
2365 .setup = pci_wch_ch353_setup,
2366 },
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002367 /* WCH CH353 2S1P card (16550 clone) */
2368 {
Alan Cox27788c52012-09-04 16:21:06 +01002369 .vendor = PCI_VENDOR_ID_WCH,
2370 .device = PCI_DEVICE_ID_WCH_CH353_2S1P,
2371 .subvendor = PCI_ANY_ID,
2372 .subdevice = PCI_ANY_ID,
2373 .setup = pci_wch_ch353_setup,
2374 },
2375 /* WCH CH353 4S card (16550 clone) */
2376 {
2377 .vendor = PCI_VENDOR_ID_WCH,
2378 .device = PCI_DEVICE_ID_WCH_CH353_4S,
2379 .subvendor = PCI_ANY_ID,
2380 .subdevice = PCI_ANY_ID,
2381 .setup = pci_wch_ch353_setup,
2382 },
2383 /* WCH CH353 2S1PF card (16550 clone) */
2384 {
2385 .vendor = PCI_VENDOR_ID_WCH,
2386 .device = PCI_DEVICE_ID_WCH_CH353_2S1PF,
2387 .subvendor = PCI_ANY_ID,
2388 .subdevice = PCI_ANY_ID,
Guainluca Anzolin6971c632012-09-04 15:56:12 +01002389 .setup = pci_wch_ch353_setup,
2390 },
Wang YanQing8b5c9132013-03-05 23:16:48 +08002391 /* WCH CH352 2S card (16550 clone) */
2392 {
2393 .vendor = PCI_VENDOR_ID_WCH,
2394 .device = PCI_DEVICE_ID_WCH_CH352_2S,
2395 .subvendor = PCI_ANY_ID,
2396 .subdevice = PCI_ANY_ID,
2397 .setup = pci_wch_ch353_setup,
2398 },
Alexandr Petrenko55c368c2016-05-23 10:04:54 +03002399 /* WCH CH355 4S card (16550 clone) */
2400 {
2401 .vendor = PCI_VENDOR_ID_WCH,
2402 .device = PCI_DEVICE_ID_WCH_CH355_4S,
2403 .subvendor = PCI_ANY_ID,
2404 .subdevice = PCI_ANY_ID,
2405 .setup = pci_wch_ch355_setup,
2406 },
Jeremy McNicoll7dde5572016-02-02 13:00:45 -08002407 /* WCH CH382 2S card (16850 clone) */
2408 {
2409 .vendor = PCIE_VENDOR_ID_WCH,
2410 .device = PCIE_DEVICE_ID_WCH_CH382_2S,
2411 .subvendor = PCI_ANY_ID,
2412 .subdevice = PCI_ANY_ID,
2413 .setup = pci_wch_ch38x_setup,
2414 },
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03002415 /* WCH CH382 2S1P card (16850 clone) */
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03002416 {
2417 .vendor = PCIE_VENDOR_ID_WCH,
2418 .device = PCIE_DEVICE_ID_WCH_CH382_2S1P,
2419 .subvendor = PCI_ANY_ID,
2420 .subdevice = PCI_ANY_ID,
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03002421 .setup = pci_wch_ch38x_setup,
2422 },
2423 /* WCH CH384 4S card (16850 clone) */
2424 {
2425 .vendor = PCIE_VENDOR_ID_WCH,
2426 .device = PCIE_DEVICE_ID_WCH_CH384_4S,
2427 .subvendor = PCI_ANY_ID,
2428 .subdevice = PCI_ANY_ID,
2429 .setup = pci_wch_ch38x_setup,
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03002430 },
Du Huanpeng04b6ff52020-08-22 09:47:28 +08002431 /* WCH CH384 8S card (16850 clone) */
2432 {
2433 .vendor = PCIE_VENDOR_ID_WCH,
2434 .device = PCIE_DEVICE_ID_WCH_CH384_8S,
2435 .subvendor = PCI_ANY_ID,
2436 .subdevice = PCI_ANY_ID,
2437 .init = pci_wch_ch38x_init,
2438 .exit = pci_wch_ch38x_exit,
2439 .setup = pci_wch_ch38x_setup,
2440 },
Alan Coxeb26dfe2012-07-12 13:00:31 +01002441 /*
2442 * ASIX devices with FIFO bug
2443 */
2444 {
2445 .vendor = PCI_VENDOR_ID_ASIX,
2446 .device = PCI_ANY_ID,
2447 .subvendor = PCI_ANY_ID,
2448 .subdevice = PCI_ANY_ID,
2449 .setup = pci_asix_setup,
2450 },
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002451 /*
Stephen Hurdebebd492013-01-17 14:14:53 -08002452 * Broadcom TruManage (NetXtreme)
2453 */
2454 {
2455 .vendor = PCI_VENDOR_ID_BROADCOM,
2456 .device = PCI_DEVICE_ID_BROADCOM_TRUMANAGE,
2457 .subvendor = PCI_ANY_ID,
2458 .subdevice = PCI_ANY_ID,
2459 .setup = pci_brcm_trumanage_setup,
2460 },
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002461 {
2462 .vendor = 0x1c29,
2463 .device = 0x1104,
2464 .subvendor = PCI_ANY_ID,
2465 .subdevice = PCI_ANY_ID,
2466 .setup = pci_fintek_setup,
Peter Hung6a8bc232015-04-01 14:00:21 +08002467 .init = pci_fintek_init,
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002468 },
2469 {
2470 .vendor = 0x1c29,
2471 .device = 0x1108,
2472 .subvendor = PCI_ANY_ID,
2473 .subdevice = PCI_ANY_ID,
2474 .setup = pci_fintek_setup,
Peter Hung6a8bc232015-04-01 14:00:21 +08002475 .init = pci_fintek_init,
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002476 },
2477 {
2478 .vendor = 0x1c29,
2479 .device = 0x1112,
2480 .subvendor = PCI_ANY_ID,
2481 .subdevice = PCI_ANY_ID,
2482 .setup = pci_fintek_setup,
Peter Hung6a8bc232015-04-01 14:00:21 +08002483 .init = pci_fintek_init,
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002484 },
Kai-Heng Fengd193db72019-08-17 00:51:24 +08002485 /*
2486 * MOXA
2487 */
2488 {
2489 .vendor = PCI_VENDOR_ID_MOXA,
2490 .device = PCI_ANY_ID,
2491 .subvendor = PCI_ANY_ID,
2492 .subdevice = PCI_ANY_ID,
2493 .setup = pci_moxa_setup,
2494 },
Ji-Ze Hong (Peter Hong)68e26a82019-08-16 13:27:29 +08002495 {
2496 .vendor = 0x1c29,
2497 .device = 0x1204,
2498 .subvendor = PCI_ANY_ID,
2499 .subdevice = PCI_ANY_ID,
2500 .setup = pci_fintek_f815xxa_setup,
2501 .init = pci_fintek_f815xxa_init,
2502 },
2503 {
2504 .vendor = 0x1c29,
2505 .device = 0x1208,
2506 .subvendor = PCI_ANY_ID,
2507 .subdevice = PCI_ANY_ID,
2508 .setup = pci_fintek_f815xxa_setup,
2509 .init = pci_fintek_f815xxa_init,
2510 },
2511 {
2512 .vendor = 0x1c29,
2513 .device = 0x1212,
2514 .subvendor = PCI_ANY_ID,
2515 .subdevice = PCI_ANY_ID,
2516 .setup = pci_fintek_f815xxa_setup,
2517 .init = pci_fintek_f815xxa_init,
2518 },
Stephen Hurdebebd492013-01-17 14:14:53 -08002519
2520 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002521 * Default "match everything" terminator entry
2522 */
2523 {
2524 .vendor = PCI_ANY_ID,
2525 .device = PCI_ANY_ID,
2526 .subvendor = PCI_ANY_ID,
2527 .subdevice = PCI_ANY_ID,
2528 .setup = pci_default_setup,
2529 }
2530};
2531
2532static inline int quirk_id_matches(u32 quirk_id, u32 dev_id)
2533{
2534 return quirk_id == PCI_ANY_ID || quirk_id == dev_id;
2535}
2536
2537static struct pci_serial_quirk *find_quirk(struct pci_dev *dev)
2538{
2539 struct pci_serial_quirk *quirk;
2540
2541 for (quirk = pci_serial_quirks; ; quirk++)
2542 if (quirk_id_matches(quirk->vendor, dev->vendor) &&
2543 quirk_id_matches(quirk->device, dev->device) &&
2544 quirk_id_matches(quirk->subvendor, dev->subsystem_vendor) &&
2545 quirk_id_matches(quirk->subdevice, dev->subsystem_device))
Alan Cox5756ee92008-02-08 04:18:51 -08002546 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002547 return quirk;
2548}
2549
Linus Torvalds1da177e2005-04-16 15:20:36 -07002550/*
2551 * This is the configuration table for all of the PCI serial boards
2552 * which we support. It is directly indexed by the pci_board_num_t enum
2553 * value, which is encoded in the pci_device_id PCI probe table's
2554 * driver_data member.
2555 *
2556 * The makeup of these names are:
Gareth Howlett26e92862006-01-04 17:00:42 +00002557 * pbn_bn{_bt}_n_baud{_offsetinhex}
Linus Torvalds1da177e2005-04-16 15:20:36 -07002558 *
Gareth Howlett26e92862006-01-04 17:00:42 +00002559 * bn = PCI BAR number
2560 * bt = Index using PCI BARs
2561 * n = number of serial ports
2562 * baud = baud rate
2563 * offsetinhex = offset for each sequential port (in hex)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002564 *
Gareth Howlett26e92862006-01-04 17:00:42 +00002565 * This table is sorted by (in order): bn, bt, baud, offsetindex, n.
Russell Kingf1690f32005-05-06 10:19:09 +01002566 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07002567 * Please note: in theory if n = 1, _bt infix should make no difference.
2568 * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200
2569 */
2570enum pci_board_num_t {
2571 pbn_default = 0,
2572
2573 pbn_b0_1_115200,
2574 pbn_b0_2_115200,
2575 pbn_b0_4_115200,
2576 pbn_b0_5_115200,
Alan Coxbf0df632007-10-16 01:24:00 -07002577 pbn_b0_8_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002578
2579 pbn_b0_1_921600,
2580 pbn_b0_2_921600,
2581 pbn_b0_4_921600,
2582
David Ransondb1de152005-07-27 11:43:55 -07002583 pbn_b0_2_1130000,
2584
Andrey Paninfbc0dc02005-07-18 11:38:09 +01002585 pbn_b0_4_1152000,
2586
Ian Abbott1c9c8582017-02-03 20:25:00 +00002587 pbn_b0_4_1250000,
2588
Gareth Howlett26e92862006-01-04 17:00:42 +00002589 pbn_b0_2_1843200,
2590 pbn_b0_4_1843200,
2591
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02002592 pbn_b0_1_3906250,
Lee Howard7106b4e2008-10-21 13:48:58 +01002593
Linus Torvalds1da177e2005-04-16 15:20:36 -07002594 pbn_b0_bt_1_115200,
2595 pbn_b0_bt_2_115200,
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08002596 pbn_b0_bt_4_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002597 pbn_b0_bt_8_115200,
2598
2599 pbn_b0_bt_1_460800,
2600 pbn_b0_bt_2_460800,
2601 pbn_b0_bt_4_460800,
2602
2603 pbn_b0_bt_1_921600,
2604 pbn_b0_bt_2_921600,
2605 pbn_b0_bt_4_921600,
2606 pbn_b0_bt_8_921600,
2607
2608 pbn_b1_1_115200,
2609 pbn_b1_2_115200,
2610 pbn_b1_4_115200,
2611 pbn_b1_8_115200,
Will Page04bf7e72009-04-06 17:32:15 +01002612 pbn_b1_16_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002613
2614 pbn_b1_1_921600,
2615 pbn_b1_2_921600,
2616 pbn_b1_4_921600,
2617 pbn_b1_8_921600,
2618
Gareth Howlett26e92862006-01-04 17:00:42 +00002619 pbn_b1_2_1250000,
2620
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002621 pbn_b1_bt_1_115200,
Will Page04bf7e72009-04-06 17:32:15 +01002622 pbn_b1_bt_2_115200,
2623 pbn_b1_bt_4_115200,
2624
Linus Torvalds1da177e2005-04-16 15:20:36 -07002625 pbn_b1_bt_2_921600,
2626
2627 pbn_b1_1_1382400,
2628 pbn_b1_2_1382400,
2629 pbn_b1_4_1382400,
2630 pbn_b1_8_1382400,
2631
2632 pbn_b2_1_115200,
Peter Horton737c1752006-08-26 09:07:36 +01002633 pbn_b2_2_115200,
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08002634 pbn_b2_4_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002635 pbn_b2_8_115200,
2636
2637 pbn_b2_1_460800,
2638 pbn_b2_4_460800,
2639 pbn_b2_8_460800,
2640 pbn_b2_16_460800,
2641
2642 pbn_b2_1_921600,
2643 pbn_b2_4_921600,
2644 pbn_b2_8_921600,
2645
Lytochkin Borise8470032010-07-26 10:02:26 +04002646 pbn_b2_8_1152000,
2647
Linus Torvalds1da177e2005-04-16 15:20:36 -07002648 pbn_b2_bt_1_115200,
2649 pbn_b2_bt_2_115200,
2650 pbn_b2_bt_4_115200,
2651
2652 pbn_b2_bt_2_921600,
2653 pbn_b2_bt_4_921600,
2654
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00002655 pbn_b3_2_115200,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002656 pbn_b3_4_115200,
2657 pbn_b3_8_115200,
2658
Yegor Yefremov66169ad2010-06-04 09:58:18 +02002659 pbn_b4_bt_2_921600,
2660 pbn_b4_bt_4_921600,
2661 pbn_b4_bt_8_921600,
2662
Linus Torvalds1da177e2005-04-16 15:20:36 -07002663 /*
2664 * Board-specific versions.
2665 */
2666 pbn_panacom,
2667 pbn_panacom2,
2668 pbn_panacom4,
2669 pbn_plx_romulus,
Mike Skoog1bc8cde2014-10-16 13:10:01 -07002670 pbn_endrun_2_4000000,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002671 pbn_oxsemi,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02002672 pbn_oxsemi_1_3906250,
2673 pbn_oxsemi_2_3906250,
2674 pbn_oxsemi_4_3906250,
2675 pbn_oxsemi_8_3906250,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002676 pbn_intel_i960,
2677 pbn_sgi_ioc3,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002678 pbn_computone_4,
2679 pbn_computone_6,
2680 pbn_computone_8,
2681 pbn_sbsxrsio,
Olof Johanssonaa798502007-08-22 14:01:55 -07002682 pbn_pasemi_1682M,
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01002683 pbn_ni8430_2,
2684 pbn_ni8430_4,
2685 pbn_ni8430_8,
2686 pbn_ni8430_16,
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07002687 pbn_ADDIDATA_PCIe_1_3906250,
2688 pbn_ADDIDATA_PCIe_2_3906250,
2689 pbn_ADDIDATA_PCIe_4_3906250,
2690 pbn_ADDIDATA_PCIe_8_3906250,
Dirk Brandewie095e24b2010-11-17 07:35:20 -08002691 pbn_ce4100_1_115200,
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04002692 pbn_omegapci,
Nicos Gollan7808edc2011-05-05 21:00:37 +02002693 pbn_NETMOS9900_2s_115200,
Stephen Hurdebebd492013-01-17 14:14:53 -08002694 pbn_brcm_trumanage,
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07002695 pbn_fintek_4,
2696 pbn_fintek_8,
2697 pbn_fintek_12,
Ji-Ze Hong (Peter Hong)68e26a82019-08-16 13:27:29 +08002698 pbn_fintek_F81504A,
2699 pbn_fintek_F81508A,
2700 pbn_fintek_F81512A,
Jeremy McNicoll7dde5572016-02-02 13:00:45 -08002701 pbn_wch382_2,
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03002702 pbn_wch384_4,
Du Huanpeng04b6ff52020-08-22 09:47:28 +08002703 pbn_wch384_8,
Kai-Heng Feng8515dbc2019-08-10 03:01:29 +08002704 pbn_sunix_pci_1s,
2705 pbn_sunix_pci_2s,
2706 pbn_sunix_pci_4s,
2707 pbn_sunix_pci_8s,
2708 pbn_sunix_pci_16s,
Maciej W. Rozyckif771a342021-06-10 20:38:59 +02002709 pbn_titan_1_4000000,
2710 pbn_titan_2_4000000,
2711 pbn_titan_4_4000000,
2712 pbn_titan_8_4000000,
Kai-Heng Fengd193db72019-08-17 00:51:24 +08002713 pbn_moxa8250_2p,
2714 pbn_moxa8250_4p,
2715 pbn_moxa8250_8p,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002716};
2717
2718/*
2719 * uart_offset - the space between channels
2720 * reg_shift - describes how the UART registers are mapped
2721 * to PCI memory by the card.
2722 * For example IER register on SBS, Inc. PMC-OctPro is located at
2723 * offset 0x10 from the UART base, while UART_IER is defined as 1
2724 * in include/linux/serial_reg.h,
2725 * see first lines of serial_in() and serial_out() in 8250.c
2726*/
2727
Bill Pembertonde88b342012-11-19 13:24:32 -05002728static struct pciserial_board pci_boards[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002729 [pbn_default] = {
2730 .flags = FL_BASE0,
2731 .num_ports = 1,
2732 .base_baud = 115200,
2733 .uart_offset = 8,
2734 },
2735 [pbn_b0_1_115200] = {
2736 .flags = FL_BASE0,
2737 .num_ports = 1,
2738 .base_baud = 115200,
2739 .uart_offset = 8,
2740 },
2741 [pbn_b0_2_115200] = {
2742 .flags = FL_BASE0,
2743 .num_ports = 2,
2744 .base_baud = 115200,
2745 .uart_offset = 8,
2746 },
2747 [pbn_b0_4_115200] = {
2748 .flags = FL_BASE0,
2749 .num_ports = 4,
2750 .base_baud = 115200,
2751 .uart_offset = 8,
2752 },
2753 [pbn_b0_5_115200] = {
2754 .flags = FL_BASE0,
2755 .num_ports = 5,
2756 .base_baud = 115200,
2757 .uart_offset = 8,
2758 },
Alan Coxbf0df632007-10-16 01:24:00 -07002759 [pbn_b0_8_115200] = {
2760 .flags = FL_BASE0,
2761 .num_ports = 8,
2762 .base_baud = 115200,
2763 .uart_offset = 8,
2764 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002765 [pbn_b0_1_921600] = {
2766 .flags = FL_BASE0,
2767 .num_ports = 1,
2768 .base_baud = 921600,
2769 .uart_offset = 8,
2770 },
2771 [pbn_b0_2_921600] = {
2772 .flags = FL_BASE0,
2773 .num_ports = 2,
2774 .base_baud = 921600,
2775 .uart_offset = 8,
2776 },
2777 [pbn_b0_4_921600] = {
2778 .flags = FL_BASE0,
2779 .num_ports = 4,
2780 .base_baud = 921600,
2781 .uart_offset = 8,
2782 },
David Ransondb1de152005-07-27 11:43:55 -07002783
2784 [pbn_b0_2_1130000] = {
2785 .flags = FL_BASE0,
2786 .num_ports = 2,
2787 .base_baud = 1130000,
2788 .uart_offset = 8,
2789 },
2790
Andrey Paninfbc0dc02005-07-18 11:38:09 +01002791 [pbn_b0_4_1152000] = {
2792 .flags = FL_BASE0,
2793 .num_ports = 4,
2794 .base_baud = 1152000,
2795 .uart_offset = 8,
2796 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002797
Ian Abbott1c9c8582017-02-03 20:25:00 +00002798 [pbn_b0_4_1250000] = {
2799 .flags = FL_BASE0,
2800 .num_ports = 4,
2801 .base_baud = 1250000,
2802 .uart_offset = 8,
2803 },
2804
Gareth Howlett26e92862006-01-04 17:00:42 +00002805 [pbn_b0_2_1843200] = {
2806 .flags = FL_BASE0,
2807 .num_ports = 2,
2808 .base_baud = 1843200,
2809 .uart_offset = 8,
2810 },
2811 [pbn_b0_4_1843200] = {
2812 .flags = FL_BASE0,
2813 .num_ports = 4,
2814 .base_baud = 1843200,
2815 .uart_offset = 8,
2816 },
2817
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02002818 [pbn_b0_1_3906250] = {
Lee Howard7106b4e2008-10-21 13:48:58 +01002819 .flags = FL_BASE0,
2820 .num_ports = 1,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02002821 .base_baud = 3906250,
Lee Howard7106b4e2008-10-21 13:48:58 +01002822 .uart_offset = 8,
2823 },
Gareth Howlett26e92862006-01-04 17:00:42 +00002824
Linus Torvalds1da177e2005-04-16 15:20:36 -07002825 [pbn_b0_bt_1_115200] = {
2826 .flags = FL_BASE0|FL_BASE_BARS,
2827 .num_ports = 1,
2828 .base_baud = 115200,
2829 .uart_offset = 8,
2830 },
2831 [pbn_b0_bt_2_115200] = {
2832 .flags = FL_BASE0|FL_BASE_BARS,
2833 .num_ports = 2,
2834 .base_baud = 115200,
2835 .uart_offset = 8,
2836 },
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08002837 [pbn_b0_bt_4_115200] = {
2838 .flags = FL_BASE0|FL_BASE_BARS,
2839 .num_ports = 4,
2840 .base_baud = 115200,
2841 .uart_offset = 8,
2842 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002843 [pbn_b0_bt_8_115200] = {
2844 .flags = FL_BASE0|FL_BASE_BARS,
2845 .num_ports = 8,
2846 .base_baud = 115200,
2847 .uart_offset = 8,
2848 },
2849
2850 [pbn_b0_bt_1_460800] = {
2851 .flags = FL_BASE0|FL_BASE_BARS,
2852 .num_ports = 1,
2853 .base_baud = 460800,
2854 .uart_offset = 8,
2855 },
2856 [pbn_b0_bt_2_460800] = {
2857 .flags = FL_BASE0|FL_BASE_BARS,
2858 .num_ports = 2,
2859 .base_baud = 460800,
2860 .uart_offset = 8,
2861 },
2862 [pbn_b0_bt_4_460800] = {
2863 .flags = FL_BASE0|FL_BASE_BARS,
2864 .num_ports = 4,
2865 .base_baud = 460800,
2866 .uart_offset = 8,
2867 },
2868
2869 [pbn_b0_bt_1_921600] = {
2870 .flags = FL_BASE0|FL_BASE_BARS,
2871 .num_ports = 1,
2872 .base_baud = 921600,
2873 .uart_offset = 8,
2874 },
2875 [pbn_b0_bt_2_921600] = {
2876 .flags = FL_BASE0|FL_BASE_BARS,
2877 .num_ports = 2,
2878 .base_baud = 921600,
2879 .uart_offset = 8,
2880 },
2881 [pbn_b0_bt_4_921600] = {
2882 .flags = FL_BASE0|FL_BASE_BARS,
2883 .num_ports = 4,
2884 .base_baud = 921600,
2885 .uart_offset = 8,
2886 },
2887 [pbn_b0_bt_8_921600] = {
2888 .flags = FL_BASE0|FL_BASE_BARS,
2889 .num_ports = 8,
2890 .base_baud = 921600,
2891 .uart_offset = 8,
2892 },
2893
2894 [pbn_b1_1_115200] = {
2895 .flags = FL_BASE1,
2896 .num_ports = 1,
2897 .base_baud = 115200,
2898 .uart_offset = 8,
2899 },
2900 [pbn_b1_2_115200] = {
2901 .flags = FL_BASE1,
2902 .num_ports = 2,
2903 .base_baud = 115200,
2904 .uart_offset = 8,
2905 },
2906 [pbn_b1_4_115200] = {
2907 .flags = FL_BASE1,
2908 .num_ports = 4,
2909 .base_baud = 115200,
2910 .uart_offset = 8,
2911 },
2912 [pbn_b1_8_115200] = {
2913 .flags = FL_BASE1,
2914 .num_ports = 8,
2915 .base_baud = 115200,
2916 .uart_offset = 8,
2917 },
Will Page04bf7e72009-04-06 17:32:15 +01002918 [pbn_b1_16_115200] = {
2919 .flags = FL_BASE1,
2920 .num_ports = 16,
2921 .base_baud = 115200,
2922 .uart_offset = 8,
2923 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002924
2925 [pbn_b1_1_921600] = {
2926 .flags = FL_BASE1,
2927 .num_ports = 1,
2928 .base_baud = 921600,
2929 .uart_offset = 8,
2930 },
2931 [pbn_b1_2_921600] = {
2932 .flags = FL_BASE1,
2933 .num_ports = 2,
2934 .base_baud = 921600,
2935 .uart_offset = 8,
2936 },
2937 [pbn_b1_4_921600] = {
2938 .flags = FL_BASE1,
2939 .num_ports = 4,
2940 .base_baud = 921600,
2941 .uart_offset = 8,
2942 },
2943 [pbn_b1_8_921600] = {
2944 .flags = FL_BASE1,
2945 .num_ports = 8,
2946 .base_baud = 921600,
2947 .uart_offset = 8,
2948 },
Gareth Howlett26e92862006-01-04 17:00:42 +00002949 [pbn_b1_2_1250000] = {
2950 .flags = FL_BASE1,
2951 .num_ports = 2,
2952 .base_baud = 1250000,
2953 .uart_offset = 8,
2954 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07002955
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002956 [pbn_b1_bt_1_115200] = {
2957 .flags = FL_BASE1|FL_BASE_BARS,
2958 .num_ports = 1,
2959 .base_baud = 115200,
2960 .uart_offset = 8,
2961 },
Will Page04bf7e72009-04-06 17:32:15 +01002962 [pbn_b1_bt_2_115200] = {
2963 .flags = FL_BASE1|FL_BASE_BARS,
2964 .num_ports = 2,
2965 .base_baud = 115200,
2966 .uart_offset = 8,
2967 },
2968 [pbn_b1_bt_4_115200] = {
2969 .flags = FL_BASE1|FL_BASE_BARS,
2970 .num_ports = 4,
2971 .base_baud = 115200,
2972 .uart_offset = 8,
2973 },
Niels de Vos84f8c6f2007-08-22 14:01:14 -07002974
Linus Torvalds1da177e2005-04-16 15:20:36 -07002975 [pbn_b1_bt_2_921600] = {
2976 .flags = FL_BASE1|FL_BASE_BARS,
2977 .num_ports = 2,
2978 .base_baud = 921600,
2979 .uart_offset = 8,
2980 },
2981
2982 [pbn_b1_1_1382400] = {
2983 .flags = FL_BASE1,
2984 .num_ports = 1,
2985 .base_baud = 1382400,
2986 .uart_offset = 8,
2987 },
2988 [pbn_b1_2_1382400] = {
2989 .flags = FL_BASE1,
2990 .num_ports = 2,
2991 .base_baud = 1382400,
2992 .uart_offset = 8,
2993 },
2994 [pbn_b1_4_1382400] = {
2995 .flags = FL_BASE1,
2996 .num_ports = 4,
2997 .base_baud = 1382400,
2998 .uart_offset = 8,
2999 },
3000 [pbn_b1_8_1382400] = {
3001 .flags = FL_BASE1,
3002 .num_ports = 8,
3003 .base_baud = 1382400,
3004 .uart_offset = 8,
3005 },
3006
3007 [pbn_b2_1_115200] = {
3008 .flags = FL_BASE2,
3009 .num_ports = 1,
3010 .base_baud = 115200,
3011 .uart_offset = 8,
3012 },
Peter Horton737c1752006-08-26 09:07:36 +01003013 [pbn_b2_2_115200] = {
3014 .flags = FL_BASE2,
3015 .num_ports = 2,
3016 .base_baud = 115200,
3017 .uart_offset = 8,
3018 },
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08003019 [pbn_b2_4_115200] = {
3020 .flags = FL_BASE2,
3021 .num_ports = 4,
3022 .base_baud = 115200,
3023 .uart_offset = 8,
3024 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003025 [pbn_b2_8_115200] = {
3026 .flags = FL_BASE2,
3027 .num_ports = 8,
3028 .base_baud = 115200,
3029 .uart_offset = 8,
3030 },
3031
3032 [pbn_b2_1_460800] = {
3033 .flags = FL_BASE2,
3034 .num_ports = 1,
3035 .base_baud = 460800,
3036 .uart_offset = 8,
3037 },
3038 [pbn_b2_4_460800] = {
3039 .flags = FL_BASE2,
3040 .num_ports = 4,
3041 .base_baud = 460800,
3042 .uart_offset = 8,
3043 },
3044 [pbn_b2_8_460800] = {
3045 .flags = FL_BASE2,
3046 .num_ports = 8,
3047 .base_baud = 460800,
3048 .uart_offset = 8,
3049 },
3050 [pbn_b2_16_460800] = {
3051 .flags = FL_BASE2,
3052 .num_ports = 16,
3053 .base_baud = 460800,
3054 .uart_offset = 8,
3055 },
3056
3057 [pbn_b2_1_921600] = {
3058 .flags = FL_BASE2,
3059 .num_ports = 1,
3060 .base_baud = 921600,
3061 .uart_offset = 8,
3062 },
3063 [pbn_b2_4_921600] = {
3064 .flags = FL_BASE2,
3065 .num_ports = 4,
3066 .base_baud = 921600,
3067 .uart_offset = 8,
3068 },
3069 [pbn_b2_8_921600] = {
3070 .flags = FL_BASE2,
3071 .num_ports = 8,
3072 .base_baud = 921600,
3073 .uart_offset = 8,
3074 },
3075
Lytochkin Borise8470032010-07-26 10:02:26 +04003076 [pbn_b2_8_1152000] = {
3077 .flags = FL_BASE2,
3078 .num_ports = 8,
3079 .base_baud = 1152000,
3080 .uart_offset = 8,
3081 },
3082
Linus Torvalds1da177e2005-04-16 15:20:36 -07003083 [pbn_b2_bt_1_115200] = {
3084 .flags = FL_BASE2|FL_BASE_BARS,
3085 .num_ports = 1,
3086 .base_baud = 115200,
3087 .uart_offset = 8,
3088 },
3089 [pbn_b2_bt_2_115200] = {
3090 .flags = FL_BASE2|FL_BASE_BARS,
3091 .num_ports = 2,
3092 .base_baud = 115200,
3093 .uart_offset = 8,
3094 },
3095 [pbn_b2_bt_4_115200] = {
3096 .flags = FL_BASE2|FL_BASE_BARS,
3097 .num_ports = 4,
3098 .base_baud = 115200,
3099 .uart_offset = 8,
3100 },
3101
3102 [pbn_b2_bt_2_921600] = {
3103 .flags = FL_BASE2|FL_BASE_BARS,
3104 .num_ports = 2,
3105 .base_baud = 921600,
3106 .uart_offset = 8,
3107 },
3108 [pbn_b2_bt_4_921600] = {
3109 .flags = FL_BASE2|FL_BASE_BARS,
3110 .num_ports = 4,
3111 .base_baud = 921600,
3112 .uart_offset = 8,
3113 },
3114
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00003115 [pbn_b3_2_115200] = {
3116 .flags = FL_BASE3,
3117 .num_ports = 2,
3118 .base_baud = 115200,
3119 .uart_offset = 8,
3120 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003121 [pbn_b3_4_115200] = {
3122 .flags = FL_BASE3,
3123 .num_ports = 4,
3124 .base_baud = 115200,
3125 .uart_offset = 8,
3126 },
3127 [pbn_b3_8_115200] = {
3128 .flags = FL_BASE3,
3129 .num_ports = 8,
3130 .base_baud = 115200,
3131 .uart_offset = 8,
3132 },
3133
Yegor Yefremov66169ad2010-06-04 09:58:18 +02003134 [pbn_b4_bt_2_921600] = {
3135 .flags = FL_BASE4,
3136 .num_ports = 2,
3137 .base_baud = 921600,
3138 .uart_offset = 8,
3139 },
3140 [pbn_b4_bt_4_921600] = {
3141 .flags = FL_BASE4,
3142 .num_ports = 4,
3143 .base_baud = 921600,
3144 .uart_offset = 8,
3145 },
3146 [pbn_b4_bt_8_921600] = {
3147 .flags = FL_BASE4,
3148 .num_ports = 8,
3149 .base_baud = 921600,
3150 .uart_offset = 8,
3151 },
3152
Linus Torvalds1da177e2005-04-16 15:20:36 -07003153 /*
3154 * Entries following this are board-specific.
3155 */
3156
3157 /*
3158 * Panacom - IOMEM
3159 */
3160 [pbn_panacom] = {
3161 .flags = FL_BASE2,
3162 .num_ports = 2,
3163 .base_baud = 921600,
3164 .uart_offset = 0x400,
3165 .reg_shift = 7,
3166 },
3167 [pbn_panacom2] = {
3168 .flags = FL_BASE2|FL_BASE_BARS,
3169 .num_ports = 2,
3170 .base_baud = 921600,
3171 .uart_offset = 0x400,
3172 .reg_shift = 7,
3173 },
3174 [pbn_panacom4] = {
3175 .flags = FL_BASE2|FL_BASE_BARS,
3176 .num_ports = 4,
3177 .base_baud = 921600,
3178 .uart_offset = 0x400,
3179 .reg_shift = 7,
3180 },
3181
3182 /* I think this entry is broken - the first_offset looks wrong --rmk */
3183 [pbn_plx_romulus] = {
3184 .flags = FL_BASE2,
3185 .num_ports = 4,
3186 .base_baud = 921600,
3187 .uart_offset = 8 << 2,
3188 .reg_shift = 2,
3189 .first_offset = 0x03,
3190 },
3191
3192 /*
Mike Skoog1bc8cde2014-10-16 13:10:01 -07003193 * EndRun Technologies
3194 * Uses the size of PCI Base region 0 to
3195 * signal now many ports are available
3196 * 2 port 952 Uart support
3197 */
3198 [pbn_endrun_2_4000000] = {
3199 .flags = FL_BASE0,
3200 .num_ports = 2,
3201 .base_baud = 4000000,
3202 .uart_offset = 0x200,
3203 .first_offset = 0x1000,
3204 },
3205
3206 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003207 * This board uses the size of PCI Base region 0 to
3208 * signal now many ports are available
3209 */
3210 [pbn_oxsemi] = {
3211 .flags = FL_BASE0|FL_REGION_SZ_CAP,
3212 .num_ports = 32,
3213 .base_baud = 115200,
3214 .uart_offset = 8,
3215 },
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02003216 [pbn_oxsemi_1_3906250] = {
Lee Howard7106b4e2008-10-21 13:48:58 +01003217 .flags = FL_BASE0,
3218 .num_ports = 1,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02003219 .base_baud = 3906250,
Lee Howard7106b4e2008-10-21 13:48:58 +01003220 .uart_offset = 0x200,
3221 .first_offset = 0x1000,
3222 },
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02003223 [pbn_oxsemi_2_3906250] = {
Lee Howard7106b4e2008-10-21 13:48:58 +01003224 .flags = FL_BASE0,
3225 .num_ports = 2,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02003226 .base_baud = 3906250,
Lee Howard7106b4e2008-10-21 13:48:58 +01003227 .uart_offset = 0x200,
3228 .first_offset = 0x1000,
3229 },
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02003230 [pbn_oxsemi_4_3906250] = {
Lee Howard7106b4e2008-10-21 13:48:58 +01003231 .flags = FL_BASE0,
3232 .num_ports = 4,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02003233 .base_baud = 3906250,
Lee Howard7106b4e2008-10-21 13:48:58 +01003234 .uart_offset = 0x200,
3235 .first_offset = 0x1000,
3236 },
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02003237 [pbn_oxsemi_8_3906250] = {
Lee Howard7106b4e2008-10-21 13:48:58 +01003238 .flags = FL_BASE0,
3239 .num_ports = 8,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02003240 .base_baud = 3906250,
Lee Howard7106b4e2008-10-21 13:48:58 +01003241 .uart_offset = 0x200,
3242 .first_offset = 0x1000,
3243 },
3244
Linus Torvalds1da177e2005-04-16 15:20:36 -07003245
3246 /*
3247 * EKF addition for i960 Boards form EKF with serial port.
3248 * Max 256 ports.
3249 */
3250 [pbn_intel_i960] = {
3251 .flags = FL_BASE0,
3252 .num_ports = 32,
3253 .base_baud = 921600,
3254 .uart_offset = 8 << 2,
3255 .reg_shift = 2,
3256 .first_offset = 0x10000,
3257 },
3258 [pbn_sgi_ioc3] = {
3259 .flags = FL_BASE0|FL_NOIRQ,
3260 .num_ports = 1,
3261 .base_baud = 458333,
3262 .uart_offset = 8,
3263 .reg_shift = 0,
3264 .first_offset = 0x20178,
3265 },
3266
3267 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003268 * Computone - uses IOMEM.
3269 */
3270 [pbn_computone_4] = {
3271 .flags = FL_BASE0,
3272 .num_ports = 4,
3273 .base_baud = 921600,
3274 .uart_offset = 0x40,
3275 .reg_shift = 2,
3276 .first_offset = 0x200,
3277 },
3278 [pbn_computone_6] = {
3279 .flags = FL_BASE0,
3280 .num_ports = 6,
3281 .base_baud = 921600,
3282 .uart_offset = 0x40,
3283 .reg_shift = 2,
3284 .first_offset = 0x200,
3285 },
3286 [pbn_computone_8] = {
3287 .flags = FL_BASE0,
3288 .num_ports = 8,
3289 .base_baud = 921600,
3290 .uart_offset = 0x40,
3291 .reg_shift = 2,
3292 .first_offset = 0x200,
3293 },
3294 [pbn_sbsxrsio] = {
3295 .flags = FL_BASE0,
3296 .num_ports = 8,
3297 .base_baud = 460800,
3298 .uart_offset = 256,
3299 .reg_shift = 4,
3300 },
3301 /*
Olof Johanssonaa798502007-08-22 14:01:55 -07003302 * PA Semi PWRficient PA6T-1682M on-chip UART
3303 */
3304 [pbn_pasemi_1682M] = {
3305 .flags = FL_BASE0,
3306 .num_ports = 1,
3307 .base_baud = 8333333,
3308 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01003309 /*
3310 * National Instruments 843x
3311 */
3312 [pbn_ni8430_16] = {
3313 .flags = FL_BASE0,
3314 .num_ports = 16,
3315 .base_baud = 3686400,
3316 .uart_offset = 0x10,
3317 .first_offset = 0x800,
3318 },
3319 [pbn_ni8430_8] = {
3320 .flags = FL_BASE0,
3321 .num_ports = 8,
3322 .base_baud = 3686400,
3323 .uart_offset = 0x10,
3324 .first_offset = 0x800,
3325 },
3326 [pbn_ni8430_4] = {
3327 .flags = FL_BASE0,
3328 .num_ports = 4,
3329 .base_baud = 3686400,
3330 .uart_offset = 0x10,
3331 .first_offset = 0x800,
3332 },
3333 [pbn_ni8430_2] = {
3334 .flags = FL_BASE0,
3335 .num_ports = 2,
3336 .base_baud = 3686400,
3337 .uart_offset = 0x10,
3338 .first_offset = 0x800,
3339 },
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07003340 /*
3341 * ADDI-DATA GmbH PCI-Express communication cards <info@addi-data.com>
3342 */
3343 [pbn_ADDIDATA_PCIe_1_3906250] = {
3344 .flags = FL_BASE0,
3345 .num_ports = 1,
3346 .base_baud = 3906250,
3347 .uart_offset = 0x200,
3348 .first_offset = 0x1000,
3349 },
3350 [pbn_ADDIDATA_PCIe_2_3906250] = {
3351 .flags = FL_BASE0,
3352 .num_ports = 2,
3353 .base_baud = 3906250,
3354 .uart_offset = 0x200,
3355 .first_offset = 0x1000,
3356 },
3357 [pbn_ADDIDATA_PCIe_4_3906250] = {
3358 .flags = FL_BASE0,
3359 .num_ports = 4,
3360 .base_baud = 3906250,
3361 .uart_offset = 0x200,
3362 .first_offset = 0x1000,
3363 },
3364 [pbn_ADDIDATA_PCIe_8_3906250] = {
3365 .flags = FL_BASE0,
3366 .num_ports = 8,
3367 .base_baud = 3906250,
3368 .uart_offset = 0x200,
3369 .first_offset = 0x1000,
3370 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08003371 [pbn_ce4100_1_115200] = {
Maxime Bizon08ec2122012-10-19 10:45:07 +02003372 .flags = FL_BASE_BARS,
3373 .num_ports = 2,
Dirk Brandewie095e24b2010-11-17 07:35:20 -08003374 .base_baud = 921600,
3375 .reg_shift = 2,
3376 },
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04003377 [pbn_omegapci] = {
3378 .flags = FL_BASE0,
3379 .num_ports = 8,
3380 .base_baud = 115200,
3381 .uart_offset = 0x200,
3382 },
Nicos Gollan7808edc2011-05-05 21:00:37 +02003383 [pbn_NETMOS9900_2s_115200] = {
3384 .flags = FL_BASE0,
3385 .num_ports = 2,
3386 .base_baud = 115200,
3387 },
Stephen Hurdebebd492013-01-17 14:14:53 -08003388 [pbn_brcm_trumanage] = {
3389 .flags = FL_BASE0,
3390 .num_ports = 1,
3391 .reg_shift = 2,
3392 .base_baud = 115200,
3393 },
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07003394 [pbn_fintek_4] = {
3395 .num_ports = 4,
3396 .uart_offset = 8,
3397 .base_baud = 115200,
3398 .first_offset = 0x40,
3399 },
3400 [pbn_fintek_8] = {
3401 .num_ports = 8,
3402 .uart_offset = 8,
3403 .base_baud = 115200,
3404 .first_offset = 0x40,
3405 },
3406 [pbn_fintek_12] = {
3407 .num_ports = 12,
3408 .uart_offset = 8,
3409 .base_baud = 115200,
3410 .first_offset = 0x40,
3411 },
Ji-Ze Hong (Peter Hong)68e26a82019-08-16 13:27:29 +08003412 [pbn_fintek_F81504A] = {
3413 .num_ports = 4,
3414 .uart_offset = 8,
3415 .base_baud = 115200,
3416 },
3417 [pbn_fintek_F81508A] = {
3418 .num_ports = 8,
3419 .uart_offset = 8,
3420 .base_baud = 115200,
3421 },
3422 [pbn_fintek_F81512A] = {
3423 .num_ports = 12,
3424 .uart_offset = 8,
3425 .base_baud = 115200,
3426 },
Jeremy McNicoll7dde5572016-02-02 13:00:45 -08003427 [pbn_wch382_2] = {
3428 .flags = FL_BASE0,
3429 .num_ports = 2,
3430 .base_baud = 115200,
3431 .uart_offset = 8,
3432 .first_offset = 0xC0,
3433 },
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03003434 [pbn_wch384_4] = {
3435 .flags = FL_BASE0,
3436 .num_ports = 4,
3437 .base_baud = 115200,
3438 .uart_offset = 8,
3439 .first_offset = 0xC0,
3440 },
Du Huanpeng04b6ff52020-08-22 09:47:28 +08003441 [pbn_wch384_8] = {
3442 .flags = FL_BASE0,
3443 .num_ports = 8,
3444 .base_baud = 115200,
3445 .uart_offset = 8,
3446 .first_offset = 0x00,
3447 },
Kai-Heng Feng8515dbc2019-08-10 03:01:29 +08003448 [pbn_sunix_pci_1s] = {
3449 .num_ports = 1,
3450 .base_baud = 921600,
3451 .uart_offset = 0x8,
3452 },
3453 [pbn_sunix_pci_2s] = {
3454 .num_ports = 2,
3455 .base_baud = 921600,
3456 .uart_offset = 0x8,
3457 },
3458 [pbn_sunix_pci_4s] = {
3459 .num_ports = 4,
3460 .base_baud = 921600,
3461 .uart_offset = 0x8,
3462 },
3463 [pbn_sunix_pci_8s] = {
3464 .num_ports = 8,
3465 .base_baud = 921600,
3466 .uart_offset = 0x8,
3467 },
3468 [pbn_sunix_pci_16s] = {
3469 .num_ports = 16,
3470 .base_baud = 921600,
3471 .uart_offset = 0x8,
3472 },
Maciej W. Rozyckif771a342021-06-10 20:38:59 +02003473 [pbn_titan_1_4000000] = {
3474 .flags = FL_BASE0,
3475 .num_ports = 1,
3476 .base_baud = 4000000,
3477 .uart_offset = 0x200,
3478 .first_offset = 0x1000,
3479 },
3480 [pbn_titan_2_4000000] = {
3481 .flags = FL_BASE0,
3482 .num_ports = 2,
3483 .base_baud = 4000000,
3484 .uart_offset = 0x200,
3485 .first_offset = 0x1000,
3486 },
3487 [pbn_titan_4_4000000] = {
3488 .flags = FL_BASE0,
3489 .num_ports = 4,
3490 .base_baud = 4000000,
3491 .uart_offset = 0x200,
3492 .first_offset = 0x1000,
3493 },
3494 [pbn_titan_8_4000000] = {
3495 .flags = FL_BASE0,
3496 .num_ports = 8,
3497 .base_baud = 4000000,
3498 .uart_offset = 0x200,
3499 .first_offset = 0x1000,
3500 },
Kai-Heng Fengd193db72019-08-17 00:51:24 +08003501 [pbn_moxa8250_2p] = {
3502 .flags = FL_BASE1,
3503 .num_ports = 2,
3504 .base_baud = 921600,
3505 .uart_offset = 0x200,
3506 },
3507 [pbn_moxa8250_4p] = {
3508 .flags = FL_BASE1,
3509 .num_ports = 4,
3510 .base_baud = 921600,
3511 .uart_offset = 0x200,
3512 },
3513 [pbn_moxa8250_8p] = {
3514 .flags = FL_BASE1,
3515 .num_ports = 8,
3516 .base_baud = 921600,
3517 .uart_offset = 0x200,
3518 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003519};
3520
Guainluca Anzolin6971c632012-09-04 15:56:12 +01003521static const struct pci_device_id blacklist[] = {
3522 /* softmodems */
Alan Cox5756ee92008-02-08 04:18:51 -08003523 { PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */
Maciej Szmigieroebf7c062010-10-26 21:48:21 +02003524 { PCI_VDEVICE(MOTOROLA, 0x3052), }, /* Motorola Si3052-based modem */
3525 { PCI_DEVICE(0x1543, 0x3052), }, /* Si3052-based modem, default IDs */
Guainluca Anzolin6971c632012-09-04 15:56:12 +01003526
3527 /* multi-io cards handled by parport_serial */
3528 { PCI_DEVICE(0x4348, 0x7053), }, /* WCH CH353 2S1P */
Ezequiel Garciafeb58142014-05-24 15:24:51 -03003529 { PCI_DEVICE(0x4348, 0x5053), }, /* WCH CH353 1S1P */
Sergej Pupykin2fdd8c82014-11-06 14:36:31 +03003530 { PCI_DEVICE(0x1c00, 0x3250), }, /* WCH CH382 2S1P */
Heikki Krogerusd9eda9b2015-10-13 13:29:02 +03003531
3532 /* Intel platforms with MID UART */
3533 { PCI_VDEVICE(INTEL, 0x081b), },
3534 { PCI_VDEVICE(INTEL, 0x081c), },
3535 { PCI_VDEVICE(INTEL, 0x081d), },
3536 { PCI_VDEVICE(INTEL, 0x1191), },
Andy Shevchenkodaf39302017-09-22 15:11:56 +03003537 { PCI_VDEVICE(INTEL, 0x18d8), },
Heikki Krogerus6ede6dc2015-10-13 13:29:06 +03003538 { PCI_VDEVICE(INTEL, 0x19d8), },
Andy Shevchenkoa13e19c2016-08-17 19:20:27 +03003539
3540 /* Intel platforms with DesignWare UART */
Andy Shevchenko6bb5d752016-08-17 19:20:28 +03003541 { PCI_VDEVICE(INTEL, 0x0936), },
Andy Shevchenkoa13e19c2016-08-17 19:20:27 +03003542 { PCI_VDEVICE(INTEL, 0x0f0a), },
3543 { PCI_VDEVICE(INTEL, 0x0f0c), },
3544 { PCI_VDEVICE(INTEL, 0x228a), },
3545 { PCI_VDEVICE(INTEL, 0x228c), },
Andy Shevchenko7f0909d2021-07-13 13:17:39 +03003546 { PCI_VDEVICE(INTEL, 0x4b96), },
3547 { PCI_VDEVICE(INTEL, 0x4b97), },
3548 { PCI_VDEVICE(INTEL, 0x4b98), },
3549 { PCI_VDEVICE(INTEL, 0x4b99), },
3550 { PCI_VDEVICE(INTEL, 0x4b9a), },
3551 { PCI_VDEVICE(INTEL, 0x4b9b), },
Andy Shevchenkoa13e19c2016-08-17 19:20:27 +03003552 { PCI_VDEVICE(INTEL, 0x9ce3), },
3553 { PCI_VDEVICE(INTEL, 0x9ce4), },
Sudip Mukherjee5d1a2382017-01-30 22:28:22 +00003554
3555 /* Exar devices */
3556 { PCI_VDEVICE(EXAR, PCI_ANY_ID), },
Jan Kiszkafc6cc962017-02-08 17:09:06 +01003557 { PCI_VDEVICE(COMMTECH, PCI_ANY_ID), },
Heikki Krogerus54b2f302019-01-24 23:51:22 +02003558
Andy Shevchenkofcfd3c02021-11-22 15:35:10 +02003559 /* Pericom devices */
3560 { PCI_VDEVICE(PERICOM, PCI_ANY_ID), },
3561 { PCI_VDEVICE(ACCESSIO, PCI_ANY_ID), },
3562
Heikki Krogerus54b2f302019-01-24 23:51:22 +02003563 /* End of the black list */
3564 { }
Christian Schmidt436bbd42007-08-22 14:01:19 -07003565};
3566
Andy Shevchenko7d8905d2017-07-24 20:28:32 +03003567static int serial_pci_is_class_communication(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003568{
Linus Torvalds1da177e2005-04-16 15:20:36 -07003569 /*
3570 * If it is not a communications device or the programming
3571 * interface is greater than 6, give up.
Linus Torvalds1da177e2005-04-16 15:20:36 -07003572 */
3573 if ((((dev->class >> 8) != PCI_CLASS_COMMUNICATION_SERIAL) &&
Andy Shevchenkoe7f3e992018-02-02 20:39:13 +02003574 ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MULTISERIAL) &&
Linus Torvalds1da177e2005-04-16 15:20:36 -07003575 ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) ||
3576 (dev->class & 0xff) > 6)
3577 return -ENODEV;
3578
Andy Shevchenko7d8905d2017-07-24 20:28:32 +03003579 return 0;
3580}
3581
Andy Shevchenko7d8905d2017-07-24 20:28:32 +03003582/*
3583 * Given a complete unknown PCI device, try to use some heuristics to
3584 * guess what the configuration might be, based on the pitiful PCI
3585 * serial specs. Returns 0 on success, -ENODEV on failure.
3586 */
3587static int
3588serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
3589{
3590 int num_iomem, num_port, first_port = -1, i;
Andy Shevchenko824d17c2019-01-24 23:51:21 +02003591 int rc;
3592
3593 rc = serial_pci_is_class_communication(dev);
3594 if (rc)
3595 return rc;
Andy Shevchenko7d8905d2017-07-24 20:28:32 +03003596
Andy Shevchenkoe7f3e992018-02-02 20:39:13 +02003597 /*
3598 * Should we try to make guesses for multiport serial devices later?
3599 */
3600 if ((dev->class >> 8) == PCI_CLASS_COMMUNICATION_MULTISERIAL)
3601 return -ENODEV;
3602
Linus Torvalds1da177e2005-04-16 15:20:36 -07003603 num_iomem = num_port = 0;
Denis Efremovc9c13ba2019-09-28 02:43:08 +03003604 for (i = 0; i < PCI_STD_NUM_BARS; i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07003605 if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
3606 num_port++;
3607 if (first_port == -1)
3608 first_port = i;
3609 }
3610 if (pci_resource_flags(dev, i) & IORESOURCE_MEM)
3611 num_iomem++;
3612 }
3613
3614 /*
3615 * If there is 1 or 0 iomem regions, and exactly one port,
3616 * use it. We guess the number of ports based on the IO
3617 * region size.
3618 */
3619 if (num_iomem <= 1 && num_port == 1) {
3620 board->flags = first_port;
3621 board->num_ports = pci_resource_len(dev, first_port) / 8;
3622 return 0;
3623 }
3624
3625 /*
3626 * Now guess if we've got a board which indexes by BARs.
3627 * Each IO BAR should be 8 bytes, and they should follow
3628 * consecutively.
3629 */
3630 first_port = -1;
3631 num_port = 0;
Denis Efremovc9c13ba2019-09-28 02:43:08 +03003632 for (i = 0; i < PCI_STD_NUM_BARS; i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07003633 if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
3634 pci_resource_len(dev, i) == 8 &&
3635 (first_port == -1 || (first_port + num_port) == i)) {
3636 num_port++;
3637 if (first_port == -1)
3638 first_port = i;
3639 }
3640 }
3641
3642 if (num_port > 1) {
3643 board->flags = first_port | FL_BASE_BARS;
3644 board->num_ports = num_port;
3645 return 0;
3646 }
3647
3648 return -ENODEV;
3649}
3650
3651static inline int
Russell King975a1a7d2009-01-02 13:44:27 +00003652serial_pci_matches(const struct pciserial_board *board,
3653 const struct pciserial_board *guessed)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003654{
3655 return
3656 board->num_ports == guessed->num_ports &&
3657 board->base_baud == guessed->base_baud &&
3658 board->uart_offset == guessed->uart_offset &&
3659 board->reg_shift == guessed->reg_shift &&
3660 board->first_offset == guessed->first_offset;
3661}
3662
Russell King241fc432005-07-27 11:35:54 +01003663struct serial_private *
Russell King975a1a7d2009-01-02 13:44:27 +00003664pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
Russell King241fc432005-07-27 11:35:54 +01003665{
Alan Cox2655a2c2012-07-12 12:59:50 +01003666 struct uart_8250_port uart;
Russell King241fc432005-07-27 11:35:54 +01003667 struct serial_private *priv;
3668 struct pci_serial_quirk *quirk;
3669 int rc, nr_ports, i;
3670
3671 nr_ports = board->num_ports;
3672
3673 /*
3674 * Find an init and setup quirks.
3675 */
3676 quirk = find_quirk(dev);
3677
3678 /*
3679 * Run the new-style initialization function.
3680 * The initialization function returns:
3681 * <0 - error
3682 * 0 - use board->num_ports
3683 * >0 - number of ports
3684 */
3685 if (quirk->init) {
3686 rc = quirk->init(dev);
3687 if (rc < 0) {
3688 priv = ERR_PTR(rc);
3689 goto err_out;
3690 }
3691 if (rc)
3692 nr_ports = rc;
3693 }
3694
Len Baker42c457c2021-09-05 17:57:28 +02003695 priv = kzalloc(struct_size(priv, line, nr_ports), GFP_KERNEL);
Russell King241fc432005-07-27 11:35:54 +01003696 if (!priv) {
3697 priv = ERR_PTR(-ENOMEM);
3698 goto err_deinit;
3699 }
3700
Russell King241fc432005-07-27 11:35:54 +01003701 priv->dev = dev;
3702 priv->quirk = quirk;
3703
Alan Cox2655a2c2012-07-12 12:59:50 +01003704 memset(&uart, 0, sizeof(uart));
3705 uart.port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
3706 uart.port.uartclk = board->base_baud * 16;
Ralf Ramsauer84284132019-08-12 13:21:52 +02003707
Christian Gmeiner9808f9b2021-05-27 11:54:40 +02003708 if (board->flags & FL_NOIRQ) {
3709 uart.port.irq = 0;
Ralf Ramsauer84284132019-08-12 13:21:52 +02003710 } else {
Christian Gmeiner9808f9b2021-05-27 11:54:40 +02003711 if (pci_match_id(pci_use_msi, dev)) {
Andy Shevchenko11773842021-10-22 16:51:47 +03003712 pci_dbg(dev, "Using MSI(-X) interrupts\n");
Christian Gmeiner9808f9b2021-05-27 11:54:40 +02003713 pci_set_master(dev);
Mario Kleiner341abd62021-07-29 06:33:06 +02003714 uart.port.flags &= ~UPF_SHARE_IRQ;
Christian Gmeiner9808f9b2021-05-27 11:54:40 +02003715 rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES);
3716 } else {
Andy Shevchenko11773842021-10-22 16:51:47 +03003717 pci_dbg(dev, "Using legacy interrupts\n");
Christian Gmeiner9808f9b2021-05-27 11:54:40 +02003718 rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY);
3719 }
3720 if (rc < 0) {
3721 kfree(priv);
3722 priv = ERR_PTR(rc);
3723 goto err_deinit;
3724 }
3725
3726 uart.port.irq = pci_irq_vector(dev, 0);
Ralf Ramsauer84284132019-08-12 13:21:52 +02003727 }
3728
Alan Cox2655a2c2012-07-12 12:59:50 +01003729 uart.port.dev = &dev->dev;
Russell King241fc432005-07-27 11:35:54 +01003730
3731 for (i = 0; i < nr_ports; i++) {
Alan Cox2655a2c2012-07-12 12:59:50 +01003732 if (quirk->setup(priv, board, &uart, i))
Russell King241fc432005-07-27 11:35:54 +01003733 break;
3734
Andy Shevchenko11773842021-10-22 16:51:47 +03003735 pci_dbg(dev, "Setup PCI port: port %lx, irq %d, type %d\n",
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07003736 uart.port.iobase, uart.port.irq, uart.port.iotype);
Alan Cox5756ee92008-02-08 04:18:51 -08003737
Alan Cox2655a2c2012-07-12 12:59:50 +01003738 priv->line[i] = serial8250_register_8250_port(&uart);
Russell King241fc432005-07-27 11:35:54 +01003739 if (priv->line[i] < 0) {
Andy Shevchenko11773842021-10-22 16:51:47 +03003740 pci_err(dev,
Greg Kroah-Hartmanaf8c5b82013-09-28 13:01:59 -07003741 "Couldn't register serial port %lx, irq %d, type %d, error %d\n",
3742 uart.port.iobase, uart.port.irq,
3743 uart.port.iotype, priv->line[i]);
Russell King241fc432005-07-27 11:35:54 +01003744 break;
3745 }
3746 }
Russell King241fc432005-07-27 11:35:54 +01003747 priv->nr = i;
Gabriel Krisman Bertazif209fa02016-11-28 19:34:42 -02003748 priv->board = board;
Russell King241fc432005-07-27 11:35:54 +01003749 return priv;
3750
Alan Cox5756ee92008-02-08 04:18:51 -08003751err_deinit:
Russell King241fc432005-07-27 11:35:54 +01003752 if (quirk->exit)
3753 quirk->exit(dev);
Alan Cox5756ee92008-02-08 04:18:51 -08003754err_out:
Russell King241fc432005-07-27 11:35:54 +01003755 return priv;
3756}
3757EXPORT_SYMBOL_GPL(pciserial_init_ports);
3758
Wei Yongjun80cd94e2017-02-05 16:12:34 +00003759static void pciserial_detach_ports(struct serial_private *priv)
Russell King241fc432005-07-27 11:35:54 +01003760{
3761 struct pci_serial_quirk *quirk;
3762 int i;
3763
3764 for (i = 0; i < priv->nr; i++)
3765 serial8250_unregister_port(priv->line[i]);
3766
Russell King241fc432005-07-27 11:35:54 +01003767 /*
3768 * Find the exit quirks.
3769 */
3770 quirk = find_quirk(priv->dev);
3771 if (quirk->exit)
3772 quirk->exit(priv->dev);
Gabriel Krisman Bertazif209fa02016-11-28 19:34:42 -02003773}
Russell King241fc432005-07-27 11:35:54 +01003774
Gabriel Krisman Bertazif209fa02016-11-28 19:34:42 -02003775void pciserial_remove_ports(struct serial_private *priv)
3776{
3777 pciserial_detach_ports(priv);
Russell King241fc432005-07-27 11:35:54 +01003778 kfree(priv);
3779}
3780EXPORT_SYMBOL_GPL(pciserial_remove_ports);
3781
3782void pciserial_suspend_ports(struct serial_private *priv)
3783{
3784 int i;
3785
3786 for (i = 0; i < priv->nr; i++)
3787 if (priv->line[i] >= 0)
3788 serial8250_suspend_port(priv->line[i]);
Dan Williams5f1a3892012-04-10 14:11:03 -07003789
3790 /*
3791 * Ensure that every init quirk is properly torn down
3792 */
3793 if (priv->quirk->exit)
3794 priv->quirk->exit(priv->dev);
Russell King241fc432005-07-27 11:35:54 +01003795}
3796EXPORT_SYMBOL_GPL(pciserial_suspend_ports);
3797
3798void pciserial_resume_ports(struct serial_private *priv)
3799{
3800 int i;
3801
3802 /*
3803 * Ensure that the board is correctly configured.
3804 */
3805 if (priv->quirk->init)
3806 priv->quirk->init(priv->dev);
3807
3808 for (i = 0; i < priv->nr; i++)
3809 if (priv->line[i] >= 0)
3810 serial8250_resume_port(priv->line[i]);
3811}
3812EXPORT_SYMBOL_GPL(pciserial_resume_ports);
3813
Linus Torvalds1da177e2005-04-16 15:20:36 -07003814/*
3815 * Probe one serial board. Unfortunately, there is no rhyme nor reason
3816 * to the arrangement of serial ports on a PCI card.
3817 */
Bill Pemberton9671f092012-11-19 13:21:50 -05003818static int
Linus Torvalds1da177e2005-04-16 15:20:36 -07003819pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
3820{
Frédéric Brière5bf8f502011-05-29 15:08:03 -04003821 struct pci_serial_quirk *quirk;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003822 struct serial_private *priv;
Russell King975a1a7d2009-01-02 13:44:27 +00003823 const struct pciserial_board *board;
Heikki Krogerus54b2f302019-01-24 23:51:22 +02003824 const struct pci_device_id *exclude;
Russell King975a1a7d2009-01-02 13:44:27 +00003825 struct pciserial_board tmp;
Russell King241fc432005-07-27 11:35:54 +01003826 int rc;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003827
Frédéric Brière5bf8f502011-05-29 15:08:03 -04003828 quirk = find_quirk(dev);
3829 if (quirk->probe) {
3830 rc = quirk->probe(dev);
3831 if (rc)
3832 return rc;
3833 }
3834
Linus Torvalds1da177e2005-04-16 15:20:36 -07003835 if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
Andy Shevchenko11773842021-10-22 16:51:47 +03003836 pci_err(dev, "invalid driver_data: %ld\n", ent->driver_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003837 return -EINVAL;
3838 }
3839
3840 board = &pci_boards[ent->driver_data];
3841
Heikki Krogerus54b2f302019-01-24 23:51:22 +02003842 exclude = pci_match_id(blacklist, dev);
3843 if (exclude)
3844 return -ENODEV;
Andy Shevchenko7d8905d2017-07-24 20:28:32 +03003845
Andy Shevchenko3f64b1d2016-02-15 18:01:51 +02003846 rc = pcim_enable_device(dev);
Michael Reed28071902011-05-31 12:06:28 -05003847 pci_save_state(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003848 if (rc)
3849 return rc;
3850
3851 if (ent->driver_data == pbn_default) {
3852 /*
3853 * Use a copy of the pci_board entry for this;
3854 * avoid changing entries in the table.
3855 */
Russell King1c7c1fe2005-07-27 11:31:19 +01003856 memcpy(&tmp, board, sizeof(struct pciserial_board));
Linus Torvalds1da177e2005-04-16 15:20:36 -07003857 board = &tmp;
3858
3859 /*
3860 * We matched one of our class entries. Try to
3861 * determine the parameters of this board.
3862 */
Russell King975a1a7d2009-01-02 13:44:27 +00003863 rc = serial_pci_guess_board(dev, &tmp);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003864 if (rc)
Andy Shevchenko3f64b1d2016-02-15 18:01:51 +02003865 return rc;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003866 } else {
3867 /*
3868 * We matched an explicit entry. If we are able to
3869 * detect this boards settings with our heuristic,
3870 * then we no longer need this entry.
3871 */
Russell King1c7c1fe2005-07-27 11:31:19 +01003872 memcpy(&tmp, &pci_boards[pbn_default],
3873 sizeof(struct pciserial_board));
Linus Torvalds1da177e2005-04-16 15:20:36 -07003874 rc = serial_pci_guess_board(dev, &tmp);
3875 if (rc == 0 && serial_pci_matches(board, &tmp))
3876 moan_device("Redundant entry in serial pci_table.",
3877 dev);
3878 }
3879
Russell King241fc432005-07-27 11:35:54 +01003880 priv = pciserial_init_ports(dev, board);
Andy Shevchenko3f64b1d2016-02-15 18:01:51 +02003881 if (IS_ERR(priv))
3882 return PTR_ERR(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003883
Andy Shevchenko3f64b1d2016-02-15 18:01:51 +02003884 pci_set_drvdata(dev, priv);
3885 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003886}
3887
Bill Pembertonae8d8a12012-11-19 13:26:18 -05003888static void pciserial_remove_one(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003889{
3890 struct serial_private *priv = pci_get_drvdata(dev);
3891
Russell King241fc432005-07-27 11:35:54 +01003892 pciserial_remove_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003893}
3894
Andy Shevchenko61702c32015-02-02 14:53:26 +02003895#ifdef CONFIG_PM_SLEEP
3896static int pciserial_suspend_one(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003897{
Chuhong Yuan76b41062019-07-24 21:17:58 +08003898 struct serial_private *priv = dev_get_drvdata(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003899
Russell King241fc432005-07-27 11:35:54 +01003900 if (priv)
3901 pciserial_suspend_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003902
Linus Torvalds1da177e2005-04-16 15:20:36 -07003903 return 0;
3904}
3905
Andy Shevchenko61702c32015-02-02 14:53:26 +02003906static int pciserial_resume_one(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003907{
Andy Shevchenko61702c32015-02-02 14:53:26 +02003908 struct pci_dev *pdev = to_pci_dev(dev);
3909 struct serial_private *priv = pci_get_drvdata(pdev);
Dirk Hohndelccb9d592007-10-29 06:28:17 -07003910 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07003911
3912 if (priv) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07003913 /*
3914 * The device may have been disabled. Re-enable it.
3915 */
Andy Shevchenko61702c32015-02-02 14:53:26 +02003916 err = pci_enable_device(pdev);
Alan Cox40836c42008-10-13 10:36:11 +01003917 /* FIXME: We cannot simply error out here */
Dirk Hohndelccb9d592007-10-29 06:28:17 -07003918 if (err)
Andy Shevchenko11773842021-10-22 16:51:47 +03003919 pci_err(pdev, "Unable to re-enable ports, trying to continue.\n");
Russell King241fc432005-07-27 11:35:54 +01003920 pciserial_resume_ports(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -07003921 }
3922 return 0;
3923}
Alexey Dobriyan1d5e7992006-09-25 16:51:27 -07003924#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07003925
Andy Shevchenko61702c32015-02-02 14:53:26 +02003926static SIMPLE_DEV_PM_OPS(pciserial_pm_ops, pciserial_suspend_one,
3927 pciserial_resume_one);
3928
Arvind Yadavc40f7162017-07-23 15:31:06 +05303929static const struct pci_device_id serial_pci_tbl[] = {
Michael Bramer78d70d42009-01-27 11:51:16 +00003930 /* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */
3931 { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620,
3932 PCI_DEVICE_ID_ADVANTECH_PCI3620, 0x0001, 0, 0,
3933 pbn_b2_8_921600 },
Thomee Wright0c6d7742014-05-19 20:30:51 +00003934 /* Advantech also use 0x3618 and 0xf618 */
3935 { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3618,
3936 PCI_DEVICE_ID_ADVANTECH_PCI3618, PCI_ANY_ID, 0, 0,
3937 pbn_b0_4_921600 },
3938 { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCIf618,
3939 PCI_DEVICE_ID_ADVANTECH_PCI3618, PCI_ANY_ID, 0, 0,
3940 pbn_b0_4_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07003941 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
3942 PCI_SUBVENDOR_ID_CONNECT_TECH,
3943 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
3944 pbn_b1_8_1382400 },
3945 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
3946 PCI_SUBVENDOR_ID_CONNECT_TECH,
3947 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
3948 pbn_b1_4_1382400 },
3949 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
3950 PCI_SUBVENDOR_ID_CONNECT_TECH,
3951 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
3952 pbn_b1_2_1382400 },
3953 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3954 PCI_SUBVENDOR_ID_CONNECT_TECH,
3955 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
3956 pbn_b1_8_1382400 },
3957 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3958 PCI_SUBVENDOR_ID_CONNECT_TECH,
3959 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
3960 pbn_b1_4_1382400 },
3961 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3962 PCI_SUBVENDOR_ID_CONNECT_TECH,
3963 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
3964 pbn_b1_2_1382400 },
3965 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3966 PCI_SUBVENDOR_ID_CONNECT_TECH,
3967 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485, 0, 0,
3968 pbn_b1_8_921600 },
3969 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3970 PCI_SUBVENDOR_ID_CONNECT_TECH,
3971 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4, 0, 0,
3972 pbn_b1_8_921600 },
3973 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3974 PCI_SUBVENDOR_ID_CONNECT_TECH,
3975 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485, 0, 0,
3976 pbn_b1_4_921600 },
3977 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3978 PCI_SUBVENDOR_ID_CONNECT_TECH,
3979 PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2, 0, 0,
3980 pbn_b1_4_921600 },
3981 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3982 PCI_SUBVENDOR_ID_CONNECT_TECH,
3983 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485, 0, 0,
3984 pbn_b1_2_921600 },
3985 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3986 PCI_SUBVENDOR_ID_CONNECT_TECH,
3987 PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6, 0, 0,
3988 pbn_b1_8_921600 },
3989 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3990 PCI_SUBVENDOR_ID_CONNECT_TECH,
3991 PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1, 0, 0,
3992 pbn_b1_8_921600 },
3993 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3994 PCI_SUBVENDOR_ID_CONNECT_TECH,
3995 PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1, 0, 0,
3996 pbn_b1_4_921600 },
Gareth Howlett26e92862006-01-04 17:00:42 +00003997 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
3998 PCI_SUBVENDOR_ID_CONNECT_TECH,
3999 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ, 0, 0,
4000 pbn_b1_2_1250000 },
4001 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
4002 PCI_SUBVENDOR_ID_CONNECT_TECH,
4003 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2, 0, 0,
4004 pbn_b0_2_1843200 },
4005 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
4006 PCI_SUBVENDOR_ID_CONNECT_TECH,
4007 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0,
4008 pbn_b0_4_1843200 },
Yoichi Yuasa85d14942006-02-08 21:46:24 +00004009 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
4010 PCI_VENDOR_ID_AFAVLAB,
4011 PCI_SUBDEVICE_ID_AFAVLAB_P061, 0, 0,
4012 pbn_b0_4_1152000 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004013 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
Alan Cox5756ee92008-02-08 04:18:51 -08004014 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004015 pbn_b2_bt_1_115200 },
4016 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM2,
Alan Cox5756ee92008-02-08 04:18:51 -08004017 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004018 pbn_b2_bt_2_115200 },
4019 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM422,
Alan Cox5756ee92008-02-08 04:18:51 -08004020 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004021 pbn_b2_bt_4_115200 },
4022 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM232,
Alan Cox5756ee92008-02-08 04:18:51 -08004023 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004024 pbn_b2_bt_2_115200 },
4025 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM4,
Alan Cox5756ee92008-02-08 04:18:51 -08004026 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004027 pbn_b2_bt_4_115200 },
4028 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8,
Alan Cox5756ee92008-02-08 04:18:51 -08004029 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004030 pbn_b2_8_115200 },
Flavio Leitnere65f0f82009-01-02 13:50:43 +00004031 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_7803,
4032 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4033 pbn_b2_8_460800 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004034 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM8,
4035 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4036 pbn_b2_8_115200 },
4037
4038 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_GTEK_SERIAL2,
4039 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4040 pbn_b2_bt_2_115200 },
4041 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM200,
4042 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4043 pbn_b2_bt_2_921600 },
4044 /*
4045 * VScom SPCOM800, from sl@s.pl
4046 */
Alan Cox5756ee92008-02-08 04:18:51 -08004047 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM800,
4048 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004049 pbn_b2_8_921600 },
4050 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_1077,
Alan Cox5756ee92008-02-08 04:18:51 -08004051 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004052 pbn_b2_4_921600 },
Catalin(ux) M BOIEb76c5a02008-07-23 21:29:46 -07004053 /* Unknown card - subdevice 0x1584 */
4054 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4055 PCI_VENDOR_ID_PLX,
4056 PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0,
Scott Ashcroftd13402a2013-03-03 21:35:06 +00004057 pbn_b2_4_115200 },
4058 /* Unknown card - subdevice 0x1588 */
4059 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4060 PCI_VENDOR_ID_PLX,
4061 PCI_SUBDEVICE_ID_UNKNOWN_0x1588, 0, 0,
4062 pbn_b2_8_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004063 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4064 PCI_SUBVENDOR_ID_KEYSPAN,
4065 PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0,
4066 pbn_panacom },
4067 { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_QUADMODEM,
4068 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4069 pbn_panacom4 },
4070 { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_DUALMODEM,
4071 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4072 pbn_panacom2 },
Matthias Fuchsa9cccd32007-02-10 01:46:05 -08004073 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
4074 PCI_VENDOR_ID_ESDGMBH,
4075 PCI_DEVICE_ID_ESDGMBH_CPCIASIO4, 0, 0,
4076 pbn_b2_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004077 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4078 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08004079 PCI_SUBDEVICE_ID_CHASE_PCIFAST4, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004080 pbn_b2_4_460800 },
4081 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4082 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08004083 PCI_SUBDEVICE_ID_CHASE_PCIFAST8, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004084 pbn_b2_8_460800 },
4085 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4086 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08004087 PCI_SUBDEVICE_ID_CHASE_PCIFAST16, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004088 pbn_b2_16_460800 },
4089 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4090 PCI_SUBVENDOR_ID_CHASE_PCIFAST,
Alan Cox5756ee92008-02-08 04:18:51 -08004091 PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004092 pbn_b2_16_460800 },
4093 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4094 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
Alan Cox5756ee92008-02-08 04:18:51 -08004095 PCI_SUBDEVICE_ID_CHASE_PCIRAS4, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004096 pbn_b2_4_460800 },
4097 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4098 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
Alan Cox5756ee92008-02-08 04:18:51 -08004099 PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004100 pbn_b2_8_460800 },
Bjorn Helgaasadd7b582005-10-24 22:11:57 +01004101 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
4102 PCI_SUBVENDOR_ID_EXSYS,
4103 PCI_SUBDEVICE_ID_EXSYS_4055, 0, 0,
Shawn Bohreree4cd1b2012-05-28 15:20:47 -05004104 pbn_b2_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004105 /*
4106 * Megawolf Romulus PCI Serial Card, from Mike Hudson
4107 * (Exoray@isys.ca)
4108 */
4109 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_ROMULUS,
4110 0x10b5, 0x106a, 0, 0,
4111 pbn_plx_romulus },
Alan Cox55c7c0f2012-11-29 09:03:00 +10304112 /*
Mike Skoog1bc8cde2014-10-16 13:10:01 -07004113 * EndRun Technologies. PCI express device range.
4114 * EndRun PTP/1588 has 2 Native UARTs.
4115 */
4116 { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588,
4117 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4118 pbn_endrun_2_4000000 },
4119 /*
Alan Cox55c7c0f2012-11-29 09:03:00 +10304120 * Quatech cards. These actually have configurable clocks but for
4121 * now we just use the default.
4122 *
4123 * 100 series are RS232, 200 series RS422,
4124 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07004125 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC100,
4126 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4127 pbn_b1_4_115200 },
4128 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100,
4129 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4130 pbn_b1_2_115200 },
Alan Cox55c7c0f2012-11-29 09:03:00 +10304131 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100E,
4132 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4133 pbn_b2_2_115200 },
4134 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC200,
4135 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4136 pbn_b1_2_115200 },
4137 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC200E,
4138 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4139 pbn_b2_2_115200 },
4140 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC200,
4141 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4142 pbn_b1_4_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004143 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100D,
4144 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4145 pbn_b1_8_115200 },
4146 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100M,
4147 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4148 pbn_b1_8_115200 },
Alan Cox55c7c0f2012-11-29 09:03:00 +10304149 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSCP100,
4150 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4151 pbn_b1_4_115200 },
4152 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSCP100,
4153 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4154 pbn_b1_2_115200 },
4155 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSCP200,
4156 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4157 pbn_b1_4_115200 },
4158 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSCP200,
4159 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4160 pbn_b1_2_115200 },
4161 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSCLP100,
4162 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4163 pbn_b2_4_115200 },
4164 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSCLP100,
4165 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4166 pbn_b2_2_115200 },
4167 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SSCLP100,
4168 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4169 pbn_b2_1_115200 },
4170 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSCLP200,
4171 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4172 pbn_b2_4_115200 },
4173 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSCLP200,
4174 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4175 pbn_b2_2_115200 },
4176 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SSCLP200,
4177 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4178 pbn_b2_1_115200 },
4179 { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESCLP100,
4180 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4181 pbn_b0_8_115200 },
4182
Linus Torvalds1da177e2005-04-16 15:20:36 -07004183 { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_OXSEMI_16PCI954,
Alan Cox5756ee92008-02-08 04:18:51 -08004184 PCI_VENDOR_ID_SPECIALIX, PCI_SUBDEVICE_ID_SPECIALIX_SPEED4,
4185 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004186 pbn_b0_4_921600 },
4187 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
Alan Cox5756ee92008-02-08 04:18:51 -08004188 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL,
4189 0, 0,
Andrey Paninfbc0dc02005-07-18 11:38:09 +01004190 pbn_b0_4_1152000 },
Mikulas Patockac9bd9d02010-10-26 14:20:48 -04004191 { PCI_VENDOR_ID_OXSEMI, 0x9505,
4192 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4193 pbn_b0_bt_2_921600 },
David Ransondb1de152005-07-27 11:43:55 -07004194
4195 /*
4196 * The below card is a little controversial since it is the
4197 * subject of a PCI vendor/device ID clash. (See
4198 * www.ussg.iu.edu/hypermail/linux/kernel/0303.1/0516.html).
4199 * For now just used the hex ID 0x950a.
4200 */
4201 { PCI_VENDOR_ID_OXSEMI, 0x950a,
Flavio Leitner26e82202012-09-21 21:04:34 -03004202 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_00,
4203 0, 0, pbn_b0_2_115200 },
4204 { PCI_VENDOR_ID_OXSEMI, 0x950a,
4205 PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_30,
4206 0, 0, pbn_b0_2_115200 },
Niels de Vos39aced62009-01-02 13:46:58 +00004207 { PCI_VENDOR_ID_OXSEMI, 0x950a,
David Ransondb1de152005-07-27 11:43:55 -07004208 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4209 pbn_b0_2_1130000 },
Andre Przywara70fd8fd2009-06-11 12:41:57 +01004210 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_C950,
4211 PCI_VENDOR_ID_OXSEMI, PCI_SUBDEVICE_ID_OXSEMI_C950, 0, 0,
4212 pbn_b0_1_921600 },
Andrey Paninfbc0dc02005-07-18 11:38:09 +01004213 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004214 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4215 pbn_b0_4_115200 },
4216 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952,
4217 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4218 pbn_b0_bt_2_921600 },
Lytochkin Borise8470032010-07-26 10:02:26 +04004219 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI958,
Anton Wuerfel1a33e342016-01-14 16:08:10 +01004220 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Lytochkin Borise8470032010-07-26 10:02:26 +04004221 pbn_b2_8_1152000 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004222
4223 /*
Lee Howard7106b4e2008-10-21 13:48:58 +01004224 * Oxford Semiconductor Inc. Tornado PCI express device range.
4225 */
4226 { PCI_VENDOR_ID_OXSEMI, 0xc101, /* OXPCIe952 1 Legacy UART */
4227 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004228 pbn_b0_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004229 { PCI_VENDOR_ID_OXSEMI, 0xc105, /* OXPCIe952 1 Legacy UART */
4230 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004231 pbn_b0_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004232 { PCI_VENDOR_ID_OXSEMI, 0xc11b, /* OXPCIe952 1 Native UART */
4233 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004234 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004235 { PCI_VENDOR_ID_OXSEMI, 0xc11f, /* OXPCIe952 1 Native UART */
4236 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004237 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004238 { PCI_VENDOR_ID_OXSEMI, 0xc120, /* OXPCIe952 1 Legacy UART */
4239 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004240 pbn_b0_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004241 { PCI_VENDOR_ID_OXSEMI, 0xc124, /* OXPCIe952 1 Legacy UART */
4242 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004243 pbn_b0_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004244 { PCI_VENDOR_ID_OXSEMI, 0xc138, /* OXPCIe952 1 Native UART */
4245 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004246 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004247 { PCI_VENDOR_ID_OXSEMI, 0xc13d, /* OXPCIe952 1 Native UART */
4248 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004249 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004250 { PCI_VENDOR_ID_OXSEMI, 0xc140, /* OXPCIe952 1 Legacy UART */
4251 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004252 pbn_b0_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004253 { PCI_VENDOR_ID_OXSEMI, 0xc141, /* OXPCIe952 1 Legacy UART */
4254 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004255 pbn_b0_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004256 { PCI_VENDOR_ID_OXSEMI, 0xc144, /* OXPCIe952 1 Legacy UART */
4257 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004258 pbn_b0_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004259 { PCI_VENDOR_ID_OXSEMI, 0xc145, /* OXPCIe952 1 Legacy UART */
4260 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004261 pbn_b0_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004262 { PCI_VENDOR_ID_OXSEMI, 0xc158, /* OXPCIe952 2 Native UART */
4263 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004264 pbn_oxsemi_2_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004265 { PCI_VENDOR_ID_OXSEMI, 0xc15d, /* OXPCIe952 2 Native UART */
4266 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004267 pbn_oxsemi_2_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004268 { PCI_VENDOR_ID_OXSEMI, 0xc208, /* OXPCIe954 4 Native UART */
4269 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004270 pbn_oxsemi_4_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004271 { PCI_VENDOR_ID_OXSEMI, 0xc20d, /* OXPCIe954 4 Native UART */
4272 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004273 pbn_oxsemi_4_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004274 { PCI_VENDOR_ID_OXSEMI, 0xc308, /* OXPCIe958 8 Native UART */
4275 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004276 pbn_oxsemi_8_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004277 { PCI_VENDOR_ID_OXSEMI, 0xc30d, /* OXPCIe958 8 Native UART */
4278 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004279 pbn_oxsemi_8_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004280 { PCI_VENDOR_ID_OXSEMI, 0xc40b, /* OXPCIe200 1 Native UART */
4281 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004282 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004283 { PCI_VENDOR_ID_OXSEMI, 0xc40f, /* OXPCIe200 1 Native UART */
4284 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004285 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004286 { PCI_VENDOR_ID_OXSEMI, 0xc41b, /* OXPCIe200 1 Native UART */
4287 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004288 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004289 { PCI_VENDOR_ID_OXSEMI, 0xc41f, /* OXPCIe200 1 Native UART */
4290 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004291 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004292 { PCI_VENDOR_ID_OXSEMI, 0xc42b, /* OXPCIe200 1 Native UART */
4293 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004294 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004295 { PCI_VENDOR_ID_OXSEMI, 0xc42f, /* OXPCIe200 1 Native UART */
4296 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004297 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004298 { PCI_VENDOR_ID_OXSEMI, 0xc43b, /* OXPCIe200 1 Native UART */
4299 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004300 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004301 { PCI_VENDOR_ID_OXSEMI, 0xc43f, /* OXPCIe200 1 Native UART */
4302 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004303 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004304 { PCI_VENDOR_ID_OXSEMI, 0xc44b, /* OXPCIe200 1 Native UART */
4305 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004306 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004307 { PCI_VENDOR_ID_OXSEMI, 0xc44f, /* OXPCIe200 1 Native UART */
4308 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004309 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004310 { PCI_VENDOR_ID_OXSEMI, 0xc45b, /* OXPCIe200 1 Native UART */
4311 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004312 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004313 { PCI_VENDOR_ID_OXSEMI, 0xc45f, /* OXPCIe200 1 Native UART */
4314 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004315 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004316 { PCI_VENDOR_ID_OXSEMI, 0xc46b, /* OXPCIe200 1 Native UART */
4317 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004318 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004319 { PCI_VENDOR_ID_OXSEMI, 0xc46f, /* OXPCIe200 1 Native UART */
4320 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004321 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004322 { PCI_VENDOR_ID_OXSEMI, 0xc47b, /* OXPCIe200 1 Native UART */
4323 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004324 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004325 { PCI_VENDOR_ID_OXSEMI, 0xc47f, /* OXPCIe200 1 Native UART */
4326 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004327 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004328 { PCI_VENDOR_ID_OXSEMI, 0xc48b, /* OXPCIe200 1 Native UART */
4329 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004330 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004331 { PCI_VENDOR_ID_OXSEMI, 0xc48f, /* OXPCIe200 1 Native UART */
4332 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004333 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004334 { PCI_VENDOR_ID_OXSEMI, 0xc49b, /* OXPCIe200 1 Native UART */
4335 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004336 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004337 { PCI_VENDOR_ID_OXSEMI, 0xc49f, /* OXPCIe200 1 Native UART */
4338 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004339 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004340 { PCI_VENDOR_ID_OXSEMI, 0xc4ab, /* OXPCIe200 1 Native UART */
4341 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004342 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004343 { PCI_VENDOR_ID_OXSEMI, 0xc4af, /* OXPCIe200 1 Native UART */
4344 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004345 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004346 { PCI_VENDOR_ID_OXSEMI, 0xc4bb, /* OXPCIe200 1 Native UART */
4347 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004348 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004349 { PCI_VENDOR_ID_OXSEMI, 0xc4bf, /* OXPCIe200 1 Native UART */
4350 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004351 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004352 { PCI_VENDOR_ID_OXSEMI, 0xc4cb, /* OXPCIe200 1 Native UART */
4353 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004354 pbn_oxsemi_1_3906250 },
Lee Howard7106b4e2008-10-21 13:48:58 +01004355 { PCI_VENDOR_ID_OXSEMI, 0xc4cf, /* OXPCIe200 1 Native UART */
4356 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004357 pbn_oxsemi_1_3906250 },
Lee Howardb80de362008-10-21 13:50:14 +01004358 /*
4359 * Mainpine Inc. IQ Express "Rev3" utilizing OxSemi Tornado
4360 */
4361 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 1 Port V.34 Super-G3 Fax */
4362 PCI_VENDOR_ID_MAINPINE, 0x4001, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004363 pbn_oxsemi_1_3906250 },
Lee Howardb80de362008-10-21 13:50:14 +01004364 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 2 Port V.34 Super-G3 Fax */
4365 PCI_VENDOR_ID_MAINPINE, 0x4002, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004366 pbn_oxsemi_2_3906250 },
Lee Howardb80de362008-10-21 13:50:14 +01004367 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 4 Port V.34 Super-G3 Fax */
4368 PCI_VENDOR_ID_MAINPINE, 0x4004, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004369 pbn_oxsemi_4_3906250 },
Lee Howardb80de362008-10-21 13:50:14 +01004370 { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 8 Port V.34 Super-G3 Fax */
4371 PCI_VENDOR_ID_MAINPINE, 0x4008, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004372 pbn_oxsemi_8_3906250 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05004373
4374 /*
4375 * Digi/IBM PCIe 2-port Async EIA-232 Adapter utilizing OxSemi Tornado
4376 */
4377 { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM,
4378 PCI_SUBVENDOR_ID_IBM, PCI_ANY_ID, 0, 0,
Maciej W. Rozycki6cbe45d2021-06-10 20:39:03 +02004379 pbn_oxsemi_2_3906250 },
Scott Kilauaa273ae2011-05-11 15:41:59 -05004380
Lee Howard7106b4e2008-10-21 13:48:58 +01004381 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07004382 * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards,
4383 * from skokodyn@yahoo.com
4384 */
4385 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
4386 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO232, 0, 0,
4387 pbn_sbsxrsio },
4388 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
4389 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO422, 0, 0,
4390 pbn_sbsxrsio },
4391 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
4392 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL232, 0, 0,
4393 pbn_sbsxrsio },
4394 { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
4395 PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL422, 0, 0,
4396 pbn_sbsxrsio },
4397
4398 /*
4399 * Digitan DS560-558, from jimd@esoft.com
4400 */
4401 { PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_ATT_VENUS_MODEM,
Alan Cox5756ee92008-02-08 04:18:51 -08004402 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004403 pbn_b1_1_115200 },
4404
4405 /*
4406 * Titan Electronic cards
4407 * The 400L and 800L have a custom setup quirk.
4408 */
4409 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100,
Alan Cox5756ee92008-02-08 04:18:51 -08004410 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004411 pbn_b0_1_921600 },
4412 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200,
Alan Cox5756ee92008-02-08 04:18:51 -08004413 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004414 pbn_b0_2_921600 },
4415 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400,
Alan Cox5756ee92008-02-08 04:18:51 -08004416 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004417 pbn_b0_4_921600 },
4418 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800B,
Alan Cox5756ee92008-02-08 04:18:51 -08004419 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -07004420 pbn_b0_4_921600 },
4421 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100L,
4422 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4423 pbn_b1_1_921600 },
4424 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200L,
4425 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4426 pbn_b1_bt_2_921600 },
4427 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400L,
4428 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4429 pbn_b0_bt_4_921600 },
4430 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800L,
4431 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4432 pbn_b0_bt_8_921600 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02004433 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200I,
4434 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4435 pbn_b4_bt_2_921600 },
4436 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400I,
4437 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4438 pbn_b4_bt_4_921600 },
4439 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800I,
4440 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4441 pbn_b4_bt_8_921600 },
4442 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400EH,
4443 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4444 pbn_b0_4_921600 },
4445 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EH,
4446 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4447 pbn_b0_4_921600 },
4448 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EHB,
4449 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4450 pbn_b0_4_921600 },
4451 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100E,
4452 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozyckif771a342021-06-10 20:38:59 +02004453 pbn_titan_1_4000000 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02004454 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200E,
4455 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozyckif771a342021-06-10 20:38:59 +02004456 pbn_titan_2_4000000 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02004457 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400E,
4458 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozyckif771a342021-06-10 20:38:59 +02004459 pbn_titan_4_4000000 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02004460 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800E,
4461 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozyckif771a342021-06-10 20:38:59 +02004462 pbn_titan_8_4000000 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02004463 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EI,
4464 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozyckif771a342021-06-10 20:38:59 +02004465 pbn_titan_2_4000000 },
Yegor Yefremov66169ad2010-06-04 09:58:18 +02004466 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EISI,
4467 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Maciej W. Rozyckif771a342021-06-10 20:38:59 +02004468 pbn_titan_2_4000000 },
Yegor Yefremov48c02472013-12-09 12:11:15 +01004469 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200V3,
4470 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4471 pbn_b0_bt_2_921600 },
Yegor Yefremov1e9deb12011-12-27 15:47:37 +01004472 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400V3,
4473 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4474 pbn_b0_4_921600 },
4475 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_410V3,
4476 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4477 pbn_b0_4_921600 },
4478 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800V3,
4479 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4480 pbn_b0_4_921600 },
4481 { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800V3B,
4482 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4483 pbn_b0_4_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004484
4485 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550,
4486 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4487 pbn_b2_1_460800 },
4488 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_650,
4489 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4490 pbn_b2_1_460800 },
4491 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_850,
4492 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4493 pbn_b2_1_460800 },
4494 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_550,
4495 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4496 pbn_b2_bt_2_921600 },
4497 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_650,
4498 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4499 pbn_b2_bt_2_921600 },
4500 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_850,
4501 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4502 pbn_b2_bt_2_921600 },
4503 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_550,
4504 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4505 pbn_b2_bt_4_921600 },
4506 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_650,
4507 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4508 pbn_b2_bt_4_921600 },
4509 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_850,
4510 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4511 pbn_b2_bt_4_921600 },
4512 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_550,
4513 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4514 pbn_b0_1_921600 },
4515 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_650,
4516 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4517 pbn_b0_1_921600 },
4518 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_850,
4519 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4520 pbn_b0_1_921600 },
4521 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_550,
4522 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4523 pbn_b0_bt_2_921600 },
4524 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_650,
4525 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4526 pbn_b0_bt_2_921600 },
4527 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_850,
4528 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4529 pbn_b0_bt_2_921600 },
4530 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_550,
4531 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4532 pbn_b0_bt_4_921600 },
4533 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_650,
4534 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4535 pbn_b0_bt_4_921600 },
4536 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850,
4537 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4538 pbn_b0_bt_4_921600 },
Andrey Panin3ec9c592006-02-02 20:15:09 +00004539 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_550,
4540 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4541 pbn_b0_bt_8_921600 },
4542 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_650,
4543 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4544 pbn_b0_bt_8_921600 },
4545 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_850,
4546 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4547 pbn_b0_bt_8_921600 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004548
4549 /*
4550 * Computone devices submitted by Doug McNash dmcnash@computone.com
4551 */
4552 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
4553 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG4,
4554 0, 0, pbn_computone_4 },
4555 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
4556 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG8,
4557 0, 0, pbn_computone_8 },
4558 { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
4559 PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG6,
4560 0, 0, pbn_computone_6 },
4561
4562 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI95N,
4563 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4564 pbn_oxsemi },
4565 { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
4566 PCI_VENDOR_ID_TIMEDIA, PCI_ANY_ID, 0, 0,
4567 pbn_b0_bt_1_921600 },
4568
4569 /*
Kai-Heng Feng8515dbc2019-08-10 03:01:29 +08004570 * Sunix PCI serial boards
Stephen Chiversabd7bac2013-01-28 19:49:20 +11004571 */
4572 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
Kai-Heng Feng8515dbc2019-08-10 03:01:29 +08004573 PCI_VENDOR_ID_SUNIX, 0x0001, 0, 0,
4574 pbn_sunix_pci_1s },
Stephen Chiversabd7bac2013-01-28 19:49:20 +11004575 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
Kai-Heng Feng8515dbc2019-08-10 03:01:29 +08004576 PCI_VENDOR_ID_SUNIX, 0x0002, 0, 0,
4577 pbn_sunix_pci_2s },
4578 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
4579 PCI_VENDOR_ID_SUNIX, 0x0004, 0, 0,
4580 pbn_sunix_pci_4s },
4581 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
4582 PCI_VENDOR_ID_SUNIX, 0x0084, 0, 0,
4583 pbn_sunix_pci_4s },
4584 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
4585 PCI_VENDOR_ID_SUNIX, 0x0008, 0, 0,
4586 pbn_sunix_pci_8s },
4587 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
4588 PCI_VENDOR_ID_SUNIX, 0x0088, 0, 0,
4589 pbn_sunix_pci_8s },
4590 { PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
4591 PCI_VENDOR_ID_SUNIX, 0x0010, 0, 0,
4592 pbn_sunix_pci_16s },
Stephen Chiversabd7bac2013-01-28 19:49:20 +11004593
4594 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07004595 * AFAVLAB serial card, from Harald Welte <laforge@gnumonks.org>
4596 */
4597 { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P028,
4598 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4599 pbn_b0_bt_8_115200 },
4600 { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P030,
4601 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4602 pbn_b0_bt_8_115200 },
4603
4604 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_DSERIAL,
4605 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4606 pbn_b0_bt_2_115200 },
4607 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_A,
4608 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4609 pbn_b0_bt_2_115200 },
4610 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B,
4611 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4612 pbn_b0_bt_2_115200 },
Lennert Buytenhekb87e5e22009-11-11 14:26:42 -08004613 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_A,
4614 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4615 pbn_b0_bt_2_115200 },
4616 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_B,
4617 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4618 pbn_b0_bt_2_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004619 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A,
4620 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4621 pbn_b0_bt_4_460800 },
4622 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_B,
4623 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4624 pbn_b0_bt_4_460800 },
4625 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_PLUS,
4626 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4627 pbn_b0_bt_2_460800 },
4628 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_A,
4629 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4630 pbn_b0_bt_2_460800 },
4631 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_B,
4632 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4633 pbn_b0_bt_2_460800 },
4634 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_SSERIAL,
4635 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4636 pbn_b0_bt_1_115200 },
4637 { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_650,
4638 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4639 pbn_b0_bt_1_460800 },
4640
4641 /*
Russell King1fb8cac2006-12-13 14:45:46 +00004642 * Korenix Jetcard F0/F1 cards (JC1204, JC1208, JC1404, JC1408).
4643 * Cards are identified by their subsystem vendor IDs, which
4644 * (in hex) match the model number.
4645 *
4646 * Note that JC140x are RS422/485 cards which require ox950
4647 * ACR = 0x10, and as such are not currently fully supported.
4648 */
4649 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
4650 0x1204, 0x0004, 0, 0,
4651 pbn_b0_4_921600 },
4652 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
4653 0x1208, 0x0004, 0, 0,
4654 pbn_b0_4_921600 },
4655/* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
4656 0x1402, 0x0002, 0, 0,
4657 pbn_b0_2_921600 }, */
4658/* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
4659 0x1404, 0x0004, 0, 0,
4660 pbn_b0_4_921600 }, */
4661 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF1,
4662 0x1208, 0x0004, 0, 0,
4663 pbn_b0_4_921600 },
4664
Kiros Yeh2a52fcb2009-12-21 16:26:48 -08004665 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2,
4666 0x1204, 0x0004, 0, 0,
4667 pbn_b0_4_921600 },
4668 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2,
4669 0x1208, 0x0004, 0, 0,
4670 pbn_b0_4_921600 },
4671 { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF3,
4672 0x1208, 0x0004, 0, 0,
4673 pbn_b0_4_921600 },
Russell King1fb8cac2006-12-13 14:45:46 +00004674 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07004675 * Dell Remote Access Card 4 - Tim_T_Murphy@Dell.com
4676 */
4677 { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RAC4,
4678 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4679 pbn_b1_1_1382400 },
4680
4681 /*
4682 * Dell Remote Access Card III - Tim_T_Murphy@Dell.com
4683 */
4684 { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RACIII,
4685 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4686 pbn_b1_1_1382400 },
4687
4688 /*
4689 * RAStel 2 port modem, gerg@moreton.com.au
4690 */
4691 { PCI_VENDOR_ID_MORETON, PCI_DEVICE_ID_RASTEL_2PORT,
4692 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4693 pbn_b2_bt_2_115200 },
4694
4695 /*
4696 * EKF addition for i960 Boards form EKF with serial port
4697 */
4698 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80960_RP,
4699 0xE4BF, PCI_ANY_ID, 0, 0,
4700 pbn_intel_i960 },
4701
4702 /*
4703 * Xircom Cardbus/Ethernet combos
4704 */
4705 { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_X3201_MDM,
4706 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4707 pbn_b0_1_115200 },
4708 /*
4709 * Xircom RBM56G cardbus modem - Dirk Arnold (temp entry)
4710 */
4711 { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_RBM56G,
4712 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4713 pbn_b0_1_115200 },
4714
4715 /*
4716 * Untested PCI modems, sent in from various folks...
4717 */
4718
4719 /*
4720 * Elsa Model 56K PCI Modem, from Andreas Rath <arh@01019freenet.de>
4721 */
4722 { PCI_VENDOR_ID_ROCKWELL, 0x1004,
4723 0x1048, 0x1500, 0, 0,
4724 pbn_b1_1_115200 },
4725
4726 { PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
4727 0xFF00, 0, 0, 0,
4728 pbn_sgi_ioc3 },
4729
4730 /*
4731 * HP Diva card
4732 */
4733 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
4734 PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_RMP3, 0, 0,
4735 pbn_b1_1_115200 },
4736 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
4737 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4738 pbn_b0_5_115200 },
4739 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
4740 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4741 pbn_b2_1_115200 },
Randy Wrighte0e24202021-05-14 10:26:54 -06004742 /* HPE PCI serial device */
4743 { PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL,
4744 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4745 pbn_b1_1_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004746
Alon Bar-Levd9004eb2006-01-18 11:47:33 +00004747 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,
4748 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4749 pbn_b3_2_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004750 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM4,
4751 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4752 pbn_b3_4_115200 },
4753 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM8,
4754 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4755 pbn_b3_8_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004756 /*
4757 * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke)
4758 */
4759 { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560,
4760 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4761 pbn_b0_1_115200 },
Niels de Vos84f8c6f2007-08-22 14:01:14 -07004762 /*
4763 * ITE
4764 */
4765 { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
4766 PCI_ANY_ID, PCI_ANY_ID,
4767 0, 0,
4768 pbn_b1_bt_1_115200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07004769
4770 /*
Peter Horton737c1752006-08-26 09:07:36 +01004771 * IntaShield IS-200
4772 */
4773 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200,
4774 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */
4775 pbn_b2_2_115200 },
Ignacio García Pérez4b6f6ce2008-05-23 13:04:28 -07004776 /*
4777 * IntaShield IS-400
4778 */
4779 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
4780 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
4781 pbn_b2_4_115200 },
Peter Horton737c1752006-08-26 09:07:36 +01004782 /*
Nikola Ciprich9f2068f2018-02-13 15:04:46 +01004783 * BrainBoxes UC-260
4784 */
4785 { PCI_VENDOR_ID_INTASHIELD, 0x0D21,
4786 PCI_ANY_ID, PCI_ANY_ID,
4787 PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00,
4788 pbn_b2_4_115200 },
4789 { PCI_VENDOR_ID_INTASHIELD, 0x0E34,
4790 PCI_ANY_ID, PCI_ANY_ID,
4791 PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00,
4792 pbn_b2_4_115200 },
4793 /*
Thomas Hoehn48212002007-02-10 01:46:05 -08004794 * Perle PCI-RAS cards
4795 */
4796 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
4797 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS4,
4798 0, 0, pbn_b2_4_921600 },
4799 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
4800 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8,
4801 0, 0, pbn_b2_8_921600 },
Alan Coxbf0df632007-10-16 01:24:00 -07004802
4803 /*
4804 * Mainpine series cards: Fairly standard layout but fools
4805 * parts of the autodetect in some cases and uses otherwise
4806 * unmatched communications subclasses in the PCI Express case
4807 */
4808
4809 { /* RockForceDUO */
4810 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4811 PCI_VENDOR_ID_MAINPINE, 0x0200,
4812 0, 0, pbn_b0_2_115200 },
4813 { /* RockForceQUATRO */
4814 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4815 PCI_VENDOR_ID_MAINPINE, 0x0300,
4816 0, 0, pbn_b0_4_115200 },
4817 { /* RockForceDUO+ */
4818 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4819 PCI_VENDOR_ID_MAINPINE, 0x0400,
4820 0, 0, pbn_b0_2_115200 },
4821 { /* RockForceQUATRO+ */
4822 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4823 PCI_VENDOR_ID_MAINPINE, 0x0500,
4824 0, 0, pbn_b0_4_115200 },
4825 { /* RockForce+ */
4826 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4827 PCI_VENDOR_ID_MAINPINE, 0x0600,
4828 0, 0, pbn_b0_2_115200 },
4829 { /* RockForce+ */
4830 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4831 PCI_VENDOR_ID_MAINPINE, 0x0700,
4832 0, 0, pbn_b0_4_115200 },
4833 { /* RockForceOCTO+ */
4834 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4835 PCI_VENDOR_ID_MAINPINE, 0x0800,
4836 0, 0, pbn_b0_8_115200 },
4837 { /* RockForceDUO+ */
4838 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4839 PCI_VENDOR_ID_MAINPINE, 0x0C00,
4840 0, 0, pbn_b0_2_115200 },
4841 { /* RockForceQUARTRO+ */
4842 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4843 PCI_VENDOR_ID_MAINPINE, 0x0D00,
4844 0, 0, pbn_b0_4_115200 },
4845 { /* RockForceOCTO+ */
4846 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4847 PCI_VENDOR_ID_MAINPINE, 0x1D00,
4848 0, 0, pbn_b0_8_115200 },
4849 { /* RockForceD1 */
4850 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4851 PCI_VENDOR_ID_MAINPINE, 0x2000,
4852 0, 0, pbn_b0_1_115200 },
4853 { /* RockForceF1 */
4854 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4855 PCI_VENDOR_ID_MAINPINE, 0x2100,
4856 0, 0, pbn_b0_1_115200 },
4857 { /* RockForceD2 */
4858 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4859 PCI_VENDOR_ID_MAINPINE, 0x2200,
4860 0, 0, pbn_b0_2_115200 },
4861 { /* RockForceF2 */
4862 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4863 PCI_VENDOR_ID_MAINPINE, 0x2300,
4864 0, 0, pbn_b0_2_115200 },
4865 { /* RockForceD4 */
4866 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4867 PCI_VENDOR_ID_MAINPINE, 0x2400,
4868 0, 0, pbn_b0_4_115200 },
4869 { /* RockForceF4 */
4870 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4871 PCI_VENDOR_ID_MAINPINE, 0x2500,
4872 0, 0, pbn_b0_4_115200 },
4873 { /* RockForceD8 */
4874 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4875 PCI_VENDOR_ID_MAINPINE, 0x2600,
4876 0, 0, pbn_b0_8_115200 },
4877 { /* RockForceF8 */
4878 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4879 PCI_VENDOR_ID_MAINPINE, 0x2700,
4880 0, 0, pbn_b0_8_115200 },
4881 { /* IQ Express D1 */
4882 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4883 PCI_VENDOR_ID_MAINPINE, 0x3000,
4884 0, 0, pbn_b0_1_115200 },
4885 { /* IQ Express F1 */
4886 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4887 PCI_VENDOR_ID_MAINPINE, 0x3100,
4888 0, 0, pbn_b0_1_115200 },
4889 { /* IQ Express D2 */
4890 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4891 PCI_VENDOR_ID_MAINPINE, 0x3200,
4892 0, 0, pbn_b0_2_115200 },
4893 { /* IQ Express F2 */
4894 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4895 PCI_VENDOR_ID_MAINPINE, 0x3300,
4896 0, 0, pbn_b0_2_115200 },
4897 { /* IQ Express D4 */
4898 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4899 PCI_VENDOR_ID_MAINPINE, 0x3400,
4900 0, 0, pbn_b0_4_115200 },
4901 { /* IQ Express F4 */
4902 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4903 PCI_VENDOR_ID_MAINPINE, 0x3500,
4904 0, 0, pbn_b0_4_115200 },
4905 { /* IQ Express D8 */
4906 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4907 PCI_VENDOR_ID_MAINPINE, 0x3C00,
4908 0, 0, pbn_b0_8_115200 },
4909 { /* IQ Express F8 */
4910 PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
4911 PCI_VENDOR_ID_MAINPINE, 0x3D00,
4912 0, 0, pbn_b0_8_115200 },
4913
4914
Thomas Hoehn48212002007-02-10 01:46:05 -08004915 /*
Olof Johanssonaa798502007-08-22 14:01:55 -07004916 * PA Semi PA6T-1682M on-chip UART
4917 */
4918 { PCI_VENDOR_ID_PASEMI, 0xa004,
4919 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4920 pbn_pasemi_1682M },
4921
4922 /*
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01004923 * National Instruments
4924 */
Will Page04bf7e72009-04-06 17:32:15 +01004925 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI23216,
4926 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4927 pbn_b1_16_115200 },
4928 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2328,
4929 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4930 pbn_b1_8_115200 },
4931 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2324,
4932 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4933 pbn_b1_bt_4_115200 },
4934 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2322,
4935 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4936 pbn_b1_bt_2_115200 },
4937 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2324I,
4938 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4939 pbn_b1_bt_4_115200 },
4940 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI2322I,
4941 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4942 pbn_b1_bt_2_115200 },
4943 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_23216,
4944 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4945 pbn_b1_16_115200 },
4946 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2328,
4947 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4948 pbn_b1_8_115200 },
4949 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2324,
4950 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4951 pbn_b1_bt_4_115200 },
4952 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8420_2322,
4953 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4954 pbn_b1_bt_2_115200 },
4955 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8422_2324,
4956 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4957 pbn_b1_bt_4_115200 },
4958 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8422_2322,
4959 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4960 pbn_b1_bt_2_115200 },
Shawn Bohrer46a0fac2009-04-06 17:32:07 +01004961 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2322,
4962 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4963 pbn_ni8430_2 },
4964 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2322,
4965 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4966 pbn_ni8430_2 },
4967 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2324,
4968 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4969 pbn_ni8430_4 },
4970 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2324,
4971 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4972 pbn_ni8430_4 },
4973 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_2328,
4974 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4975 pbn_ni8430_8 },
4976 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_2328,
4977 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4978 pbn_ni8430_8 },
4979 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8430_23216,
4980 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4981 pbn_ni8430_16 },
4982 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8430_23216,
4983 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4984 pbn_ni8430_16 },
4985 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8432_2322,
4986 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4987 pbn_ni8430_2 },
4988 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8432_2322,
4989 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4990 pbn_ni8430_2 },
4991 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI8432_2324,
4992 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4993 pbn_ni8430_4 },
4994 { PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI8432_2324,
4995 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4996 pbn_ni8430_4 },
4997
4998 /*
Kai-Heng Fengd193db72019-08-17 00:51:24 +08004999 * MOXA
5000 */
5001 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102E,
5002 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5003 pbn_moxa8250_2p },
5004 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102EL,
5005 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5006 pbn_moxa8250_2p },
5007 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104EL_A,
5008 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5009 pbn_moxa8250_4p },
5010 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP114EL,
5011 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5012 pbn_moxa8250_4p },
5013 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_A,
5014 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5015 pbn_moxa8250_8p },
5016 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_B,
5017 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5018 pbn_moxa8250_8p },
5019 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118EL_A,
5020 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5021 pbn_moxa8250_8p },
5022 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118E_A_I,
5023 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5024 pbn_moxa8250_8p },
5025 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132EL,
5026 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5027 pbn_moxa8250_2p },
5028 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP134EL_A,
5029 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5030 pbn_moxa8250_4p },
5031 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP138E_A,
5032 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5033 pbn_moxa8250_8p },
5034 { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168EL_A,
5035 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5036 pbn_moxa8250_8p },
5037
5038 /*
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08005039 * ADDI-DATA GmbH communication cards <info@addi-data.com>
5040 */
5041 { PCI_VENDOR_ID_ADDIDATA,
5042 PCI_DEVICE_ID_ADDIDATA_APCI7500,
5043 PCI_ANY_ID,
5044 PCI_ANY_ID,
5045 0,
5046 0,
5047 pbn_b0_4_115200 },
5048
5049 { PCI_VENDOR_ID_ADDIDATA,
5050 PCI_DEVICE_ID_ADDIDATA_APCI7420,
5051 PCI_ANY_ID,
5052 PCI_ANY_ID,
5053 0,
5054 0,
5055 pbn_b0_2_115200 },
5056
5057 { PCI_VENDOR_ID_ADDIDATA,
5058 PCI_DEVICE_ID_ADDIDATA_APCI7300,
5059 PCI_ANY_ID,
5060 PCI_ANY_ID,
5061 0,
5062 0,
5063 pbn_b0_1_115200 },
5064
Ian Abbott086231f2013-07-16 16:14:39 +01005065 { PCI_VENDOR_ID_AMCC,
Ian Abbott57c1f0e2013-07-16 16:14:40 +01005066 PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800,
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08005067 PCI_ANY_ID,
5068 PCI_ANY_ID,
5069 0,
5070 0,
5071 pbn_b1_8_115200 },
5072
5073 { PCI_VENDOR_ID_ADDIDATA,
5074 PCI_DEVICE_ID_ADDIDATA_APCI7500_2,
5075 PCI_ANY_ID,
5076 PCI_ANY_ID,
5077 0,
5078 0,
5079 pbn_b0_4_115200 },
5080
5081 { PCI_VENDOR_ID_ADDIDATA,
5082 PCI_DEVICE_ID_ADDIDATA_APCI7420_2,
5083 PCI_ANY_ID,
5084 PCI_ANY_ID,
5085 0,
5086 0,
5087 pbn_b0_2_115200 },
5088
5089 { PCI_VENDOR_ID_ADDIDATA,
5090 PCI_DEVICE_ID_ADDIDATA_APCI7300_2,
5091 PCI_ANY_ID,
5092 PCI_ANY_ID,
5093 0,
5094 0,
5095 pbn_b0_1_115200 },
5096
5097 { PCI_VENDOR_ID_ADDIDATA,
5098 PCI_DEVICE_ID_ADDIDATA_APCI7500_3,
5099 PCI_ANY_ID,
5100 PCI_ANY_ID,
5101 0,
5102 0,
5103 pbn_b0_4_115200 },
5104
5105 { PCI_VENDOR_ID_ADDIDATA,
5106 PCI_DEVICE_ID_ADDIDATA_APCI7420_3,
5107 PCI_ANY_ID,
5108 PCI_ANY_ID,
5109 0,
5110 0,
5111 pbn_b0_2_115200 },
5112
5113 { PCI_VENDOR_ID_ADDIDATA,
5114 PCI_DEVICE_ID_ADDIDATA_APCI7300_3,
5115 PCI_ANY_ID,
5116 PCI_ANY_ID,
5117 0,
5118 0,
5119 pbn_b0_1_115200 },
5120
5121 { PCI_VENDOR_ID_ADDIDATA,
5122 PCI_DEVICE_ID_ADDIDATA_APCI7800_3,
5123 PCI_ANY_ID,
5124 PCI_ANY_ID,
5125 0,
5126 0,
5127 pbn_b0_8_115200 },
5128
Krauth.Julien1b62cbf2009-10-26 16:50:04 -07005129 { PCI_VENDOR_ID_ADDIDATA,
5130 PCI_DEVICE_ID_ADDIDATA_APCIe7500,
5131 PCI_ANY_ID,
5132 PCI_ANY_ID,
5133 0,
5134 0,
5135 pbn_ADDIDATA_PCIe_4_3906250 },
5136
5137 { PCI_VENDOR_ID_ADDIDATA,
5138 PCI_DEVICE_ID_ADDIDATA_APCIe7420,
5139 PCI_ANY_ID,
5140 PCI_ANY_ID,
5141 0,
5142 0,
5143 pbn_ADDIDATA_PCIe_2_3906250 },
5144
5145 { PCI_VENDOR_ID_ADDIDATA,
5146 PCI_DEVICE_ID_ADDIDATA_APCIe7300,
5147 PCI_ANY_ID,
5148 PCI_ANY_ID,
5149 0,
5150 0,
5151 pbn_ADDIDATA_PCIe_1_3906250 },
5152
5153 { PCI_VENDOR_ID_ADDIDATA,
5154 PCI_DEVICE_ID_ADDIDATA_APCIe7800,
5155 PCI_ANY_ID,
5156 PCI_ANY_ID,
5157 0,
5158 0,
5159 pbn_ADDIDATA_PCIe_8_3906250 },
5160
Jiri Slaby25cf9bc2009-01-15 13:30:34 +00005161 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
5162 PCI_VENDOR_ID_IBM, 0x0299,
5163 0, 0, pbn_b0_bt_2_115200 },
5164
Stefan Seyfried972ce082013-07-01 09:14:21 +02005165 /*
5166 * other NetMos 9835 devices are most likely handled by the
5167 * parport_serial driver, check drivers/parport/parport_serial.c
5168 * before adding them here.
5169 */
5170
Michael Bueschc4285b42009-06-30 11:41:21 -07005171 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901,
5172 0xA000, 0x1000,
5173 0, 0, pbn_b0_1_115200 },
5174
Nicos Gollan7808edc2011-05-05 21:00:37 +02005175 /* the 9901 is a rebranded 9912 */
5176 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
5177 0xA000, 0x1000,
5178 0, 0, pbn_b0_1_115200 },
5179
5180 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
5181 0xA000, 0x1000,
5182 0, 0, pbn_b0_1_115200 },
5183
5184 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9904,
5185 0xA000, 0x1000,
5186 0, 0, pbn_b0_1_115200 },
5187
5188 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
5189 0xA000, 0x1000,
5190 0, 0, pbn_b0_1_115200 },
5191
5192 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
5193 0xA000, 0x3002,
5194 0, 0, pbn_NETMOS9900_2s_115200 },
5195
Krauth.Julien02c9b5c2008-02-04 22:27:49 -08005196 /*
Eric Smith44178172011-07-11 22:53:13 -06005197 * Best Connectivity and Rosewill PCI Multi I/O cards
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08005198 */
5199
5200 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
5201 0xA000, 0x1000,
5202 0, 0, pbn_b0_1_115200 },
5203
5204 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
Eric Smith44178172011-07-11 22:53:13 -06005205 0xA000, 0x3002,
5206 0, 0, pbn_b0_bt_2_115200 },
5207
5208 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08005209 0xA000, 0x3004,
5210 0, 0, pbn_b0_bt_4_115200 },
Dirk Brandewie095e24b2010-11-17 07:35:20 -08005211 /* Intel CE4100 */
5212 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
5213 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5214 pbn_ce4100_1_115200 },
Mika Westerberg6c55d9b2016-01-29 16:49:47 +02005215
Antony Pavlovd9a0fbf2011-05-18 22:38:30 +04005216 /*
5217 * Cronyx Omega PCI
5218 */
5219 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
5220 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5221 pbn_omegapci },
Ira W. Snyderac6ec5b2009-12-21 16:26:45 -08005222
5223 /*
Stephen Hurdebebd492013-01-17 14:14:53 -08005224 * Broadcom TruManage
5225 */
5226 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BROADCOM_TRUMANAGE,
5227 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5228 pbn_brcm_trumanage },
5229
5230 /*
Alan Cox66835492012-08-16 12:01:33 +01005231 * AgeStar as-prs2-009
5232 */
5233 { PCI_VENDOR_ID_AGESTAR, PCI_DEVICE_ID_AGESTAR_9375,
5234 PCI_ANY_ID, PCI_ANY_ID,
5235 0, 0, pbn_b0_bt_2_115200 },
Alan Cox27788c52012-09-04 16:21:06 +01005236
5237 /*
5238 * WCH CH353 series devices: The 2S1P is handled by parport_serial
5239 * so not listed here.
5240 */
5241 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH353_4S,
5242 PCI_ANY_ID, PCI_ANY_ID,
5243 0, 0, pbn_b0_bt_4_115200 },
5244
5245 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH353_2S1PF,
5246 PCI_ANY_ID, PCI_ANY_ID,
5247 0, 0, pbn_b0_bt_2_115200 },
5248
Alexandr Petrenko55c368c2016-05-23 10:04:54 +03005249 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH355_4S,
5250 PCI_ANY_ID, PCI_ANY_ID,
5251 0, 0, pbn_b0_bt_4_115200 },
5252
Jeremy McNicoll7dde5572016-02-02 13:00:45 -08005253 { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH382_2S,
5254 PCI_ANY_ID, PCI_ANY_ID,
5255 0, 0, pbn_wch382_2 },
5256
Sergej Pupykin72a3c0e2014-12-30 16:16:50 +03005257 { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S,
5258 PCI_ANY_ID, PCI_ANY_ID,
5259 0, 0, pbn_wch384_4 },
5260
Du Huanpeng04b6ff52020-08-22 09:47:28 +08005261 { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_8S,
5262 PCI_ANY_ID, PCI_ANY_ID,
5263 0, 0, pbn_wch384_8 },
Tobias Diedrich3c5a87b2020-09-14 19:36:28 +02005264 /*
5265 * Realtek RealManage
5266 */
5267 { PCI_VENDOR_ID_REALTEK, 0x816a,
5268 PCI_ANY_ID, PCI_ANY_ID,
5269 0, 0, pbn_b0_1_115200 },
5270
5271 { PCI_VENDOR_ID_REALTEK, 0x816b,
5272 PCI_ANY_ID, PCI_ANY_ID,
5273 0, 0, pbn_b0_1_115200 },
Du Huanpeng04b6ff52020-08-22 09:47:28 +08005274
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07005275 /* Fintek PCI serial cards */
5276 { PCI_DEVICE(0x1c29, 0x1104), .driver_data = pbn_fintek_4 },
5277 { PCI_DEVICE(0x1c29, 0x1108), .driver_data = pbn_fintek_8 },
5278 { PCI_DEVICE(0x1c29, 0x1112), .driver_data = pbn_fintek_12 },
Ji-Ze Hong (Peter Hong)68e26a82019-08-16 13:27:29 +08005279 { PCI_DEVICE(0x1c29, 0x1204), .driver_data = pbn_fintek_F81504A },
5280 { PCI_DEVICE(0x1c29, 0x1208), .driver_data = pbn_fintek_F81508A },
5281 { PCI_DEVICE(0x1c29, 0x1212), .driver_data = pbn_fintek_F81512A },
Greg Kroah-Hartman2c62a3c2013-10-17 10:44:26 -07005282
Ian Abbott1c9c8582017-02-03 20:25:00 +00005283 /* MKS Tenta SCOM-080x serial cards */
5284 { PCI_DEVICE(0x1601, 0x0800), .driver_data = pbn_b0_4_1250000 },
5285 { PCI_DEVICE(0x1601, 0xa801), .driver_data = pbn_b0_4_1250000 },
5286
Matt Wilson3bfd1302017-11-13 11:31:31 -08005287 /* Amazon PCI serial device */
5288 { PCI_DEVICE(0x1d0f, 0x8250), .driver_data = pbn_b0_1_115200 },
5289
Matt Schulte14faa8c2012-11-21 10:35:15 -06005290 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -07005291 * These entries match devices with class COMMUNICATION_SERIAL,
5292 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
5293 */
5294 { PCI_ANY_ID, PCI_ANY_ID,
5295 PCI_ANY_ID, PCI_ANY_ID,
5296 PCI_CLASS_COMMUNICATION_SERIAL << 8,
5297 0xffff00, pbn_default },
5298 { PCI_ANY_ID, PCI_ANY_ID,
5299 PCI_ANY_ID, PCI_ANY_ID,
5300 PCI_CLASS_COMMUNICATION_MODEM << 8,
5301 0xffff00, pbn_default },
5302 { PCI_ANY_ID, PCI_ANY_ID,
5303 PCI_ANY_ID, PCI_ANY_ID,
5304 PCI_CLASS_COMMUNICATION_MULTISERIAL << 8,
5305 0xffff00, pbn_default },
5306 { 0, }
5307};
5308
Michael Reed28071902011-05-31 12:06:28 -05005309static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
5310 pci_channel_state_t state)
5311{
5312 struct serial_private *priv = pci_get_drvdata(dev);
5313
5314 if (state == pci_channel_io_perm_failure)
5315 return PCI_ERS_RESULT_DISCONNECT;
5316
5317 if (priv)
Gabriel Krisman Bertazif209fa02016-11-28 19:34:42 -02005318 pciserial_detach_ports(priv);
Michael Reed28071902011-05-31 12:06:28 -05005319
5320 pci_disable_device(dev);
5321
5322 return PCI_ERS_RESULT_NEED_RESET;
5323}
5324
5325static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
5326{
5327 int rc;
5328
5329 rc = pci_enable_device(dev);
5330
5331 if (rc)
5332 return PCI_ERS_RESULT_DISCONNECT;
5333
5334 pci_restore_state(dev);
5335 pci_save_state(dev);
5336
5337 return PCI_ERS_RESULT_RECOVERED;
5338}
5339
5340static void serial8250_io_resume(struct pci_dev *dev)
5341{
5342 struct serial_private *priv = pci_get_drvdata(dev);
Gabriel Krisman Bertazic130b662016-12-28 16:42:00 -02005343 struct serial_private *new;
Michael Reed28071902011-05-31 12:06:28 -05005344
Gabriel Krisman Bertazif209fa02016-11-28 19:34:42 -02005345 if (!priv)
5346 return;
5347
Gabriel Krisman Bertazic130b662016-12-28 16:42:00 -02005348 new = pciserial_init_ports(dev, priv->board);
5349 if (!IS_ERR(new)) {
5350 pci_set_drvdata(dev, new);
5351 kfree(priv);
Gabriel Krisman Bertazif209fa02016-11-28 19:34:42 -02005352 }
Michael Reed28071902011-05-31 12:06:28 -05005353}
5354
Stephen Hemminger1d352032012-09-07 09:33:17 -07005355static const struct pci_error_handlers serial8250_err_handler = {
Michael Reed28071902011-05-31 12:06:28 -05005356 .error_detected = serial8250_io_error_detected,
5357 .slot_reset = serial8250_io_slot_reset,
5358 .resume = serial8250_io_resume,
5359};
5360
Linus Torvalds1da177e2005-04-16 15:20:36 -07005361static struct pci_driver serial_pci_driver = {
5362 .name = "serial",
5363 .probe = pciserial_init_one,
Bill Pemberton2d47b712012-11-19 13:21:34 -05005364 .remove = pciserial_remove_one,
Andy Shevchenko61702c32015-02-02 14:53:26 +02005365 .driver = {
5366 .pm = &pciserial_pm_ops,
5367 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07005368 .id_table = serial_pci_tbl,
Michael Reed28071902011-05-31 12:06:28 -05005369 .err_handler = &serial8250_err_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07005370};
5371
Wei Yongjun15a12e82012-10-26 23:04:22 +08005372module_pci_driver(serial_pci_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -07005373
5374MODULE_LICENSE("GPL");
5375MODULE_DESCRIPTION("Generic 8250/16x50 PCI serial probe module");
5376MODULE_DEVICE_TABLE(pci, serial_pci_tbl);