1 #if defined(CONFIG_SERIAL_EFM32_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5 #include <linux/kernel.h>
6 #include <linux/module.h>
8 #include <linux/platform_device.h>
9 #include <linux/console.h>
10 #include <linux/sysrq.h>
11 #include <linux/serial_core.h>
12 #include <linux/tty_flip.h>
13 #include <linux/slab.h>
14 #include <linux/clk.h>
16 #include <linux/of_device.h>
18 #include <linux/platform_data/efm32-uart.h>
20 #define DRIVER_NAME "efm32-uart"
21 #define DEV_NAME "ttyefm"
23 #define UARTn_CTRL 0x00
24 #define UARTn_CTRL_SYNC 0x0001
25 #define UARTn_CTRL_TXBIL 0x1000
27 #define UARTn_FRAME 0x04
28 #define UARTn_FRAME_DATABITS__MASK 0x000f
29 #define UARTn_FRAME_DATABITS(n) ((n) - 3)
30 #define UARTn_FRAME_PARITY_NONE 0x0000
31 #define UARTn_FRAME_PARITY_EVEN 0x0200
32 #define UARTn_FRAME_PARITY_ODD 0x0300
33 #define UARTn_FRAME_STOPBITS_HALF 0x0000
34 #define UARTn_FRAME_STOPBITS_ONE 0x1000
35 #define UARTn_FRAME_STOPBITS_TWO 0x3000
37 #define UARTn_CMD 0x0c
38 #define UARTn_CMD_RXEN 0x0001
39 #define UARTn_CMD_RXDIS 0x0002
40 #define UARTn_CMD_TXEN 0x0004
41 #define UARTn_CMD_TXDIS 0x0008
43 #define UARTn_STATUS 0x10
44 #define UARTn_STATUS_TXENS 0x0002
45 #define UARTn_STATUS_TXC 0x0020
46 #define UARTn_STATUS_TXBL 0x0040
47 #define UARTn_STATUS_RXDATAV 0x0080
49 #define UARTn_CLKDIV 0x14
51 #define UARTn_RXDATAX 0x18
52 #define UARTn_RXDATAX_RXDATA__MASK 0x01ff
53 #define UARTn_RXDATAX_PERR 0x4000
54 #define UARTn_RXDATAX_FERR 0x8000
56 * This is a software only flag used for ignore_status_mask and
57 * read_status_mask! It's used for breaks that the hardware doesn't report
60 #define SW_UARTn_RXDATAX_BERR 0x2000
62 #define UARTn_TXDATA 0x34
65 #define UARTn_IF_TXC 0x0001
66 #define UARTn_IF_TXBL 0x0002
67 #define UARTn_IF_RXDATAV 0x0004
68 #define UARTn_IF_RXOF 0x0010
70 #define UARTn_IFS 0x44
71 #define UARTn_IFC 0x48
72 #define UARTn_IEN 0x4c
74 #define UARTn_ROUTE 0x54
75 #define UARTn_ROUTE_LOCATION__MASK 0x0700
76 #define UARTn_ROUTE_LOCATION(n) (((n) << 8) & UARTn_ROUTE_LOCATION__MASK)
77 #define UARTn_ROUTE_RXPEN 0x0001
78 #define UARTn_ROUTE_TXPEN 0x0002
80 struct efm32_uart_port {
81 struct uart_port port;
84 struct efm32_uart_pdata pdata;
86 #define to_efm_port(_port) container_of(_port, struct efm32_uart_port, port)
87 #define efm_debug(efm_port, format, arg...) \
88 dev_dbg(efm_port->port.dev, format, ##arg)
90 static void efm32_uart_write32(struct efm32_uart_port *efm_port,
91 u32 value, unsigned offset)
93 writel_relaxed(value, efm_port->port.membase + offset);
96 static u32 efm32_uart_read32(struct efm32_uart_port *efm_port,
99 return readl_relaxed(efm_port->port.membase + offset);
102 static unsigned int efm32_uart_tx_empty(struct uart_port *port)
104 struct efm32_uart_port *efm_port = to_efm_port(port);
105 u32 status = efm32_uart_read32(efm_port, UARTn_STATUS);
107 if (status & UARTn_STATUS_TXC)
113 static void efm32_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
115 /* sorry, neither handshaking lines nor loop functionallity */
118 static unsigned int efm32_uart_get_mctrl(struct uart_port *port)
120 /* sorry, no handshaking lines available */
121 return TIOCM_CAR | TIOCM_CTS | TIOCM_DSR;
124 static void efm32_uart_stop_tx(struct uart_port *port)
126 struct efm32_uart_port *efm_port = to_efm_port(port);
127 u32 ien = efm32_uart_read32(efm_port, UARTn_IEN);
129 efm32_uart_write32(efm_port, UARTn_CMD_TXDIS, UARTn_CMD);
130 ien &= ~(UARTn_IF_TXC | UARTn_IF_TXBL);
131 efm32_uart_write32(efm_port, ien, UARTn_IEN);
134 static void efm32_uart_tx_chars(struct efm32_uart_port *efm_port)
136 struct uart_port *port = &efm_port->port;
137 struct circ_buf *xmit = &port->state->xmit;
139 while (efm32_uart_read32(efm_port, UARTn_STATUS) &
143 efm32_uart_write32(efm_port, port->x_char,
148 if (!uart_circ_empty(xmit) && !uart_tx_stopped(port)) {
150 efm32_uart_write32(efm_port, xmit->buf[xmit->tail],
152 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
157 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
158 uart_write_wakeup(port);
160 if (!port->x_char && uart_circ_empty(xmit) &&
161 efm32_uart_read32(efm_port, UARTn_STATUS) &
163 efm32_uart_stop_tx(port);
166 static void efm32_uart_start_tx(struct uart_port *port)
168 struct efm32_uart_port *efm_port = to_efm_port(port);
171 efm32_uart_write32(efm_port,
172 UARTn_IF_TXBL | UARTn_IF_TXC, UARTn_IFC);
173 ien = efm32_uart_read32(efm_port, UARTn_IEN);
174 efm32_uart_write32(efm_port,
175 ien | UARTn_IF_TXBL | UARTn_IF_TXC, UARTn_IEN);
176 efm32_uart_write32(efm_port, UARTn_CMD_TXEN, UARTn_CMD);
178 efm32_uart_tx_chars(efm_port);
181 static void efm32_uart_stop_rx(struct uart_port *port)
183 struct efm32_uart_port *efm_port = to_efm_port(port);
185 efm32_uart_write32(efm_port, UARTn_CMD_RXDIS, UARTn_CMD);
188 static void efm32_uart_enable_ms(struct uart_port *port)
190 /* no handshake lines, no modem status interrupts */
193 static void efm32_uart_break_ctl(struct uart_port *port, int ctl)
195 /* not possible without fiddling with gpios */
198 static void efm32_uart_rx_chars(struct efm32_uart_port *efm_port)
200 struct uart_port *port = &efm_port->port;
202 while (efm32_uart_read32(efm_port, UARTn_STATUS) &
203 UARTn_STATUS_RXDATAV) {
204 u32 rxdata = efm32_uart_read32(efm_port, UARTn_RXDATAX);
208 * This is a reserved bit and I only saw it read as 0. But to be
209 * sure not to be confused too much by new devices adhere to the
210 * warning in the reference manual that reserverd bits might
211 * read as 1 in the future.
213 rxdata &= ~SW_UARTn_RXDATAX_BERR;
217 if ((rxdata & UARTn_RXDATAX_FERR) &&
218 !(rxdata & UARTn_RXDATAX_RXDATA__MASK)) {
219 rxdata |= SW_UARTn_RXDATAX_BERR;
221 if (uart_handle_break(port))
223 } else if (rxdata & UARTn_RXDATAX_PERR)
224 port->icount.parity++;
225 else if (rxdata & UARTn_RXDATAX_FERR)
226 port->icount.frame++;
228 rxdata &= port->read_status_mask;
230 if (rxdata & SW_UARTn_RXDATAX_BERR)
232 else if (rxdata & UARTn_RXDATAX_PERR)
234 else if (rxdata & UARTn_RXDATAX_FERR)
236 else if (uart_handle_sysrq_char(port,
237 rxdata & UARTn_RXDATAX_RXDATA__MASK))
240 if ((rxdata & port->ignore_status_mask) == 0)
241 tty_insert_flip_char(&port->state->port,
242 rxdata & UARTn_RXDATAX_RXDATA__MASK, flag);
246 static irqreturn_t efm32_uart_rxirq(int irq, void *data)
248 struct efm32_uart_port *efm_port = data;
249 u32 irqflag = efm32_uart_read32(efm_port, UARTn_IF);
250 int handled = IRQ_NONE;
251 struct uart_port *port = &efm_port->port;
252 struct tty_port *tport = &port->state->port;
254 spin_lock(&port->lock);
256 if (irqflag & UARTn_IF_RXDATAV) {
257 efm32_uart_write32(efm_port, UARTn_IF_RXDATAV, UARTn_IFC);
258 efm32_uart_rx_chars(efm_port);
260 handled = IRQ_HANDLED;
263 if (irqflag & UARTn_IF_RXOF) {
264 efm32_uart_write32(efm_port, UARTn_IF_RXOF, UARTn_IFC);
265 port->icount.overrun++;
266 tty_insert_flip_char(tport, 0, TTY_OVERRUN);
268 handled = IRQ_HANDLED;
271 spin_unlock(&port->lock);
273 tty_flip_buffer_push(tport);
278 static irqreturn_t efm32_uart_txirq(int irq, void *data)
280 struct efm32_uart_port *efm_port = data;
281 u32 irqflag = efm32_uart_read32(efm_port, UARTn_IF);
283 /* TXBL doesn't need to be cleared */
284 if (irqflag & UARTn_IF_TXC)
285 efm32_uart_write32(efm_port, UARTn_IF_TXC, UARTn_IFC);
287 if (irqflag & (UARTn_IF_TXC | UARTn_IF_TXBL)) {
288 efm32_uart_tx_chars(efm_port);
294 static int efm32_uart_startup(struct uart_port *port)
296 struct efm32_uart_port *efm_port = to_efm_port(port);
299 ret = clk_enable(efm_port->clk);
301 efm_debug(efm_port, "failed to enable clk\n");
304 port->uartclk = clk_get_rate(efm_port->clk);
306 /* Enable pins at configured location */
307 efm32_uart_write32(efm_port,
308 UARTn_ROUTE_LOCATION(efm_port->pdata.location) |
309 UARTn_ROUTE_RXPEN | UARTn_ROUTE_TXPEN,
312 ret = request_irq(port->irq, efm32_uart_rxirq, 0,
313 DRIVER_NAME, efm_port);
315 efm_debug(efm_port, "failed to register rxirq\n");
316 goto err_request_irq_rx;
319 /* disable all irqs */
320 efm32_uart_write32(efm_port, 0, UARTn_IEN);
322 ret = request_irq(efm_port->txirq, efm32_uart_txirq, 0,
323 DRIVER_NAME, efm_port);
325 efm_debug(efm_port, "failed to register txirq\n");
326 free_irq(port->irq, efm_port);
329 clk_disable(efm_port->clk);
331 efm32_uart_write32(efm_port,
332 UARTn_IF_RXDATAV | UARTn_IF_RXOF, UARTn_IEN);
333 efm32_uart_write32(efm_port, UARTn_CMD_RXEN, UARTn_CMD);
340 static void efm32_uart_shutdown(struct uart_port *port)
342 struct efm32_uart_port *efm_port = to_efm_port(port);
344 efm32_uart_write32(efm_port, 0, UARTn_IEN);
345 free_irq(port->irq, efm_port);
347 clk_disable(efm_port->clk);
350 static void efm32_uart_set_termios(struct uart_port *port,
351 struct ktermios *new, struct ktermios *old)
353 struct efm32_uart_port *efm_port = to_efm_port(port);
359 /* no modem control lines */
360 new->c_cflag &= ~(CRTSCTS | CMSPAR);
362 baud = uart_get_baud_rate(port, new, old,
363 DIV_ROUND_CLOSEST(port->uartclk, 16 * 8192),
364 DIV_ROUND_CLOSEST(port->uartclk, 16));
366 switch (new->c_cflag & CSIZE) {
368 frame |= UARTn_FRAME_DATABITS(5);
371 frame |= UARTn_FRAME_DATABITS(6);
374 frame |= UARTn_FRAME_DATABITS(7);
377 frame |= UARTn_FRAME_DATABITS(8);
381 if (new->c_cflag & CSTOPB)
382 /* the receiver only verifies the first stop bit */
383 frame |= UARTn_FRAME_STOPBITS_TWO;
385 frame |= UARTn_FRAME_STOPBITS_ONE;
387 if (new->c_cflag & PARENB) {
388 if (new->c_cflag & PARODD)
389 frame |= UARTn_FRAME_PARITY_ODD;
391 frame |= UARTn_FRAME_PARITY_EVEN;
393 frame |= UARTn_FRAME_PARITY_NONE;
396 * the 6 lowest bits of CLKDIV are dc, bit 6 has value 0.25.
397 * port->uartclk <= 14e6, so 4 * port->uartclk doesn't overflow.
399 clkdiv = (DIV_ROUND_CLOSEST(4 * port->uartclk, 16 * baud) - 4) << 6;
401 spin_lock_irqsave(&port->lock, flags);
403 efm32_uart_write32(efm_port,
404 UARTn_CMD_TXDIS | UARTn_CMD_RXDIS, UARTn_CMD);
406 port->read_status_mask = UARTn_RXDATAX_RXDATA__MASK;
407 if (new->c_iflag & INPCK)
408 port->read_status_mask |=
409 UARTn_RXDATAX_FERR | UARTn_RXDATAX_PERR;
410 if (new->c_iflag & (BRKINT | PARMRK))
411 port->read_status_mask |= SW_UARTn_RXDATAX_BERR;
413 port->ignore_status_mask = 0;
414 if (new->c_iflag & IGNPAR)
415 port->ignore_status_mask |=
416 UARTn_RXDATAX_FERR | UARTn_RXDATAX_PERR;
417 if (new->c_iflag & IGNBRK)
418 port->ignore_status_mask |= SW_UARTn_RXDATAX_BERR;
420 uart_update_timeout(port, new->c_cflag, baud);
422 efm32_uart_write32(efm_port, UARTn_CTRL_TXBIL, UARTn_CTRL);
423 efm32_uart_write32(efm_port, frame, UARTn_FRAME);
424 efm32_uart_write32(efm_port, clkdiv, UARTn_CLKDIV);
426 efm32_uart_write32(efm_port, UARTn_CMD_TXEN | UARTn_CMD_RXEN,
429 spin_unlock_irqrestore(&port->lock, flags);
432 static const char *efm32_uart_type(struct uart_port *port)
434 return port->type == PORT_EFMUART ? "efm32-uart" : NULL;
437 static void efm32_uart_release_port(struct uart_port *port)
439 struct efm32_uart_port *efm_port = to_efm_port(port);
441 clk_unprepare(efm_port->clk);
442 clk_put(efm_port->clk);
443 iounmap(port->membase);
446 static int efm32_uart_request_port(struct uart_port *port)
448 struct efm32_uart_port *efm_port = to_efm_port(port);
451 port->membase = ioremap(port->mapbase, 60);
452 if (!efm_port->port.membase) {
454 efm_debug(efm_port, "failed to remap\n");
458 efm_port->clk = clk_get(port->dev, NULL);
459 if (IS_ERR(efm_port->clk)) {
460 ret = PTR_ERR(efm_port->clk);
461 efm_debug(efm_port, "failed to get clock\n");
465 ret = clk_prepare(efm_port->clk);
467 clk_put(efm_port->clk);
470 iounmap(port->membase);
477 static void efm32_uart_config_port(struct uart_port *port, int type)
479 if (type & UART_CONFIG_TYPE &&
480 !efm32_uart_request_port(port))
481 port->type = PORT_EFMUART;
484 static int efm32_uart_verify_port(struct uart_port *port,
485 struct serial_struct *serinfo)
489 if (serinfo->type != PORT_UNKNOWN && serinfo->type != PORT_EFMUART)
495 static struct uart_ops efm32_uart_pops = {
496 .tx_empty = efm32_uart_tx_empty,
497 .set_mctrl = efm32_uart_set_mctrl,
498 .get_mctrl = efm32_uart_get_mctrl,
499 .stop_tx = efm32_uart_stop_tx,
500 .start_tx = efm32_uart_start_tx,
501 .stop_rx = efm32_uart_stop_rx,
502 .enable_ms = efm32_uart_enable_ms,
503 .break_ctl = efm32_uart_break_ctl,
504 .startup = efm32_uart_startup,
505 .shutdown = efm32_uart_shutdown,
506 .set_termios = efm32_uart_set_termios,
507 .type = efm32_uart_type,
508 .release_port = efm32_uart_release_port,
509 .request_port = efm32_uart_request_port,
510 .config_port = efm32_uart_config_port,
511 .verify_port = efm32_uart_verify_port,
514 static struct efm32_uart_port *efm32_uart_ports[5];
516 #ifdef CONFIG_SERIAL_EFM32_UART_CONSOLE
517 static void efm32_uart_console_putchar(struct uart_port *port, int ch)
519 struct efm32_uart_port *efm_port = to_efm_port(port);
520 unsigned int timeout = 0x400;
524 status = efm32_uart_read32(efm_port, UARTn_STATUS);
526 if (status & UARTn_STATUS_TXBL)
531 efm32_uart_write32(efm_port, ch, UARTn_TXDATA);
534 static void efm32_uart_console_write(struct console *co, const char *s,
537 struct efm32_uart_port *efm_port = efm32_uart_ports[co->index];
538 u32 status = efm32_uart_read32(efm_port, UARTn_STATUS);
539 unsigned int timeout = 0x400;
541 if (!(status & UARTn_STATUS_TXENS))
542 efm32_uart_write32(efm_port, UARTn_CMD_TXEN, UARTn_CMD);
544 uart_console_write(&efm_port->port, s, count,
545 efm32_uart_console_putchar);
547 /* Wait for the transmitter to become empty */
549 u32 status = efm32_uart_read32(efm_port, UARTn_STATUS);
550 if (status & UARTn_STATUS_TXC)
556 if (!(status & UARTn_STATUS_TXENS))
557 efm32_uart_write32(efm_port, UARTn_CMD_TXDIS, UARTn_CMD);
560 static void efm32_uart_console_get_options(struct efm32_uart_port *efm_port,
561 int *baud, int *parity, int *bits)
563 u32 ctrl = efm32_uart_read32(efm_port, UARTn_CTRL);
564 u32 route, clkdiv, frame;
566 if (ctrl & UARTn_CTRL_SYNC)
567 /* not operating in async mode */
570 route = efm32_uart_read32(efm_port, UARTn_ROUTE);
571 if (!(route & UARTn_ROUTE_TXPEN))
572 /* tx pin not routed */
575 clkdiv = efm32_uart_read32(efm_port, UARTn_CLKDIV);
577 *baud = DIV_ROUND_CLOSEST(4 * efm_port->port.uartclk,
578 16 * (4 + (clkdiv >> 6)));
580 frame = efm32_uart_read32(efm_port, UARTn_FRAME);
581 if (frame & UARTn_FRAME_PARITY_ODD)
583 else if (frame & UARTn_FRAME_PARITY_EVEN)
588 *bits = (frame & UARTn_FRAME_DATABITS__MASK) -
589 UARTn_FRAME_DATABITS(4) + 4;
591 efm_debug(efm_port, "get_opts: options=%d%c%d\n",
592 *baud, *parity, *bits);
595 static int efm32_uart_console_setup(struct console *co, char *options)
597 struct efm32_uart_port *efm_port;
604 if (co->index < 0 || co->index >= ARRAY_SIZE(efm32_uart_ports)) {
606 for (i = 0; i < ARRAY_SIZE(efm32_uart_ports); ++i) {
607 if (efm32_uart_ports[i]) {
608 pr_warn("efm32-console: fall back to console index %u (from %hhi)\n",
616 efm_port = efm32_uart_ports[co->index];
618 pr_warn("efm32-console: No port at %d\n", co->index);
622 ret = clk_prepare(efm_port->clk);
624 dev_warn(efm_port->port.dev,
625 "console: clk_prepare failed: %d\n", ret);
629 efm_port->port.uartclk = clk_get_rate(efm_port->clk);
632 uart_parse_options(options, &baud, &parity, &bits, &flow);
634 efm32_uart_console_get_options(efm_port,
635 &baud, &parity, &bits);
637 return uart_set_options(&efm_port->port, co, baud, parity, bits, flow);
640 static struct uart_driver efm32_uart_reg;
642 static struct console efm32_uart_console = {
644 .write = efm32_uart_console_write,
645 .device = uart_console_device,
646 .setup = efm32_uart_console_setup,
647 .flags = CON_PRINTBUFFER,
649 .data = &efm32_uart_reg,
653 #define efm32_uart_console (*(struct console *)NULL)
654 #endif /* ifdef CONFIG_SERIAL_EFM32_UART_CONSOLE / else */
656 static struct uart_driver efm32_uart_reg = {
657 .owner = THIS_MODULE,
658 .driver_name = DRIVER_NAME,
659 .dev_name = DEV_NAME,
660 .nr = ARRAY_SIZE(efm32_uart_ports),
661 .cons = &efm32_uart_console,
664 static int efm32_uart_probe_dt(struct platform_device *pdev,
665 struct efm32_uart_port *efm_port)
667 struct device_node *np = pdev->dev.of_node;
674 ret = of_property_read_u32(np, "efm32,location", &location);
676 /* fall back to old and (wrongly) generic property "location" */
677 ret = of_property_read_u32(np, "location", &location);
680 dev_err(&pdev->dev, "invalid location\n");
683 efm_debug(efm_port, "using location %u\n", location);
684 efm_port->pdata.location = location;
686 efm_debug(efm_port, "fall back to location 0\n");
689 ret = of_alias_get_id(np, "serial");
691 dev_err(&pdev->dev, "failed to get alias id: %d\n", ret);
694 efm_port->port.line = ret;
700 static int efm32_uart_probe(struct platform_device *pdev)
702 struct efm32_uart_port *efm_port;
703 struct resource *res;
707 efm_port = kzalloc(sizeof(*efm_port), GFP_KERNEL);
709 dev_dbg(&pdev->dev, "failed to allocate private data\n");
713 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
716 dev_dbg(&pdev->dev, "failed to determine base address\n");
720 if (resource_size(res) < 60) {
722 dev_dbg(&pdev->dev, "memory resource too small\n");
726 ret = platform_get_irq(pdev, 0);
728 dev_dbg(&pdev->dev, "failed to get rx irq\n");
732 efm_port->port.irq = ret;
734 ret = platform_get_irq(pdev, 1);
736 ret = efm_port->port.irq + 1;
738 efm_port->txirq = ret;
740 efm_port->port.dev = &pdev->dev;
741 efm_port->port.mapbase = res->start;
742 efm_port->port.type = PORT_EFMUART;
743 efm_port->port.iotype = UPIO_MEM32;
744 efm_port->port.fifosize = 2;
745 efm_port->port.ops = &efm32_uart_pops;
746 efm_port->port.flags = UPF_BOOT_AUTOCONF;
748 ret = efm32_uart_probe_dt(pdev, efm_port);
750 /* not created by device tree */
751 const struct efm32_uart_pdata *pdata = dev_get_platdata(&pdev->dev);
753 efm_port->port.line = pdev->id;
756 efm_port->pdata = *pdata;
760 line = efm_port->port.line;
762 if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
763 efm32_uart_ports[line] = efm_port;
765 ret = uart_add_one_port(&efm32_uart_reg, &efm_port->port);
767 dev_dbg(&pdev->dev, "failed to add port: %d\n", ret);
769 if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
770 efm32_uart_ports[line] = NULL;
777 platform_set_drvdata(pdev, efm_port);
778 dev_dbg(&pdev->dev, "\\o/\n");
784 static int efm32_uart_remove(struct platform_device *pdev)
786 struct efm32_uart_port *efm_port = platform_get_drvdata(pdev);
787 unsigned int line = efm_port->port.line;
789 uart_remove_one_port(&efm32_uart_reg, &efm_port->port);
791 if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
792 efm32_uart_ports[line] = NULL;
799 static const struct of_device_id efm32_uart_dt_ids[] = {
801 .compatible = "energymicro,efm32-uart",
803 /* doesn't follow the "vendor,device" scheme, don't use */
804 .compatible = "efm32,uart",
809 MODULE_DEVICE_TABLE(of, efm32_uart_dt_ids);
811 static struct platform_driver efm32_uart_driver = {
812 .probe = efm32_uart_probe,
813 .remove = efm32_uart_remove,
817 .owner = THIS_MODULE,
818 .of_match_table = efm32_uart_dt_ids,
822 static int __init efm32_uart_init(void)
826 ret = uart_register_driver(&efm32_uart_reg);
830 ret = platform_driver_register(&efm32_uart_driver);
832 uart_unregister_driver(&efm32_uart_reg);
834 pr_info("EFM32 UART/USART driver\n");
838 module_init(efm32_uart_init);
840 static void __exit efm32_uart_exit(void)
842 platform_driver_unregister(&efm32_uart_driver);
843 uart_unregister_driver(&efm32_uart_reg);
846 MODULE_AUTHOR("Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>");
847 MODULE_DESCRIPTION("EFM32 UART/USART driver");
848 MODULE_LICENSE("GPL v2");
849 MODULE_ALIAS("platform:" DRIVER_NAME);