1 From 1d2b44b1afa3ef081cd817dbf947d48eb8f5d21a Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Tue, 5 Apr 2011 14:10:57 +0200
4 Subject: [PATCH 09/13] SERIAL: Lantiq: Add driver for MIPS Lantiq SOCs.
6 Signed-off-by: John Crispin <blogic@openwrt.org>
7 Signed-off-by: Ralph Hempel <ralph.hempel@lantiq.com>
8 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 Cc: alan@lxorguk.ukuu.org.uk
10 Cc: linux-mips@linux-mips.org
11 Cc: linux-serial@vger.kernel.org
12 Patchwork: https://patchwork.linux-mips.org/patch/2269/
13 Acked-by: Alan Cox <alan@linux.intel.com>
14 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
16 drivers/tty/serial/Kconfig | 8 +
17 drivers/tty/serial/Makefile | 1 +
18 drivers/tty/serial/lantiq.c | 756 +++++++++++++++++++++++++++++++++++++++++++
19 3 files changed, 765 insertions(+), 0 deletions(-)
20 create mode 100644 drivers/tty/serial/lantiq.c
23 +++ b/drivers/serial/lantiq.c
26 + * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
28 + * This program is free software; you can redistribute it and/or modify it
29 + * under the terms of the GNU General Public License version 2 as published
30 + * by the Free Software Foundation.
32 + * This program is distributed in the hope that it will be useful,
33 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
34 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 + * GNU General Public License for more details.
37 + * You should have received a copy of the GNU General Public License
38 + * along with this program; if not, write to the Free Software
39 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41 + * Copyright (C) 2004 Infineon IFAP DC COM CPE
42 + * Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
43 + * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
44 + * Copyright (C) 2010 Thomas Langer, <thomas.langer@lantiq.com>
47 +#include <linux/slab.h>
48 +#include <linux/module.h>
49 +#include <linux/ioport.h>
50 +#include <linux/init.h>
51 +#include <linux/console.h>
52 +#include <linux/sysrq.h>
53 +#include <linux/device.h>
54 +#include <linux/tty.h>
55 +#include <linux/tty_flip.h>
56 +#include <linux/serial_core.h>
57 +#include <linux/serial.h>
58 +#include <linux/platform_device.h>
59 +#include <linux/io.h>
60 +#include <linux/clk.h>
62 +#include <lantiq_soc.h>
64 +#define PORT_LTQ_ASC 111
66 +#define UART_DUMMY_UER_RX 1
67 +#define DRVNAME "ltq_asc"
69 +#define LTQ_ASC_TBUF (0x0020 + 3)
70 +#define LTQ_ASC_RBUF (0x0024 + 3)
72 +#define LTQ_ASC_TBUF 0x0020
73 +#define LTQ_ASC_RBUF 0x0024
75 +#define LTQ_ASC_FSTAT 0x0048
76 +#define LTQ_ASC_WHBSTATE 0x0018
77 +#define LTQ_ASC_STATE 0x0014
78 +#define LTQ_ASC_IRNCR 0x00F8
79 +#define LTQ_ASC_CLC 0x0000
80 +#define LTQ_ASC_ID 0x0008
81 +#define LTQ_ASC_PISEL 0x0004
82 +#define LTQ_ASC_TXFCON 0x0044
83 +#define LTQ_ASC_RXFCON 0x0040
84 +#define LTQ_ASC_CON 0x0010
85 +#define LTQ_ASC_BG 0x0050
86 +#define LTQ_ASC_IRNREN 0x00F4
88 +#define ASC_IRNREN_TX 0x1
89 +#define ASC_IRNREN_RX 0x2
90 +#define ASC_IRNREN_ERR 0x4
91 +#define ASC_IRNREN_TX_BUF 0x8
92 +#define ASC_IRNCR_TIR 0x1
93 +#define ASC_IRNCR_RIR 0x2
94 +#define ASC_IRNCR_EIR 0x4
96 +#define ASCOPT_CSIZE 0x3
99 +#define ASCCLC_DISS 0x2
100 +#define ASCCLC_RMCMASK 0x0000FF00
101 +#define ASCCLC_RMCOFFSET 8
102 +#define ASCCON_M_8ASYNC 0x0
103 +#define ASCCON_M_7ASYNC 0x2
104 +#define ASCCON_ODD 0x00000020
105 +#define ASCCON_STP 0x00000080
106 +#define ASCCON_BRS 0x00000100
107 +#define ASCCON_FDE 0x00000200
108 +#define ASCCON_R 0x00008000
109 +#define ASCCON_FEN 0x00020000
110 +#define ASCCON_ROEN 0x00080000
111 +#define ASCCON_TOEN 0x00100000
112 +#define ASCSTATE_PE 0x00010000
113 +#define ASCSTATE_FE 0x00020000
114 +#define ASCSTATE_ROE 0x00080000
115 +#define ASCSTATE_ANY (ASCSTATE_ROE|ASCSTATE_PE|ASCSTATE_FE)
116 +#define ASCWHBSTATE_CLRREN 0x00000001
117 +#define ASCWHBSTATE_SETREN 0x00000002
118 +#define ASCWHBSTATE_CLRPE 0x00000004
119 +#define ASCWHBSTATE_CLRFE 0x00000008
120 +#define ASCWHBSTATE_CLRROE 0x00000020
121 +#define ASCTXFCON_TXFEN 0x0001
122 +#define ASCTXFCON_TXFFLU 0x0002
123 +#define ASCTXFCON_TXFITLMASK 0x3F00
124 +#define ASCTXFCON_TXFITLOFF 8
125 +#define ASCRXFCON_RXFEN 0x0001
126 +#define ASCRXFCON_RXFFLU 0x0002
127 +#define ASCRXFCON_RXFITLMASK 0x3F00
128 +#define ASCRXFCON_RXFITLOFF 8
129 +#define ASCFSTAT_RXFFLMASK 0x003F
130 +#define ASCFSTAT_TXFFLMASK 0x3F00
131 +#define ASCFSTAT_TXFREEMASK 0x3F000000
132 +#define ASCFSTAT_TXFREEOFF 24
134 +static void lqasc_tx_chars(struct uart_port *port);
135 +static struct ltq_uart_port *lqasc_port[MAXPORTS];
136 +static struct uart_driver lqasc_reg;
137 +static DEFINE_SPINLOCK(ltq_asc_lock);
139 +struct ltq_uart_port {
140 + struct uart_port port;
142 + unsigned int tx_irq;
143 + unsigned int rx_irq;
144 + unsigned int err_irq;
147 +static inline struct
148 +ltq_uart_port *to_ltq_uart_port(struct uart_port *port)
150 + return container_of(port, struct ltq_uart_port, port);
154 +lqasc_stop_tx(struct uart_port *port)
160 +lqasc_start_tx(struct uart_port *port)
162 + unsigned long flags;
163 + spin_lock_irqsave(<q_asc_lock, flags);
164 + lqasc_tx_chars(port);
165 + spin_unlock_irqrestore(<q_asc_lock, flags);
170 +lqasc_stop_rx(struct uart_port *port)
172 + ltq_w32(ASCWHBSTATE_CLRREN, port->membase + LTQ_ASC_WHBSTATE);
176 +lqasc_enable_ms(struct uart_port *port)
181 +lqasc_rx_chars(struct uart_port *port)
183 + struct tty_struct *tty = tty_port_tty_get(&port->state->port);
184 + unsigned int ch = 0, rsr = 0, fifocnt;
187 + dev_dbg(port->dev, "%s:tty is busy now", __func__);
191 + ltq_r32(port->membase + LTQ_ASC_FSTAT) & ASCFSTAT_RXFFLMASK;
192 + while (fifocnt--) {
193 + u8 flag = TTY_NORMAL;
194 + ch = ltq_r8(port->membase + LTQ_ASC_RBUF);
195 + rsr = (ltq_r32(port->membase + LTQ_ASC_STATE)
196 + & ASCSTATE_ANY) | UART_DUMMY_UER_RX;
197 + tty_flip_buffer_push(tty);
201 + * Note that the error handling code is
202 + * out of the main execution path
204 + if (rsr & ASCSTATE_ANY) {
205 + if (rsr & ASCSTATE_PE) {
206 + port->icount.parity++;
207 + ltq_w32_mask(0, ASCWHBSTATE_CLRPE,
208 + port->membase + LTQ_ASC_WHBSTATE);
209 + } else if (rsr & ASCSTATE_FE) {
210 + port->icount.frame++;
211 + ltq_w32_mask(0, ASCWHBSTATE_CLRFE,
212 + port->membase + LTQ_ASC_WHBSTATE);
214 + if (rsr & ASCSTATE_ROE) {
215 + port->icount.overrun++;
216 + ltq_w32_mask(0, ASCWHBSTATE_CLRROE,
217 + port->membase + LTQ_ASC_WHBSTATE);
220 + rsr &= port->read_status_mask;
222 + if (rsr & ASCSTATE_PE)
224 + else if (rsr & ASCSTATE_FE)
228 + if ((rsr & port->ignore_status_mask) == 0)
229 + tty_insert_flip_char(tty, ch, flag);
231 + if (rsr & ASCSTATE_ROE)
233 + * Overrun is special, since it's reported
234 + * immediately, and doesn't affect the current
237 + tty_insert_flip_char(tty, 0, TTY_OVERRUN);
240 + tty_flip_buffer_push(tty);
246 +lqasc_tx_chars(struct uart_port *port)
248 + struct circ_buf *xmit = &port->state->xmit;
249 + if (uart_tx_stopped(port)) {
250 + lqasc_stop_tx(port);
254 + while (((ltq_r32(port->membase + LTQ_ASC_FSTAT) &
255 + ASCFSTAT_TXFREEMASK) >> ASCFSTAT_TXFREEOFF) != 0) {
256 + if (port->x_char) {
257 + ltq_w8(port->x_char, port->membase + LTQ_ASC_TBUF);
263 + if (uart_circ_empty(xmit))
266 + ltq_w8(port->state->xmit.buf[port->state->xmit.tail],
267 + port->membase + LTQ_ASC_TBUF);
268 + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
272 + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
273 + uart_write_wakeup(port);
277 +lqasc_tx_int(int irq, void *_port)
279 + unsigned long flags;
280 + struct uart_port *port = (struct uart_port *)_port;
281 + spin_lock_irqsave(<q_asc_lock, flags);
282 + ltq_w32(ASC_IRNCR_TIR, port->membase + LTQ_ASC_IRNCR);
283 + spin_unlock_irqrestore(<q_asc_lock, flags);
284 + lqasc_start_tx(port);
285 + return IRQ_HANDLED;
289 +lqasc_err_int(int irq, void *_port)
291 + unsigned long flags;
292 + struct uart_port *port = (struct uart_port *)_port;
293 + spin_lock_irqsave(<q_asc_lock, flags);
294 + /* clear any pending interrupts */
295 + ltq_w32_mask(0, ASCWHBSTATE_CLRPE | ASCWHBSTATE_CLRFE |
296 + ASCWHBSTATE_CLRROE, port->membase + LTQ_ASC_WHBSTATE);
297 + spin_unlock_irqrestore(<q_asc_lock, flags);
298 + return IRQ_HANDLED;
302 +lqasc_rx_int(int irq, void *_port)
304 + unsigned long flags;
305 + struct uart_port *port = (struct uart_port *)_port;
306 + spin_lock_irqsave(<q_asc_lock, flags);
307 + ltq_w32(ASC_IRNCR_RIR, port->membase + LTQ_ASC_IRNCR);
308 + lqasc_rx_chars(port);
309 + spin_unlock_irqrestore(<q_asc_lock, flags);
310 + return IRQ_HANDLED;
314 +lqasc_tx_empty(struct uart_port *port)
317 + status = ltq_r32(port->membase + LTQ_ASC_FSTAT) & ASCFSTAT_TXFFLMASK;
318 + return status ? 0 : TIOCSER_TEMT;
322 +lqasc_get_mctrl(struct uart_port *port)
324 + return TIOCM_CTS | TIOCM_CAR | TIOCM_DSR;
328 +lqasc_set_mctrl(struct uart_port *port, u_int mctrl)
333 +lqasc_break_ctl(struct uart_port *port, int break_state)
338 +lqasc_startup(struct uart_port *port)
340 + struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
343 + port->uartclk = clk_get_rate(ltq_port->clk);
345 + ltq_w32_mask(ASCCLC_DISS | ASCCLC_RMCMASK, (1 << ASCCLC_RMCOFFSET),
346 + port->membase + LTQ_ASC_CLC);
348 + ltq_w32(0, port->membase + LTQ_ASC_PISEL);
350 + ((TXFIFO_FL << ASCTXFCON_TXFITLOFF) & ASCTXFCON_TXFITLMASK) |
351 + ASCTXFCON_TXFEN | ASCTXFCON_TXFFLU,
352 + port->membase + LTQ_ASC_TXFCON);
354 + ((RXFIFO_FL << ASCRXFCON_RXFITLOFF) & ASCRXFCON_RXFITLMASK)
355 + | ASCRXFCON_RXFEN | ASCRXFCON_RXFFLU,
356 + port->membase + LTQ_ASC_RXFCON);
357 + /* make sure other settings are written to hardware before
358 + * setting enable bits
361 + ltq_w32_mask(0, ASCCON_M_8ASYNC | ASCCON_FEN | ASCCON_TOEN |
362 + ASCCON_ROEN, port->membase + LTQ_ASC_CON);
364 + retval = request_irq(ltq_port->tx_irq, lqasc_tx_int,
365 + IRQF_DISABLED, "asc_tx", port);
367 + pr_err("failed to request lqasc_tx_int\n");
371 + retval = request_irq(ltq_port->rx_irq, lqasc_rx_int,
372 + IRQF_DISABLED, "asc_rx", port);
374 + pr_err("failed to request lqasc_rx_int\n");
378 + retval = request_irq(ltq_port->err_irq, lqasc_err_int,
379 + IRQF_DISABLED, "asc_err", port);
381 + pr_err("failed to request lqasc_err_int\n");
385 + ltq_w32(ASC_IRNREN_RX | ASC_IRNREN_ERR | ASC_IRNREN_TX,
386 + port->membase + LTQ_ASC_IRNREN);
390 + free_irq(ltq_port->rx_irq, port);
392 + free_irq(ltq_port->tx_irq, port);
397 +lqasc_shutdown(struct uart_port *port)
399 + struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
400 + free_irq(ltq_port->tx_irq, port);
401 + free_irq(ltq_port->rx_irq, port);
402 + free_irq(ltq_port->err_irq, port);
404 + ltq_w32(0, port->membase + LTQ_ASC_CON);
405 + ltq_w32_mask(ASCRXFCON_RXFEN, ASCRXFCON_RXFFLU,
406 + port->membase + LTQ_ASC_RXFCON);
407 + ltq_w32_mask(ASCTXFCON_TXFEN, ASCTXFCON_TXFFLU,
408 + port->membase + LTQ_ASC_TXFCON);
412 +lqasc_set_termios(struct uart_port *port,
413 + struct ktermios *new, struct ktermios *old)
415 + unsigned int cflag;
416 + unsigned int iflag;
417 + unsigned int divisor;
419 + unsigned int con = 0;
420 + unsigned long flags;
422 + cflag = new->c_cflag;
423 + iflag = new->c_iflag;
425 + switch (cflag & CSIZE) {
427 + con = ASCCON_M_7ASYNC;
433 + new->c_cflag &= ~ CSIZE;
434 + new->c_cflag |= CS8;
435 + con = ASCCON_M_8ASYNC;
439 + cflag &= ~CMSPAR; /* Mark/Space parity is not supported */
441 + if (cflag & CSTOPB)
444 + if (cflag & PARENB) {
445 + if (!(cflag & PARODD))
446 + con &= ~ASCCON_ODD;
451 + port->read_status_mask = ASCSTATE_ROE;
453 + port->read_status_mask |= ASCSTATE_FE | ASCSTATE_PE;
455 + port->ignore_status_mask = 0;
456 + if (iflag & IGNPAR)
457 + port->ignore_status_mask |= ASCSTATE_FE | ASCSTATE_PE;
459 + if (iflag & IGNBRK) {
461 + * If we're ignoring parity and break indicators,
462 + * ignore overruns too (for real raw support).
464 + if (iflag & IGNPAR)
465 + port->ignore_status_mask |= ASCSTATE_ROE;
468 + if ((cflag & CREAD) == 0)
469 + port->ignore_status_mask |= UART_DUMMY_UER_RX;
471 + /* set error signals - framing, parity and overrun, enable receiver */
472 + con |= ASCCON_FEN | ASCCON_TOEN | ASCCON_ROEN;
474 + spin_lock_irqsave(<q_asc_lock, flags);
477 + ltq_w32_mask(0, con, port->membase + LTQ_ASC_CON);
479 + /* Set baud rate - take a divider of 2 into account */
480 + baud = uart_get_baud_rate(port, new, old, 0, port->uartclk / 16);
481 + divisor = uart_get_divisor(port, baud);
482 + divisor = divisor / 2 - 1;
484 + /* disable the baudrate generator */
485 + ltq_w32_mask(ASCCON_R, 0, port->membase + LTQ_ASC_CON);
487 + /* make sure the fractional divider is off */
488 + ltq_w32_mask(ASCCON_FDE, 0, port->membase + LTQ_ASC_CON);
490 + /* set up to use divisor of 2 */
491 + ltq_w32_mask(ASCCON_BRS, 0, port->membase + LTQ_ASC_CON);
493 + /* now we can write the new baudrate into the register */
494 + ltq_w32(divisor, port->membase + LTQ_ASC_BG);
496 + /* turn the baudrate generator back on */
497 + ltq_w32_mask(0, ASCCON_R, port->membase + LTQ_ASC_CON);
500 + ltq_w32(ASCWHBSTATE_SETREN, port->membase + LTQ_ASC_WHBSTATE);
502 + spin_unlock_irqrestore(<q_asc_lock, flags);
504 + /* Don't rewrite B0 */
505 + if (tty_termios_baud_rate(new))
506 + tty_termios_encode_baud_rate(new, baud, baud);
510 +lqasc_type(struct uart_port *port)
512 + if (port->type == PORT_LTQ_ASC)
519 +lqasc_release_port(struct uart_port *port)
521 + if (port->flags & UPF_IOREMAP) {
522 + iounmap(port->membase);
523 + port->membase = NULL;
528 +lqasc_request_port(struct uart_port *port)
530 + struct platform_device *pdev = to_platform_device(port->dev);
531 + struct resource *res;
534 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
536 + dev_err(&pdev->dev, "cannot obtain I/O memory region");
539 + size = resource_size(res);
541 + res = devm_request_mem_region(&pdev->dev, res->start,
542 + size, dev_name(&pdev->dev));
544 + dev_err(&pdev->dev, "cannot request I/O memory region");
548 + if (port->flags & UPF_IOREMAP) {
549 + port->membase = devm_ioremap_nocache(&pdev->dev,
550 + port->mapbase, size);
551 + if (port->membase == NULL)
558 +lqasc_config_port(struct uart_port *port, int flags)
560 + if (flags & UART_CONFIG_TYPE) {
561 + port->type = PORT_LTQ_ASC;
562 + lqasc_request_port(port);
567 +lqasc_verify_port(struct uart_port *port,
568 + struct serial_struct *ser)
571 + if (ser->type != PORT_UNKNOWN && ser->type != PORT_LTQ_ASC)
573 + if (ser->irq < 0 || ser->irq >= NR_IRQS)
575 + if (ser->baud_base < 9600)
580 +static struct uart_ops lqasc_pops = {
581 + .tx_empty = lqasc_tx_empty,
582 + .set_mctrl = lqasc_set_mctrl,
583 + .get_mctrl = lqasc_get_mctrl,
584 + .stop_tx = lqasc_stop_tx,
585 + .start_tx = lqasc_start_tx,
586 + .stop_rx = lqasc_stop_rx,
587 + .enable_ms = lqasc_enable_ms,
588 + .break_ctl = lqasc_break_ctl,
589 + .startup = lqasc_startup,
590 + .shutdown = lqasc_shutdown,
591 + .set_termios = lqasc_set_termios,
592 + .type = lqasc_type,
593 + .release_port = lqasc_release_port,
594 + .request_port = lqasc_request_port,
595 + .config_port = lqasc_config_port,
596 + .verify_port = lqasc_verify_port,
600 +lqasc_console_putchar(struct uart_port *port, int ch)
604 + if (!port->membase)
608 + fifofree = (ltq_r32(port->membase + LTQ_ASC_FSTAT)
609 + & ASCFSTAT_TXFREEMASK) >> ASCFSTAT_TXFREEOFF;
610 + } while (fifofree == 0);
611 + ltq_w8(ch, port->membase + LTQ_ASC_TBUF);
616 +lqasc_console_write(struct console *co, const char *s, u_int count)
618 + struct ltq_uart_port *ltq_port;
619 + struct uart_port *port;
620 + unsigned long flags;
622 + if (co->index >= MAXPORTS)
625 + ltq_port = lqasc_port[co->index];
629 + port = <q_port->port;
631 + spin_lock_irqsave(<q_asc_lock, flags);
632 + uart_console_write(port, s, count, lqasc_console_putchar);
633 + spin_unlock_irqrestore(<q_asc_lock, flags);
637 +lqasc_console_setup(struct console *co, char *options)
639 + struct ltq_uart_port *ltq_port;
640 + struct uart_port *port;
646 + if (co->index >= MAXPORTS)
649 + ltq_port = lqasc_port[co->index];
653 + port = <q_port->port;
655 + port->uartclk = clk_get_rate(ltq_port->clk);
658 + uart_parse_options(options, &baud, &parity, &bits, &flow);
659 + return uart_set_options(port, co, baud, parity, bits, flow);
662 +static struct console lqasc_console = {
664 + .write = lqasc_console_write,
665 + .device = uart_console_device,
666 + .setup = lqasc_console_setup,
667 + .flags = CON_PRINTBUFFER,
669 + .data = &lqasc_reg,
673 +lqasc_console_init(void)
675 + register_console(&lqasc_console);
678 +console_initcall(lqasc_console_init);
680 +static struct uart_driver lqasc_reg = {
681 + .owner = THIS_MODULE,
682 + .driver_name = DRVNAME,
683 + .dev_name = "ttyLTQ",
687 + .cons = &lqasc_console,
691 +lqasc_probe(struct platform_device *pdev)
693 + struct ltq_uart_port *ltq_port;
694 + struct uart_port *port;
695 + struct resource *mmres, *irqres;
696 + int tx_irq, rx_irq, err_irq;
700 + mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
701 + irqres = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
702 + if (!mmres || !irqres)
705 + if (pdev->id >= MAXPORTS)
708 + if (lqasc_port[pdev->id] != NULL)
711 + clk = clk_get(&pdev->dev, "fpi");
713 + pr_err("failed to get fpi clk\n");
717 + tx_irq = platform_get_irq_byname(pdev, "tx");
718 + rx_irq = platform_get_irq_byname(pdev, "rx");
719 + err_irq = platform_get_irq_byname(pdev, "err");
720 + if ((tx_irq < 0) | (rx_irq < 0) | (err_irq < 0))
723 + ltq_port = kzalloc(sizeof(struct ltq_uart_port), GFP_KERNEL);
727 + port = <q_port->port;
729 + port->iotype = SERIAL_IO_MEM;
730 + port->flags = ASYNC_BOOT_AUTOCONF | UPF_IOREMAP;
731 + port->ops = &lqasc_pops;
732 + port->fifosize = 16;
733 + port->type = PORT_LTQ_ASC,
734 + port->line = pdev->id;
735 + port->dev = &pdev->dev;
737 + port->irq = tx_irq; /* unused, just to be backward-compatibe */
738 + port->mapbase = mmres->start;
740 + ltq_port->clk = clk;
742 + ltq_port->tx_irq = tx_irq;
743 + ltq_port->rx_irq = rx_irq;
744 + ltq_port->err_irq = err_irq;
746 + lqasc_port[pdev->id] = ltq_port;
747 + platform_set_drvdata(pdev, ltq_port);
749 + ret = uart_add_one_port(&lqasc_reg, port);
754 +static struct platform_driver lqasc_driver = {
757 + .owner = THIS_MODULE,
766 + ret = uart_register_driver(&lqasc_reg);
770 + ret = platform_driver_probe(&lqasc_driver, lqasc_probe);
772 + uart_unregister_driver(&lqasc_reg);
777 +module_init(init_lqasc);
779 +MODULE_DESCRIPTION("Lantiq serial port driver");
780 +MODULE_LICENSE("GPL");
781 --- a/drivers/serial/Kconfig
782 +++ b/drivers/serial/Kconfig
783 @@ -1383,6 +1383,14 @@
785 Support for Console on the NWP serial ports.
787 +config SERIAL_LANTIQ
788 + bool "Lantiq serial driver"
791 + select SERIAL_CORE_CONSOLE
793 + Support for console and UART on Lantiq SoCs.
796 tristate "Freescale QUICC Engine serial port support"
797 depends on QUICC_ENGINE
798 --- a/drivers/serial/Makefile
799 +++ b/drivers/serial/Makefile
801 obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
802 obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
803 obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o
804 +obj-$(CONFIG_SERIAL_LANTIQ) += lantiq.o