xref: /linux/drivers/tty/serial/8250/8250_exar.c (revision 413058df4331ce29f9934a5870d582c7e71fe15f)
1d0aeaa83SSudip Mukherjee /*
2d0aeaa83SSudip Mukherjee  *  Probe module for 8250/16550-type Exar chips PCI serial ports.
3d0aeaa83SSudip Mukherjee  *
4d0aeaa83SSudip Mukherjee  *  Based on drivers/tty/serial/8250/8250_pci.c,
5d0aeaa83SSudip Mukherjee  *
6d0aeaa83SSudip Mukherjee  *  Copyright (C) 2017 Sudip Mukherjee, All Rights Reserved.
7d0aeaa83SSudip Mukherjee  *
8d0aeaa83SSudip Mukherjee  * This program is free software; you can redistribute it and/or modify
9d0aeaa83SSudip Mukherjee  * it under the terms of the GNU General Public License as published by
10d0aeaa83SSudip Mukherjee  * the Free Software Foundation; either version 2 of the License.
11d0aeaa83SSudip Mukherjee  */
124076cf08SJan Kiszka #include <linux/acpi.h>
13*413058dfSJan Kiszka #include <linux/dmi.h>
14d0aeaa83SSudip Mukherjee #include <linux/io.h>
15d0aeaa83SSudip Mukherjee #include <linux/kernel.h>
16d0aeaa83SSudip Mukherjee #include <linux/module.h>
17d0aeaa83SSudip Mukherjee #include <linux/pci.h>
18380b1e2fSJan Kiszka #include <linux/property.h>
19d0aeaa83SSudip Mukherjee #include <linux/serial_core.h>
20d0aeaa83SSudip Mukherjee #include <linux/serial_reg.h>
21d0aeaa83SSudip Mukherjee #include <linux/slab.h>
22d0aeaa83SSudip Mukherjee #include <linux/string.h>
23d0aeaa83SSudip Mukherjee #include <linux/tty.h>
24d0aeaa83SSudip Mukherjee #include <linux/8250_pci.h>
25d0aeaa83SSudip Mukherjee 
26d0aeaa83SSudip Mukherjee #include <asm/byteorder.h>
27d0aeaa83SSudip Mukherjee 
28d0aeaa83SSudip Mukherjee #include "8250.h"
29d0aeaa83SSudip Mukherjee 
30fc6cc961SJan Kiszka #define PCI_DEVICE_ID_COMMTECH_4224PCI335	0x0002
31fc6cc961SJan Kiszka #define PCI_DEVICE_ID_COMMTECH_4222PCI335	0x0004
32fc6cc961SJan Kiszka #define PCI_DEVICE_ID_COMMTECH_2324PCI335	0x000a
33fc6cc961SJan Kiszka #define PCI_DEVICE_ID_COMMTECH_2328PCI335	0x000b
34d0aeaa83SSudip Mukherjee #define PCI_DEVICE_ID_COMMTECH_4224PCIE		0x0020
35d0aeaa83SSudip Mukherjee #define PCI_DEVICE_ID_COMMTECH_4228PCIE		0x0021
36d0aeaa83SSudip Mukherjee #define PCI_DEVICE_ID_COMMTECH_4222PCIE		0x0022
37d0aeaa83SSudip Mukherjee #define PCI_DEVICE_ID_EXAR_XR17V4358		0x4358
38d0aeaa83SSudip Mukherjee #define PCI_DEVICE_ID_EXAR_XR17V8358		0x8358
39d0aeaa83SSudip Mukherjee 
407e12357eSJan Kiszka #define UART_EXAR_8XMODE	0x88	/* 8X sampling rate select */
417e12357eSJan Kiszka 
427e12357eSJan Kiszka #define UART_EXAR_FCTR		0x08	/* Feature Control Register */
437e12357eSJan Kiszka #define UART_FCTR_EXAR_IRDA	0x10	/* IrDa data encode select */
447e12357eSJan Kiszka #define UART_FCTR_EXAR_485	0x20	/* Auto 485 half duplex dir ctl */
457e12357eSJan Kiszka #define UART_FCTR_EXAR_TRGA	0x00	/* FIFO trigger table A */
467e12357eSJan Kiszka #define UART_FCTR_EXAR_TRGB	0x60	/* FIFO trigger table B */
477e12357eSJan Kiszka #define UART_FCTR_EXAR_TRGC	0x80	/* FIFO trigger table C */
487e12357eSJan Kiszka #define UART_FCTR_EXAR_TRGD	0xc0	/* FIFO trigger table D programmable */
497e12357eSJan Kiszka 
507e12357eSJan Kiszka #define UART_EXAR_TXTRG		0x0a	/* Tx FIFO trigger level write-only */
517e12357eSJan Kiszka #define UART_EXAR_RXTRG		0x0b	/* Rx FIFO trigger level write-only */
527e12357eSJan Kiszka 
53d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOINT_7_0	0x8f	/* MPIOINT[7:0] */
54d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOLVL_7_0	0x90	/* MPIOLVL[7:0] */
55d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIO3T_7_0	0x91	/* MPIO3T[7:0] */
56d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOINV_7_0	0x92	/* MPIOINV[7:0] */
57d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOSEL_7_0	0x93	/* MPIOSEL[7:0] */
58d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOOD_7_0	0x94	/* MPIOOD[7:0] */
59d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOINT_15_8	0x95	/* MPIOINT[15:8] */
60d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOLVL_15_8	0x96	/* MPIOLVL[15:8] */
61d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIO3T_15_8	0x97	/* MPIO3T[15:8] */
62d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOINV_15_8	0x98	/* MPIOINV[15:8] */
63d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOSEL_15_8	0x99	/* MPIOSEL[15:8] */
64d0aeaa83SSudip Mukherjee #define UART_EXAR_MPIOOD_15_8	0x9a	/* MPIOOD[15:8] */
65d0aeaa83SSudip Mukherjee 
66*413058dfSJan Kiszka #define UART_EXAR_RS485_DLY(x)	((x) << 4)
67*413058dfSJan Kiszka 
68*413058dfSJan Kiszka /*
69*413058dfSJan Kiszka  * IOT2040 MPIO wiring semantics:
70*413058dfSJan Kiszka  *
71*413058dfSJan Kiszka  * MPIO		Port	Function
72*413058dfSJan Kiszka  * ----		----	--------
73*413058dfSJan Kiszka  * 0		2 	Mode bit 0
74*413058dfSJan Kiszka  * 1		2	Mode bit 1
75*413058dfSJan Kiszka  * 2		2	Terminate bus
76*413058dfSJan Kiszka  * 3		-	<reserved>
77*413058dfSJan Kiszka  * 4		3	Mode bit 0
78*413058dfSJan Kiszka  * 5		3	Mode bit 1
79*413058dfSJan Kiszka  * 6		3	Terminate bus
80*413058dfSJan Kiszka  * 7		-	<reserved>
81*413058dfSJan Kiszka  * 8		2	Enable
82*413058dfSJan Kiszka  * 9		3	Enable
83*413058dfSJan Kiszka  * 10		-	Red LED
84*413058dfSJan Kiszka  * 11..15	-	<unused>
85*413058dfSJan Kiszka  */
86*413058dfSJan Kiszka 
87*413058dfSJan Kiszka /* IOT2040 MPIOs 0..7 */
88*413058dfSJan Kiszka #define IOT2040_UART_MODE_RS232		0x01
89*413058dfSJan Kiszka #define IOT2040_UART_MODE_RS485		0x02
90*413058dfSJan Kiszka #define IOT2040_UART_MODE_RS422		0x03
91*413058dfSJan Kiszka #define IOT2040_UART_TERMINATE_BUS	0x04
92*413058dfSJan Kiszka 
93*413058dfSJan Kiszka #define IOT2040_UART1_MASK		0x0f
94*413058dfSJan Kiszka #define IOT2040_UART2_SHIFT		4
95*413058dfSJan Kiszka 
96*413058dfSJan Kiszka #define IOT2040_UARTS_DEFAULT_MODE	0x11	/* both RS232 */
97*413058dfSJan Kiszka #define IOT2040_UARTS_GPIO_LO_MODE	0x88	/* reserved pins as input */
98*413058dfSJan Kiszka 
99*413058dfSJan Kiszka /* IOT2040 MPIOs 8..15 */
100*413058dfSJan Kiszka #define IOT2040_UARTS_ENABLE		0x03
101*413058dfSJan Kiszka #define IOT2040_UARTS_GPIO_HI_MODE	0xF8	/* enable & LED as outputs */
102*413058dfSJan Kiszka 
103d0aeaa83SSudip Mukherjee struct exar8250;
104d0aeaa83SSudip Mukherjee 
1050d963ebfSJan Kiszka struct exar8250_platform {
1060d963ebfSJan Kiszka 	int (*rs485_config)(struct uart_port *, struct serial_rs485 *);
1070d963ebfSJan Kiszka 	int (*register_gpio)(struct pci_dev *, struct uart_8250_port *);
1080d963ebfSJan Kiszka };
1090d963ebfSJan Kiszka 
110d0aeaa83SSudip Mukherjee /**
111d0aeaa83SSudip Mukherjee  * struct exar8250_board - board information
112d0aeaa83SSudip Mukherjee  * @num_ports: number of serial ports
113d0aeaa83SSudip Mukherjee  * @reg_shift: describes UART register mapping in PCI memory
114d0aeaa83SSudip Mukherjee  */
115d0aeaa83SSudip Mukherjee struct exar8250_board {
116d0aeaa83SSudip Mukherjee 	unsigned int num_ports;
117d0aeaa83SSudip Mukherjee 	unsigned int reg_shift;
118d0aeaa83SSudip Mukherjee 	bool has_slave;
119d0aeaa83SSudip Mukherjee 	int	(*setup)(struct exar8250 *, struct pci_dev *,
120d0aeaa83SSudip Mukherjee 			 struct uart_8250_port *, int);
121d0aeaa83SSudip Mukherjee 	void	(*exit)(struct pci_dev *pcidev);
122d0aeaa83SSudip Mukherjee };
123d0aeaa83SSudip Mukherjee 
124d0aeaa83SSudip Mukherjee struct exar8250 {
125d0aeaa83SSudip Mukherjee 	unsigned int		nr;
126d0aeaa83SSudip Mukherjee 	struct exar8250_board	*board;
127d0aeaa83SSudip Mukherjee 	int			line[0];
128d0aeaa83SSudip Mukherjee };
129d0aeaa83SSudip Mukherjee 
130d0aeaa83SSudip Mukherjee static int default_setup(struct exar8250 *priv, struct pci_dev *pcidev,
131d0aeaa83SSudip Mukherjee 			 int idx, unsigned int offset,
132d0aeaa83SSudip Mukherjee 			 struct uart_8250_port *port)
133d0aeaa83SSudip Mukherjee {
134d0aeaa83SSudip Mukherjee 	const struct exar8250_board *board = priv->board;
135d0aeaa83SSudip Mukherjee 	unsigned int bar = 0;
136d0aeaa83SSudip Mukherjee 
13724572af4SJan Kiszka 	if (!pcim_iomap_table(pcidev)[bar] && !pcim_iomap(pcidev, bar, 0))
13824572af4SJan Kiszka 		return -ENOMEM;
13924572af4SJan Kiszka 
140d0aeaa83SSudip Mukherjee 	port->port.iotype = UPIO_MEM;
141d0aeaa83SSudip Mukherjee 	port->port.mapbase = pci_resource_start(pcidev, bar) + offset;
142d0aeaa83SSudip Mukherjee 	port->port.membase = pcim_iomap_table(pcidev)[bar] + offset;
143d0aeaa83SSudip Mukherjee 	port->port.regshift = board->reg_shift;
144d0aeaa83SSudip Mukherjee 
145d0aeaa83SSudip Mukherjee 	return 0;
146d0aeaa83SSudip Mukherjee }
147d0aeaa83SSudip Mukherjee 
148d0aeaa83SSudip Mukherjee static int
149fc6cc961SJan Kiszka pci_fastcom335_setup(struct exar8250 *priv, struct pci_dev *pcidev,
150fc6cc961SJan Kiszka 		     struct uart_8250_port *port, int idx)
151fc6cc961SJan Kiszka {
152fc6cc961SJan Kiszka 	unsigned int offset = idx * 0x200;
153fc6cc961SJan Kiszka 	unsigned int baud = 1843200;
154fc6cc961SJan Kiszka 	u8 __iomem *p;
155fc6cc961SJan Kiszka 	int err;
156fc6cc961SJan Kiszka 
157fc6cc961SJan Kiszka 	port->port.flags |= UPF_EXAR_EFR;
158fc6cc961SJan Kiszka 	port->port.uartclk = baud * 16;
159fc6cc961SJan Kiszka 
160fc6cc961SJan Kiszka 	err = default_setup(priv, pcidev, idx, offset, port);
161fc6cc961SJan Kiszka 	if (err)
162fc6cc961SJan Kiszka 		return err;
163fc6cc961SJan Kiszka 
164fc6cc961SJan Kiszka 	p = port->port.membase;
165fc6cc961SJan Kiszka 
166fc6cc961SJan Kiszka 	writeb(0x00, p + UART_EXAR_8XMODE);
167fc6cc961SJan Kiszka 	writeb(UART_FCTR_EXAR_TRGD, p + UART_EXAR_FCTR);
168fc6cc961SJan Kiszka 	writeb(32, p + UART_EXAR_TXTRG);
169fc6cc961SJan Kiszka 	writeb(32, p + UART_EXAR_RXTRG);
170fc6cc961SJan Kiszka 
171fc6cc961SJan Kiszka 	/*
172fc6cc961SJan Kiszka 	 * Setup Multipurpose Input/Output pins.
173fc6cc961SJan Kiszka 	 */
174fc6cc961SJan Kiszka 	if (idx == 0) {
175fc6cc961SJan Kiszka 		switch (pcidev->device) {
176fc6cc961SJan Kiszka 		case PCI_DEVICE_ID_COMMTECH_4222PCI335:
177fc6cc961SJan Kiszka 		case PCI_DEVICE_ID_COMMTECH_4224PCI335:
178fc6cc961SJan Kiszka 			writeb(0x78, p + UART_EXAR_MPIOLVL_7_0);
179fc6cc961SJan Kiszka 			writeb(0x00, p + UART_EXAR_MPIOINV_7_0);
180fc6cc961SJan Kiszka 			writeb(0x00, p + UART_EXAR_MPIOSEL_7_0);
181fc6cc961SJan Kiszka 			break;
182fc6cc961SJan Kiszka 		case PCI_DEVICE_ID_COMMTECH_2324PCI335:
183fc6cc961SJan Kiszka 		case PCI_DEVICE_ID_COMMTECH_2328PCI335:
184fc6cc961SJan Kiszka 			writeb(0x00, p + UART_EXAR_MPIOLVL_7_0);
185fc6cc961SJan Kiszka 			writeb(0xc0, p + UART_EXAR_MPIOINV_7_0);
186fc6cc961SJan Kiszka 			writeb(0xc0, p + UART_EXAR_MPIOSEL_7_0);
187fc6cc961SJan Kiszka 			break;
188fc6cc961SJan Kiszka 		}
189fc6cc961SJan Kiszka 		writeb(0x00, p + UART_EXAR_MPIOINT_7_0);
190fc6cc961SJan Kiszka 		writeb(0x00, p + UART_EXAR_MPIO3T_7_0);
191fc6cc961SJan Kiszka 		writeb(0x00, p + UART_EXAR_MPIOOD_7_0);
192fc6cc961SJan Kiszka 	}
193fc6cc961SJan Kiszka 
194fc6cc961SJan Kiszka 	return 0;
195fc6cc961SJan Kiszka }
196fc6cc961SJan Kiszka 
197fc6cc961SJan Kiszka static int
198d0aeaa83SSudip Mukherjee pci_connect_tech_setup(struct exar8250 *priv, struct pci_dev *pcidev,
199d0aeaa83SSudip Mukherjee 		       struct uart_8250_port *port, int idx)
200d0aeaa83SSudip Mukherjee {
201d0aeaa83SSudip Mukherjee 	unsigned int offset = idx * 0x200;
202d0aeaa83SSudip Mukherjee 	unsigned int baud = 1843200;
203d0aeaa83SSudip Mukherjee 
204d0aeaa83SSudip Mukherjee 	port->port.uartclk = baud * 16;
205d0aeaa83SSudip Mukherjee 	return default_setup(priv, pcidev, idx, offset, port);
206d0aeaa83SSudip Mukherjee }
207d0aeaa83SSudip Mukherjee 
208d0aeaa83SSudip Mukherjee static int
209d0aeaa83SSudip Mukherjee pci_xr17c154_setup(struct exar8250 *priv, struct pci_dev *pcidev,
210d0aeaa83SSudip Mukherjee 		   struct uart_8250_port *port, int idx)
211d0aeaa83SSudip Mukherjee {
212d0aeaa83SSudip Mukherjee 	unsigned int offset = idx * 0x200;
213d0aeaa83SSudip Mukherjee 	unsigned int baud = 921600;
214d0aeaa83SSudip Mukherjee 
215d0aeaa83SSudip Mukherjee 	port->port.uartclk = baud * 16;
216d0aeaa83SSudip Mukherjee 	return default_setup(priv, pcidev, idx, offset, port);
217d0aeaa83SSudip Mukherjee }
218d0aeaa83SSudip Mukherjee 
219d0aeaa83SSudip Mukherjee static void setup_gpio(u8 __iomem *p)
220d0aeaa83SSudip Mukherjee {
221d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOINT_7_0);
222d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOLVL_7_0);
223d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIO3T_7_0);
224d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOINV_7_0);
225d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOSEL_7_0);
226d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOOD_7_0);
227d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOINT_15_8);
228d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOLVL_15_8);
229d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIO3T_15_8);
230d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOINV_15_8);
231d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOSEL_15_8);
232d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_MPIOOD_15_8);
233d0aeaa83SSudip Mukherjee }
234d0aeaa83SSudip Mukherjee 
235d0aeaa83SSudip Mukherjee static void *
236380b1e2fSJan Kiszka __xr17v35x_register_gpio(struct pci_dev *pcidev,
237380b1e2fSJan Kiszka 			 const struct property_entry *properties)
238d0aeaa83SSudip Mukherjee {
239d0aeaa83SSudip Mukherjee 	struct platform_device *pdev;
240d0aeaa83SSudip Mukherjee 
241d0aeaa83SSudip Mukherjee 	pdev = platform_device_alloc("gpio_exar", PLATFORM_DEVID_AUTO);
242d0aeaa83SSudip Mukherjee 	if (!pdev)
243d0aeaa83SSudip Mukherjee 		return NULL;
244d0aeaa83SSudip Mukherjee 
245d3936d74SJan Kiszka 	pdev->dev.parent = &pcidev->dev;
2464076cf08SJan Kiszka 	ACPI_COMPANION_SET(&pdev->dev, ACPI_COMPANION(&pcidev->dev));
247d3936d74SJan Kiszka 
248380b1e2fSJan Kiszka 	if (platform_device_add_properties(pdev, properties) < 0 ||
249380b1e2fSJan Kiszka 	    platform_device_add(pdev) < 0) {
250d0aeaa83SSudip Mukherjee 		platform_device_put(pdev);
251d0aeaa83SSudip Mukherjee 		return NULL;
252d0aeaa83SSudip Mukherjee 	}
253d0aeaa83SSudip Mukherjee 
254d0aeaa83SSudip Mukherjee 	return pdev;
255d0aeaa83SSudip Mukherjee }
256d0aeaa83SSudip Mukherjee 
257380b1e2fSJan Kiszka static const struct property_entry exar_gpio_properties[] = {
258380b1e2fSJan Kiszka 	PROPERTY_ENTRY_U32("linux,first-pin", 0),
259380b1e2fSJan Kiszka 	PROPERTY_ENTRY_U32("ngpios", 16),
260380b1e2fSJan Kiszka 	{ }
261380b1e2fSJan Kiszka };
262380b1e2fSJan Kiszka 
2630d963ebfSJan Kiszka static int xr17v35x_register_gpio(struct pci_dev *pcidev,
2640d963ebfSJan Kiszka 				  struct uart_8250_port *port)
2650d963ebfSJan Kiszka {
2660d963ebfSJan Kiszka 	if (pcidev->vendor == PCI_VENDOR_ID_EXAR)
2670d963ebfSJan Kiszka 		port->port.private_data =
268380b1e2fSJan Kiszka 			__xr17v35x_register_gpio(pcidev, exar_gpio_properties);
2690d963ebfSJan Kiszka 
2700d963ebfSJan Kiszka 	return 0;
2710d963ebfSJan Kiszka }
2720d963ebfSJan Kiszka 
2730d963ebfSJan Kiszka static const struct exar8250_platform exar8250_default_platform = {
2740d963ebfSJan Kiszka 	.register_gpio = xr17v35x_register_gpio,
2750d963ebfSJan Kiszka };
2760d963ebfSJan Kiszka 
277*413058dfSJan Kiszka static int iot2040_rs485_config(struct uart_port *port,
278*413058dfSJan Kiszka 				struct serial_rs485 *rs485)
279*413058dfSJan Kiszka {
280*413058dfSJan Kiszka 	bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED);
281*413058dfSJan Kiszka 	u8 __iomem *p = port->membase;
282*413058dfSJan Kiszka 	u8 mask = IOT2040_UART1_MASK;
283*413058dfSJan Kiszka 	u8 mode, value;
284*413058dfSJan Kiszka 
285*413058dfSJan Kiszka 	if (is_rs485) {
286*413058dfSJan Kiszka 		if (rs485->flags & SER_RS485_RX_DURING_TX)
287*413058dfSJan Kiszka 			mode = IOT2040_UART_MODE_RS422;
288*413058dfSJan Kiszka 		else
289*413058dfSJan Kiszka 			mode = IOT2040_UART_MODE_RS485;
290*413058dfSJan Kiszka 
291*413058dfSJan Kiszka 		if (rs485->flags & SER_RS485_TERMINATE_BUS)
292*413058dfSJan Kiszka 			mode |= IOT2040_UART_TERMINATE_BUS;
293*413058dfSJan Kiszka 	} else {
294*413058dfSJan Kiszka 		mode = IOT2040_UART_MODE_RS232;
295*413058dfSJan Kiszka 	}
296*413058dfSJan Kiszka 
297*413058dfSJan Kiszka 	if (port->line == 3) {
298*413058dfSJan Kiszka 		mask <<= IOT2040_UART2_SHIFT;
299*413058dfSJan Kiszka 		mode <<= IOT2040_UART2_SHIFT;
300*413058dfSJan Kiszka 	}
301*413058dfSJan Kiszka 
302*413058dfSJan Kiszka 	value = readb(p + UART_EXAR_MPIOLVL_7_0);
303*413058dfSJan Kiszka 	value &= ~mask;
304*413058dfSJan Kiszka 	value |= mode;
305*413058dfSJan Kiszka 	writeb(value, p + UART_EXAR_MPIOLVL_7_0);
306*413058dfSJan Kiszka 
307*413058dfSJan Kiszka 	value = readb(p + UART_EXAR_FCTR);
308*413058dfSJan Kiszka 	if (is_rs485)
309*413058dfSJan Kiszka 		value |= UART_FCTR_EXAR_485;
310*413058dfSJan Kiszka 	else
311*413058dfSJan Kiszka 		value &= ~UART_FCTR_EXAR_485;
312*413058dfSJan Kiszka 	writeb(value, p + UART_EXAR_FCTR);
313*413058dfSJan Kiszka 
314*413058dfSJan Kiszka 	if (is_rs485)
315*413058dfSJan Kiszka 		writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR);
316*413058dfSJan Kiszka 
317*413058dfSJan Kiszka 	port->rs485 = *rs485;
318*413058dfSJan Kiszka 
319*413058dfSJan Kiszka 	return 0;
320*413058dfSJan Kiszka }
321*413058dfSJan Kiszka 
322*413058dfSJan Kiszka static const struct property_entry iot2040_gpio_properties[] = {
323*413058dfSJan Kiszka 	PROPERTY_ENTRY_U32("linux,first-pin", 10),
324*413058dfSJan Kiszka 	PROPERTY_ENTRY_U32("ngpios", 1),
325*413058dfSJan Kiszka 	{ }
326*413058dfSJan Kiszka };
327*413058dfSJan Kiszka 
328*413058dfSJan Kiszka static int iot2040_register_gpio(struct pci_dev *pcidev,
329*413058dfSJan Kiszka 			      struct uart_8250_port *port)
330*413058dfSJan Kiszka {
331*413058dfSJan Kiszka 	u8 __iomem *p = port->port.membase;
332*413058dfSJan Kiszka 
333*413058dfSJan Kiszka 	writeb(IOT2040_UARTS_DEFAULT_MODE, p + UART_EXAR_MPIOLVL_7_0);
334*413058dfSJan Kiszka 	writeb(IOT2040_UARTS_GPIO_LO_MODE, p + UART_EXAR_MPIOSEL_7_0);
335*413058dfSJan Kiszka 	writeb(IOT2040_UARTS_ENABLE, p + UART_EXAR_MPIOLVL_15_8);
336*413058dfSJan Kiszka 	writeb(IOT2040_UARTS_GPIO_HI_MODE, p + UART_EXAR_MPIOSEL_15_8);
337*413058dfSJan Kiszka 
338*413058dfSJan Kiszka 	port->port.private_data =
339*413058dfSJan Kiszka 		__xr17v35x_register_gpio(pcidev, iot2040_gpio_properties);
340*413058dfSJan Kiszka 
341*413058dfSJan Kiszka 	return 0;
342*413058dfSJan Kiszka }
343*413058dfSJan Kiszka 
344*413058dfSJan Kiszka static const struct exar8250_platform iot2040_platform = {
345*413058dfSJan Kiszka 	.rs485_config = iot2040_rs485_config,
346*413058dfSJan Kiszka 	.register_gpio = iot2040_register_gpio,
347*413058dfSJan Kiszka };
348*413058dfSJan Kiszka 
349*413058dfSJan Kiszka static const struct dmi_system_id exar_platforms[] = {
350*413058dfSJan Kiszka 	{
351*413058dfSJan Kiszka 		.matches = {
352*413058dfSJan Kiszka 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"),
353*413058dfSJan Kiszka 			DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG,
354*413058dfSJan Kiszka 					"6ES7647-0AA00-1YA2"),
355*413058dfSJan Kiszka 		},
356*413058dfSJan Kiszka 		.driver_data = (void *)&iot2040_platform,
357*413058dfSJan Kiszka 	},
358*413058dfSJan Kiszka 	{}
359*413058dfSJan Kiszka };
360*413058dfSJan Kiszka 
361d0aeaa83SSudip Mukherjee static int
362d0aeaa83SSudip Mukherjee pci_xr17v35x_setup(struct exar8250 *priv, struct pci_dev *pcidev,
363d0aeaa83SSudip Mukherjee 		   struct uart_8250_port *port, int idx)
364d0aeaa83SSudip Mukherjee {
365d0aeaa83SSudip Mukherjee 	const struct exar8250_board *board = priv->board;
3660d963ebfSJan Kiszka 	const struct exar8250_platform *platform;
367*413058dfSJan Kiszka 	const struct dmi_system_id *dmi_match;
368d0aeaa83SSudip Mukherjee 	unsigned int offset = idx * 0x400;
369d0aeaa83SSudip Mukherjee 	unsigned int baud = 7812500;
370d0aeaa83SSudip Mukherjee 	u8 __iomem *p;
371d0aeaa83SSudip Mukherjee 	int ret;
372d0aeaa83SSudip Mukherjee 
373*413058dfSJan Kiszka 	dmi_match = dmi_first_match(exar_platforms);
374*413058dfSJan Kiszka 	if (dmi_match)
375*413058dfSJan Kiszka 		platform = dmi_match->driver_data;
376*413058dfSJan Kiszka 	else
3770d963ebfSJan Kiszka 		platform = &exar8250_default_platform;
3780d963ebfSJan Kiszka 
379d0aeaa83SSudip Mukherjee 	port->port.uartclk = baud * 16;
3800d963ebfSJan Kiszka 	port->port.rs485_config = platform->rs485_config;
3810d963ebfSJan Kiszka 
382d0aeaa83SSudip Mukherjee 	/*
383d0aeaa83SSudip Mukherjee 	 * Setup the uart clock for the devices on expansion slot to
384d0aeaa83SSudip Mukherjee 	 * half the clock speed of the main chip (which is 125MHz)
385d0aeaa83SSudip Mukherjee 	 */
386d0aeaa83SSudip Mukherjee 	if (board->has_slave && idx >= 8)
387d0aeaa83SSudip Mukherjee 		port->port.uartclk /= 2;
388d0aeaa83SSudip Mukherjee 
3895b5f252dSJan Kiszka 	ret = default_setup(priv, pcidev, idx, offset, port);
3905b5f252dSJan Kiszka 	if (ret)
3915b5f252dSJan Kiszka 		return ret;
392d0aeaa83SSudip Mukherjee 
3935b5f252dSJan Kiszka 	p = port->port.membase;
394d0aeaa83SSudip Mukherjee 
395d0aeaa83SSudip Mukherjee 	writeb(0x00, p + UART_EXAR_8XMODE);
396d0aeaa83SSudip Mukherjee 	writeb(UART_FCTR_EXAR_TRGD, p + UART_EXAR_FCTR);
397d0aeaa83SSudip Mukherjee 	writeb(128, p + UART_EXAR_TXTRG);
398d0aeaa83SSudip Mukherjee 	writeb(128, p + UART_EXAR_RXTRG);
399d0aeaa83SSudip Mukherjee 
4005b5f252dSJan Kiszka 	if (idx == 0) {
4015b5f252dSJan Kiszka 		/* Setup Multipurpose Input/Output pins. */
4025b5f252dSJan Kiszka 		setup_gpio(p);
403d0aeaa83SSudip Mukherjee 
4040d963ebfSJan Kiszka 		ret = platform->register_gpio(pcidev, port);
4055b5f252dSJan Kiszka 	}
406d0aeaa83SSudip Mukherjee 
4070d963ebfSJan Kiszka 	return ret;
408d0aeaa83SSudip Mukherjee }
409d0aeaa83SSudip Mukherjee 
410d0aeaa83SSudip Mukherjee static void pci_xr17v35x_exit(struct pci_dev *pcidev)
411d0aeaa83SSudip Mukherjee {
412d0aeaa83SSudip Mukherjee 	struct exar8250 *priv = pci_get_drvdata(pcidev);
413d0aeaa83SSudip Mukherjee 	struct uart_8250_port *port = serial8250_get_port(priv->line[0]);
414d0aeaa83SSudip Mukherjee 	struct platform_device *pdev = port->port.private_data;
415d0aeaa83SSudip Mukherjee 
416d0aeaa83SSudip Mukherjee 	platform_device_unregister(pdev);
417d0aeaa83SSudip Mukherjee 	port->port.private_data = NULL;
418d0aeaa83SSudip Mukherjee }
419d0aeaa83SSudip Mukherjee 
420d0aeaa83SSudip Mukherjee static int
421d0aeaa83SSudip Mukherjee exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
422d0aeaa83SSudip Mukherjee {
423d0aeaa83SSudip Mukherjee 	unsigned int nr_ports, i, bar = 0, maxnr;
424d0aeaa83SSudip Mukherjee 	struct exar8250_board *board;
425d0aeaa83SSudip Mukherjee 	struct uart_8250_port uart;
426d0aeaa83SSudip Mukherjee 	struct exar8250 *priv;
427d0aeaa83SSudip Mukherjee 	int rc;
428d0aeaa83SSudip Mukherjee 
429d0aeaa83SSudip Mukherjee 	board = (struct exar8250_board *)ent->driver_data;
430d0aeaa83SSudip Mukherjee 	if (!board)
431d0aeaa83SSudip Mukherjee 		return -EINVAL;
432d0aeaa83SSudip Mukherjee 
433d0aeaa83SSudip Mukherjee 	rc = pcim_enable_device(pcidev);
434d0aeaa83SSudip Mukherjee 	if (rc)
435d0aeaa83SSudip Mukherjee 		return rc;
436d0aeaa83SSudip Mukherjee 
437d0aeaa83SSudip Mukherjee 	maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3);
438d0aeaa83SSudip Mukherjee 
439d0aeaa83SSudip Mukherjee 	nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
440d0aeaa83SSudip Mukherjee 
441d0aeaa83SSudip Mukherjee 	priv = devm_kzalloc(&pcidev->dev, sizeof(*priv) +
442d0aeaa83SSudip Mukherjee 			    sizeof(unsigned int) * nr_ports,
443d0aeaa83SSudip Mukherjee 			    GFP_KERNEL);
444d0aeaa83SSudip Mukherjee 	if (!priv)
445d0aeaa83SSudip Mukherjee 		return -ENOMEM;
446d0aeaa83SSudip Mukherjee 
447d0aeaa83SSudip Mukherjee 	priv->board = board;
448d0aeaa83SSudip Mukherjee 
449172c33cbSJan Kiszka 	pci_set_master(pcidev);
450172c33cbSJan Kiszka 
451172c33cbSJan Kiszka 	rc = pci_alloc_irq_vectors(pcidev, 1, 1, PCI_IRQ_ALL_TYPES);
452172c33cbSJan Kiszka 	if (rc < 0)
453172c33cbSJan Kiszka 		return rc;
454172c33cbSJan Kiszka 
455d0aeaa83SSudip Mukherjee 	memset(&uart, 0, sizeof(uart));
456d0aeaa83SSudip Mukherjee 	uart.port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ
457d0aeaa83SSudip Mukherjee 			  | UPF_EXAR_EFR;
458172c33cbSJan Kiszka 	uart.port.irq = pci_irq_vector(pcidev, 0);
459d0aeaa83SSudip Mukherjee 	uart.port.dev = &pcidev->dev;
460d0aeaa83SSudip Mukherjee 
461d0aeaa83SSudip Mukherjee 	for (i = 0; i < nr_ports && i < maxnr; i++) {
462d0aeaa83SSudip Mukherjee 		rc = board->setup(priv, pcidev, &uart, i);
463d0aeaa83SSudip Mukherjee 		if (rc) {
464d0aeaa83SSudip Mukherjee 			dev_err(&pcidev->dev, "Failed to setup port %u\n", i);
465d0aeaa83SSudip Mukherjee 			break;
466d0aeaa83SSudip Mukherjee 		}
467d0aeaa83SSudip Mukherjee 
468d0aeaa83SSudip Mukherjee 		dev_dbg(&pcidev->dev, "Setup PCI port: port %lx, irq %d, type %d\n",
469d0aeaa83SSudip Mukherjee 			uart.port.iobase, uart.port.irq, uart.port.iotype);
470d0aeaa83SSudip Mukherjee 
471d0aeaa83SSudip Mukherjee 		priv->line[i] = serial8250_register_8250_port(&uart);
472d0aeaa83SSudip Mukherjee 		if (priv->line[i] < 0) {
473d0aeaa83SSudip Mukherjee 			dev_err(&pcidev->dev,
474d0aeaa83SSudip Mukherjee 				"Couldn't register serial port %lx, irq %d, type %d, error %d\n",
475d0aeaa83SSudip Mukherjee 				uart.port.iobase, uart.port.irq,
476d0aeaa83SSudip Mukherjee 				uart.port.iotype, priv->line[i]);
477d0aeaa83SSudip Mukherjee 			break;
478d0aeaa83SSudip Mukherjee 		}
479d0aeaa83SSudip Mukherjee 	}
480d0aeaa83SSudip Mukherjee 	priv->nr = i;
481d0aeaa83SSudip Mukherjee 	pci_set_drvdata(pcidev, priv);
482d0aeaa83SSudip Mukherjee 	return 0;
483d0aeaa83SSudip Mukherjee }
484d0aeaa83SSudip Mukherjee 
485d0aeaa83SSudip Mukherjee static void exar_pci_remove(struct pci_dev *pcidev)
486d0aeaa83SSudip Mukherjee {
487d0aeaa83SSudip Mukherjee 	struct exar8250 *priv = pci_get_drvdata(pcidev);
488d0aeaa83SSudip Mukherjee 	unsigned int i;
489d0aeaa83SSudip Mukherjee 
490d0aeaa83SSudip Mukherjee 	for (i = 0; i < priv->nr; i++)
491d0aeaa83SSudip Mukherjee 		serial8250_unregister_port(priv->line[i]);
492d0aeaa83SSudip Mukherjee 
493d0aeaa83SSudip Mukherjee 	if (priv->board->exit)
494d0aeaa83SSudip Mukherjee 		priv->board->exit(pcidev);
495d0aeaa83SSudip Mukherjee }
496d0aeaa83SSudip Mukherjee 
497d0aeaa83SSudip Mukherjee static int __maybe_unused exar_suspend(struct device *dev)
498d0aeaa83SSudip Mukherjee {
499d0aeaa83SSudip Mukherjee 	struct pci_dev *pcidev = to_pci_dev(dev);
500d0aeaa83SSudip Mukherjee 	struct exar8250 *priv = pci_get_drvdata(pcidev);
501d0aeaa83SSudip Mukherjee 	unsigned int i;
502d0aeaa83SSudip Mukherjee 
503d0aeaa83SSudip Mukherjee 	for (i = 0; i < priv->nr; i++)
504d0aeaa83SSudip Mukherjee 		if (priv->line[i] >= 0)
505d0aeaa83SSudip Mukherjee 			serial8250_suspend_port(priv->line[i]);
506d0aeaa83SSudip Mukherjee 
507d0aeaa83SSudip Mukherjee 	/* Ensure that every init quirk is properly torn down */
508d0aeaa83SSudip Mukherjee 	if (priv->board->exit)
509d0aeaa83SSudip Mukherjee 		priv->board->exit(pcidev);
510d0aeaa83SSudip Mukherjee 
511d0aeaa83SSudip Mukherjee 	return 0;
512d0aeaa83SSudip Mukherjee }
513d0aeaa83SSudip Mukherjee 
514d0aeaa83SSudip Mukherjee static int __maybe_unused exar_resume(struct device *dev)
515d0aeaa83SSudip Mukherjee {
516d0aeaa83SSudip Mukherjee 	struct pci_dev *pcidev = to_pci_dev(dev);
517d0aeaa83SSudip Mukherjee 	struct exar8250 *priv = pci_get_drvdata(pcidev);
518d0aeaa83SSudip Mukherjee 	unsigned int i;
519d0aeaa83SSudip Mukherjee 
520d0aeaa83SSudip Mukherjee 	for (i = 0; i < priv->nr; i++)
521d0aeaa83SSudip Mukherjee 		if (priv->line[i] >= 0)
522d0aeaa83SSudip Mukherjee 			serial8250_resume_port(priv->line[i]);
523d0aeaa83SSudip Mukherjee 
524d0aeaa83SSudip Mukherjee 	return 0;
525d0aeaa83SSudip Mukherjee }
526d0aeaa83SSudip Mukherjee 
527d0aeaa83SSudip Mukherjee static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume);
528d0aeaa83SSudip Mukherjee 
529fc6cc961SJan Kiszka static const struct exar8250_board pbn_fastcom335_2 = {
530fc6cc961SJan Kiszka 	.num_ports	= 2,
531fc6cc961SJan Kiszka 	.setup		= pci_fastcom335_setup,
532fc6cc961SJan Kiszka };
533fc6cc961SJan Kiszka 
534fc6cc961SJan Kiszka static const struct exar8250_board pbn_fastcom335_4 = {
535fc6cc961SJan Kiszka 	.num_ports	= 4,
536fc6cc961SJan Kiszka 	.setup		= pci_fastcom335_setup,
537fc6cc961SJan Kiszka };
538fc6cc961SJan Kiszka 
539fc6cc961SJan Kiszka static const struct exar8250_board pbn_fastcom335_8 = {
540fc6cc961SJan Kiszka 	.num_ports	= 8,
541fc6cc961SJan Kiszka 	.setup		= pci_fastcom335_setup,
542fc6cc961SJan Kiszka };
543fc6cc961SJan Kiszka 
544d0aeaa83SSudip Mukherjee static const struct exar8250_board pbn_connect = {
545d0aeaa83SSudip Mukherjee 	.setup		= pci_connect_tech_setup,
546d0aeaa83SSudip Mukherjee };
547d0aeaa83SSudip Mukherjee 
548d0aeaa83SSudip Mukherjee static const struct exar8250_board pbn_exar_ibm_saturn = {
549d0aeaa83SSudip Mukherjee 	.num_ports	= 1,
550d0aeaa83SSudip Mukherjee 	.setup		= pci_xr17c154_setup,
551d0aeaa83SSudip Mukherjee };
552d0aeaa83SSudip Mukherjee 
553d0aeaa83SSudip Mukherjee static const struct exar8250_board pbn_exar_XR17C15x = {
554d0aeaa83SSudip Mukherjee 	.setup		= pci_xr17c154_setup,
555d0aeaa83SSudip Mukherjee };
556d0aeaa83SSudip Mukherjee 
557d0aeaa83SSudip Mukherjee static const struct exar8250_board pbn_exar_XR17V35x = {
558d0aeaa83SSudip Mukherjee 	.setup		= pci_xr17v35x_setup,
559d0aeaa83SSudip Mukherjee 	.exit		= pci_xr17v35x_exit,
560d0aeaa83SSudip Mukherjee };
561d0aeaa83SSudip Mukherjee 
562d0aeaa83SSudip Mukherjee static const struct exar8250_board pbn_exar_XR17V4358 = {
563d0aeaa83SSudip Mukherjee 	.num_ports	= 12,
564d0aeaa83SSudip Mukherjee 	.has_slave	= true,
565d0aeaa83SSudip Mukherjee 	.setup		= pci_xr17v35x_setup,
566d0aeaa83SSudip Mukherjee 	.exit		= pci_xr17v35x_exit,
567d0aeaa83SSudip Mukherjee };
568d0aeaa83SSudip Mukherjee 
569d0aeaa83SSudip Mukherjee static const struct exar8250_board pbn_exar_XR17V8358 = {
570d0aeaa83SSudip Mukherjee 	.num_ports	= 16,
571d0aeaa83SSudip Mukherjee 	.has_slave	= true,
572d0aeaa83SSudip Mukherjee 	.setup		= pci_xr17v35x_setup,
573d0aeaa83SSudip Mukherjee 	.exit		= pci_xr17v35x_exit,
574d0aeaa83SSudip Mukherjee };
575d0aeaa83SSudip Mukherjee 
576d0aeaa83SSudip Mukherjee #define CONNECT_DEVICE(devid, sdevid, bd) {				\
577d0aeaa83SSudip Mukherjee 	PCI_DEVICE_SUB(							\
578d0aeaa83SSudip Mukherjee 		PCI_VENDOR_ID_EXAR,					\
579d0aeaa83SSudip Mukherjee 		PCI_DEVICE_ID_EXAR_##devid,				\
580d0aeaa83SSudip Mukherjee 		PCI_SUBVENDOR_ID_CONNECT_TECH,				\
581d0aeaa83SSudip Mukherjee 		PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_##sdevid), 0, 0,	\
582d0aeaa83SSudip Mukherjee 		(kernel_ulong_t)&bd					\
583d0aeaa83SSudip Mukherjee 	}
584d0aeaa83SSudip Mukherjee 
585d0aeaa83SSudip Mukherjee #define EXAR_DEVICE(vend, devid, bd) {					\
586d0aeaa83SSudip Mukherjee 	PCI_VDEVICE(vend, PCI_DEVICE_ID_##devid), (kernel_ulong_t)&bd	\
587d0aeaa83SSudip Mukherjee 	}
588d0aeaa83SSudip Mukherjee 
589d0aeaa83SSudip Mukherjee #define IBM_DEVICE(devid, sdevid, bd) {			\
590d0aeaa83SSudip Mukherjee 	PCI_DEVICE_SUB(					\
591d0aeaa83SSudip Mukherjee 		PCI_VENDOR_ID_EXAR,			\
592d0aeaa83SSudip Mukherjee 		PCI_DEVICE_ID_EXAR_##devid,		\
593d0aeaa83SSudip Mukherjee 		PCI_VENDOR_ID_IBM,			\
594d0aeaa83SSudip Mukherjee 		PCI_SUBDEVICE_ID_IBM_##sdevid), 0, 0,	\
595d0aeaa83SSudip Mukherjee 		(kernel_ulong_t)&bd			\
596d0aeaa83SSudip Mukherjee 	}
597d0aeaa83SSudip Mukherjee 
598d0aeaa83SSudip Mukherjee static struct pci_device_id exar_pci_tbl[] = {
599d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect),
600d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect),
601d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C158, UART_8_232, pbn_connect),
602d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C152, UART_1_1, pbn_connect),
603d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C154, UART_2_2, pbn_connect),
604d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C158, UART_4_4, pbn_connect),
605d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C152, UART_2, pbn_connect),
606d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C154, UART_4, pbn_connect),
607d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C158, UART_8, pbn_connect),
608d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C152, UART_2_485, pbn_connect),
609d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C154, UART_4_485, pbn_connect),
610d0aeaa83SSudip Mukherjee 	CONNECT_DEVICE(XR17C158, UART_8_485, pbn_connect),
611d0aeaa83SSudip Mukherjee 
612d0aeaa83SSudip Mukherjee 	IBM_DEVICE(XR17C152, SATURN_SERIAL_ONE_PORT, pbn_exar_ibm_saturn),
613d0aeaa83SSudip Mukherjee 
614d0aeaa83SSudip Mukherjee 	/* Exar Corp. XR17C15[248] Dual/Quad/Octal UART */
615d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(EXAR, EXAR_XR17C152, pbn_exar_XR17C15x),
616d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(EXAR, EXAR_XR17C154, pbn_exar_XR17C15x),
617d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(EXAR, EXAR_XR17C158, pbn_exar_XR17C15x),
618d0aeaa83SSudip Mukherjee 
619d0aeaa83SSudip Mukherjee 	/* Exar Corp. XR17V[48]35[248] Dual/Quad/Octal/Hexa PCIe UARTs */
620d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(EXAR, EXAR_XR17V352, pbn_exar_XR17V35x),
621d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(EXAR, EXAR_XR17V354, pbn_exar_XR17V35x),
622d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(EXAR, EXAR_XR17V358, pbn_exar_XR17V35x),
623d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(EXAR, EXAR_XR17V4358, pbn_exar_XR17V4358),
624d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(EXAR, EXAR_XR17V8358, pbn_exar_XR17V8358),
625d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(COMMTECH, COMMTECH_4222PCIE, pbn_exar_XR17V35x),
626d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(COMMTECH, COMMTECH_4224PCIE, pbn_exar_XR17V35x),
627d0aeaa83SSudip Mukherjee 	EXAR_DEVICE(COMMTECH, COMMTECH_4228PCIE, pbn_exar_XR17V35x),
628fc6cc961SJan Kiszka 
629fc6cc961SJan Kiszka 	EXAR_DEVICE(COMMTECH, COMMTECH_4222PCI335, pbn_fastcom335_2),
630fc6cc961SJan Kiszka 	EXAR_DEVICE(COMMTECH, COMMTECH_4224PCI335, pbn_fastcom335_4),
631fc6cc961SJan Kiszka 	EXAR_DEVICE(COMMTECH, COMMTECH_2324PCI335, pbn_fastcom335_4),
632fc6cc961SJan Kiszka 	EXAR_DEVICE(COMMTECH, COMMTECH_2328PCI335, pbn_fastcom335_8),
633d0aeaa83SSudip Mukherjee 	{ 0, }
634d0aeaa83SSudip Mukherjee };
635d0aeaa83SSudip Mukherjee MODULE_DEVICE_TABLE(pci, exar_pci_tbl);
636d0aeaa83SSudip Mukherjee 
637d0aeaa83SSudip Mukherjee static struct pci_driver exar_pci_driver = {
638d0aeaa83SSudip Mukherjee 	.name		= "exar_serial",
639d0aeaa83SSudip Mukherjee 	.probe		= exar_pci_probe,
640d0aeaa83SSudip Mukherjee 	.remove		= exar_pci_remove,
641d0aeaa83SSudip Mukherjee 	.driver         = {
642d0aeaa83SSudip Mukherjee 		.pm     = &exar_pci_pm,
643d0aeaa83SSudip Mukherjee 	},
644d0aeaa83SSudip Mukherjee 	.id_table	= exar_pci_tbl,
645d0aeaa83SSudip Mukherjee };
646d0aeaa83SSudip Mukherjee module_pci_driver(exar_pci_driver);
647d0aeaa83SSudip Mukherjee 
648d0aeaa83SSudip Mukherjee MODULE_LICENSE("GPL");
6492b57b7ffSAndy Shevchenko MODULE_DESCRIPTION("Exar Serial Driver");
650d0aeaa83SSudip Mukherjee MODULE_AUTHOR("Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>");
651