2 * st-asc.c: ST Asynchronous serial controller (ASC) driver
4 * Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
13 #if defined(CONFIG_SERIAL_ST_ASC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
17 #include <linux/module.h>
18 #include <linux/serial.h>
19 #include <linux/console.h>
20 #include <linux/sysrq.h>
21 #include <linux/platform_device.h>
23 #include <linux/irq.h>
24 #include <linux/tty.h>
25 #include <linux/tty_flip.h>
26 #include <linux/delay.h>
27 #include <linux/spinlock.h>
28 #include <linux/pm_runtime.h>
30 #include <linux/of_platform.h>
31 #include <linux/serial_core.h>
32 #include <linux/clk.h>
34 #define DRIVER_NAME "st-asc"
35 #define ASC_SERIAL_NAME "ttyAS"
36 #define ASC_FIFO_SIZE 16
37 #define ASC_MAX_PORTS 8
40 struct uart_port port;
42 unsigned int hw_flow_control:1;
43 unsigned int force_m1:1;
46 static struct asc_port asc_ports[ASC_MAX_PORTS];
47 static struct uart_driver asc_uart_driver;
49 /*---- UART Register definitions ------------------------------*/
51 /* Register offsets */
53 #define ASC_BAUDRATE 0x00
54 #define ASC_TXBUF 0x04
55 #define ASC_RXBUF 0x08
57 #define ASC_INTEN 0x10
59 #define ASC_GUARDTIME 0x18
60 #define ASC_TIMEOUT 0x1C
61 #define ASC_TXRESET 0x20
62 #define ASC_RXRESET 0x24
63 #define ASC_RETRIES 0x28
66 #define ASC_RXBUF_PE 0x100
67 #define ASC_RXBUF_FE 0x200
69 * Some of status comes from higher bits of the character and some come from
70 * the status register. Combining both of them in to single status using dummy
73 #define ASC_RXBUF_DUMMY_RX 0x10000
74 #define ASC_RXBUF_DUMMY_BE 0x20000
75 #define ASC_RXBUF_DUMMY_OE 0x40000
79 #define ASC_CTL_MODE_MSK 0x0007
80 #define ASC_CTL_MODE_8BIT 0x0001
81 #define ASC_CTL_MODE_7BIT_PAR 0x0003
82 #define ASC_CTL_MODE_9BIT 0x0004
83 #define ASC_CTL_MODE_8BIT_WKUP 0x0005
84 #define ASC_CTL_MODE_8BIT_PAR 0x0007
85 #define ASC_CTL_STOP_MSK 0x0018
86 #define ASC_CTL_STOP_HALFBIT 0x0000
87 #define ASC_CTL_STOP_1BIT 0x0008
88 #define ASC_CTL_STOP_1_HALFBIT 0x0010
89 #define ASC_CTL_STOP_2BIT 0x0018
90 #define ASC_CTL_PARITYODD 0x0020
91 #define ASC_CTL_LOOPBACK 0x0040
92 #define ASC_CTL_RUN 0x0080
93 #define ASC_CTL_RXENABLE 0x0100
94 #define ASC_CTL_SCENABLE 0x0200
95 #define ASC_CTL_FIFOENABLE 0x0400
96 #define ASC_CTL_CTSENABLE 0x0800
97 #define ASC_CTL_BAUDMODE 0x1000
101 #define ASC_GUARDTIME_MSK 0x00FF
105 #define ASC_INTEN_RBE 0x0001
106 #define ASC_INTEN_TE 0x0002
107 #define ASC_INTEN_THE 0x0004
108 #define ASC_INTEN_PE 0x0008
109 #define ASC_INTEN_FE 0x0010
110 #define ASC_INTEN_OE 0x0020
111 #define ASC_INTEN_TNE 0x0040
112 #define ASC_INTEN_TOI 0x0080
113 #define ASC_INTEN_RHF 0x0100
117 #define ASC_RETRIES_MSK 0x00FF
121 #define ASC_RXBUF_MSK 0x03FF
125 #define ASC_STA_RBF 0x0001
126 #define ASC_STA_TE 0x0002
127 #define ASC_STA_THE 0x0004
128 #define ASC_STA_PE 0x0008
129 #define ASC_STA_FE 0x0010
130 #define ASC_STA_OE 0x0020
131 #define ASC_STA_TNE 0x0040
132 #define ASC_STA_TOI 0x0080
133 #define ASC_STA_RHF 0x0100
134 #define ASC_STA_TF 0x0200
135 #define ASC_STA_NKD 0x0400
139 #define ASC_TIMEOUT_MSK 0x00FF
143 #define ASC_TXBUF_MSK 0x01FF
145 /*---- Inline function definitions ---------------------------*/
147 static inline struct asc_port *to_asc_port(struct uart_port *port)
149 return container_of(port, struct asc_port, port);
152 static inline u32 asc_in(struct uart_port *port, u32 offset)
154 return readl(port->membase + offset);
157 static inline void asc_out(struct uart_port *port, u32 offset, u32 value)
159 writel(value, port->membase + offset);
163 * Some simple utility functions to enable and disable interrupts.
164 * Note that these need to be called with interrupts disabled.
166 static inline void asc_disable_tx_interrupts(struct uart_port *port)
168 u32 intenable = asc_in(port, ASC_INTEN) & ~ASC_INTEN_THE;
169 asc_out(port, ASC_INTEN, intenable);
170 (void)asc_in(port, ASC_INTEN); /* Defeat bus write posting */
173 static inline void asc_enable_tx_interrupts(struct uart_port *port)
175 u32 intenable = asc_in(port, ASC_INTEN) | ASC_INTEN_THE;
176 asc_out(port, ASC_INTEN, intenable);
179 static inline void asc_disable_rx_interrupts(struct uart_port *port)
181 u32 intenable = asc_in(port, ASC_INTEN) & ~ASC_INTEN_RBE;
182 asc_out(port, ASC_INTEN, intenable);
183 (void)asc_in(port, ASC_INTEN); /* Defeat bus write posting */
186 static inline void asc_enable_rx_interrupts(struct uart_port *port)
188 u32 intenable = asc_in(port, ASC_INTEN) | ASC_INTEN_RBE;
189 asc_out(port, ASC_INTEN, intenable);
192 static inline u32 asc_txfifo_is_empty(struct uart_port *port)
194 return asc_in(port, ASC_STA) & ASC_STA_TE;
197 static inline u32 asc_txfifo_is_half_empty(struct uart_port *port)
199 return asc_in(port, ASC_STA) & ASC_STA_THE;
202 static inline const char *asc_port_name(struct uart_port *port)
204 return to_platform_device(port->dev)->name;
207 /*----------------------------------------------------------------------*/
210 * This section contains code to support the use of the ASC as a
211 * generic serial port.
214 static inline unsigned asc_hw_txroom(struct uart_port *port)
216 u32 status = asc_in(port, ASC_STA);
218 if (status & ASC_STA_THE)
219 return port->fifosize / 2;
220 else if (!(status & ASC_STA_TF))
227 * Start transmitting chars.
228 * This is called from both interrupt and task level.
229 * Either way interrupts are disabled.
231 static void asc_transmit_chars(struct uart_port *port)
233 struct circ_buf *xmit = &port->state->xmit;
237 txroom = asc_hw_txroom(port);
239 if ((txroom != 0) && port->x_char) {
242 asc_out(port, ASC_TXBUF, c);
244 txroom = asc_hw_txroom(port);
247 if (uart_tx_stopped(port)) {
249 * We should try and stop the hardware here, but I
250 * don't think the ASC has any way to do that.
252 asc_disable_tx_interrupts(port);
256 if (uart_circ_empty(xmit)) {
257 asc_disable_tx_interrupts(port);
265 c = xmit->buf[xmit->tail];
266 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
267 asc_out(port, ASC_TXBUF, c);
270 } while ((txroom > 0) && (!uart_circ_empty(xmit)));
272 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
273 uart_write_wakeup(port);
275 if (uart_circ_empty(xmit))
276 asc_disable_tx_interrupts(port);
279 static void asc_receive_chars(struct uart_port *port)
281 struct tty_port *tport = &port->state->port;
282 unsigned long status;
287 pm_wakeup_event(tport->tty->dev, 0);
289 while ((status = asc_in(port, ASC_STA)) & ASC_STA_RBF) {
290 c = asc_in(port, ASC_RXBUF) | ASC_RXBUF_DUMMY_RX;
294 if ((c & (ASC_RXBUF_FE | ASC_RXBUF_PE)) ||
295 status & ASC_STA_OE) {
297 if (c & ASC_RXBUF_FE) {
298 if (c == (ASC_RXBUF_FE | ASC_RXBUF_DUMMY_RX)) {
300 if (uart_handle_break(port))
302 c |= ASC_RXBUF_DUMMY_BE;
304 port->icount.frame++;
306 } else if (c & ASC_RXBUF_PE) {
307 port->icount.parity++;
310 * Reading any data from the RX FIFO clears the
311 * overflow error condition.
313 if (status & ASC_STA_OE) {
314 port->icount.overrun++;
315 c |= ASC_RXBUF_DUMMY_OE;
318 c &= port->read_status_mask;
320 if (c & ASC_RXBUF_DUMMY_BE)
322 else if (c & ASC_RXBUF_PE)
324 else if (c & ASC_RXBUF_FE)
328 if (uart_handle_sysrq_char(port, c & 0xff))
331 uart_insert_char(port, c, ASC_RXBUF_DUMMY_OE, c & 0xff, flag);
334 /* Tell the rest of the system the news. New characters! */
335 tty_flip_buffer_push(tport);
338 static irqreturn_t asc_interrupt(int irq, void *ptr)
340 struct uart_port *port = ptr;
343 spin_lock(&port->lock);
345 status = asc_in(port, ASC_STA);
347 if (status & ASC_STA_RBF) {
348 /* Receive FIFO not empty */
349 asc_receive_chars(port);
352 if ((status & ASC_STA_THE) &&
353 (asc_in(port, ASC_INTEN) & ASC_INTEN_THE)) {
354 /* Transmitter FIFO at least half empty */
355 asc_transmit_chars(port);
358 spin_unlock(&port->lock);
363 /*----------------------------------------------------------------------*/
369 static unsigned int asc_tx_empty(struct uart_port *port)
371 return asc_txfifo_is_empty(port) ? TIOCSER_TEMT : 0;
374 static void asc_set_mctrl(struct uart_port *port, unsigned int mctrl)
377 * This routine is used for seting signals of: DTR, DCD, CTS/RTS
378 * We use ASC's hardware for CTS/RTS, so don't need any for that.
379 * Some boards have DTR and DCD implemented using PIO pins,
380 * code to do this should be hooked in here.
384 static unsigned int asc_get_mctrl(struct uart_port *port)
387 * This routine is used for geting signals of: DTR, DCD, DSR, RI,
390 return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
393 /* There are probably characters waiting to be transmitted. */
394 static void asc_start_tx(struct uart_port *port)
396 struct circ_buf *xmit = &port->state->xmit;
398 if (!uart_circ_empty(xmit))
399 asc_enable_tx_interrupts(port);
403 static void asc_stop_tx(struct uart_port *port)
405 asc_disable_tx_interrupts(port);
409 static void asc_stop_rx(struct uart_port *port)
411 asc_disable_rx_interrupts(port);
414 /* Handle breaks - ignored by us */
415 static void asc_break_ctl(struct uart_port *port, int break_state)
417 /* Nothing here yet .. */
421 * Enable port for reception.
423 static int asc_startup(struct uart_port *port)
425 if (request_irq(port->irq, asc_interrupt, IRQF_NO_SUSPEND,
426 asc_port_name(port), port)) {
427 dev_err(port->dev, "cannot allocate irq.\n");
431 asc_transmit_chars(port);
432 asc_enable_rx_interrupts(port);
437 static void asc_shutdown(struct uart_port *port)
439 asc_disable_tx_interrupts(port);
440 asc_disable_rx_interrupts(port);
441 free_irq(port->irq, port);
444 static void asc_pm(struct uart_port *port, unsigned int state,
445 unsigned int oldstate)
447 struct asc_port *ascport = to_asc_port(port);
448 unsigned long flags = 0;
452 case UART_PM_STATE_ON:
453 clk_prepare_enable(ascport->clk);
455 case UART_PM_STATE_OFF:
457 * Disable the ASC baud rate generator, which is as close as
458 * we can come to turning it off. Note this is not called with
459 * the port spinlock held.
461 spin_lock_irqsave(&port->lock, flags);
462 ctl = asc_in(port, ASC_CTL) & ~ASC_CTL_RUN;
463 asc_out(port, ASC_CTL, ctl);
464 spin_unlock_irqrestore(&port->lock, flags);
465 clk_disable_unprepare(ascport->clk);
470 static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
471 struct ktermios *old)
473 struct asc_port *ascport = to_asc_port(port);
479 /* Update termios to reflect hardware capabilities */
480 termios->c_cflag &= ~(CMSPAR |
481 (ascport->hw_flow_control ? 0 : CRTSCTS));
483 port->uartclk = clk_get_rate(ascport->clk);
485 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
486 cflag = termios->c_cflag;
488 spin_lock_irqsave(&port->lock, flags);
490 /* read control register */
491 ctrl_val = asc_in(port, ASC_CTL);
493 /* stop serial port and reset value */
494 asc_out(port, ASC_CTL, (ctrl_val & ~ASC_CTL_RUN));
495 ctrl_val = ASC_CTL_RXENABLE | ASC_CTL_FIFOENABLE;
497 /* reset fifo rx & tx */
498 asc_out(port, ASC_TXRESET, 1);
499 asc_out(port, ASC_RXRESET, 1);
501 /* set character length */
502 if ((cflag & CSIZE) == CS7) {
503 ctrl_val |= ASC_CTL_MODE_7BIT_PAR;
505 ctrl_val |= (cflag & PARENB) ? ASC_CTL_MODE_8BIT_PAR :
510 ctrl_val |= (cflag & CSTOPB) ? ASC_CTL_STOP_2BIT : ASC_CTL_STOP_1BIT;
514 ctrl_val |= ASC_CTL_PARITYODD;
516 /* hardware flow control */
517 if ((cflag & CRTSCTS))
518 ctrl_val |= ASC_CTL_CTSENABLE;
520 if ((baud < 19200) && !ascport->force_m1) {
521 asc_out(port, ASC_BAUDRATE, (port->uartclk / (16 * baud)));
524 * MODE 1: recommended for high bit rates (above 19.2K)
526 * baudrate * 16 * 2^16
527 * ASCBaudRate = ------------------------
530 * To keep maths inside 64bits, we divide inputclock by 16.
532 u64 dividend = (u64)baud * (1 << 16);
534 do_div(dividend, port->uartclk / 16);
535 asc_out(port, ASC_BAUDRATE, dividend);
536 ctrl_val |= ASC_CTL_BAUDMODE;
539 uart_update_timeout(port, cflag, baud);
541 ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE;
542 if (termios->c_iflag & INPCK)
543 ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
544 if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
545 ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE;
548 * Characters to ignore
550 ascport->port.ignore_status_mask = 0;
551 if (termios->c_iflag & IGNPAR)
552 ascport->port.ignore_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
553 if (termios->c_iflag & IGNBRK) {
554 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_BE;
556 * If we're ignoring parity and break indicators,
557 * ignore overruns too (for real raw support).
559 if (termios->c_iflag & IGNPAR)
560 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_OE;
564 * Ignore all characters if CREAD is not set.
566 if (!(termios->c_cflag & CREAD))
567 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_RX;
569 /* Set the timeout */
570 asc_out(port, ASC_TIMEOUT, 20);
572 /* write final value and enable port */
573 asc_out(port, ASC_CTL, (ctrl_val | ASC_CTL_RUN));
575 spin_unlock_irqrestore(&port->lock, flags);
578 static const char *asc_type(struct uart_port *port)
580 return (port->type == PORT_ASC) ? DRIVER_NAME : NULL;
583 static void asc_release_port(struct uart_port *port)
587 static int asc_request_port(struct uart_port *port)
593 * Called when the port is opened, and UPF_BOOT_AUTOCONF flag is set
594 * Set type field if successful
596 static void asc_config_port(struct uart_port *port, int flags)
598 if ((flags & UART_CONFIG_TYPE))
599 port->type = PORT_ASC;
603 asc_verify_port(struct uart_port *port, struct serial_struct *ser)
605 /* No user changeable parameters */
609 #ifdef CONFIG_CONSOLE_POLL
611 * Console polling routines for writing and reading from the uart while
612 * in an interrupt or debug context (i.e. kgdb).
615 static int asc_get_poll_char(struct uart_port *port)
617 if (!(asc_in(port, ASC_STA) & ASC_STA_RBF))
620 return asc_in(port, ASC_RXBUF);
623 static void asc_put_poll_char(struct uart_port *port, unsigned char c)
625 while (!asc_txfifo_is_half_empty(port))
627 asc_out(port, ASC_TXBUF, c);
630 #endif /* CONFIG_CONSOLE_POLL */
632 /*---------------------------------------------------------------------*/
634 static struct uart_ops asc_uart_ops = {
635 .tx_empty = asc_tx_empty,
636 .set_mctrl = asc_set_mctrl,
637 .get_mctrl = asc_get_mctrl,
638 .start_tx = asc_start_tx,
639 .stop_tx = asc_stop_tx,
640 .stop_rx = asc_stop_rx,
641 .break_ctl = asc_break_ctl,
642 .startup = asc_startup,
643 .shutdown = asc_shutdown,
644 .set_termios = asc_set_termios,
646 .release_port = asc_release_port,
647 .request_port = asc_request_port,
648 .config_port = asc_config_port,
649 .verify_port = asc_verify_port,
651 #ifdef CONFIG_CONSOLE_POLL
652 .poll_get_char = asc_get_poll_char,
653 .poll_put_char = asc_put_poll_char,
654 #endif /* CONFIG_CONSOLE_POLL */
657 static int asc_init_port(struct asc_port *ascport,
658 struct platform_device *pdev)
660 struct uart_port *port = &ascport->port;
661 struct resource *res;
663 port->iotype = UPIO_MEM;
664 port->flags = UPF_BOOT_AUTOCONF;
665 port->ops = &asc_uart_ops;
666 port->fifosize = ASC_FIFO_SIZE;
667 port->dev = &pdev->dev;
668 port->irq = platform_get_irq(pdev, 0);
670 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
671 port->membase = devm_ioremap_resource(&pdev->dev, res);
672 if (IS_ERR(port->membase))
673 return PTR_ERR(port->membase);
674 port->mapbase = res->start;
676 spin_lock_init(&port->lock);
678 ascport->clk = devm_clk_get(&pdev->dev, NULL);
680 if (WARN_ON(IS_ERR(ascport->clk)))
682 /* ensure that clk rate is correct by enabling the clk */
683 clk_prepare_enable(ascport->clk);
684 ascport->port.uartclk = clk_get_rate(ascport->clk);
685 WARN_ON(ascport->port.uartclk == 0);
686 clk_disable_unprepare(ascport->clk);
691 static struct asc_port *asc_of_get_asc_port(struct platform_device *pdev)
693 struct device_node *np = pdev->dev.of_node;
699 id = of_alias_get_id(np, ASC_SERIAL_NAME);
704 if (WARN_ON(id >= ASC_MAX_PORTS))
707 asc_ports[id].hw_flow_control = of_property_read_bool(np,
708 "st,hw-flow-control");
709 asc_ports[id].force_m1 = of_property_read_bool(np, "st,force_m1");
710 asc_ports[id].port.line = id;
711 return &asc_ports[id];
715 static struct of_device_id asc_match[] = {
716 { .compatible = "st,asc", },
720 MODULE_DEVICE_TABLE(of, asc_match);
723 static int asc_serial_probe(struct platform_device *pdev)
726 struct asc_port *ascport;
728 ascport = asc_of_get_asc_port(pdev);
732 ret = asc_init_port(ascport, pdev);
736 ret = uart_add_one_port(&asc_uart_driver, &ascport->port);
740 platform_set_drvdata(pdev, &ascport->port);
745 static int asc_serial_remove(struct platform_device *pdev)
747 struct uart_port *port = platform_get_drvdata(pdev);
749 return uart_remove_one_port(&asc_uart_driver, port);
752 #ifdef CONFIG_PM_SLEEP
753 static int asc_serial_suspend(struct device *dev)
755 struct platform_device *pdev = to_platform_device(dev);
756 struct uart_port *port = platform_get_drvdata(pdev);
758 return uart_suspend_port(&asc_uart_driver, port);
761 static int asc_serial_resume(struct device *dev)
763 struct platform_device *pdev = to_platform_device(dev);
764 struct uart_port *port = platform_get_drvdata(pdev);
766 return uart_resume_port(&asc_uart_driver, port);
769 #endif /* CONFIG_PM_SLEEP */
771 /*----------------------------------------------------------------------*/
773 #ifdef CONFIG_SERIAL_ST_ASC_CONSOLE
774 static void asc_console_putchar(struct uart_port *port, int ch)
776 unsigned int timeout = 1000000;
778 /* Wait for upto 1 second in case flow control is stopping us. */
779 while (--timeout && !asc_txfifo_is_half_empty(port))
782 asc_out(port, ASC_TXBUF, ch);
786 * Print a string to the serial port trying not to disturb
787 * any possible real use of the port...
790 static void asc_console_write(struct console *co, const char *s, unsigned count)
792 struct uart_port *port = &asc_ports[co->index].port;
794 unsigned long timeout = 1000000;
798 local_irq_save(flags);
800 locked = 0; /* asc_interrupt has already claimed the lock */
801 else if (oops_in_progress)
802 locked = spin_trylock(&port->lock);
804 spin_lock(&port->lock);
807 * Disable interrupts so we don't get the IRQ line bouncing
808 * up and down while interrupts are disabled.
810 intenable = asc_in(port, ASC_INTEN);
811 asc_out(port, ASC_INTEN, 0);
812 (void)asc_in(port, ASC_INTEN); /* Defeat bus write posting */
814 uart_console_write(port, s, count, asc_console_putchar);
816 while (--timeout && !asc_txfifo_is_empty(port))
819 asc_out(port, ASC_INTEN, intenable);
822 spin_unlock(&port->lock);
823 local_irq_restore(flags);
826 static int asc_console_setup(struct console *co, char *options)
828 struct asc_port *ascport;
834 if (co->index >= ASC_MAX_PORTS)
837 ascport = &asc_ports[co->index];
840 * This driver does not support early console initialization
841 * (use ARM early printk support instead), so we only expect
842 * this to be called during the uart port registration when the
843 * driver gets probed and the port should be mapped at that point.
845 if (ascport->port.mapbase == 0 || ascport->port.membase == NULL)
849 uart_parse_options(options, &baud, &parity, &bits, &flow);
851 return uart_set_options(&ascport->port, co, baud, parity, bits, flow);
854 static struct console asc_console = {
855 .name = ASC_SERIAL_NAME,
856 .device = uart_console_device,
857 .write = asc_console_write,
858 .setup = asc_console_setup,
859 .flags = CON_PRINTBUFFER,
861 .data = &asc_uart_driver,
864 #define ASC_SERIAL_CONSOLE (&asc_console)
867 #define ASC_SERIAL_CONSOLE NULL
868 #endif /* CONFIG_SERIAL_ST_ASC_CONSOLE */
870 static struct uart_driver asc_uart_driver = {
871 .owner = THIS_MODULE,
872 .driver_name = DRIVER_NAME,
873 .dev_name = ASC_SERIAL_NAME,
877 .cons = ASC_SERIAL_CONSOLE,
880 static const struct dev_pm_ops asc_serial_pm_ops = {
881 SET_SYSTEM_SLEEP_PM_OPS(asc_serial_suspend, asc_serial_resume)
884 static struct platform_driver asc_serial_driver = {
885 .probe = asc_serial_probe,
886 .remove = asc_serial_remove,
889 .pm = &asc_serial_pm_ops,
890 .owner = THIS_MODULE,
891 .of_match_table = of_match_ptr(asc_match),
895 static int __init asc_init(void)
898 static char banner[] __initdata =
899 KERN_INFO "STMicroelectronics ASC driver initialized\n";
903 ret = uart_register_driver(&asc_uart_driver);
907 ret = platform_driver_register(&asc_serial_driver);
909 uart_unregister_driver(&asc_uart_driver);
914 static void __exit asc_exit(void)
916 platform_driver_unregister(&asc_serial_driver);
917 uart_unregister_driver(&asc_uart_driver);
920 module_init(asc_init);
921 module_exit(asc_exit);
923 MODULE_ALIAS("platform:" DRIVER_NAME);
924 MODULE_AUTHOR("STMicroelectronics (R&D) Limited");
925 MODULE_DESCRIPTION("STMicroelectronics ASC serial port driver");
926 MODULE_LICENSE("GPL");