Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Synopsys DesignWare 8250 driver. |
| 3 | * |
| 4 | * Copyright 2011 Picochip, Jamie Iles. |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 5 | * Copyright 2013 Intel Corporation |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * The Synopsys DesignWare 8250 has an extra feature whereby it detects if the |
| 13 | * LCR is written whilst busy. If it is, then a busy detect interrupt is |
| 14 | * raised, the LCR needs to be rewritten and the uart status register read. |
| 15 | */ |
| 16 | #include <linux/device.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/io.h> |
| 19 | #include <linux/module.h> |
| 20 | #include <linux/serial_8250.h> |
| 21 | #include <linux/serial_core.h> |
| 22 | #include <linux/serial_reg.h> |
| 23 | #include <linux/of.h> |
| 24 | #include <linux/of_irq.h> |
| 25 | #include <linux/of_platform.h> |
| 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/slab.h> |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 28 | #include <linux/acpi.h> |
Emilio López | e302cd9 | 2013-03-29 00:15:49 +0100 | [diff] [blame] | 29 | #include <linux/clk.h> |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 30 | #include <linux/pm_runtime.h> |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 31 | |
Heikki Krogerus | 7277b2a | 2013-01-10 11:25:12 +0200 | [diff] [blame] | 32 | #include "8250.h" |
| 33 | |
Heikki Krogerus | 30046df | 2013-01-10 11:25:09 +0200 | [diff] [blame] | 34 | /* Offsets for the DesignWare specific registers */ |
| 35 | #define DW_UART_USR 0x1f /* UART Status Register */ |
| 36 | #define DW_UART_CPR 0xf4 /* Component Parameter Register */ |
| 37 | #define DW_UART_UCV 0xf8 /* UART Component Version */ |
| 38 | |
| 39 | /* Component Parameter Register bits */ |
| 40 | #define DW_UART_CPR_ABP_DATA_WIDTH (3 << 0) |
| 41 | #define DW_UART_CPR_AFCE_MODE (1 << 4) |
| 42 | #define DW_UART_CPR_THRE_MODE (1 << 5) |
| 43 | #define DW_UART_CPR_SIR_MODE (1 << 6) |
| 44 | #define DW_UART_CPR_SIR_LP_MODE (1 << 7) |
| 45 | #define DW_UART_CPR_ADDITIONAL_FEATURES (1 << 8) |
| 46 | #define DW_UART_CPR_FIFO_ACCESS (1 << 9) |
| 47 | #define DW_UART_CPR_FIFO_STAT (1 << 10) |
| 48 | #define DW_UART_CPR_SHADOW (1 << 11) |
| 49 | #define DW_UART_CPR_ENCODED_PARMS (1 << 12) |
| 50 | #define DW_UART_CPR_DMA_EXTRA (1 << 13) |
| 51 | #define DW_UART_CPR_FIFO_MODE (0xff << 16) |
| 52 | /* Helper for fifo size calculation */ |
| 53 | #define DW_UART_CPR_FIFO_SIZE(a) (((a >> 16) & 0xff) * 16) |
| 54 | |
| 55 | |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 56 | struct dw8250_data { |
Emilio López | e302cd9 | 2013-03-29 00:15:49 +0100 | [diff] [blame] | 57 | int last_lcr; |
| 58 | int line; |
| 59 | struct clk *clk; |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | static void dw8250_serial_out(struct uart_port *p, int offset, int value) |
| 63 | { |
| 64 | struct dw8250_data *d = p->private_data; |
| 65 | |
| 66 | if (offset == UART_LCR) |
| 67 | d->last_lcr = value; |
| 68 | |
| 69 | offset <<= p->regshift; |
| 70 | writeb(value, p->membase + offset); |
| 71 | } |
| 72 | |
| 73 | static unsigned int dw8250_serial_in(struct uart_port *p, int offset) |
| 74 | { |
| 75 | offset <<= p->regshift; |
| 76 | |
| 77 | return readb(p->membase + offset); |
| 78 | } |
| 79 | |
| 80 | static void dw8250_serial_out32(struct uart_port *p, int offset, int value) |
| 81 | { |
| 82 | struct dw8250_data *d = p->private_data; |
| 83 | |
| 84 | if (offset == UART_LCR) |
| 85 | d->last_lcr = value; |
| 86 | |
| 87 | offset <<= p->regshift; |
| 88 | writel(value, p->membase + offset); |
| 89 | } |
| 90 | |
| 91 | static unsigned int dw8250_serial_in32(struct uart_port *p, int offset) |
| 92 | { |
| 93 | offset <<= p->regshift; |
| 94 | |
| 95 | return readl(p->membase + offset); |
| 96 | } |
| 97 | |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 98 | static int dw8250_handle_irq(struct uart_port *p) |
| 99 | { |
| 100 | struct dw8250_data *d = p->private_data; |
| 101 | unsigned int iir = p->serial_in(p, UART_IIR); |
| 102 | |
| 103 | if (serial8250_handle_irq(p, iir)) { |
| 104 | return 1; |
| 105 | } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) { |
| 106 | /* Clear the USR and write the LCR again. */ |
Heikki Krogerus | 30046df | 2013-01-10 11:25:09 +0200 | [diff] [blame] | 107 | (void)p->serial_in(p, DW_UART_USR); |
Maxime Ripard | 68e56cb | 2013-01-14 20:09:26 +0100 | [diff] [blame] | 108 | p->serial_out(p, UART_LCR, d->last_lcr); |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 109 | |
| 110 | return 1; |
| 111 | } |
| 112 | |
| 113 | return 0; |
| 114 | } |
| 115 | |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 116 | static void |
| 117 | dw8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old) |
| 118 | { |
| 119 | if (!state) |
| 120 | pm_runtime_get_sync(port->dev); |
| 121 | |
| 122 | serial8250_do_pm(port, state, old); |
| 123 | |
| 124 | if (state) |
| 125 | pm_runtime_put_sync_suspend(port->dev); |
| 126 | } |
| 127 | |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 128 | static int dw8250_probe_of(struct uart_port *p) |
| 129 | { |
| 130 | struct device_node *np = p->dev->of_node; |
| 131 | u32 val; |
| 132 | |
| 133 | if (!of_property_read_u32(np, "reg-io-width", &val)) { |
| 134 | switch (val) { |
| 135 | case 1: |
| 136 | break; |
| 137 | case 4: |
| 138 | p->iotype = UPIO_MEM32; |
| 139 | p->serial_in = dw8250_serial_in32; |
| 140 | p->serial_out = dw8250_serial_out32; |
| 141 | break; |
| 142 | default: |
| 143 | dev_err(p->dev, "unsupported reg-io-width (%u)\n", val); |
| 144 | return -EINVAL; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | if (!of_property_read_u32(np, "reg-shift", &val)) |
| 149 | p->regshift = val; |
| 150 | |
Emilio López | e302cd9 | 2013-03-29 00:15:49 +0100 | [diff] [blame] | 151 | /* clock got configured through clk api, all done */ |
| 152 | if (p->uartclk) |
| 153 | return 0; |
| 154 | |
| 155 | /* try to find out clock frequency from DT as fallback */ |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 156 | if (of_property_read_u32(np, "clock-frequency", &val)) { |
Emilio López | e302cd9 | 2013-03-29 00:15:49 +0100 | [diff] [blame] | 157 | dev_err(p->dev, "clk or clock-frequency not defined\n"); |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 158 | return -EINVAL; |
| 159 | } |
| 160 | p->uartclk = val; |
| 161 | |
| 162 | return 0; |
| 163 | } |
| 164 | |
Heikki Krogerus | 053fac3 | 2013-01-16 14:08:15 +0200 | [diff] [blame] | 165 | #ifdef CONFIG_ACPI |
Heikki Krogerus | 94b2b47 | 2013-04-10 16:58:30 +0300 | [diff] [blame] | 166 | static int dw8250_probe_acpi(struct uart_8250_port *up) |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 167 | { |
| 168 | const struct acpi_device_id *id; |
Heikki Krogerus | 94b2b47 | 2013-04-10 16:58:30 +0300 | [diff] [blame] | 169 | struct uart_port *p = &up->port; |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 170 | |
| 171 | id = acpi_match_device(p->dev->driver->acpi_match_table, p->dev); |
| 172 | if (!id) |
| 173 | return -ENODEV; |
| 174 | |
| 175 | p->iotype = UPIO_MEM32; |
| 176 | p->serial_in = dw8250_serial_in32; |
| 177 | p->serial_out = dw8250_serial_out32; |
| 178 | p->regshift = 2; |
Heikki Krogerus | aea02e8 | 2013-04-10 16:58:29 +0300 | [diff] [blame] | 179 | |
| 180 | if (!p->uartclk) |
| 181 | p->uartclk = (unsigned int)id->driver_data; |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 182 | |
Heikki Krogerus | 94b2b47 | 2013-04-10 16:58:30 +0300 | [diff] [blame] | 183 | up->dma = devm_kzalloc(p->dev, sizeof(*up->dma), GFP_KERNEL); |
| 184 | if (!up->dma) |
| 185 | return -ENOMEM; |
| 186 | |
| 187 | up->dma->rxconf.src_maxburst = p->fifosize / 4; |
| 188 | up->dma->txconf.dst_maxburst = p->fifosize / 4; |
Heikki Krogerus | 7277b2a | 2013-01-10 11:25:12 +0200 | [diff] [blame] | 189 | |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 190 | return 0; |
| 191 | } |
Heikki Krogerus | 053fac3 | 2013-01-16 14:08:15 +0200 | [diff] [blame] | 192 | #else |
| 193 | static inline int dw8250_probe_acpi(struct uart_port *p) |
| 194 | { |
| 195 | return -ENODEV; |
| 196 | } |
| 197 | #endif /* CONFIG_ACPI */ |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 198 | |
Heikki Krogerus | 30046df | 2013-01-10 11:25:09 +0200 | [diff] [blame] | 199 | static void dw8250_setup_port(struct uart_8250_port *up) |
| 200 | { |
| 201 | struct uart_port *p = &up->port; |
| 202 | u32 reg = readl(p->membase + DW_UART_UCV); |
| 203 | |
| 204 | /* |
| 205 | * If the Component Version Register returns zero, we know that |
| 206 | * ADDITIONAL_FEATURES are not enabled. No need to go any further. |
| 207 | */ |
| 208 | if (!reg) |
| 209 | return; |
| 210 | |
| 211 | dev_dbg_ratelimited(p->dev, "Designware UART version %c.%c%c\n", |
| 212 | (reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff); |
| 213 | |
| 214 | reg = readl(p->membase + DW_UART_CPR); |
| 215 | if (!reg) |
| 216 | return; |
| 217 | |
| 218 | /* Select the type based on fifo */ |
| 219 | if (reg & DW_UART_CPR_FIFO_MODE) { |
| 220 | p->type = PORT_16550A; |
| 221 | p->flags |= UPF_FIXED_TYPE; |
| 222 | p->fifosize = DW_UART_CPR_FIFO_SIZE(reg); |
| 223 | up->tx_loadsz = p->fifosize; |
Heikki Krogerus | 2920adb | 2013-04-10 16:58:31 +0300 | [diff] [blame^] | 224 | up->capabilities = UART_CAP_FIFO; |
Heikki Krogerus | 30046df | 2013-01-10 11:25:09 +0200 | [diff] [blame] | 225 | } |
Heikki Krogerus | 2920adb | 2013-04-10 16:58:31 +0300 | [diff] [blame^] | 226 | |
| 227 | if (reg & DW_UART_CPR_AFCE_MODE) |
| 228 | up->capabilities |= UART_CAP_AFE; |
Heikki Krogerus | 30046df | 2013-01-10 11:25:09 +0200 | [diff] [blame] | 229 | } |
| 230 | |
Bill Pemberton | 9671f09 | 2012-11-19 13:21:50 -0500 | [diff] [blame] | 231 | static int dw8250_probe(struct platform_device *pdev) |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 232 | { |
Alan Cox | 2655a2c | 2012-07-12 12:59:50 +0100 | [diff] [blame] | 233 | struct uart_8250_port uart = {}; |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 234 | struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 235 | struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 236 | struct dw8250_data *data; |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 237 | int err; |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 238 | |
| 239 | if (!regs || !irq) { |
| 240 | dev_err(&pdev->dev, "no registers/irq defined\n"); |
| 241 | return -EINVAL; |
| 242 | } |
| 243 | |
Alan Cox | 2655a2c | 2012-07-12 12:59:50 +0100 | [diff] [blame] | 244 | spin_lock_init(&uart.port.lock); |
| 245 | uart.port.mapbase = regs->start; |
| 246 | uart.port.irq = irq->start; |
| 247 | uart.port.handle_irq = dw8250_handle_irq; |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 248 | uart.port.pm = dw8250_do_pm; |
Alan Cox | 2655a2c | 2012-07-12 12:59:50 +0100 | [diff] [blame] | 249 | uart.port.type = PORT_8250; |
Heikki Krogerus | f93366f | 2013-01-10 11:25:07 +0200 | [diff] [blame] | 250 | uart.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT; |
Alan Cox | 2655a2c | 2012-07-12 12:59:50 +0100 | [diff] [blame] | 251 | uart.port.dev = &pdev->dev; |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 252 | |
Heikki Krogerus | f93366f | 2013-01-10 11:25:07 +0200 | [diff] [blame] | 253 | uart.port.membase = ioremap(regs->start, resource_size(regs)); |
| 254 | if (!uart.port.membase) |
| 255 | return -ENOMEM; |
| 256 | |
Emilio López | e302cd9 | 2013-03-29 00:15:49 +0100 | [diff] [blame] | 257 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
| 258 | if (!data) |
| 259 | return -ENOMEM; |
| 260 | |
| 261 | data->clk = devm_clk_get(&pdev->dev, NULL); |
| 262 | if (!IS_ERR(data->clk)) { |
| 263 | clk_prepare_enable(data->clk); |
| 264 | uart.port.uartclk = clk_get_rate(data->clk); |
| 265 | } |
| 266 | |
Alan Cox | 2655a2c | 2012-07-12 12:59:50 +0100 | [diff] [blame] | 267 | uart.port.iotype = UPIO_MEM; |
| 268 | uart.port.serial_in = dw8250_serial_in; |
| 269 | uart.port.serial_out = dw8250_serial_out; |
Emilio López | e302cd9 | 2013-03-29 00:15:49 +0100 | [diff] [blame] | 270 | uart.port.private_data = data; |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 271 | |
Heikki Krogerus | f5836a5 | 2013-01-16 14:08:16 +0200 | [diff] [blame] | 272 | dw8250_setup_port(&uart); |
| 273 | |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 274 | if (pdev->dev.of_node) { |
| 275 | err = dw8250_probe_of(&uart.port); |
| 276 | if (err) |
| 277 | return err; |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 278 | } else if (ACPI_HANDLE(&pdev->dev)) { |
Heikki Krogerus | 94b2b47 | 2013-04-10 16:58:30 +0300 | [diff] [blame] | 279 | err = dw8250_probe_acpi(&uart); |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 280 | if (err) |
| 281 | return err; |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 282 | } else { |
| 283 | return -ENODEV; |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 284 | } |
| 285 | |
Alan Cox | 2655a2c | 2012-07-12 12:59:50 +0100 | [diff] [blame] | 286 | data->line = serial8250_register_8250_port(&uart); |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 287 | if (data->line < 0) |
| 288 | return data->line; |
| 289 | |
| 290 | platform_set_drvdata(pdev, data); |
| 291 | |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 292 | pm_runtime_set_active(&pdev->dev); |
| 293 | pm_runtime_enable(&pdev->dev); |
| 294 | |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 295 | return 0; |
| 296 | } |
| 297 | |
Bill Pemberton | ae8d8a1 | 2012-11-19 13:26:18 -0500 | [diff] [blame] | 298 | static int dw8250_remove(struct platform_device *pdev) |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 299 | { |
| 300 | struct dw8250_data *data = platform_get_drvdata(pdev); |
| 301 | |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 302 | pm_runtime_get_sync(&pdev->dev); |
| 303 | |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 304 | serial8250_unregister_port(data->line); |
| 305 | |
Emilio López | e302cd9 | 2013-03-29 00:15:49 +0100 | [diff] [blame] | 306 | if (!IS_ERR(data->clk)) |
| 307 | clk_disable_unprepare(data->clk); |
| 308 | |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 309 | pm_runtime_disable(&pdev->dev); |
| 310 | pm_runtime_put_noidle(&pdev->dev); |
| 311 | |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 312 | return 0; |
| 313 | } |
| 314 | |
James Hogan | b61c5ed | 2012-10-15 10:25:58 +0100 | [diff] [blame] | 315 | #ifdef CONFIG_PM |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 316 | static int dw8250_suspend(struct device *dev) |
James Hogan | b61c5ed | 2012-10-15 10:25:58 +0100 | [diff] [blame] | 317 | { |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 318 | struct dw8250_data *data = dev_get_drvdata(dev); |
James Hogan | b61c5ed | 2012-10-15 10:25:58 +0100 | [diff] [blame] | 319 | |
| 320 | serial8250_suspend_port(data->line); |
| 321 | |
| 322 | return 0; |
| 323 | } |
| 324 | |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 325 | static int dw8250_resume(struct device *dev) |
James Hogan | b61c5ed | 2012-10-15 10:25:58 +0100 | [diff] [blame] | 326 | { |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 327 | struct dw8250_data *data = dev_get_drvdata(dev); |
James Hogan | b61c5ed | 2012-10-15 10:25:58 +0100 | [diff] [blame] | 328 | |
| 329 | serial8250_resume_port(data->line); |
| 330 | |
| 331 | return 0; |
| 332 | } |
James Hogan | b61c5ed | 2012-10-15 10:25:58 +0100 | [diff] [blame] | 333 | #endif /* CONFIG_PM */ |
| 334 | |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 335 | #ifdef CONFIG_PM_RUNTIME |
| 336 | static int dw8250_runtime_suspend(struct device *dev) |
| 337 | { |
| 338 | struct dw8250_data *data = dev_get_drvdata(dev); |
| 339 | |
| 340 | clk_disable_unprepare(data->clk); |
| 341 | |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | static int dw8250_runtime_resume(struct device *dev) |
| 346 | { |
| 347 | struct dw8250_data *data = dev_get_drvdata(dev); |
| 348 | |
| 349 | clk_prepare_enable(data->clk); |
| 350 | |
| 351 | return 0; |
| 352 | } |
| 353 | #endif |
| 354 | |
| 355 | static const struct dev_pm_ops dw8250_pm_ops = { |
| 356 | SET_SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume) |
| 357 | SET_RUNTIME_PM_OPS(dw8250_runtime_suspend, dw8250_runtime_resume, NULL) |
| 358 | }; |
| 359 | |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 360 | static const struct of_device_id dw8250_of_match[] = { |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 361 | { .compatible = "snps,dw-apb-uart" }, |
| 362 | { /* Sentinel */ } |
| 363 | }; |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 364 | MODULE_DEVICE_TABLE(of, dw8250_of_match); |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 365 | |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 366 | static const struct acpi_device_id dw8250_acpi_match[] = { |
Heikki Krogerus | aea02e8 | 2013-04-10 16:58:29 +0300 | [diff] [blame] | 367 | { "INT33C4", 0 }, |
| 368 | { "INT33C5", 0 }, |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 369 | { }, |
| 370 | }; |
| 371 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); |
| 372 | |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 373 | static struct platform_driver dw8250_platform_driver = { |
| 374 | .driver = { |
| 375 | .name = "dw-apb-uart", |
| 376 | .owner = THIS_MODULE, |
Heikki Krogerus | ffc3ae6 | 2013-04-10 16:58:28 +0300 | [diff] [blame] | 377 | .pm = &dw8250_pm_ops, |
Heikki Krogerus | a7260c8 | 2013-01-10 11:25:08 +0200 | [diff] [blame] | 378 | .of_match_table = dw8250_of_match, |
Heikki Krogerus | 6a7320c | 2013-01-10 11:25:10 +0200 | [diff] [blame] | 379 | .acpi_match_table = ACPI_PTR(dw8250_acpi_match), |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 380 | }, |
| 381 | .probe = dw8250_probe, |
Bill Pemberton | 2d47b71 | 2012-11-19 13:21:34 -0500 | [diff] [blame] | 382 | .remove = dw8250_remove, |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 383 | }; |
| 384 | |
Axel Lin | c8381c15 | 2011-11-28 19:22:15 +0800 | [diff] [blame] | 385 | module_platform_driver(dw8250_platform_driver); |
Jamie Iles | 7d4008e | 2011-08-26 19:04:50 +0100 | [diff] [blame] | 386 | |
| 387 | MODULE_AUTHOR("Jamie Iles"); |
| 388 | MODULE_LICENSE("GPL"); |
| 389 | MODULE_DESCRIPTION("Synopsys DesignWare 8250 serial port driver"); |