staging: erofs: integrate decompression inplace
[linux/fpc-iii.git] / drivers / tty / serial / 8250 / 8250_dw.c
blob284e8d052fc3ced300ec73f5bf5945ea45d2aaf1
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Synopsys DesignWare 8250 driver.
5 * Copyright 2011 Picochip, Jamie Iles.
6 * Copyright 2013 Intel Corporation
8 * The Synopsys DesignWare 8250 has an extra feature whereby it detects if the
9 * LCR is written whilst busy. If it is, then a busy detect interrupt is
10 * raised, the LCR needs to be rewritten and the uart status register read.
12 #include <linux/delay.h>
13 #include <linux/device.h>
14 #include <linux/io.h>
15 #include <linux/module.h>
16 #include <linux/serial_8250.h>
17 #include <linux/serial_reg.h>
18 #include <linux/of.h>
19 #include <linux/of_irq.h>
20 #include <linux/of_platform.h>
21 #include <linux/platform_device.h>
22 #include <linux/slab.h>
23 #include <linux/acpi.h>
24 #include <linux/clk.h>
25 #include <linux/reset.h>
26 #include <linux/pm_runtime.h>
28 #include <asm/byteorder.h>
30 #include "8250.h"
32 /* Offsets for the DesignWare specific registers */
33 #define DW_UART_USR 0x1f /* UART Status Register */
34 #define DW_UART_DLF 0xc0 /* Divisor Latch Fraction Register */
35 #define DW_UART_CPR 0xf4 /* Component Parameter Register */
36 #define DW_UART_UCV 0xf8 /* UART Component Version */
38 /* Component Parameter Register bits */
39 #define DW_UART_CPR_ABP_DATA_WIDTH (3 << 0)
40 #define DW_UART_CPR_AFCE_MODE (1 << 4)
41 #define DW_UART_CPR_THRE_MODE (1 << 5)
42 #define DW_UART_CPR_SIR_MODE (1 << 6)
43 #define DW_UART_CPR_SIR_LP_MODE (1 << 7)
44 #define DW_UART_CPR_ADDITIONAL_FEATURES (1 << 8)
45 #define DW_UART_CPR_FIFO_ACCESS (1 << 9)
46 #define DW_UART_CPR_FIFO_STAT (1 << 10)
47 #define DW_UART_CPR_SHADOW (1 << 11)
48 #define DW_UART_CPR_ENCODED_PARMS (1 << 12)
49 #define DW_UART_CPR_DMA_EXTRA (1 << 13)
50 #define DW_UART_CPR_FIFO_MODE (0xff << 16)
51 /* Helper for fifo size calculation */
52 #define DW_UART_CPR_FIFO_SIZE(a) (((a >> 16) & 0xff) * 16)
54 /* DesignWare specific register fields */
55 #define DW_UART_MCR_SIRE BIT(6)
57 struct dw8250_data {
58 u8 usr_reg;
59 u8 dlf_size;
60 int line;
61 int msr_mask_on;
62 int msr_mask_off;
63 struct clk *clk;
64 struct clk *pclk;
65 struct reset_control *rst;
66 struct uart_8250_dma dma;
68 unsigned int skip_autocfg:1;
69 unsigned int uart_16550_compatible:1;
72 static inline u32 dw8250_readl_ext(struct uart_port *p, int offset)
74 if (p->iotype == UPIO_MEM32BE)
75 return ioread32be(p->membase + offset);
76 return readl(p->membase + offset);
79 static inline void dw8250_writel_ext(struct uart_port *p, int offset, u32 reg)
81 if (p->iotype == UPIO_MEM32BE)
82 iowrite32be(reg, p->membase + offset);
83 else
84 writel(reg, p->membase + offset);
87 static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value)
89 struct dw8250_data *d = p->private_data;
91 /* Override any modem control signals if needed */
92 if (offset == UART_MSR) {
93 value |= d->msr_mask_on;
94 value &= ~d->msr_mask_off;
97 return value;
100 static void dw8250_force_idle(struct uart_port *p)
102 struct uart_8250_port *up = up_to_u8250p(p);
104 serial8250_clear_and_reinit_fifos(up);
105 (void)p->serial_in(p, UART_RX);
108 static void dw8250_check_lcr(struct uart_port *p, int value)
110 void __iomem *offset = p->membase + (UART_LCR << p->regshift);
111 int tries = 1000;
113 /* Make sure LCR write wasn't ignored */
114 while (tries--) {
115 unsigned int lcr = p->serial_in(p, UART_LCR);
117 if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
118 return;
120 dw8250_force_idle(p);
122 #ifdef CONFIG_64BIT
123 if (p->type == PORT_OCTEON)
124 __raw_writeq(value & 0xff, offset);
125 else
126 #endif
127 if (p->iotype == UPIO_MEM32)
128 writel(value, offset);
129 else if (p->iotype == UPIO_MEM32BE)
130 iowrite32be(value, offset);
131 else
132 writeb(value, offset);
135 * FIXME: this deadlocks if port->lock is already held
136 * dev_err(p->dev, "Couldn't set LCR to %d\n", value);
140 /* Returns once the transmitter is empty or we run out of retries */
141 static void dw8250_tx_wait_empty(struct uart_port *p)
143 unsigned int tries = 20000;
144 unsigned int delay_threshold = tries - 1000;
145 unsigned int lsr;
147 while (tries--) {
148 lsr = readb (p->membase + (UART_LSR << p->regshift));
149 if (lsr & UART_LSR_TEMT)
150 break;
152 /* The device is first given a chance to empty without delay,
153 * to avoid slowdowns at high bitrates. If after 1000 tries
154 * the buffer has still not emptied, allow more time for low-
155 * speed links. */
156 if (tries < delay_threshold)
157 udelay (1);
161 static void dw8250_serial_out38x(struct uart_port *p, int offset, int value)
163 struct dw8250_data *d = p->private_data;
165 /* Allow the TX to drain before we reconfigure */
166 if (offset == UART_LCR)
167 dw8250_tx_wait_empty(p);
169 writeb(value, p->membase + (offset << p->regshift));
171 if (offset == UART_LCR && !d->uart_16550_compatible)
172 dw8250_check_lcr(p, value);
176 static void dw8250_serial_out(struct uart_port *p, int offset, int value)
178 struct dw8250_data *d = p->private_data;
180 writeb(value, p->membase + (offset << p->regshift));
182 if (offset == UART_LCR && !d->uart_16550_compatible)
183 dw8250_check_lcr(p, value);
186 static unsigned int dw8250_serial_in(struct uart_port *p, int offset)
188 unsigned int value = readb(p->membase + (offset << p->regshift));
190 return dw8250_modify_msr(p, offset, value);
193 #ifdef CONFIG_64BIT
194 static unsigned int dw8250_serial_inq(struct uart_port *p, int offset)
196 unsigned int value;
198 value = (u8)__raw_readq(p->membase + (offset << p->regshift));
200 return dw8250_modify_msr(p, offset, value);
203 static void dw8250_serial_outq(struct uart_port *p, int offset, int value)
205 struct dw8250_data *d = p->private_data;
207 value &= 0xff;
208 __raw_writeq(value, p->membase + (offset << p->regshift));
209 /* Read back to ensure register write ordering. */
210 __raw_readq(p->membase + (UART_LCR << p->regshift));
212 if (offset == UART_LCR && !d->uart_16550_compatible)
213 dw8250_check_lcr(p, value);
215 #endif /* CONFIG_64BIT */
217 static void dw8250_serial_out32(struct uart_port *p, int offset, int value)
219 struct dw8250_data *d = p->private_data;
221 writel(value, p->membase + (offset << p->regshift));
223 if (offset == UART_LCR && !d->uart_16550_compatible)
224 dw8250_check_lcr(p, value);
227 static unsigned int dw8250_serial_in32(struct uart_port *p, int offset)
229 unsigned int value = readl(p->membase + (offset << p->regshift));
231 return dw8250_modify_msr(p, offset, value);
234 static void dw8250_serial_out32be(struct uart_port *p, int offset, int value)
236 struct dw8250_data *d = p->private_data;
238 iowrite32be(value, p->membase + (offset << p->regshift));
240 if (offset == UART_LCR && !d->uart_16550_compatible)
241 dw8250_check_lcr(p, value);
244 static unsigned int dw8250_serial_in32be(struct uart_port *p, int offset)
246 unsigned int value = ioread32be(p->membase + (offset << p->regshift));
248 return dw8250_modify_msr(p, offset, value);
252 static int dw8250_handle_irq(struct uart_port *p)
254 struct uart_8250_port *up = up_to_u8250p(p);
255 struct dw8250_data *d = p->private_data;
256 unsigned int iir = p->serial_in(p, UART_IIR);
257 unsigned int status;
258 unsigned long flags;
261 * There are ways to get Designware-based UARTs into a state where
262 * they are asserting UART_IIR_RX_TIMEOUT but there is no actual
263 * data available. If we see such a case then we'll do a bogus
264 * read. If we don't do this then the "RX TIMEOUT" interrupt will
265 * fire forever.
267 * This problem has only been observed so far when not in DMA mode
268 * so we limit the workaround only to non-DMA mode.
270 if (!up->dma && ((iir & 0x3f) == UART_IIR_RX_TIMEOUT)) {
271 spin_lock_irqsave(&p->lock, flags);
272 status = p->serial_in(p, UART_LSR);
274 if (!(status & (UART_LSR_DR | UART_LSR_BI)))
275 (void) p->serial_in(p, UART_RX);
277 spin_unlock_irqrestore(&p->lock, flags);
280 if (serial8250_handle_irq(p, iir))
281 return 1;
283 if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
284 /* Clear the USR */
285 (void)p->serial_in(p, d->usr_reg);
287 return 1;
290 return 0;
293 static void
294 dw8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old)
296 if (!state)
297 pm_runtime_get_sync(port->dev);
299 serial8250_do_pm(port, state, old);
301 if (state)
302 pm_runtime_put_sync_suspend(port->dev);
305 static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
306 struct ktermios *old)
308 unsigned int baud = tty_termios_baud_rate(termios);
309 struct dw8250_data *d = p->private_data;
310 long rate;
311 int ret;
313 if (IS_ERR(d->clk))
314 goto out;
316 clk_disable_unprepare(d->clk);
317 rate = clk_round_rate(d->clk, baud * 16);
318 if (rate < 0)
319 ret = rate;
320 else if (rate == 0)
321 ret = -ENOENT;
322 else
323 ret = clk_set_rate(d->clk, rate);
324 clk_prepare_enable(d->clk);
326 if (!ret)
327 p->uartclk = rate;
329 out:
330 p->status &= ~UPSTAT_AUTOCTS;
331 if (termios->c_cflag & CRTSCTS)
332 p->status |= UPSTAT_AUTOCTS;
334 serial8250_do_set_termios(p, termios, old);
337 static void dw8250_set_ldisc(struct uart_port *p, struct ktermios *termios)
339 struct uart_8250_port *up = up_to_u8250p(p);
340 unsigned int mcr = p->serial_in(p, UART_MCR);
342 if (up->capabilities & UART_CAP_IRDA) {
343 if (termios->c_line == N_IRDA)
344 mcr |= DW_UART_MCR_SIRE;
345 else
346 mcr &= ~DW_UART_MCR_SIRE;
348 p->serial_out(p, UART_MCR, mcr);
350 serial8250_do_set_ldisc(p, termios);
354 * dw8250_fallback_dma_filter will prevent the UART from getting just any free
355 * channel on platforms that have DMA engines, but don't have any channels
356 * assigned to the UART.
358 * REVISIT: This is a work around for limitation in the DMA Engine API. Once the
359 * core problem is fixed, this function is no longer needed.
361 static bool dw8250_fallback_dma_filter(struct dma_chan *chan, void *param)
363 return false;
366 static bool dw8250_idma_filter(struct dma_chan *chan, void *param)
368 return param == chan->device->dev;
372 * divisor = div(I) + div(F)
373 * "I" means integer, "F" means fractional
374 * quot = div(I) = clk / (16 * baud)
375 * frac = div(F) * 2^dlf_size
377 * let rem = clk % (16 * baud)
378 * we have: div(F) * (16 * baud) = rem
379 * so frac = 2^dlf_size * rem / (16 * baud) = (rem << dlf_size) / (16 * baud)
381 static unsigned int dw8250_get_divisor(struct uart_port *p,
382 unsigned int baud,
383 unsigned int *frac)
385 unsigned int quot, rem, base_baud = baud * 16;
386 struct dw8250_data *d = p->private_data;
388 quot = p->uartclk / base_baud;
389 rem = p->uartclk % base_baud;
390 *frac = DIV_ROUND_CLOSEST(rem << d->dlf_size, base_baud);
392 return quot;
395 static void dw8250_set_divisor(struct uart_port *p, unsigned int baud,
396 unsigned int quot, unsigned int quot_frac)
398 dw8250_writel_ext(p, DW_UART_DLF, quot_frac);
399 serial8250_do_set_divisor(p, baud, quot, quot_frac);
402 static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
404 if (p->dev->of_node) {
405 struct device_node *np = p->dev->of_node;
406 int id;
408 /* get index of serial line, if found in DT aliases */
409 id = of_alias_get_id(np, "serial");
410 if (id >= 0)
411 p->line = id;
412 #ifdef CONFIG_64BIT
413 if (of_device_is_compatible(np, "cavium,octeon-3860-uart")) {
414 p->serial_in = dw8250_serial_inq;
415 p->serial_out = dw8250_serial_outq;
416 p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
417 p->type = PORT_OCTEON;
418 data->usr_reg = 0x27;
419 data->skip_autocfg = true;
421 #endif
422 if (of_device_is_big_endian(p->dev->of_node)) {
423 p->iotype = UPIO_MEM32BE;
424 p->serial_in = dw8250_serial_in32be;
425 p->serial_out = dw8250_serial_out32be;
427 if (of_device_is_compatible(np, "marvell,armada-38x-uart"))
428 p->serial_out = dw8250_serial_out38x;
430 } else if (acpi_dev_present("APMC0D08", NULL, -1)) {
431 p->iotype = UPIO_MEM32;
432 p->regshift = 2;
433 p->serial_in = dw8250_serial_in32;
434 data->uart_16550_compatible = true;
437 /* Platforms with iDMA 64-bit */
438 if (platform_get_resource_byname(to_platform_device(p->dev),
439 IORESOURCE_MEM, "lpss_priv")) {
440 data->dma.rx_param = p->dev->parent;
441 data->dma.tx_param = p->dev->parent;
442 data->dma.fn = dw8250_idma_filter;
446 static void dw8250_setup_port(struct uart_port *p)
448 struct uart_8250_port *up = up_to_u8250p(p);
449 u32 reg;
452 * If the Component Version Register returns zero, we know that
453 * ADDITIONAL_FEATURES are not enabled. No need to go any further.
455 reg = dw8250_readl_ext(p, DW_UART_UCV);
456 if (!reg)
457 return;
459 dev_dbg(p->dev, "Designware UART version %c.%c%c\n",
460 (reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff);
462 dw8250_writel_ext(p, DW_UART_DLF, ~0U);
463 reg = dw8250_readl_ext(p, DW_UART_DLF);
464 dw8250_writel_ext(p, DW_UART_DLF, 0);
466 if (reg) {
467 struct dw8250_data *d = p->private_data;
469 d->dlf_size = fls(reg);
470 p->get_divisor = dw8250_get_divisor;
471 p->set_divisor = dw8250_set_divisor;
474 reg = dw8250_readl_ext(p, DW_UART_CPR);
475 if (!reg)
476 return;
478 /* Select the type based on fifo */
479 if (reg & DW_UART_CPR_FIFO_MODE) {
480 p->type = PORT_16550A;
481 p->flags |= UPF_FIXED_TYPE;
482 p->fifosize = DW_UART_CPR_FIFO_SIZE(reg);
483 up->capabilities = UART_CAP_FIFO;
486 if (reg & DW_UART_CPR_AFCE_MODE)
487 up->capabilities |= UART_CAP_AFE;
489 if (reg & DW_UART_CPR_SIR_MODE)
490 up->capabilities |= UART_CAP_IRDA;
493 static int dw8250_probe(struct platform_device *pdev)
495 struct uart_8250_port uart = {};
496 struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
497 int irq = platform_get_irq(pdev, 0);
498 struct uart_port *p = &uart.port;
499 struct device *dev = &pdev->dev;
500 struct dw8250_data *data;
501 int err;
502 u32 val;
504 if (!regs) {
505 dev_err(dev, "no registers defined\n");
506 return -EINVAL;
509 if (irq < 0) {
510 if (irq != -EPROBE_DEFER)
511 dev_err(dev, "cannot get irq\n");
512 return irq;
515 spin_lock_init(&p->lock);
516 p->mapbase = regs->start;
517 p->irq = irq;
518 p->handle_irq = dw8250_handle_irq;
519 p->pm = dw8250_do_pm;
520 p->type = PORT_8250;
521 p->flags = UPF_SHARE_IRQ | UPF_FIXED_PORT;
522 p->dev = dev;
523 p->iotype = UPIO_MEM;
524 p->serial_in = dw8250_serial_in;
525 p->serial_out = dw8250_serial_out;
526 p->set_ldisc = dw8250_set_ldisc;
527 p->set_termios = dw8250_set_termios;
529 p->membase = devm_ioremap(dev, regs->start, resource_size(regs));
530 if (!p->membase)
531 return -ENOMEM;
533 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
534 if (!data)
535 return -ENOMEM;
537 data->dma.fn = dw8250_fallback_dma_filter;
538 data->usr_reg = DW_UART_USR;
539 p->private_data = data;
541 data->uart_16550_compatible = device_property_read_bool(dev,
542 "snps,uart-16550-compatible");
544 err = device_property_read_u32(dev, "reg-shift", &val);
545 if (!err)
546 p->regshift = val;
548 err = device_property_read_u32(dev, "reg-io-width", &val);
549 if (!err && val == 4) {
550 p->iotype = UPIO_MEM32;
551 p->serial_in = dw8250_serial_in32;
552 p->serial_out = dw8250_serial_out32;
555 if (device_property_read_bool(dev, "dcd-override")) {
556 /* Always report DCD as active */
557 data->msr_mask_on |= UART_MSR_DCD;
558 data->msr_mask_off |= UART_MSR_DDCD;
561 if (device_property_read_bool(dev, "dsr-override")) {
562 /* Always report DSR as active */
563 data->msr_mask_on |= UART_MSR_DSR;
564 data->msr_mask_off |= UART_MSR_DDSR;
567 if (device_property_read_bool(dev, "cts-override")) {
568 /* Always report CTS as active */
569 data->msr_mask_on |= UART_MSR_CTS;
570 data->msr_mask_off |= UART_MSR_DCTS;
573 if (device_property_read_bool(dev, "ri-override")) {
574 /* Always report Ring indicator as inactive */
575 data->msr_mask_off |= UART_MSR_RI;
576 data->msr_mask_off |= UART_MSR_TERI;
579 /* Always ask for fixed clock rate from a property. */
580 device_property_read_u32(dev, "clock-frequency", &p->uartclk);
582 /* If there is separate baudclk, get the rate from it. */
583 data->clk = devm_clk_get(dev, "baudclk");
584 if (IS_ERR(data->clk) && PTR_ERR(data->clk) != -EPROBE_DEFER)
585 data->clk = devm_clk_get(dev, NULL);
586 if (IS_ERR(data->clk) && PTR_ERR(data->clk) == -EPROBE_DEFER)
587 return -EPROBE_DEFER;
588 if (!IS_ERR_OR_NULL(data->clk)) {
589 err = clk_prepare_enable(data->clk);
590 if (err)
591 dev_warn(dev, "could not enable optional baudclk: %d\n",
592 err);
593 else
594 p->uartclk = clk_get_rate(data->clk);
597 /* If no clock rate is defined, fail. */
598 if (!p->uartclk) {
599 dev_err(dev, "clock rate not defined\n");
600 err = -EINVAL;
601 goto err_clk;
604 data->pclk = devm_clk_get(dev, "apb_pclk");
605 if (IS_ERR(data->pclk) && PTR_ERR(data->pclk) == -EPROBE_DEFER) {
606 err = -EPROBE_DEFER;
607 goto err_clk;
609 if (!IS_ERR(data->pclk)) {
610 err = clk_prepare_enable(data->pclk);
611 if (err) {
612 dev_err(dev, "could not enable apb_pclk\n");
613 goto err_clk;
617 data->rst = devm_reset_control_get_optional_exclusive(dev, NULL);
618 if (IS_ERR(data->rst)) {
619 err = PTR_ERR(data->rst);
620 goto err_pclk;
622 reset_control_deassert(data->rst);
624 dw8250_quirks(p, data);
626 /* If the Busy Functionality is not implemented, don't handle it */
627 if (data->uart_16550_compatible)
628 p->handle_irq = NULL;
630 if (!data->skip_autocfg)
631 dw8250_setup_port(p);
633 /* If we have a valid fifosize, try hooking up DMA */
634 if (p->fifosize) {
635 data->dma.rxconf.src_maxburst = p->fifosize / 4;
636 data->dma.txconf.dst_maxburst = p->fifosize / 4;
637 uart.dma = &data->dma;
640 data->line = serial8250_register_8250_port(&uart);
641 if (data->line < 0) {
642 err = data->line;
643 goto err_reset;
646 platform_set_drvdata(pdev, data);
648 pm_runtime_set_active(dev);
649 pm_runtime_enable(dev);
651 return 0;
653 err_reset:
654 reset_control_assert(data->rst);
656 err_pclk:
657 if (!IS_ERR(data->pclk))
658 clk_disable_unprepare(data->pclk);
660 err_clk:
661 if (!IS_ERR(data->clk))
662 clk_disable_unprepare(data->clk);
664 return err;
667 static int dw8250_remove(struct platform_device *pdev)
669 struct dw8250_data *data = platform_get_drvdata(pdev);
671 pm_runtime_get_sync(&pdev->dev);
673 serial8250_unregister_port(data->line);
675 reset_control_assert(data->rst);
677 if (!IS_ERR(data->pclk))
678 clk_disable_unprepare(data->pclk);
680 if (!IS_ERR(data->clk))
681 clk_disable_unprepare(data->clk);
683 pm_runtime_disable(&pdev->dev);
684 pm_runtime_put_noidle(&pdev->dev);
686 return 0;
689 #ifdef CONFIG_PM_SLEEP
690 static int dw8250_suspend(struct device *dev)
692 struct dw8250_data *data = dev_get_drvdata(dev);
694 serial8250_suspend_port(data->line);
696 return 0;
699 static int dw8250_resume(struct device *dev)
701 struct dw8250_data *data = dev_get_drvdata(dev);
703 serial8250_resume_port(data->line);
705 return 0;
707 #endif /* CONFIG_PM_SLEEP */
709 #ifdef CONFIG_PM
710 static int dw8250_runtime_suspend(struct device *dev)
712 struct dw8250_data *data = dev_get_drvdata(dev);
714 if (!IS_ERR(data->clk))
715 clk_disable_unprepare(data->clk);
717 if (!IS_ERR(data->pclk))
718 clk_disable_unprepare(data->pclk);
720 return 0;
723 static int dw8250_runtime_resume(struct device *dev)
725 struct dw8250_data *data = dev_get_drvdata(dev);
727 if (!IS_ERR(data->pclk))
728 clk_prepare_enable(data->pclk);
730 if (!IS_ERR(data->clk))
731 clk_prepare_enable(data->clk);
733 return 0;
735 #endif
737 static const struct dev_pm_ops dw8250_pm_ops = {
738 SET_SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume)
739 SET_RUNTIME_PM_OPS(dw8250_runtime_suspend, dw8250_runtime_resume, NULL)
742 static const struct of_device_id dw8250_of_match[] = {
743 { .compatible = "snps,dw-apb-uart" },
744 { .compatible = "cavium,octeon-3860-uart" },
745 { .compatible = "marvell,armada-38x-uart" },
746 { .compatible = "renesas,rzn1-uart" },
747 { /* Sentinel */ }
749 MODULE_DEVICE_TABLE(of, dw8250_of_match);
751 static const struct acpi_device_id dw8250_acpi_match[] = {
752 { "INT33C4", 0 },
753 { "INT33C5", 0 },
754 { "INT3434", 0 },
755 { "INT3435", 0 },
756 { "80860F0A", 0 },
757 { "8086228A", 0 },
758 { "APMC0D08", 0},
759 { "AMD0020", 0 },
760 { "AMDI0020", 0 },
761 { "BRCM2032", 0 },
762 { "HISI0031", 0 },
763 { },
765 MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
767 static struct platform_driver dw8250_platform_driver = {
768 .driver = {
769 .name = "dw-apb-uart",
770 .pm = &dw8250_pm_ops,
771 .of_match_table = dw8250_of_match,
772 .acpi_match_table = ACPI_PTR(dw8250_acpi_match),
774 .probe = dw8250_probe,
775 .remove = dw8250_remove,
778 module_platform_driver(dw8250_platform_driver);
780 MODULE_AUTHOR("Jamie Iles");
781 MODULE_LICENSE("GPL");
782 MODULE_DESCRIPTION("Synopsys DesignWare 8250 serial port driver");
783 MODULE_ALIAS("platform:dw-apb-uart");