2 *Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD.
4 *This program is free software; you can redistribute it and/or modify
5 *it under the terms of the GNU General Public License as published by
6 *the Free Software Foundation; version 2 of the License.
8 *This program is distributed in the hope that it will be useful,
9 *but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 *GNU General Public License for more details.
13 *You should have received a copy of the GNU General Public License
14 *along with this program; if not, write to the Free Software
15 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 #include <linux/serial_reg.h>
18 #include <linux/pci.h>
19 #include <linux/module.h>
20 #include <linux/pci.h>
21 #include <linux/serial_core.h>
22 #include <linux/interrupt.h>
25 #include <linux/dmaengine.h>
26 #include <linux/pch_dma.h>
29 PCH_UART_HANDLED_RX_INT_SHIFT,
30 PCH_UART_HANDLED_TX_INT_SHIFT,
31 PCH_UART_HANDLED_RX_ERR_INT_SHIFT,
32 PCH_UART_HANDLED_RX_TRG_INT_SHIFT,
33 PCH_UART_HANDLED_MS_INT_SHIFT,
41 #define PCH_UART_DRIVER_DEVICE "ttyPCH"
43 /* Set the max number of UART port
44 * Intel EG20T PCH: 4 port
45 * OKI SEMICONDUCTOR ML7213 IOH: 3 port
49 #define PCH_UART_HANDLED_RX_INT (1<<((PCH_UART_HANDLED_RX_INT_SHIFT)<<1))
50 #define PCH_UART_HANDLED_TX_INT (1<<((PCH_UART_HANDLED_TX_INT_SHIFT)<<1))
51 #define PCH_UART_HANDLED_RX_ERR_INT (1<<((\
52 PCH_UART_HANDLED_RX_ERR_INT_SHIFT)<<1))
53 #define PCH_UART_HANDLED_RX_TRG_INT (1<<((\
54 PCH_UART_HANDLED_RX_TRG_INT_SHIFT)<<1))
55 #define PCH_UART_HANDLED_MS_INT (1<<((PCH_UART_HANDLED_MS_INT_SHIFT)<<1))
57 #define PCH_UART_RBR 0x00
58 #define PCH_UART_THR 0x00
60 #define PCH_UART_IER_MASK (PCH_UART_IER_ERBFI|PCH_UART_IER_ETBEI|\
61 PCH_UART_IER_ELSI|PCH_UART_IER_EDSSI)
62 #define PCH_UART_IER_ERBFI 0x00000001
63 #define PCH_UART_IER_ETBEI 0x00000002
64 #define PCH_UART_IER_ELSI 0x00000004
65 #define PCH_UART_IER_EDSSI 0x00000008
67 #define PCH_UART_IIR_IP 0x00000001
68 #define PCH_UART_IIR_IID 0x00000006
69 #define PCH_UART_IIR_MSI 0x00000000
70 #define PCH_UART_IIR_TRI 0x00000002
71 #define PCH_UART_IIR_RRI 0x00000004
72 #define PCH_UART_IIR_REI 0x00000006
73 #define PCH_UART_IIR_TOI 0x00000008
74 #define PCH_UART_IIR_FIFO256 0x00000020
75 #define PCH_UART_IIR_FIFO64 PCH_UART_IIR_FIFO256
76 #define PCH_UART_IIR_FE 0x000000C0
78 #define PCH_UART_FCR_FIFOE 0x00000001
79 #define PCH_UART_FCR_RFR 0x00000002
80 #define PCH_UART_FCR_TFR 0x00000004
81 #define PCH_UART_FCR_DMS 0x00000008
82 #define PCH_UART_FCR_FIFO256 0x00000020
83 #define PCH_UART_FCR_RFTL 0x000000C0
85 #define PCH_UART_FCR_RFTL1 0x00000000
86 #define PCH_UART_FCR_RFTL64 0x00000040
87 #define PCH_UART_FCR_RFTL128 0x00000080
88 #define PCH_UART_FCR_RFTL224 0x000000C0
89 #define PCH_UART_FCR_RFTL16 PCH_UART_FCR_RFTL64
90 #define PCH_UART_FCR_RFTL32 PCH_UART_FCR_RFTL128
91 #define PCH_UART_FCR_RFTL56 PCH_UART_FCR_RFTL224
92 #define PCH_UART_FCR_RFTL4 PCH_UART_FCR_RFTL64
93 #define PCH_UART_FCR_RFTL8 PCH_UART_FCR_RFTL128
94 #define PCH_UART_FCR_RFTL14 PCH_UART_FCR_RFTL224
95 #define PCH_UART_FCR_RFTL_SHIFT 6
97 #define PCH_UART_LCR_WLS 0x00000003
98 #define PCH_UART_LCR_STB 0x00000004
99 #define PCH_UART_LCR_PEN 0x00000008
100 #define PCH_UART_LCR_EPS 0x00000010
101 #define PCH_UART_LCR_SP 0x00000020
102 #define PCH_UART_LCR_SB 0x00000040
103 #define PCH_UART_LCR_DLAB 0x00000080
104 #define PCH_UART_LCR_NP 0x00000000
105 #define PCH_UART_LCR_OP PCH_UART_LCR_PEN
106 #define PCH_UART_LCR_EP (PCH_UART_LCR_PEN | PCH_UART_LCR_EPS)
107 #define PCH_UART_LCR_1P (PCH_UART_LCR_PEN | PCH_UART_LCR_SP)
108 #define PCH_UART_LCR_0P (PCH_UART_LCR_PEN | PCH_UART_LCR_EPS |\
111 #define PCH_UART_LCR_5BIT 0x00000000
112 #define PCH_UART_LCR_6BIT 0x00000001
113 #define PCH_UART_LCR_7BIT 0x00000002
114 #define PCH_UART_LCR_8BIT 0x00000003
116 #define PCH_UART_MCR_DTR 0x00000001
117 #define PCH_UART_MCR_RTS 0x00000002
118 #define PCH_UART_MCR_OUT 0x0000000C
119 #define PCH_UART_MCR_LOOP 0x00000010
120 #define PCH_UART_MCR_AFE 0x00000020
122 #define PCH_UART_LSR_DR 0x00000001
123 #define PCH_UART_LSR_ERR (1<<7)
125 #define PCH_UART_MSR_DCTS 0x00000001
126 #define PCH_UART_MSR_DDSR 0x00000002
127 #define PCH_UART_MSR_TERI 0x00000004
128 #define PCH_UART_MSR_DDCD 0x00000008
129 #define PCH_UART_MSR_CTS 0x00000010
130 #define PCH_UART_MSR_DSR 0x00000020
131 #define PCH_UART_MSR_RI 0x00000040
132 #define PCH_UART_MSR_DCD 0x00000080
133 #define PCH_UART_MSR_DELTA (PCH_UART_MSR_DCTS | PCH_UART_MSR_DDSR |\
134 PCH_UART_MSR_TERI | PCH_UART_MSR_DDCD)
136 #define PCH_UART_DLL 0x00
137 #define PCH_UART_DLM 0x01
139 #define DIV_ROUND(a, b) (((a) + ((b)/2)) / (b))
141 #define PCH_UART_IID_RLS (PCH_UART_IIR_REI)
142 #define PCH_UART_IID_RDR (PCH_UART_IIR_RRI)
143 #define PCH_UART_IID_RDR_TO (PCH_UART_IIR_RRI | PCH_UART_IIR_TOI)
144 #define PCH_UART_IID_THRE (PCH_UART_IIR_TRI)
145 #define PCH_UART_IID_MS (PCH_UART_IIR_MSI)
147 #define PCH_UART_HAL_PARITY_NONE (PCH_UART_LCR_NP)
148 #define PCH_UART_HAL_PARITY_ODD (PCH_UART_LCR_OP)
149 #define PCH_UART_HAL_PARITY_EVEN (PCH_UART_LCR_EP)
150 #define PCH_UART_HAL_PARITY_FIX1 (PCH_UART_LCR_1P)
151 #define PCH_UART_HAL_PARITY_FIX0 (PCH_UART_LCR_0P)
152 #define PCH_UART_HAL_5BIT (PCH_UART_LCR_5BIT)
153 #define PCH_UART_HAL_6BIT (PCH_UART_LCR_6BIT)
154 #define PCH_UART_HAL_7BIT (PCH_UART_LCR_7BIT)
155 #define PCH_UART_HAL_8BIT (PCH_UART_LCR_8BIT)
156 #define PCH_UART_HAL_STB1 0
157 #define PCH_UART_HAL_STB2 (PCH_UART_LCR_STB)
159 #define PCH_UART_HAL_CLR_TX_FIFO (PCH_UART_FCR_TFR)
160 #define PCH_UART_HAL_CLR_RX_FIFO (PCH_UART_FCR_RFR)
161 #define PCH_UART_HAL_CLR_ALL_FIFO (PCH_UART_HAL_CLR_TX_FIFO | \
162 PCH_UART_HAL_CLR_RX_FIFO)
164 #define PCH_UART_HAL_DMA_MODE0 0
165 #define PCH_UART_HAL_FIFO_DIS 0
166 #define PCH_UART_HAL_FIFO16 (PCH_UART_FCR_FIFOE)
167 #define PCH_UART_HAL_FIFO256 (PCH_UART_FCR_FIFOE | \
168 PCH_UART_FCR_FIFO256)
169 #define PCH_UART_HAL_FIFO64 (PCH_UART_HAL_FIFO256)
170 #define PCH_UART_HAL_TRIGGER1 (PCH_UART_FCR_RFTL1)
171 #define PCH_UART_HAL_TRIGGER64 (PCH_UART_FCR_RFTL64)
172 #define PCH_UART_HAL_TRIGGER128 (PCH_UART_FCR_RFTL128)
173 #define PCH_UART_HAL_TRIGGER224 (PCH_UART_FCR_RFTL224)
174 #define PCH_UART_HAL_TRIGGER16 (PCH_UART_FCR_RFTL16)
175 #define PCH_UART_HAL_TRIGGER32 (PCH_UART_FCR_RFTL32)
176 #define PCH_UART_HAL_TRIGGER56 (PCH_UART_FCR_RFTL56)
177 #define PCH_UART_HAL_TRIGGER4 (PCH_UART_FCR_RFTL4)
178 #define PCH_UART_HAL_TRIGGER8 (PCH_UART_FCR_RFTL8)
179 #define PCH_UART_HAL_TRIGGER14 (PCH_UART_FCR_RFTL14)
180 #define PCH_UART_HAL_TRIGGER_L (PCH_UART_FCR_RFTL64)
181 #define PCH_UART_HAL_TRIGGER_M (PCH_UART_FCR_RFTL128)
182 #define PCH_UART_HAL_TRIGGER_H (PCH_UART_FCR_RFTL224)
184 #define PCH_UART_HAL_RX_INT (PCH_UART_IER_ERBFI)
185 #define PCH_UART_HAL_TX_INT (PCH_UART_IER_ETBEI)
186 #define PCH_UART_HAL_RX_ERR_INT (PCH_UART_IER_ELSI)
187 #define PCH_UART_HAL_MS_INT (PCH_UART_IER_EDSSI)
188 #define PCH_UART_HAL_ALL_INT (PCH_UART_IER_MASK)
190 #define PCH_UART_HAL_DTR (PCH_UART_MCR_DTR)
191 #define PCH_UART_HAL_RTS (PCH_UART_MCR_RTS)
192 #define PCH_UART_HAL_OUT (PCH_UART_MCR_OUT)
193 #define PCH_UART_HAL_LOOP (PCH_UART_MCR_LOOP)
194 #define PCH_UART_HAL_AFE (PCH_UART_MCR_AFE)
196 #define PCI_VENDOR_ID_ROHM 0x10DB
198 struct pch_uart_buffer {
204 struct uart_port port;
206 void __iomem *membase;
207 resource_size_t mapbase;
209 struct pci_dev *pdev;
218 struct pch_uart_buffer rxbuf;
221 unsigned int use_dma;
222 unsigned int use_dma_flag;
223 struct dma_async_tx_descriptor *desc_tx;
224 struct dma_async_tx_descriptor *desc_rx;
225 struct pch_dma_slave param_tx;
226 struct pch_dma_slave param_rx;
227 struct dma_chan *chan_tx;
228 struct dma_chan *chan_rx;
229 struct scatterlist *sg_tx_p;
231 struct scatterlist sg_rx;
234 dma_addr_t rx_buf_dma;
237 static unsigned int default_baud = 9600;
238 static const int trigger_level_256[4] = { 1, 64, 128, 224 };
239 static const int trigger_level_64[4] = { 1, 16, 32, 56 };
240 static const int trigger_level_16[4] = { 1, 4, 8, 14 };
241 static const int trigger_level_1[4] = { 1, 1, 1, 1 };
243 static void pch_uart_hal_request(struct pci_dev *pdev, int fifosize,
246 struct eg20t_port *priv = pci_get_drvdata(pdev);
248 priv->trigger_level = 1;
252 static unsigned int get_msr(struct eg20t_port *priv, void __iomem *base)
254 unsigned int msr = ioread8(base + UART_MSR);
255 priv->dmsr |= msr & PCH_UART_MSR_DELTA;
260 static void pch_uart_hal_enable_interrupt(struct eg20t_port *priv,
263 u8 ier = ioread8(priv->membase + UART_IER);
264 ier |= flag & PCH_UART_IER_MASK;
265 iowrite8(ier, priv->membase + UART_IER);
268 static void pch_uart_hal_disable_interrupt(struct eg20t_port *priv,
271 u8 ier = ioread8(priv->membase + UART_IER);
272 ier &= ~(flag & PCH_UART_IER_MASK);
273 iowrite8(ier, priv->membase + UART_IER);
276 static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud,
277 unsigned int parity, unsigned int bits,
280 unsigned int dll, dlm, lcr;
283 div = DIV_ROUND(priv->base_baud / 16, baud);
284 if (div < 0 || USHRT_MAX <= div) {
285 dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div);
289 dll = (unsigned int)div & 0x00FFU;
290 dlm = ((unsigned int)div >> 8) & 0x00FFU;
292 if (parity & ~(PCH_UART_LCR_PEN | PCH_UART_LCR_EPS | PCH_UART_LCR_SP)) {
293 dev_err(priv->port.dev, "Invalid parity(0x%x)\n", parity);
297 if (bits & ~PCH_UART_LCR_WLS) {
298 dev_err(priv->port.dev, "Invalid bits(0x%x)\n", bits);
302 if (stb & ~PCH_UART_LCR_STB) {
303 dev_err(priv->port.dev, "Invalid STB(0x%x)\n", stb);
311 dev_dbg(priv->port.dev, "%s:baud = %d, div = %04x, lcr = %02x (%lu)\n",
312 __func__, baud, div, lcr, jiffies);
313 iowrite8(PCH_UART_LCR_DLAB, priv->membase + UART_LCR);
314 iowrite8(dll, priv->membase + PCH_UART_DLL);
315 iowrite8(dlm, priv->membase + PCH_UART_DLM);
316 iowrite8(lcr, priv->membase + UART_LCR);
321 static int pch_uart_hal_fifo_reset(struct eg20t_port *priv,
324 if (flag & ~(PCH_UART_FCR_TFR | PCH_UART_FCR_RFR)) {
325 dev_err(priv->port.dev, "%s:Invalid flag(0x%x)\n",
330 iowrite8(PCH_UART_FCR_FIFOE | priv->fcr, priv->membase + UART_FCR);
331 iowrite8(PCH_UART_FCR_FIFOE | priv->fcr | flag,
332 priv->membase + UART_FCR);
333 iowrite8(priv->fcr, priv->membase + UART_FCR);
338 static int pch_uart_hal_set_fifo(struct eg20t_port *priv,
339 unsigned int dmamode,
340 unsigned int fifo_size, unsigned int trigger)
344 if (dmamode & ~PCH_UART_FCR_DMS) {
345 dev_err(priv->port.dev, "%s:Invalid DMA Mode(0x%x)\n",
350 if (fifo_size & ~(PCH_UART_FCR_FIFOE | PCH_UART_FCR_FIFO256)) {
351 dev_err(priv->port.dev, "%s:Invalid FIFO SIZE(0x%x)\n",
352 __func__, fifo_size);
356 if (trigger & ~PCH_UART_FCR_RFTL) {
357 dev_err(priv->port.dev, "%s:Invalid TRIGGER(0x%x)\n",
362 switch (priv->fifo_size) {
364 priv->trigger_level =
365 trigger_level_256[trigger >> PCH_UART_FCR_RFTL_SHIFT];
368 priv->trigger_level =
369 trigger_level_64[trigger >> PCH_UART_FCR_RFTL_SHIFT];
372 priv->trigger_level =
373 trigger_level_16[trigger >> PCH_UART_FCR_RFTL_SHIFT];
376 priv->trigger_level =
377 trigger_level_1[trigger >> PCH_UART_FCR_RFTL_SHIFT];
381 dmamode | fifo_size | trigger | PCH_UART_FCR_RFR | PCH_UART_FCR_TFR;
382 iowrite8(PCH_UART_FCR_FIFOE, priv->membase + UART_FCR);
383 iowrite8(PCH_UART_FCR_FIFOE | PCH_UART_FCR_RFR | PCH_UART_FCR_TFR,
384 priv->membase + UART_FCR);
385 iowrite8(fcr, priv->membase + UART_FCR);
391 static u8 pch_uart_hal_get_modem(struct eg20t_port *priv)
394 return get_msr(priv, priv->membase);
397 static void pch_uart_hal_write(struct eg20t_port *priv,
398 const unsigned char *buf, int tx_size)
403 for (i = 0; i < tx_size;) {
405 iowrite8(thr, priv->membase + PCH_UART_THR);
409 static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf,
415 lsr = ioread8(priv->membase + UART_LSR);
416 for (i = 0, lsr = ioread8(priv->membase + UART_LSR);
417 i < rx_size && lsr & UART_LSR_DR;
418 lsr = ioread8(priv->membase + UART_LSR)) {
419 rbr = ioread8(priv->membase + PCH_UART_RBR);
425 static unsigned int pch_uart_hal_get_iid(struct eg20t_port *priv)
430 iir = ioread8(priv->membase + UART_IIR);
431 ret = (iir & (PCH_UART_IIR_IID | PCH_UART_IIR_TOI | PCH_UART_IIR_IP));
435 static u8 pch_uart_hal_get_line_status(struct eg20t_port *priv)
437 return ioread8(priv->membase + UART_LSR);
440 static void pch_uart_hal_set_break(struct eg20t_port *priv, int on)
444 lcr = ioread8(priv->membase + UART_LCR);
446 lcr |= PCH_UART_LCR_SB;
448 lcr &= ~PCH_UART_LCR_SB;
450 iowrite8(lcr, priv->membase + UART_LCR);
453 static int push_rx(struct eg20t_port *priv, const unsigned char *buf,
456 struct uart_port *port;
457 struct tty_struct *tty;
460 tty = tty_port_tty_get(&port->state->port);
462 dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
466 tty_insert_flip_string(tty, buf, size);
467 tty_flip_buffer_push(tty);
473 static int pop_tx_x(struct eg20t_port *priv, unsigned char *buf)
476 struct uart_port *port = &priv->port;
479 dev_dbg(priv->port.dev, "%s:X character send %02x (%lu)\n",
480 __func__, port->x_char, jiffies);
481 buf[0] = port->x_char;
491 static int dma_push_rx(struct eg20t_port *priv, int size)
493 struct tty_struct *tty;
495 struct uart_port *port = &priv->port;
498 tty = tty_port_tty_get(&port->state->port);
500 dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
504 room = tty_buffer_request_room(tty, size);
507 dev_warn(port->dev, "Rx overrun: dropping %u bytes\n",
512 tty_insert_flip_string(tty, sg_virt(&priv->sg_rx), size);
514 port->icount.rx += room;
520 static void pch_free_dma(struct uart_port *port)
522 struct eg20t_port *priv;
523 priv = container_of(port, struct eg20t_port, port);
526 dma_release_channel(priv->chan_tx);
527 priv->chan_tx = NULL;
530 dma_release_channel(priv->chan_rx);
531 priv->chan_rx = NULL;
533 if (sg_dma_address(&priv->sg_rx))
534 dma_free_coherent(port->dev, port->fifosize,
535 sg_virt(&priv->sg_rx),
536 sg_dma_address(&priv->sg_rx));
541 static bool filter(struct dma_chan *chan, void *slave)
543 struct pch_dma_slave *param = slave;
545 if ((chan->chan_id == param->chan_id) && (param->dma_dev ==
546 chan->device->dev)) {
547 chan->private = param;
554 static void pch_request_dma(struct uart_port *port)
557 struct dma_chan *chan;
558 struct pci_dev *dma_dev;
559 struct pch_dma_slave *param;
560 struct eg20t_port *priv =
561 container_of(port, struct eg20t_port, port);
563 dma_cap_set(DMA_SLAVE, mask);
565 dma_dev = pci_get_bus_and_slot(2, PCI_DEVFN(0xa, 0)); /* Get DMA's dev
568 param = &priv->param_tx;
569 param->dma_dev = &dma_dev->dev;
570 param->chan_id = priv->port.line;
571 param->tx_reg = port->mapbase + UART_TX;
572 chan = dma_request_channel(mask, filter, param);
574 dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Tx)\n",
578 priv->chan_tx = chan;
581 param = &priv->param_rx;
582 param->dma_dev = &dma_dev->dev;
583 param->chan_id = priv->port.line + 1; /* Rx = Tx + 1 */
584 param->rx_reg = port->mapbase + UART_RX;
585 chan = dma_request_channel(mask, filter, param);
587 dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n",
589 dma_release_channel(priv->chan_tx);
593 /* Get Consistent memory for DMA */
594 priv->rx_buf_virt = dma_alloc_coherent(port->dev, port->fifosize,
595 &priv->rx_buf_dma, GFP_KERNEL);
596 priv->chan_rx = chan;
599 static void pch_dma_rx_complete(void *arg)
601 struct eg20t_port *priv = arg;
602 struct uart_port *port = &priv->port;
603 struct tty_struct *tty = tty_port_tty_get(&port->state->port);
607 dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
611 dma_sync_sg_for_cpu(port->dev, &priv->sg_rx, 1, DMA_FROM_DEVICE);
612 count = dma_push_rx(priv, priv->trigger_level);
614 tty_flip_buffer_push(tty);
616 async_tx_ack(priv->desc_rx);
617 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT);
620 static void pch_dma_tx_complete(void *arg)
622 struct eg20t_port *priv = arg;
623 struct uart_port *port = &priv->port;
624 struct circ_buf *xmit = &port->state->xmit;
625 struct scatterlist *sg = priv->sg_tx_p;
628 for (i = 0; i < priv->nent; i++, sg++) {
629 xmit->tail += sg_dma_len(sg);
630 port->icount.tx += sg_dma_len(sg);
632 xmit->tail &= UART_XMIT_SIZE - 1;
633 async_tx_ack(priv->desc_tx);
634 dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE);
635 priv->tx_dma_use = 0;
637 kfree(priv->sg_tx_p);
638 if (uart_circ_chars_pending(xmit))
639 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT);
642 static int pop_tx(struct eg20t_port *priv, int size)
645 struct uart_port *port = &priv->port;
646 struct circ_buf *xmit = &port->state->xmit;
648 if (uart_tx_stopped(port) || uart_circ_empty(xmit) || count >= size)
653 CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
654 int sz = min(size - count, cnt_to_end);
655 pch_uart_hal_write(priv, &xmit->buf[xmit->tail], sz);
656 xmit->tail = (xmit->tail + sz) & (UART_XMIT_SIZE - 1);
658 } while (!uart_circ_empty(xmit) && count < size);
661 dev_dbg(priv->port.dev, "%d characters. Remained %d characters.(%lu)\n",
662 count, size - count, jiffies);
667 static int handle_rx_to(struct eg20t_port *priv)
669 struct pch_uart_buffer *buf;
672 if (!priv->start_rx) {
673 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_RX_INT);
678 rx_size = pch_uart_hal_read(priv, buf->buf, buf->size);
679 ret = push_rx(priv, buf->buf, rx_size);
682 } while (rx_size == buf->size);
684 return PCH_UART_HANDLED_RX_INT;
687 static int handle_rx(struct eg20t_port *priv)
689 return handle_rx_to(priv);
692 static int dma_handle_rx(struct eg20t_port *priv)
694 struct uart_port *port = &priv->port;
695 struct dma_async_tx_descriptor *desc;
696 struct scatterlist *sg;
698 priv = container_of(port, struct eg20t_port, port);
701 sg_init_table(&priv->sg_rx, 1); /* Initialize SG table */
703 sg_dma_len(sg) = priv->trigger_level;
705 sg_set_page(&priv->sg_rx, virt_to_page(priv->rx_buf_virt),
706 sg_dma_len(sg), (unsigned long)priv->rx_buf_virt &
709 sg_dma_address(sg) = priv->rx_buf_dma;
711 desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx,
712 sg, 1, DMA_FROM_DEVICE,
713 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
718 priv->desc_rx = desc;
719 desc->callback = pch_dma_rx_complete;
720 desc->callback_param = priv;
721 desc->tx_submit(desc);
722 dma_async_issue_pending(priv->chan_rx);
724 return PCH_UART_HANDLED_RX_INT;
727 static unsigned int handle_tx(struct eg20t_port *priv)
729 struct uart_port *port = &priv->port;
730 struct circ_buf *xmit = &port->state->xmit;
736 if (!priv->start_tx) {
737 dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n",
739 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
744 fifo_size = max(priv->fifo_size, 1);
746 if (pop_tx_x(priv, xmit->buf)) {
747 pch_uart_hal_write(priv, xmit->buf, 1);
752 size = min(xmit->head - xmit->tail, fifo_size);
756 tx_size = pop_tx(priv, size);
758 port->icount.tx += tx_size;
762 priv->tx_empty = tx_empty;
765 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
766 uart_write_wakeup(port);
769 return PCH_UART_HANDLED_TX_INT;
772 static unsigned int dma_handle_tx(struct eg20t_port *priv)
774 struct uart_port *port = &priv->port;
775 struct circ_buf *xmit = &port->state->xmit;
776 struct scatterlist *sg;
780 struct dma_async_tx_descriptor *desc;
787 if (!priv->start_tx) {
788 dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n",
790 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
795 fifo_size = max(priv->fifo_size, 1);
797 if (pop_tx_x(priv, xmit->buf)) {
798 pch_uart_hal_write(priv, xmit->buf, 1);
804 bytes = min((int)CIRC_CNT(xmit->head, xmit->tail,
805 UART_XMIT_SIZE), CIRC_CNT_TO_END(xmit->head,
806 xmit->tail, UART_XMIT_SIZE));
808 dev_dbg(priv->port.dev, "%s 0 bytes return\n", __func__);
809 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
810 uart_write_wakeup(port);
814 if (bytes > fifo_size) {
815 num = bytes / fifo_size + 1;
817 rem = bytes % fifo_size;
824 dev_dbg(priv->port.dev, "%s num=%d size=%d rem=%d\n",
825 __func__, num, size, rem);
827 priv->tx_dma_use = 1;
829 priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
831 sg_init_table(priv->sg_tx_p, num); /* Initialize SG table */
834 for (i = 0; i < num; i++, sg++) {
836 sg_set_page(sg, virt_to_page(xmit->buf),
839 sg_set_page(sg, virt_to_page(xmit->buf),
840 size, fifo_size * i);
844 nent = dma_map_sg(port->dev, sg, num, DMA_TO_DEVICE);
846 dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__);
851 for (i = 0; i < nent; i++, sg++) {
852 sg->offset = (xmit->tail & (UART_XMIT_SIZE - 1)) +
854 sg_dma_address(sg) = (sg_dma_address(sg) &
855 ~(UART_XMIT_SIZE - 1)) + sg->offset;
857 sg_dma_len(sg) = rem;
859 sg_dma_len(sg) = size;
862 desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx,
863 priv->sg_tx_p, nent, DMA_TO_DEVICE,
864 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
866 dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n",
870 dma_sync_sg_for_device(port->dev, priv->sg_tx_p, nent, DMA_TO_DEVICE);
871 priv->desc_tx = desc;
872 desc->callback = pch_dma_tx_complete;
873 desc->callback_param = priv;
875 desc->tx_submit(desc);
877 dma_async_issue_pending(priv->chan_tx);
879 return PCH_UART_HANDLED_TX_INT;
882 static void pch_uart_err_ir(struct eg20t_port *priv, unsigned int lsr)
884 u8 fcr = ioread8(priv->membase + UART_FCR);
887 fcr |= UART_FCR_CLEAR_RCVR;
888 iowrite8(fcr, priv->membase + UART_FCR);
890 if (lsr & PCH_UART_LSR_ERR)
891 dev_err(&priv->pdev->dev, "Error data in FIFO\n");
893 if (lsr & UART_LSR_FE)
894 dev_err(&priv->pdev->dev, "Framing Error\n");
896 if (lsr & UART_LSR_PE)
897 dev_err(&priv->pdev->dev, "Parity Error\n");
899 if (lsr & UART_LSR_OE)
900 dev_err(&priv->pdev->dev, "Overrun Error\n");
903 static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
905 struct eg20t_port *priv = dev_id;
906 unsigned int handled;
912 spin_lock_irqsave(&priv->port.lock, flags);
914 while ((iid = pch_uart_hal_get_iid(priv)) > 1) {
916 case PCH_UART_IID_RLS: /* Receiver Line Status */
917 lsr = pch_uart_hal_get_line_status(priv);
918 if (lsr & (PCH_UART_LSR_ERR | UART_LSR_FE |
919 UART_LSR_PE | UART_LSR_OE)) {
920 pch_uart_err_ir(priv, lsr);
921 ret = PCH_UART_HANDLED_RX_ERR_INT;
924 case PCH_UART_IID_RDR: /* Received Data Ready */
926 pch_uart_hal_disable_interrupt(priv,
927 PCH_UART_HAL_RX_INT);
928 ret = dma_handle_rx(priv);
930 pch_uart_hal_enable_interrupt(priv,
931 PCH_UART_HAL_RX_INT);
933 ret = handle_rx(priv);
936 case PCH_UART_IID_RDR_TO: /* Received Data Ready
938 ret = handle_rx_to(priv);
940 case PCH_UART_IID_THRE: /* Transmitter Holding Register
943 ret = dma_handle_tx(priv);
945 ret = handle_tx(priv);
947 case PCH_UART_IID_MS: /* Modem Status */
948 ret = PCH_UART_HANDLED_MS_INT;
950 default: /* Never junp to this label */
951 dev_err(priv->port.dev, "%s:iid=%d (%lu)\n", __func__,
956 handled |= (unsigned int)ret;
958 if (handled == 0 && iid <= 1) {
959 if (priv->int_dis_flag)
960 priv->int_dis_flag = 0;
963 spin_unlock_irqrestore(&priv->port.lock, flags);
964 return IRQ_RETVAL(handled);
967 /* This function tests whether the transmitter fifo and shifter for the port
968 described by 'port' is empty. */
969 static unsigned int pch_uart_tx_empty(struct uart_port *port)
971 struct eg20t_port *priv;
973 priv = container_of(port, struct eg20t_port, port);
982 /* Returns the current state of modem control inputs. */
983 static unsigned int pch_uart_get_mctrl(struct uart_port *port)
985 struct eg20t_port *priv;
987 unsigned int ret = 0;
989 priv = container_of(port, struct eg20t_port, port);
990 modem = pch_uart_hal_get_modem(priv);
992 if (modem & UART_MSR_DCD)
995 if (modem & UART_MSR_RI)
998 if (modem & UART_MSR_DSR)
1001 if (modem & UART_MSR_CTS)
1007 static void pch_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
1011 struct eg20t_port *priv = container_of(port, struct eg20t_port, port);
1013 if (mctrl & TIOCM_DTR)
1014 mcr |= UART_MCR_DTR;
1015 if (mctrl & TIOCM_RTS)
1016 mcr |= UART_MCR_RTS;
1017 if (mctrl & TIOCM_LOOP)
1018 mcr |= UART_MCR_LOOP;
1021 dat = pch_uart_get_mctrl(port);
1023 iowrite8(dat, priv->membase + UART_MCR);
1027 static void pch_uart_stop_tx(struct uart_port *port)
1029 struct eg20t_port *priv;
1030 priv = container_of(port, struct eg20t_port, port);
1032 priv->tx_dma_use = 0;
1035 static void pch_uart_start_tx(struct uart_port *port)
1037 struct eg20t_port *priv;
1039 priv = container_of(port, struct eg20t_port, port);
1041 if (priv->use_dma) {
1042 if (priv->tx_dma_use) {
1043 dev_dbg(priv->port.dev, "%s : Tx DMA is NOT empty.\n",
1050 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT);
1053 static void pch_uart_stop_rx(struct uart_port *port)
1055 struct eg20t_port *priv;
1056 priv = container_of(port, struct eg20t_port, port);
1058 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_RX_INT);
1059 priv->int_dis_flag = 1;
1062 /* Enable the modem status interrupts. */
1063 static void pch_uart_enable_ms(struct uart_port *port)
1065 struct eg20t_port *priv;
1066 priv = container_of(port, struct eg20t_port, port);
1067 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_MS_INT);
1070 /* Control the transmission of a break signal. */
1071 static void pch_uart_break_ctl(struct uart_port *port, int ctl)
1073 struct eg20t_port *priv;
1074 unsigned long flags;
1076 priv = container_of(port, struct eg20t_port, port);
1077 spin_lock_irqsave(&port->lock, flags);
1078 pch_uart_hal_set_break(priv, ctl);
1079 spin_unlock_irqrestore(&port->lock, flags);
1082 /* Grab any interrupt resources and initialise any low level driver state. */
1083 static int pch_uart_startup(struct uart_port *port)
1085 struct eg20t_port *priv;
1090 priv = container_of(port, struct eg20t_port, port);
1092 port->uartclk = priv->base_baud;
1093 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_ALL_INT);
1094 ret = pch_uart_hal_set_line(priv, default_baud,
1095 PCH_UART_HAL_PARITY_NONE, PCH_UART_HAL_8BIT,
1100 switch (priv->fifo_size) {
1102 fifo_size = PCH_UART_HAL_FIFO256;
1105 fifo_size = PCH_UART_HAL_FIFO64;
1108 fifo_size = PCH_UART_HAL_FIFO16;
1111 fifo_size = PCH_UART_HAL_FIFO_DIS;
1115 switch (priv->trigger) {
1116 case PCH_UART_HAL_TRIGGER1:
1119 case PCH_UART_HAL_TRIGGER_L:
1120 trigger_level = priv->fifo_size / 4;
1122 case PCH_UART_HAL_TRIGGER_M:
1123 trigger_level = priv->fifo_size / 2;
1125 case PCH_UART_HAL_TRIGGER_H:
1127 trigger_level = priv->fifo_size - (priv->fifo_size / 8);
1131 priv->trigger_level = trigger_level;
1132 ret = pch_uart_hal_set_fifo(priv, PCH_UART_HAL_DMA_MODE0,
1133 fifo_size, priv->trigger);
1137 ret = request_irq(priv->port.irq, pch_uart_interrupt, IRQF_SHARED,
1138 KBUILD_MODNAME, priv);
1143 pch_request_dma(port);
1146 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT);
1147 uart_update_timeout(port, CS8, default_baud);
1152 static void pch_uart_shutdown(struct uart_port *port)
1154 struct eg20t_port *priv;
1157 priv = container_of(port, struct eg20t_port, port);
1158 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_ALL_INT);
1159 pch_uart_hal_fifo_reset(priv, PCH_UART_HAL_CLR_ALL_FIFO);
1160 ret = pch_uart_hal_set_fifo(priv, PCH_UART_HAL_DMA_MODE0,
1161 PCH_UART_HAL_FIFO_DIS, PCH_UART_HAL_TRIGGER1);
1163 dev_err(priv->port.dev,
1164 "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret);
1166 if (priv->use_dma_flag)
1169 free_irq(priv->port.irq, priv);
1172 /* Change the port parameters, including word length, parity, stop
1173 *bits. Update read_status_mask and ignore_status_mask to indicate
1174 *the types of events we are interested in receiving. */
1175 static void pch_uart_set_termios(struct uart_port *port,
1176 struct ktermios *termios, struct ktermios *old)
1180 unsigned int parity, bits, stb;
1181 struct eg20t_port *priv;
1182 unsigned long flags;
1184 priv = container_of(port, struct eg20t_port, port);
1185 switch (termios->c_cflag & CSIZE) {
1187 bits = PCH_UART_HAL_5BIT;
1190 bits = PCH_UART_HAL_6BIT;
1193 bits = PCH_UART_HAL_7BIT;
1196 bits = PCH_UART_HAL_8BIT;
1199 if (termios->c_cflag & CSTOPB)
1200 stb = PCH_UART_HAL_STB2;
1202 stb = PCH_UART_HAL_STB1;
1204 if (termios->c_cflag & PARENB) {
1205 if (!(termios->c_cflag & PARODD))
1206 parity = PCH_UART_HAL_PARITY_ODD;
1208 parity = PCH_UART_HAL_PARITY_EVEN;
1211 parity = PCH_UART_HAL_PARITY_NONE;
1213 termios->c_cflag &= ~CMSPAR; /* Mark/Space parity is not supported */
1215 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
1217 spin_lock_irqsave(&port->lock, flags);
1219 uart_update_timeout(port, termios->c_cflag, baud);
1220 rtn = pch_uart_hal_set_line(priv, baud, parity, bits, stb);
1224 /* Don't rewrite B0 */
1225 if (tty_termios_baud_rate(termios))
1226 tty_termios_encode_baud_rate(termios, baud, baud);
1229 spin_unlock_irqrestore(&port->lock, flags);
1232 static const char *pch_uart_type(struct uart_port *port)
1234 return KBUILD_MODNAME;
1237 static void pch_uart_release_port(struct uart_port *port)
1239 struct eg20t_port *priv;
1241 priv = container_of(port, struct eg20t_port, port);
1242 pci_iounmap(priv->pdev, priv->membase);
1243 pci_release_regions(priv->pdev);
1246 static int pch_uart_request_port(struct uart_port *port)
1248 struct eg20t_port *priv;
1250 void __iomem *membase;
1252 priv = container_of(port, struct eg20t_port, port);
1253 ret = pci_request_regions(priv->pdev, KBUILD_MODNAME);
1257 membase = pci_iomap(priv->pdev, 1, 0);
1259 pci_release_regions(priv->pdev);
1262 priv->membase = port->membase = membase;
1267 static void pch_uart_config_port(struct uart_port *port, int type)
1269 struct eg20t_port *priv;
1271 priv = container_of(port, struct eg20t_port, port);
1272 if (type & UART_CONFIG_TYPE) {
1273 port->type = priv->port_type;
1274 pch_uart_request_port(port);
1278 static int pch_uart_verify_port(struct uart_port *port,
1279 struct serial_struct *serinfo)
1281 struct eg20t_port *priv;
1283 priv = container_of(port, struct eg20t_port, port);
1284 if (serinfo->flags & UPF_LOW_LATENCY) {
1285 dev_info(priv->port.dev,
1286 "PCH UART : Use PIO Mode (without DMA)\n");
1288 serinfo->flags &= ~UPF_LOW_LATENCY;
1290 #ifndef CONFIG_PCH_DMA
1291 dev_err(priv->port.dev, "%s : PCH DMA is not Loaded.\n",
1296 priv->use_dma_flag = 1;
1297 dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n");
1303 static struct uart_ops pch_uart_ops = {
1304 .tx_empty = pch_uart_tx_empty,
1305 .set_mctrl = pch_uart_set_mctrl,
1306 .get_mctrl = pch_uart_get_mctrl,
1307 .stop_tx = pch_uart_stop_tx,
1308 .start_tx = pch_uart_start_tx,
1309 .stop_rx = pch_uart_stop_rx,
1310 .enable_ms = pch_uart_enable_ms,
1311 .break_ctl = pch_uart_break_ctl,
1312 .startup = pch_uart_startup,
1313 .shutdown = pch_uart_shutdown,
1314 .set_termios = pch_uart_set_termios,
1315 /* .pm = pch_uart_pm, Not supported yet */
1316 /* .set_wake = pch_uart_set_wake, Not supported yet */
1317 .type = pch_uart_type,
1318 .release_port = pch_uart_release_port,
1319 .request_port = pch_uart_request_port,
1320 .config_port = pch_uart_config_port,
1321 .verify_port = pch_uart_verify_port
1324 static struct uart_driver pch_uart_driver = {
1325 .owner = THIS_MODULE,
1326 .driver_name = KBUILD_MODNAME,
1327 .dev_name = PCH_UART_DRIVER_DEVICE,
1333 static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1334 const struct pci_device_id *id)
1336 struct eg20t_port *priv;
1338 unsigned int iobase;
1339 unsigned int mapbase;
1340 unsigned char *rxbuf;
1341 int fifosize, base_baud;
1343 int port_type = id->driver_data;
1345 priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL);
1347 goto init_port_alloc_err;
1349 rxbuf = (unsigned char *)__get_free_page(GFP_KERNEL);
1351 goto init_port_free_txbuf;
1353 switch (port_type) {
1355 fifosize = 256; /* EG20T/ML7213: UART0 */
1356 base_baud = 1843200; /* 1.8432MHz */
1359 fifosize = 64; /* EG20T:UART1~3 ML7213: UART1~2*/
1360 base_baud = 1843200; /* 1.8432MHz */
1363 dev_err(&pdev->dev, "Invalid Port Type(=%d)\n", port_type);
1364 goto init_port_hal_free;
1367 iobase = pci_resource_start(pdev, 0);
1368 mapbase = pci_resource_start(pdev, 1);
1369 priv->mapbase = mapbase;
1370 priv->iobase = iobase;
1373 priv->rxbuf.buf = rxbuf;
1374 priv->rxbuf.size = PAGE_SIZE;
1376 priv->fifo_size = fifosize;
1377 priv->base_baud = base_baud;
1378 priv->port_type = PORT_MAX_8250 + port_type + 1;
1379 priv->port.dev = &pdev->dev;
1380 priv->port.iobase = iobase;
1381 priv->port.membase = NULL;
1382 priv->port.mapbase = mapbase;
1383 priv->port.irq = pdev->irq;
1384 priv->port.iotype = UPIO_PORT;
1385 priv->port.ops = &pch_uart_ops;
1386 priv->port.flags = UPF_BOOT_AUTOCONF;
1387 priv->port.fifosize = fifosize;
1388 priv->port.line = num++;
1389 priv->trigger = PCH_UART_HAL_TRIGGER_M;
1391 spin_lock_init(&priv->port.lock);
1393 pci_set_drvdata(pdev, priv);
1394 pch_uart_hal_request(pdev, fifosize, base_baud);
1396 ret = uart_add_one_port(&pch_uart_driver, &priv->port);
1398 goto init_port_hal_free;
1403 free_page((unsigned long)rxbuf);
1404 init_port_free_txbuf:
1406 init_port_alloc_err:
1411 static void pch_uart_exit_port(struct eg20t_port *priv)
1413 uart_remove_one_port(&pch_uart_driver, &priv->port);
1414 pci_set_drvdata(priv->pdev, NULL);
1415 free_page((unsigned long)priv->rxbuf.buf);
1418 static void pch_uart_pci_remove(struct pci_dev *pdev)
1420 struct eg20t_port *priv;
1422 priv = (struct eg20t_port *)pci_get_drvdata(pdev);
1423 pch_uart_exit_port(priv);
1424 pci_disable_device(pdev);
1429 static int pch_uart_pci_suspend(struct pci_dev *pdev, pm_message_t state)
1431 struct eg20t_port *priv = pci_get_drvdata(pdev);
1433 uart_suspend_port(&pch_uart_driver, &priv->port);
1435 pci_save_state(pdev);
1436 pci_set_power_state(pdev, pci_choose_state(pdev, state));
1440 static int pch_uart_pci_resume(struct pci_dev *pdev)
1442 struct eg20t_port *priv = pci_get_drvdata(pdev);
1445 pci_set_power_state(pdev, PCI_D0);
1446 pci_restore_state(pdev);
1448 ret = pci_enable_device(pdev);
1451 "%s-pci_enable_device failed(ret=%d) ", __func__, ret);
1455 uart_resume_port(&pch_uart_driver, &priv->port);
1460 #define pch_uart_pci_suspend NULL
1461 #define pch_uart_pci_resume NULL
1464 static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = {
1465 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8811),
1466 .driver_data = PCH_UART_8LINE},
1467 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8812),
1468 .driver_data = PCH_UART_2LINE},
1469 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8813),
1470 .driver_data = PCH_UART_2LINE},
1471 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8814),
1472 .driver_data = PCH_UART_2LINE},
1473 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8027),
1474 .driver_data = PCH_UART_8LINE},
1475 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8028),
1476 .driver_data = PCH_UART_2LINE},
1477 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8029),
1478 .driver_data = PCH_UART_2LINE},
1482 static int __devinit pch_uart_pci_probe(struct pci_dev *pdev,
1483 const struct pci_device_id *id)
1486 struct eg20t_port *priv;
1488 ret = pci_enable_device(pdev);
1492 priv = pch_uart_init_port(pdev, id);
1495 goto probe_disable_device;
1497 pci_set_drvdata(pdev, priv);
1501 probe_disable_device:
1502 pci_disable_device(pdev);
1507 static struct pci_driver pch_uart_pci_driver = {
1509 .id_table = pch_uart_pci_id,
1510 .probe = pch_uart_pci_probe,
1511 .remove = __devexit_p(pch_uart_pci_remove),
1512 .suspend = pch_uart_pci_suspend,
1513 .resume = pch_uart_pci_resume,
1516 static int __init pch_uart_module_init(void)
1520 /* register as UART driver */
1521 ret = uart_register_driver(&pch_uart_driver);
1525 /* register as PCI driver */
1526 ret = pci_register_driver(&pch_uart_pci_driver);
1528 uart_unregister_driver(&pch_uart_driver);
1532 module_init(pch_uart_module_init);
1534 static void __exit pch_uart_module_exit(void)
1536 pci_unregister_driver(&pch_uart_pci_driver);
1537 uart_unregister_driver(&pch_uart_driver);
1539 module_exit(pch_uart_module_exit);
1541 MODULE_LICENSE("GPL v2");
1542 MODULE_DESCRIPTION("Intel EG20T PCH UART PCI Driver");
1543 module_param(default_baud, uint, S_IRUGO);