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)
155 return readl_relaxed(port->membase + offset);
157 return readl(port->membase + offset);
161 static inline void asc_out(struct uart_port *port, u32 offset, u32 value)
163 #ifdef writel_relaxed
164 writel_relaxed(value, port->membase + offset);
166 writel(value, port->membase + offset);
171 * Some simple utility functions to enable and disable interrupts.
172 * Note that these need to be called with interrupts disabled.
174 static inline void asc_disable_tx_interrupts(struct uart_port *port)
176 u32 intenable = asc_in(port, ASC_INTEN) & ~ASC_INTEN_THE;
177 asc_out(port, ASC_INTEN, intenable);
178 (void)asc_in(port, ASC_INTEN); /* Defeat bus write posting */
181 static inline void asc_enable_tx_interrupts(struct uart_port *port)
183 u32 intenable = asc_in(port, ASC_INTEN) | ASC_INTEN_THE;
184 asc_out(port, ASC_INTEN, intenable);
187 static inline void asc_disable_rx_interrupts(struct uart_port *port)
189 u32 intenable = asc_in(port, ASC_INTEN) & ~ASC_INTEN_RBE;
190 asc_out(port, ASC_INTEN, intenable);
191 (void)asc_in(port, ASC_INTEN); /* Defeat bus write posting */
194 static inline void asc_enable_rx_interrupts(struct uart_port *port)
196 u32 intenable = asc_in(port, ASC_INTEN) | ASC_INTEN_RBE;
197 asc_out(port, ASC_INTEN, intenable);
200 static inline u32 asc_txfifo_is_empty(struct uart_port *port)
202 return asc_in(port, ASC_STA) & ASC_STA_TE;
205 static inline u32 asc_txfifo_is_half_empty(struct uart_port *port)
207 return asc_in(port, ASC_STA) & ASC_STA_THE;
210 static inline const char *asc_port_name(struct uart_port *port)
212 return to_platform_device(port->dev)->name;
215 /*----------------------------------------------------------------------*/
218 * This section contains code to support the use of the ASC as a
219 * generic serial port.
222 static inline unsigned asc_hw_txroom(struct uart_port *port)
224 u32 status = asc_in(port, ASC_STA);
226 if (status & ASC_STA_THE)
227 return port->fifosize / 2;
228 else if (!(status & ASC_STA_TF))
235 * Start transmitting chars.
236 * This is called from both interrupt and task level.
237 * Either way interrupts are disabled.
239 static void asc_transmit_chars(struct uart_port *port)
241 struct circ_buf *xmit = &port->state->xmit;
245 txroom = asc_hw_txroom(port);
247 if ((txroom != 0) && port->x_char) {
250 asc_out(port, ASC_TXBUF, c);
252 txroom = asc_hw_txroom(port);
255 if (uart_tx_stopped(port)) {
257 * We should try and stop the hardware here, but I
258 * don't think the ASC has any way to do that.
260 asc_disable_tx_interrupts(port);
264 if (uart_circ_empty(xmit)) {
265 asc_disable_tx_interrupts(port);
273 c = xmit->buf[xmit->tail];
274 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
275 asc_out(port, ASC_TXBUF, c);
278 } while ((txroom > 0) && (!uart_circ_empty(xmit)));
280 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
281 uart_write_wakeup(port);
283 if (uart_circ_empty(xmit))
284 asc_disable_tx_interrupts(port);
287 static void asc_receive_chars(struct uart_port *port)
289 struct tty_port *tport = &port->state->port;
290 unsigned long status;
295 pm_wakeup_event(tport->tty->dev, 0);
297 while ((status = asc_in(port, ASC_STA)) & ASC_STA_RBF) {
298 c = asc_in(port, ASC_RXBUF) | ASC_RXBUF_DUMMY_RX;
302 if ((c & (ASC_RXBUF_FE | ASC_RXBUF_PE)) ||
303 status & ASC_STA_OE) {
305 if (c & ASC_RXBUF_FE) {
306 if (c == (ASC_RXBUF_FE | ASC_RXBUF_DUMMY_RX)) {
308 if (uart_handle_break(port))
310 c |= ASC_RXBUF_DUMMY_BE;
312 port->icount.frame++;
314 } else if (c & ASC_RXBUF_PE) {
315 port->icount.parity++;
318 * Reading any data from the RX FIFO clears the
319 * overflow error condition.
321 if (status & ASC_STA_OE) {
322 port->icount.overrun++;
323 c |= ASC_RXBUF_DUMMY_OE;
326 c &= port->read_status_mask;
328 if (c & ASC_RXBUF_DUMMY_BE)
330 else if (c & ASC_RXBUF_PE)
332 else if (c & ASC_RXBUF_FE)
336 if (uart_handle_sysrq_char(port, c & 0xff))
339 uart_insert_char(port, c, ASC_RXBUF_DUMMY_OE, c & 0xff, flag);
342 /* Tell the rest of the system the news. New characters! */
343 tty_flip_buffer_push(tport);
346 static irqreturn_t asc_interrupt(int irq, void *ptr)
348 struct uart_port *port = ptr;
351 spin_lock(&port->lock);
353 status = asc_in(port, ASC_STA);
355 if (status & ASC_STA_RBF) {
356 /* Receive FIFO not empty */
357 asc_receive_chars(port);
360 if ((status & ASC_STA_THE) &&
361 (asc_in(port, ASC_INTEN) & ASC_INTEN_THE)) {
362 /* Transmitter FIFO at least half empty */
363 asc_transmit_chars(port);
366 spin_unlock(&port->lock);
371 /*----------------------------------------------------------------------*/
377 static unsigned int asc_tx_empty(struct uart_port *port)
379 return asc_txfifo_is_empty(port) ? TIOCSER_TEMT : 0;
382 static void asc_set_mctrl(struct uart_port *port, unsigned int mctrl)
385 * This routine is used for seting signals of: DTR, DCD, CTS/RTS
386 * We use ASC's hardware for CTS/RTS, so don't need any for that.
387 * Some boards have DTR and DCD implemented using PIO pins,
388 * code to do this should be hooked in here.
392 static unsigned int asc_get_mctrl(struct uart_port *port)
395 * This routine is used for geting signals of: DTR, DCD, DSR, RI,
398 return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
401 /* There are probably characters waiting to be transmitted. */
402 static void asc_start_tx(struct uart_port *port)
404 struct circ_buf *xmit = &port->state->xmit;
406 if (!uart_circ_empty(xmit))
407 asc_enable_tx_interrupts(port);
411 static void asc_stop_tx(struct uart_port *port)
413 asc_disable_tx_interrupts(port);
417 static void asc_stop_rx(struct uart_port *port)
419 asc_disable_rx_interrupts(port);
422 /* Handle breaks - ignored by us */
423 static void asc_break_ctl(struct uart_port *port, int break_state)
425 /* Nothing here yet .. */
429 * Enable port for reception.
431 static int asc_startup(struct uart_port *port)
433 if (request_irq(port->irq, asc_interrupt, 0,
434 asc_port_name(port), port)) {
435 dev_err(port->dev, "cannot allocate irq.\n");
439 asc_transmit_chars(port);
440 asc_enable_rx_interrupts(port);
445 static void asc_shutdown(struct uart_port *port)
447 asc_disable_tx_interrupts(port);
448 asc_disable_rx_interrupts(port);
449 free_irq(port->irq, port);
452 static void asc_pm(struct uart_port *port, unsigned int state,
453 unsigned int oldstate)
455 struct asc_port *ascport = to_asc_port(port);
456 unsigned long flags = 0;
460 case UART_PM_STATE_ON:
461 clk_prepare_enable(ascport->clk);
463 case UART_PM_STATE_OFF:
465 * Disable the ASC baud rate generator, which is as close as
466 * we can come to turning it off. Note this is not called with
467 * the port spinlock held.
469 spin_lock_irqsave(&port->lock, flags);
470 ctl = asc_in(port, ASC_CTL) & ~ASC_CTL_RUN;
471 asc_out(port, ASC_CTL, ctl);
472 spin_unlock_irqrestore(&port->lock, flags);
473 clk_disable_unprepare(ascport->clk);
478 static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
479 struct ktermios *old)
481 struct asc_port *ascport = to_asc_port(port);
487 /* Update termios to reflect hardware capabilities */
488 termios->c_cflag &= ~(CMSPAR |
489 (ascport->hw_flow_control ? 0 : CRTSCTS));
491 port->uartclk = clk_get_rate(ascport->clk);
493 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
494 cflag = termios->c_cflag;
496 spin_lock_irqsave(&port->lock, flags);
498 /* read control register */
499 ctrl_val = asc_in(port, ASC_CTL);
501 /* stop serial port and reset value */
502 asc_out(port, ASC_CTL, (ctrl_val & ~ASC_CTL_RUN));
503 ctrl_val = ASC_CTL_RXENABLE | ASC_CTL_FIFOENABLE;
505 /* reset fifo rx & tx */
506 asc_out(port, ASC_TXRESET, 1);
507 asc_out(port, ASC_RXRESET, 1);
509 /* set character length */
510 if ((cflag & CSIZE) == CS7) {
511 ctrl_val |= ASC_CTL_MODE_7BIT_PAR;
514 ctrl_val |= (cflag & PARENB) ? ASC_CTL_MODE_8BIT_PAR :
519 termios->c_cflag = cflag;
522 ctrl_val |= (cflag & CSTOPB) ? ASC_CTL_STOP_2BIT : ASC_CTL_STOP_1BIT;
526 ctrl_val |= ASC_CTL_PARITYODD;
528 /* hardware flow control */
529 if ((cflag & CRTSCTS))
530 ctrl_val |= ASC_CTL_CTSENABLE;
532 if ((baud < 19200) && !ascport->force_m1) {
533 asc_out(port, ASC_BAUDRATE, (port->uartclk / (16 * baud)));
536 * MODE 1: recommended for high bit rates (above 19.2K)
538 * baudrate * 16 * 2^16
539 * ASCBaudRate = ------------------------
542 * To keep maths inside 64bits, we divide inputclock by 16.
544 u64 dividend = (u64)baud * (1 << 16);
546 do_div(dividend, port->uartclk / 16);
547 asc_out(port, ASC_BAUDRATE, dividend);
548 ctrl_val |= ASC_CTL_BAUDMODE;
551 uart_update_timeout(port, cflag, baud);
553 ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE;
554 if (termios->c_iflag & INPCK)
555 ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
556 if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
557 ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE;
560 * Characters to ignore
562 ascport->port.ignore_status_mask = 0;
563 if (termios->c_iflag & IGNPAR)
564 ascport->port.ignore_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
565 if (termios->c_iflag & IGNBRK) {
566 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_BE;
568 * If we're ignoring parity and break indicators,
569 * ignore overruns too (for real raw support).
571 if (termios->c_iflag & IGNPAR)
572 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_OE;
576 * Ignore all characters if CREAD is not set.
578 if (!(termios->c_cflag & CREAD))
579 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_RX;
581 /* Set the timeout */
582 asc_out(port, ASC_TIMEOUT, 20);
584 /* write final value and enable port */
585 asc_out(port, ASC_CTL, (ctrl_val | ASC_CTL_RUN));
587 spin_unlock_irqrestore(&port->lock, flags);
590 static const char *asc_type(struct uart_port *port)
592 return (port->type == PORT_ASC) ? DRIVER_NAME : NULL;
595 static void asc_release_port(struct uart_port *port)
599 static int asc_request_port(struct uart_port *port)
605 * Called when the port is opened, and UPF_BOOT_AUTOCONF flag is set
606 * Set type field if successful
608 static void asc_config_port(struct uart_port *port, int flags)
610 if ((flags & UART_CONFIG_TYPE))
611 port->type = PORT_ASC;
615 asc_verify_port(struct uart_port *port, struct serial_struct *ser)
617 /* No user changeable parameters */
621 #ifdef CONFIG_CONSOLE_POLL
623 * Console polling routines for writing and reading from the uart while
624 * in an interrupt or debug context (i.e. kgdb).
627 static int asc_get_poll_char(struct uart_port *port)
629 if (!(asc_in(port, ASC_STA) & ASC_STA_RBF))
632 return asc_in(port, ASC_RXBUF);
635 static void asc_put_poll_char(struct uart_port *port, unsigned char c)
637 while (!asc_txfifo_is_half_empty(port))
639 asc_out(port, ASC_TXBUF, c);
642 #endif /* CONFIG_CONSOLE_POLL */
644 /*---------------------------------------------------------------------*/
646 static const struct uart_ops asc_uart_ops = {
647 .tx_empty = asc_tx_empty,
648 .set_mctrl = asc_set_mctrl,
649 .get_mctrl = asc_get_mctrl,
650 .start_tx = asc_start_tx,
651 .stop_tx = asc_stop_tx,
652 .stop_rx = asc_stop_rx,
653 .break_ctl = asc_break_ctl,
654 .startup = asc_startup,
655 .shutdown = asc_shutdown,
656 .set_termios = asc_set_termios,
658 .release_port = asc_release_port,
659 .request_port = asc_request_port,
660 .config_port = asc_config_port,
661 .verify_port = asc_verify_port,
663 #ifdef CONFIG_CONSOLE_POLL
664 .poll_get_char = asc_get_poll_char,
665 .poll_put_char = asc_put_poll_char,
666 #endif /* CONFIG_CONSOLE_POLL */
669 static int asc_init_port(struct asc_port *ascport,
670 struct platform_device *pdev)
672 struct uart_port *port = &ascport->port;
673 struct resource *res;
675 port->iotype = UPIO_MEM;
676 port->flags = UPF_BOOT_AUTOCONF;
677 port->ops = &asc_uart_ops;
678 port->fifosize = ASC_FIFO_SIZE;
679 port->dev = &pdev->dev;
680 port->irq = platform_get_irq(pdev, 0);
682 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
683 port->membase = devm_ioremap_resource(&pdev->dev, res);
684 if (IS_ERR(port->membase))
685 return PTR_ERR(port->membase);
686 port->mapbase = res->start;
688 spin_lock_init(&port->lock);
690 ascport->clk = devm_clk_get(&pdev->dev, NULL);
692 if (WARN_ON(IS_ERR(ascport->clk)))
694 /* ensure that clk rate is correct by enabling the clk */
695 clk_prepare_enable(ascport->clk);
696 ascport->port.uartclk = clk_get_rate(ascport->clk);
697 WARN_ON(ascport->port.uartclk == 0);
698 clk_disable_unprepare(ascport->clk);
703 static struct asc_port *asc_of_get_asc_port(struct platform_device *pdev)
705 struct device_node *np = pdev->dev.of_node;
711 id = of_alias_get_id(np, ASC_SERIAL_NAME);
716 if (WARN_ON(id >= ASC_MAX_PORTS))
719 asc_ports[id].hw_flow_control = of_property_read_bool(np,
720 "st,hw-flow-control");
721 asc_ports[id].force_m1 = of_property_read_bool(np, "st,force_m1");
722 asc_ports[id].port.line = id;
723 return &asc_ports[id];
727 static const struct of_device_id asc_match[] = {
728 { .compatible = "st,asc", },
732 MODULE_DEVICE_TABLE(of, asc_match);
735 static int asc_serial_probe(struct platform_device *pdev)
738 struct asc_port *ascport;
740 ascport = asc_of_get_asc_port(pdev);
744 ret = asc_init_port(ascport, pdev);
748 ret = uart_add_one_port(&asc_uart_driver, &ascport->port);
752 platform_set_drvdata(pdev, &ascport->port);
757 static int asc_serial_remove(struct platform_device *pdev)
759 struct uart_port *port = platform_get_drvdata(pdev);
761 return uart_remove_one_port(&asc_uart_driver, port);
764 #ifdef CONFIG_PM_SLEEP
765 static int asc_serial_suspend(struct device *dev)
767 struct platform_device *pdev = to_platform_device(dev);
768 struct uart_port *port = platform_get_drvdata(pdev);
770 return uart_suspend_port(&asc_uart_driver, port);
773 static int asc_serial_resume(struct device *dev)
775 struct platform_device *pdev = to_platform_device(dev);
776 struct uart_port *port = platform_get_drvdata(pdev);
778 return uart_resume_port(&asc_uart_driver, port);
781 #endif /* CONFIG_PM_SLEEP */
783 /*----------------------------------------------------------------------*/
785 #ifdef CONFIG_SERIAL_ST_ASC_CONSOLE
786 static void asc_console_putchar(struct uart_port *port, int ch)
788 unsigned int timeout = 1000000;
790 /* Wait for upto 1 second in case flow control is stopping us. */
791 while (--timeout && !asc_txfifo_is_half_empty(port))
794 asc_out(port, ASC_TXBUF, ch);
798 * Print a string to the serial port trying not to disturb
799 * any possible real use of the port...
802 static void asc_console_write(struct console *co, const char *s, unsigned count)
804 struct uart_port *port = &asc_ports[co->index].port;
806 unsigned long timeout = 1000000;
810 local_irq_save(flags);
812 locked = 0; /* asc_interrupt has already claimed the lock */
813 else if (oops_in_progress)
814 locked = spin_trylock(&port->lock);
816 spin_lock(&port->lock);
819 * Disable interrupts so we don't get the IRQ line bouncing
820 * up and down while interrupts are disabled.
822 intenable = asc_in(port, ASC_INTEN);
823 asc_out(port, ASC_INTEN, 0);
824 (void)asc_in(port, ASC_INTEN); /* Defeat bus write posting */
826 uart_console_write(port, s, count, asc_console_putchar);
828 while (--timeout && !asc_txfifo_is_empty(port))
831 asc_out(port, ASC_INTEN, intenable);
834 spin_unlock(&port->lock);
835 local_irq_restore(flags);
838 static int asc_console_setup(struct console *co, char *options)
840 struct asc_port *ascport;
846 if (co->index >= ASC_MAX_PORTS)
849 ascport = &asc_ports[co->index];
852 * This driver does not support early console initialization
853 * (use ARM early printk support instead), so we only expect
854 * this to be called during the uart port registration when the
855 * driver gets probed and the port should be mapped at that point.
857 if (ascport->port.mapbase == 0 || ascport->port.membase == NULL)
861 uart_parse_options(options, &baud, &parity, &bits, &flow);
863 return uart_set_options(&ascport->port, co, baud, parity, bits, flow);
866 static struct console asc_console = {
867 .name = ASC_SERIAL_NAME,
868 .device = uart_console_device,
869 .write = asc_console_write,
870 .setup = asc_console_setup,
871 .flags = CON_PRINTBUFFER,
873 .data = &asc_uart_driver,
876 #define ASC_SERIAL_CONSOLE (&asc_console)
879 #define ASC_SERIAL_CONSOLE NULL
880 #endif /* CONFIG_SERIAL_ST_ASC_CONSOLE */
882 static struct uart_driver asc_uart_driver = {
883 .owner = THIS_MODULE,
884 .driver_name = DRIVER_NAME,
885 .dev_name = ASC_SERIAL_NAME,
889 .cons = ASC_SERIAL_CONSOLE,
892 static const struct dev_pm_ops asc_serial_pm_ops = {
893 SET_SYSTEM_SLEEP_PM_OPS(asc_serial_suspend, asc_serial_resume)
896 static struct platform_driver asc_serial_driver = {
897 .probe = asc_serial_probe,
898 .remove = asc_serial_remove,
901 .pm = &asc_serial_pm_ops,
902 .of_match_table = of_match_ptr(asc_match),
906 static int __init asc_init(void)
909 static char banner[] __initdata =
910 KERN_INFO "STMicroelectronics ASC driver initialized\n";
914 ret = uart_register_driver(&asc_uart_driver);
918 ret = platform_driver_register(&asc_serial_driver);
920 uart_unregister_driver(&asc_uart_driver);
925 static void __exit asc_exit(void)
927 platform_driver_unregister(&asc_serial_driver);
928 uart_unregister_driver(&asc_uart_driver);
931 module_init(asc_init);
932 module_exit(asc_exit);
934 MODULE_ALIAS("platform:" DRIVER_NAME);
935 MODULE_AUTHOR("STMicroelectronics (R&D) Limited");
936 MODULE_DESCRIPTION("STMicroelectronics ASC serial port driver");
937 MODULE_LICENSE("GPL");