1 // SPDX-License-Identifier: GPL-2.0
3 * uartlite.c: Serial driver for Xilinx uartlite serial controller
5 * Copyright (C) 2006 Peter Korsgaard <jacmet@sunsite.dk>
6 * Copyright (C) 2007 Secret Lab Technologies Ltd.
9 #include <linux/platform_device.h>
10 #include <linux/module.h>
11 #include <linux/bitfield.h>
12 #include <linux/console.h>
13 #include <linux/serial.h>
14 #include <linux/serial_core.h>
15 #include <linux/tty.h>
16 #include <linux/tty_flip.h>
17 #include <linux/delay.h>
18 #include <linux/interrupt.h>
19 #include <linux/init.h>
21 #include <linux/iopoll.h>
23 #include <linux/clk.h>
24 #include <linux/pm_runtime.h>
26 #define ULITE_NAME "ttyUL"
27 #define ULITE_MAJOR 204
28 #define ULITE_MINOR 187
29 #define ULITE_NR_UARTS CONFIG_SERIAL_UARTLITE_NR_UARTS
31 /* ---------------------------------------------------------------------
32 * Register definitions
34 * For register details see datasheet:
35 * https://www.xilinx.com/support/documentation/ip_documentation/opb_uartlite.pdf
40 #define ULITE_STATUS 0x08
41 #define ULITE_CONTROL 0x0c
43 #define ULITE_REGION 16
45 #define ULITE_STATUS_RXVALID 0x01
46 #define ULITE_STATUS_RXFULL 0x02
47 #define ULITE_STATUS_TXEMPTY 0x04
48 #define ULITE_STATUS_TXFULL 0x08
49 #define ULITE_STATUS_IE 0x10
50 #define ULITE_STATUS_OVERRUN 0x20
51 #define ULITE_STATUS_FRAME 0x40
52 #define ULITE_STATUS_PARITY 0x80
54 #define ULITE_CONTROL_RST_TX 0x01
55 #define ULITE_CONTROL_RST_RX 0x02
56 #define ULITE_CONTROL_IE 0x10
57 #define UART_AUTOSUSPEND_TIMEOUT 3000 /* ms */
59 /* Static pointer to console port */
60 #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
61 static struct uart_port *console_port;
65 * struct uartlite_data: Driver private data
66 * reg_ops: Functions to read/write registers
67 * clk: Our parent clock, if present
68 * baud: The baud rate configured when this device was synthesized
69 * cflags: The cflags for parity and data bits
71 struct uartlite_data {
72 const struct uartlite_reg_ops *reg_ops;
78 struct uartlite_reg_ops {
79 u32 (*in)(void __iomem *addr);
80 void (*out)(u32 val, void __iomem *addr);
83 static u32 uartlite_inbe32(void __iomem *addr)
85 return ioread32be(addr);
88 static void uartlite_outbe32(u32 val, void __iomem *addr)
90 iowrite32be(val, addr);
93 static const struct uartlite_reg_ops uartlite_be = {
94 .in = uartlite_inbe32,
95 .out = uartlite_outbe32,
98 static u32 uartlite_inle32(void __iomem *addr)
100 return ioread32(addr);
103 static void uartlite_outle32(u32 val, void __iomem *addr)
105 iowrite32(val, addr);
108 static const struct uartlite_reg_ops uartlite_le = {
109 .in = uartlite_inle32,
110 .out = uartlite_outle32,
113 static inline u32 uart_in32(u32 offset, struct uart_port *port)
115 struct uartlite_data *pdata = port->private_data;
117 return pdata->reg_ops->in(port->membase + offset);
120 static inline void uart_out32(u32 val, u32 offset, struct uart_port *port)
122 struct uartlite_data *pdata = port->private_data;
124 pdata->reg_ops->out(val, port->membase + offset);
127 static struct uart_port ulite_ports[ULITE_NR_UARTS];
129 static struct uart_driver ulite_uart_driver;
131 /* ---------------------------------------------------------------------
132 * Core UART driver operations
135 static int ulite_receive(struct uart_port *port, int stat)
137 struct tty_port *tport = &port->state->port;
138 unsigned char ch = 0;
139 char flag = TTY_NORMAL;
141 if ((stat & (ULITE_STATUS_RXVALID | ULITE_STATUS_OVERRUN
142 | ULITE_STATUS_FRAME)) == 0)
146 if (stat & ULITE_STATUS_RXVALID) {
148 ch = uart_in32(ULITE_RX, port);
150 if (stat & ULITE_STATUS_PARITY)
151 port->icount.parity++;
154 if (stat & ULITE_STATUS_OVERRUN)
155 port->icount.overrun++;
157 if (stat & ULITE_STATUS_FRAME)
158 port->icount.frame++;
161 /* drop byte with parity error if IGNPAR specificed */
162 if (stat & port->ignore_status_mask & ULITE_STATUS_PARITY)
163 stat &= ~ULITE_STATUS_RXVALID;
165 stat &= port->read_status_mask;
167 if (stat & ULITE_STATUS_PARITY)
171 stat &= ~port->ignore_status_mask;
173 if (stat & ULITE_STATUS_RXVALID)
174 tty_insert_flip_char(tport, ch, flag);
176 if (stat & ULITE_STATUS_FRAME)
177 tty_insert_flip_char(tport, 0, TTY_FRAME);
179 if (stat & ULITE_STATUS_OVERRUN)
180 tty_insert_flip_char(tport, 0, TTY_OVERRUN);
185 static int ulite_transmit(struct uart_port *port, int stat)
187 struct circ_buf *xmit = &port->state->xmit;
189 if (stat & ULITE_STATUS_TXFULL)
193 uart_out32(port->x_char, ULITE_TX, port);
199 if (uart_circ_empty(xmit) || uart_tx_stopped(port))
202 uart_out32(xmit->buf[xmit->tail], ULITE_TX, port);
203 uart_xmit_advance(port, 1);
206 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
207 uart_write_wakeup(port);
212 static irqreturn_t ulite_isr(int irq, void *dev_id)
214 struct uart_port *port = dev_id;
215 int stat, busy, n = 0;
219 spin_lock_irqsave(&port->lock, flags);
220 stat = uart_in32(ULITE_STATUS, port);
221 busy = ulite_receive(port, stat);
222 busy |= ulite_transmit(port, stat);
223 spin_unlock_irqrestore(&port->lock, flags);
229 tty_flip_buffer_push(&port->state->port);
236 static unsigned int ulite_tx_empty(struct uart_port *port)
241 spin_lock_irqsave(&port->lock, flags);
242 ret = uart_in32(ULITE_STATUS, port);
243 spin_unlock_irqrestore(&port->lock, flags);
245 return ret & ULITE_STATUS_TXEMPTY ? TIOCSER_TEMT : 0;
248 static unsigned int ulite_get_mctrl(struct uart_port *port)
250 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
253 static void ulite_set_mctrl(struct uart_port *port, unsigned int mctrl)
258 static void ulite_stop_tx(struct uart_port *port)
263 static void ulite_start_tx(struct uart_port *port)
265 ulite_transmit(port, uart_in32(ULITE_STATUS, port));
268 static void ulite_stop_rx(struct uart_port *port)
270 /* don't forward any more data (like !CREAD) */
271 port->ignore_status_mask = ULITE_STATUS_RXVALID | ULITE_STATUS_PARITY
272 | ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN;
275 static void ulite_break_ctl(struct uart_port *port, int ctl)
280 static int ulite_startup(struct uart_port *port)
282 struct uartlite_data *pdata = port->private_data;
285 ret = clk_enable(pdata->clk);
287 dev_err(port->dev, "Failed to enable clock\n");
291 ret = request_irq(port->irq, ulite_isr, IRQF_SHARED | IRQF_TRIGGER_RISING,
296 uart_out32(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX,
297 ULITE_CONTROL, port);
298 uart_out32(ULITE_CONTROL_IE, ULITE_CONTROL, port);
303 static void ulite_shutdown(struct uart_port *port)
305 struct uartlite_data *pdata = port->private_data;
307 uart_out32(0, ULITE_CONTROL, port);
308 uart_in32(ULITE_CONTROL, port); /* dummy */
309 free_irq(port->irq, port);
310 clk_disable(pdata->clk);
313 static void ulite_set_termios(struct uart_port *port,
314 struct ktermios *termios,
315 const struct ktermios *old)
318 struct uartlite_data *pdata = port->private_data;
320 /* Set termios to what the hardware supports */
321 termios->c_iflag &= ~BRKINT;
322 termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CSIZE);
323 termios->c_cflag |= pdata->cflags & (PARENB | PARODD | CSIZE);
324 tty_termios_encode_baud_rate(termios, pdata->baud, pdata->baud);
326 spin_lock_irqsave(&port->lock, flags);
328 port->read_status_mask = ULITE_STATUS_RXVALID | ULITE_STATUS_OVERRUN
329 | ULITE_STATUS_TXFULL;
331 if (termios->c_iflag & INPCK)
332 port->read_status_mask |=
333 ULITE_STATUS_PARITY | ULITE_STATUS_FRAME;
335 port->ignore_status_mask = 0;
336 if (termios->c_iflag & IGNPAR)
337 port->ignore_status_mask |= ULITE_STATUS_PARITY
338 | ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN;
340 /* ignore all characters if CREAD is not set */
341 if ((termios->c_cflag & CREAD) == 0)
342 port->ignore_status_mask |=
343 ULITE_STATUS_RXVALID | ULITE_STATUS_PARITY
344 | ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN;
347 uart_update_timeout(port, termios->c_cflag, pdata->baud);
349 spin_unlock_irqrestore(&port->lock, flags);
352 static const char *ulite_type(struct uart_port *port)
354 return port->type == PORT_UARTLITE ? "uartlite" : NULL;
357 static void ulite_release_port(struct uart_port *port)
359 release_mem_region(port->mapbase, ULITE_REGION);
360 iounmap(port->membase);
361 port->membase = NULL;
364 static int ulite_request_port(struct uart_port *port)
366 struct uartlite_data *pdata = port->private_data;
369 pr_debug("ulite console: port=%p; port->mapbase=%llx\n",
370 port, (unsigned long long) port->mapbase);
372 if (!request_mem_region(port->mapbase, ULITE_REGION, "uartlite")) {
373 dev_err(port->dev, "Memory region busy\n");
377 port->membase = ioremap(port->mapbase, ULITE_REGION);
378 if (!port->membase) {
379 dev_err(port->dev, "Unable to map registers\n");
380 release_mem_region(port->mapbase, ULITE_REGION);
384 pdata->reg_ops = &uartlite_be;
385 ret = uart_in32(ULITE_CONTROL, port);
386 uart_out32(ULITE_CONTROL_RST_TX, ULITE_CONTROL, port);
387 ret = uart_in32(ULITE_STATUS, port);
388 /* Endianess detection */
389 if ((ret & ULITE_STATUS_TXEMPTY) != ULITE_STATUS_TXEMPTY)
390 pdata->reg_ops = &uartlite_le;
395 static void ulite_config_port(struct uart_port *port, int flags)
397 if (!ulite_request_port(port))
398 port->type = PORT_UARTLITE;
401 static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)
403 /* we don't want the core code to modify any port params */
407 static void ulite_pm(struct uart_port *port, unsigned int state,
408 unsigned int oldstate)
413 ret = pm_runtime_get_sync(port->dev);
415 dev_err(port->dev, "Failed to enable clocks\n");
417 pm_runtime_mark_last_busy(port->dev);
418 pm_runtime_put_autosuspend(port->dev);
422 #ifdef CONFIG_CONSOLE_POLL
423 static int ulite_get_poll_char(struct uart_port *port)
425 if (!(uart_in32(ULITE_STATUS, port) & ULITE_STATUS_RXVALID))
428 return uart_in32(ULITE_RX, port);
431 static void ulite_put_poll_char(struct uart_port *port, unsigned char ch)
433 while (uart_in32(ULITE_STATUS, port) & ULITE_STATUS_TXFULL)
436 /* write char to device */
437 uart_out32(ch, ULITE_TX, port);
441 static const struct uart_ops ulite_ops = {
442 .tx_empty = ulite_tx_empty,
443 .set_mctrl = ulite_set_mctrl,
444 .get_mctrl = ulite_get_mctrl,
445 .stop_tx = ulite_stop_tx,
446 .start_tx = ulite_start_tx,
447 .stop_rx = ulite_stop_rx,
448 .break_ctl = ulite_break_ctl,
449 .startup = ulite_startup,
450 .shutdown = ulite_shutdown,
451 .set_termios = ulite_set_termios,
453 .release_port = ulite_release_port,
454 .request_port = ulite_request_port,
455 .config_port = ulite_config_port,
456 .verify_port = ulite_verify_port,
458 #ifdef CONFIG_CONSOLE_POLL
459 .poll_get_char = ulite_get_poll_char,
460 .poll_put_char = ulite_put_poll_char,
464 /* ---------------------------------------------------------------------
465 * Console driver operations
468 #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
469 static void ulite_console_wait_tx(struct uart_port *port)
474 * Spin waiting for TX fifo to have space available.
475 * When using the Microblaze Debug Module this can take up to 1s
477 if (read_poll_timeout_atomic(uart_in32, val, !(val & ULITE_STATUS_TXFULL),
478 0, 1000000, false, ULITE_STATUS, port))
480 "timeout waiting for TX buffer empty\n");
483 static void ulite_console_putchar(struct uart_port *port, unsigned char ch)
485 ulite_console_wait_tx(port);
486 uart_out32(ch, ULITE_TX, port);
489 static void ulite_console_write(struct console *co, const char *s,
492 struct uart_port *port = console_port;
497 if (oops_in_progress) {
498 locked = spin_trylock_irqsave(&port->lock, flags);
500 spin_lock_irqsave(&port->lock, flags);
502 /* save and disable interrupt */
503 ier = uart_in32(ULITE_STATUS, port) & ULITE_STATUS_IE;
504 uart_out32(0, ULITE_CONTROL, port);
506 uart_console_write(port, s, count, ulite_console_putchar);
508 ulite_console_wait_tx(port);
510 /* restore interrupt state */
512 uart_out32(ULITE_CONTROL_IE, ULITE_CONTROL, port);
515 spin_unlock_irqrestore(&port->lock, flags);
518 static int ulite_console_setup(struct console *co, char *options)
520 struct uart_port *port = NULL;
526 if (co->index >= 0 && co->index < ULITE_NR_UARTS)
527 port = ulite_ports + co->index;
529 /* Has the device been initialized yet? */
530 if (!port || !port->mapbase) {
531 pr_debug("console on ttyUL%i not present\n", co->index);
537 /* not initialized yet? */
538 if (!port->membase) {
539 if (ulite_request_port(port))
544 uart_parse_options(options, &baud, &parity, &bits, &flow);
546 return uart_set_options(port, co, baud, parity, bits, flow);
549 static struct console ulite_console = {
551 .write = ulite_console_write,
552 .device = uart_console_device,
553 .setup = ulite_console_setup,
554 .flags = CON_PRINTBUFFER,
555 .index = -1, /* Specified on the cmdline (e.g. console=ttyUL0 ) */
556 .data = &ulite_uart_driver,
559 static void early_uartlite_putc(struct uart_port *port, unsigned char c)
562 * Limit how many times we'll spin waiting for TX FIFO status.
563 * This will prevent lockups if the base address is incorrectly
564 * set, or any other issue on the UARTLITE.
565 * This limit is pretty arbitrary, unless we are at about 10 baud
566 * we'll never timeout on a working UART.
568 unsigned retries = 1000000;
571 (readl(port->membase + ULITE_STATUS) & ULITE_STATUS_TXFULL))
574 /* Only attempt the iowrite if we didn't timeout */
576 writel(c & 0xff, port->membase + ULITE_TX);
579 static void early_uartlite_write(struct console *console,
580 const char *s, unsigned n)
582 struct earlycon_device *device = console->data;
583 uart_console_write(&device->port, s, n, early_uartlite_putc);
586 static int __init early_uartlite_setup(struct earlycon_device *device,
589 if (!device->port.membase)
592 device->con->write = early_uartlite_write;
595 EARLYCON_DECLARE(uartlite, early_uartlite_setup);
596 OF_EARLYCON_DECLARE(uartlite_b, "xlnx,opb-uartlite-1.00.b", early_uartlite_setup);
597 OF_EARLYCON_DECLARE(uartlite_a, "xlnx,xps-uartlite-1.00.a", early_uartlite_setup);
599 #endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */
601 static struct uart_driver ulite_uart_driver = {
602 .owner = THIS_MODULE,
603 .driver_name = "uartlite",
604 .dev_name = ULITE_NAME,
605 .major = ULITE_MAJOR,
606 .minor = ULITE_MINOR,
607 .nr = ULITE_NR_UARTS,
608 #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
609 .cons = &ulite_console,
613 /* ---------------------------------------------------------------------
614 * Port assignment functions (mapping devices to uart_port structures)
617 /** ulite_assign: register a uartlite device with the driver
619 * @dev: pointer to device structure
620 * @id: requested id number. Pass -1 for automatic port assignment
621 * @base: base address of uartlite registers
622 * @irq: irq number for uartlite
623 * @pdata: private data for uartlite
625 * Returns: 0 on success, <0 otherwise
627 static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq,
628 struct uartlite_data *pdata)
630 struct uart_port *port;
633 /* if id = -1; then scan for a free id and use that */
635 for (id = 0; id < ULITE_NR_UARTS; id++)
636 if (ulite_ports[id].mapbase == 0)
639 if (id < 0 || id >= ULITE_NR_UARTS) {
640 dev_err(dev, "%s%i too large\n", ULITE_NAME, id);
644 if ((ulite_ports[id].mapbase) && (ulite_ports[id].mapbase != base)) {
645 dev_err(dev, "cannot assign to %s%i; it is already in use\n",
650 port = &ulite_ports[id];
652 spin_lock_init(&port->lock);
655 port->iotype = UPIO_MEM;
656 port->iobase = 1; /* mark port in use */
657 port->mapbase = base;
658 port->membase = NULL;
659 port->ops = &ulite_ops;
661 port->flags = UPF_BOOT_AUTOCONF;
663 port->type = PORT_UNKNOWN;
665 port->private_data = pdata;
667 dev_set_drvdata(dev, port);
669 /* Register the port */
670 rc = uart_add_one_port(&ulite_uart_driver, port);
672 dev_err(dev, "uart_add_one_port() failed; err=%i\n", rc);
674 dev_set_drvdata(dev, NULL);
681 /** ulite_release: register a uartlite device with the driver
683 * @dev: pointer to device structure
685 static void ulite_release(struct device *dev)
687 struct uart_port *port = dev_get_drvdata(dev);
690 uart_remove_one_port(&ulite_uart_driver, port);
691 dev_set_drvdata(dev, NULL);
697 * ulite_suspend - Stop the device.
699 * @dev: handle to the device structure.
702 static int __maybe_unused ulite_suspend(struct device *dev)
704 struct uart_port *port = dev_get_drvdata(dev);
707 uart_suspend_port(&ulite_uart_driver, port);
713 * ulite_resume - Resume the device.
715 * @dev: handle to the device structure.
716 * Return: 0 on success, errno otherwise.
718 static int __maybe_unused ulite_resume(struct device *dev)
720 struct uart_port *port = dev_get_drvdata(dev);
723 uart_resume_port(&ulite_uart_driver, port);
728 static int __maybe_unused ulite_runtime_suspend(struct device *dev)
730 struct uart_port *port = dev_get_drvdata(dev);
731 struct uartlite_data *pdata = port->private_data;
733 clk_disable(pdata->clk);
737 static int __maybe_unused ulite_runtime_resume(struct device *dev)
739 struct uart_port *port = dev_get_drvdata(dev);
740 struct uartlite_data *pdata = port->private_data;
743 ret = clk_enable(pdata->clk);
745 dev_err(dev, "Cannot enable clock.\n");
751 /* ---------------------------------------------------------------------
752 * Platform bus binding
755 static const struct dev_pm_ops ulite_pm_ops = {
756 SET_SYSTEM_SLEEP_PM_OPS(ulite_suspend, ulite_resume)
757 SET_RUNTIME_PM_OPS(ulite_runtime_suspend,
758 ulite_runtime_resume, NULL)
761 #if defined(CONFIG_OF)
762 /* Match table for of_platform binding */
763 static const struct of_device_id ulite_of_match[] = {
764 { .compatible = "xlnx,opb-uartlite-1.00.b", },
765 { .compatible = "xlnx,xps-uartlite-1.00.a", },
768 MODULE_DEVICE_TABLE(of, ulite_of_match);
769 #endif /* CONFIG_OF */
771 static int ulite_probe(struct platform_device *pdev)
773 struct resource *res;
774 struct uartlite_data *pdata;
778 pdata = devm_kzalloc(&pdev->dev, sizeof(struct uartlite_data),
783 if (IS_ENABLED(CONFIG_OF)) {
785 struct device_node *np = pdev->dev.of_node;
788 prop = "port-number";
789 ret = of_property_read_u32(np, prop, &id);
790 if (ret && ret != -EINVAL)
792 return dev_err_probe(&pdev->dev, ret,
793 "could not read %s\n", prop);
795 prop = "current-speed";
796 ret = of_property_read_u32(np, prop, &pdata->baud);
800 prop = "xlnx,use-parity";
801 ret = of_property_read_u32(np, prop, &val);
802 if (ret && ret != -EINVAL)
806 prop = "xlnx,odd-parity";
807 ret = of_property_read_u32(np, prop, &val);
812 pdata->cflags |= PARODD;
813 pdata->cflags |= PARENB;
817 prop = "xlnx,data-bits";
818 ret = of_property_read_u32(np, prop, &val);
819 if (ret && ret != -EINVAL)
824 pdata->cflags |= CS5;
827 pdata->cflags |= CS6;
830 pdata->cflags |= CS7;
833 pdata->cflags |= CS8;
836 return dev_err_probe(&pdev->dev, -EINVAL,
837 "bad data bits %d\n", val);
844 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
848 irq = platform_get_irq(pdev, 0);
852 pdata->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
853 if (IS_ERR(pdata->clk)) {
854 if (PTR_ERR(pdata->clk) != -ENOENT)
855 return PTR_ERR(pdata->clk);
858 * Clock framework support is optional, continue on
859 * anyways if we don't find a matching clock.
864 ret = clk_prepare_enable(pdata->clk);
866 dev_err(&pdev->dev, "Failed to prepare clock\n");
870 pm_runtime_use_autosuspend(&pdev->dev);
871 pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT);
872 pm_runtime_set_active(&pdev->dev);
873 pm_runtime_enable(&pdev->dev);
875 if (!ulite_uart_driver.state) {
876 dev_dbg(&pdev->dev, "uartlite: calling uart_register_driver()\n");
877 ret = uart_register_driver(&ulite_uart_driver);
879 dev_err(&pdev->dev, "Failed to register driver\n");
880 clk_disable_unprepare(pdata->clk);
885 ret = ulite_assign(&pdev->dev, id, res->start, irq, pdata);
887 pm_runtime_mark_last_busy(&pdev->dev);
888 pm_runtime_put_autosuspend(&pdev->dev);
893 static int ulite_remove(struct platform_device *pdev)
895 struct uart_port *port = dev_get_drvdata(&pdev->dev);
896 struct uartlite_data *pdata = port->private_data;
898 clk_disable_unprepare(pdata->clk);
899 ulite_release(&pdev->dev);
900 pm_runtime_disable(&pdev->dev);
901 pm_runtime_set_suspended(&pdev->dev);
902 pm_runtime_dont_use_autosuspend(&pdev->dev);
906 /* work with hotplug and coldplug */
907 MODULE_ALIAS("platform:uartlite");
909 static struct platform_driver ulite_platform_driver = {
910 .probe = ulite_probe,
911 .remove = ulite_remove,
914 .of_match_table = of_match_ptr(ulite_of_match),
919 /* ---------------------------------------------------------------------
920 * Module setup/teardown
923 static int __init ulite_init(void)
926 pr_debug("uartlite: calling platform_driver_register()\n");
927 return platform_driver_register(&ulite_platform_driver);
930 static void __exit ulite_exit(void)
932 platform_driver_unregister(&ulite_platform_driver);
933 if (ulite_uart_driver.state)
934 uart_unregister_driver(&ulite_uart_driver);
937 module_init(ulite_init);
938 module_exit(ulite_exit);
940 MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>");
941 MODULE_DESCRIPTION("Xilinx uartlite serial driver");
942 MODULE_LICENSE("GPL");