blob: be8626234627e4a9f96246a027ab48a6603954af [file] [log] [blame]
Greg Kroah-Hartmane3b3d0f2017-11-06 18:11:51 +01001// SPDX-License-Identifier: GPL-2.0+
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +01002/*
3 * Serial Port driver for Open Firmware platform devices
4 *
5 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp.
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +01006 */
Jingchang Lu8ad3b132014-11-11 15:09:05 +08007#include <linux/console.h>
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +01008#include <linux/module.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +09009#include <linux/slab.h>
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010010#include <linux/serial_core.h>
Dan Williamsbf03f652012-04-10 14:10:53 -070011#include <linux/serial_reg.h>
Grant Likelyf1ca09b2010-08-16 23:44:49 -060012#include <linux/of_address.h>
Rob Herring73930a82010-11-17 17:50:23 -060013#include <linux/of_irq.h>
Stephen Rothwellc401b042008-05-23 16:32:54 +100014#include <linux/of_platform.h>
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -050015#include <linux/pm_runtime.h>
Murali Karicheri0bbeb3c2012-10-22 11:58:01 -040016#include <linux/clk.h>
Joel Stanleye2860e12017-05-29 19:27:52 +093017#include <linux/reset.h>
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010018
Peter Ujfalusic93a5992015-12-18 15:00:49 +020019#include "8250.h"
Heikki Krogerusb0b8c842013-03-25 15:51:15 +020020
Ishizaki Koue34b9c92007-05-31 19:33:04 +100021struct of_serial_info {
Murali Karicheri0bbeb3c2012-10-22 11:58:01 -040022 struct clk *clk;
Joel Stanleye2860e12017-05-29 19:27:52 +093023 struct reset_control *rst;
Ishizaki Koue34b9c92007-05-31 19:33:04 +100024 int type;
25 int line;
26};
27
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010028/*
29 * Fill a struct uart_port for a given device node
30 */
Bill Pemberton9671f092012-11-19 13:21:50 -050031static int of_platform_serial_setup(struct platform_device *ofdev,
Lukas Wunner058bc102020-02-28 14:31:06 +010032 int type, struct uart_8250_port *up,
Murali Karicheri0bbeb3c2012-10-22 11:58:01 -040033 struct of_serial_info *info)
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010034{
35 struct resource resource;
Grant Likely61c7a082010-04-13 16:12:29 -070036 struct device_node *np = ofdev->dev.of_node;
Lukas Wunner058bc102020-02-28 14:31:06 +010037 struct uart_port *port = &up->port;
Grant Likelyb84e7732011-06-30 12:39:12 -060038 u32 clk, spd, prop;
John Garrya27d93822018-08-30 17:08:50 +080039 int ret, irq;
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010040
41 memset(port, 0, sizeof *port);
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -050042
43 pm_runtime_enable(&ofdev->dev);
44 pm_runtime_get_sync(&ofdev->dev);
45
Grant Likelyb84e7732011-06-30 12:39:12 -060046 if (of_property_read_u32(np, "clock-frequency", &clk)) {
Murali Karicheri0bbeb3c2012-10-22 11:58:01 -040047
48 /* Get clk rate through clk driver if present */
Masahiro Yamada3a63d222015-05-25 14:57:43 +090049 info->clk = devm_clk_get(&ofdev->dev, NULL);
Wei Yongjun76cc4382012-11-01 13:27:34 +080050 if (IS_ERR(info->clk)) {
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -050051 ret = PTR_ERR(info->clk);
Thierry Reding87bb0082019-06-05 10:51:42 +020052 if (ret != -EPROBE_DEFER)
53 dev_warn(&ofdev->dev,
54 "failed to get clock: %d\n", ret);
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -050055 goto err_pmruntime;
Murali Karicheri0bbeb3c2012-10-22 11:58:01 -040056 }
57
Masahiro Yamada6f0c3092015-05-25 15:03:32 +090058 ret = clk_prepare_enable(info->clk);
59 if (ret < 0)
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -050060 goto err_pmruntime;
Masahiro Yamada6f0c3092015-05-25 15:03:32 +090061
Murali Karicheri0bbeb3c2012-10-22 11:58:01 -040062 clk = clk_get_rate(info->clk);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010063 }
Grant Likelyb84e7732011-06-30 12:39:12 -060064 /* If current-speed was set, then try not to change it. */
65 if (of_property_read_u32(np, "current-speed", &spd) == 0)
66 port->custom_divisor = clk / (16 * spd);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010067
68 ret = of_address_to_resource(np, 0, &resource);
69 if (ret) {
70 dev_warn(&ofdev->dev, "invalid address\n");
Alexey Khoroshilovfa9ba3ac2017-07-19 11:32:37 +030071 goto err_unprepare;
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010072 }
73
John Garryaa959472018-04-27 18:36:06 +080074 port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT |
75 UPF_FIXED_TYPE;
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +010076 spin_lock_init(&port->lock);
John Linnb912b5e2008-04-03 10:22:19 +110077
John Garryaa959472018-04-27 18:36:06 +080078 if (resource_type(&resource) == IORESOURCE_IO) {
79 port->iotype = UPIO_PORT;
80 port->iobase = resource.start;
81 } else {
82 port->mapbase = resource.start;
83 port->mapsize = resource_size(&resource);
84
85 /* Check for shifted address mapping */
Robert Hancockd06b1cf2022-01-12 13:42:14 -060086 if (of_property_read_u32(np, "reg-offset", &prop) == 0) {
87 if (prop >= port->mapsize) {
88 dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n",
89 prop, &port->mapsize);
90 ret = -EINVAL;
91 goto err_unprepare;
92 }
93
John Garryaa959472018-04-27 18:36:06 +080094 port->mapbase += prop;
Robert Hancockd06b1cf2022-01-12 13:42:14 -060095 port->mapsize -= prop;
96 }
John Garryaa959472018-04-27 18:36:06 +080097
98 port->iotype = UPIO_MEM;
99 if (of_property_read_u32(np, "reg-io-width", &prop) == 0) {
100 switch (prop) {
101 case 1:
102 port->iotype = UPIO_MEM;
103 break;
104 case 2:
105 port->iotype = UPIO_MEM16;
106 break;
107 case 4:
108 port->iotype = of_device_is_big_endian(np) ?
109 UPIO_MEM32BE : UPIO_MEM32;
110 break;
111 default:
112 dev_warn(&ofdev->dev, "unsupported reg-io-width (%d)\n",
113 prop);
114 ret = -EINVAL;
Alexander Sverdlinb29330d822018-07-13 16:58:54 +0200115 goto err_unprepare;
John Garryaa959472018-04-27 18:36:06 +0800116 }
117 }
118 port->flags |= UPF_IOREMAP;
119 }
John Linnb912b5e2008-04-03 10:22:19 +1100120
Lubomir Rintelf4817842019-02-24 13:00:53 +0100121 /* Compatibility with the deprecated pxa driver and 8250_pxa drivers. */
122 if (of_device_is_compatible(np, "mrvl,mmp-uart"))
123 port->regshift = 2;
124
John Linnb912b5e2008-04-03 10:22:19 +1100125 /* Check for registers offset within the devices address range */
Grant Likelyb84e7732011-06-30 12:39:12 -0600126 if (of_property_read_u32(np, "reg-shift", &prop) == 0)
127 port->regshift = prop;
John Linnb912b5e2008-04-03 10:22:19 +1100128
Heikki Krogerus9f1ca062013-03-25 13:34:45 +0200129 /* Check for fifo size */
130 if (of_property_read_u32(np, "fifo-size", &prop) == 0)
131 port->fifosize = prop;
132
Lucas Stach3239fd32014-12-05 20:21:57 +0100133 /* Check for a fixed line number */
134 ret = of_alias_get_id(np, "serial");
135 if (ret >= 0)
136 port->line = ret;
137
John Garrya27d93822018-08-30 17:08:50 +0800138 irq = of_irq_get(np, 0);
139 if (irq < 0) {
140 if (irq == -EPROBE_DEFER) {
141 ret = -EPROBE_DEFER;
142 goto err_unprepare;
143 }
144 /* IRQ support not mandatory */
145 irq = 0;
Alexander Sverdlinc58caaa2018-07-13 17:01:19 +0200146 }
Jamie Iles74237342011-06-27 13:32:34 +0100147
John Garrya27d93822018-08-30 17:08:50 +0800148 port->irq = irq;
149
Joel Stanleye2860e12017-05-29 19:27:52 +0930150 info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL);
Masahiro Yamadab9820a32017-12-27 14:21:05 +0900151 if (IS_ERR(info->rst)) {
152 ret = PTR_ERR(info->rst);
John Garrya27d93822018-08-30 17:08:50 +0800153 goto err_unprepare;
Masahiro Yamadab9820a32017-12-27 14:21:05 +0900154 }
155
Joel Stanleye2860e12017-05-29 19:27:52 +0930156 ret = reset_control_deassert(info->rst);
157 if (ret)
John Garrya27d93822018-08-30 17:08:50 +0800158 goto err_unprepare;
Joel Stanleye2860e12017-05-29 19:27:52 +0930159
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100160 port->type = type;
Grant Likelyb84e7732011-06-30 12:39:12 -0600161 port->uartclk = clk;
Gabor Juhosfde8be22012-07-17 17:08:31 +0100162
Sergei Shtylyov5c98e9c2017-08-20 19:51:55 +0300163 if (of_property_read_bool(np, "no-loopback-test"))
Gabor Juhosfde8be22012-07-17 17:08:31 +0100164 port->flags |= UPF_SKIP_TEST;
165
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100166 port->dev = &ofdev->dev;
Lukas Wunner283e0962020-02-28 14:31:03 +0100167 port->rs485_config = serial8250_em485_config;
Lukas Wunner058bc102020-02-28 14:31:06 +0100168 up->rs485_start_tx = serial8250_em485_start_tx;
169 up->rs485_stop_tx = serial8250_em485_stop_tx;
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100170
John Crispin9b8777e2014-10-16 21:48:21 +0200171 switch (type) {
John Crispin9b8777e2014-10-16 21:48:21 +0200172 case PORT_RT2880:
173 port->iotype = UPIO_AU;
174 break;
175 }
Dan Williamsbf03f652012-04-10 14:10:53 -0700176
Scott Woodd43b54d2015-10-07 17:31:21 -0500177 if (IS_ENABLED(CONFIG_SERIAL_8250_FSL) &&
178 (of_device_is_compatible(np, "fsl,ns16550") ||
Dmitry Safonovd68fefd2019-12-13 00:06:04 +0000179 of_device_is_compatible(np, "fsl,16550-FIFO64"))) {
Scott Woodd43b54d2015-10-07 17:31:21 -0500180 port->handle_irq = fsl8250_handle_irq;
Dmitry Safonovd68fefd2019-12-13 00:06:04 +0000181 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
182 }
Scott Woodd43b54d2015-10-07 17:31:21 -0500183
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100184 return 0;
Alexey Khoroshilovfa9ba3ac2017-07-19 11:32:37 +0300185err_unprepare:
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -0500186 clk_disable_unprepare(info->clk);
187err_pmruntime:
188 pm_runtime_put_sync(&ofdev->dev);
189 pm_runtime_disable(&ofdev->dev);
Murali Karicheri0bbeb3c2012-10-22 11:58:01 -0400190 return ret;
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100191}
192
193/*
194 * Try to register a serial port
195 */
Bill Pemberton9671f092012-11-19 13:21:50 -0500196static int of_platform_serial_probe(struct platform_device *ofdev)
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100197{
Ishizaki Koue34b9c92007-05-31 19:33:04 +1000198 struct of_serial_info *info;
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100199 struct uart_8250_port port8250;
Andy Shevchenko525667c2019-04-30 21:45:59 +0300200 unsigned int port_type;
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100201 u32 tx_threshold;
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100202 int ret;
203
Jim Quinlanf5b08382021-04-23 11:32:04 -0700204 if (IS_ENABLED(CONFIG_SERIAL_8250_BCM7271) &&
205 of_device_is_compatible(ofdev->dev.of_node, "brcm,bcm7271-uart"))
206 return -ENODEV;
207
Andy Shevchenko525667c2019-04-30 21:45:59 +0300208 port_type = (unsigned long)of_device_get_match_data(&ofdev->dev);
209 if (port_type == PORT_UNKNOWN)
Grant Likely793218d2011-02-22 21:10:26 -0700210 return -EINVAL;
211
Sergei Shtylyov5c98e9c2017-08-20 19:51:55 +0300212 if (of_property_read_bool(ofdev->dev.of_node, "used-by-rtas"))
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100213 return -EBUSY;
214
Jingchang Lu7e12e672014-10-21 16:50:21 +0800215 info = kzalloc(sizeof(*info), GFP_KERNEL);
Ishizaki Koue34b9c92007-05-31 19:33:04 +1000216 if (info == NULL)
217 return -ENOMEM;
218
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100219 memset(&port8250, 0, sizeof(port8250));
Lukas Wunner058bc102020-02-28 14:31:06 +0100220 ret = of_platform_serial_setup(ofdev, port_type, &port8250, info);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100221 if (ret)
Alexey Khoroshilovfa9ba3ac2017-07-19 11:32:37 +0300222 goto err_free;
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100223
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100224 if (port8250.port.fifosize)
225 port8250.capabilities = UART_CAP_FIFO;
Heikki Krogerusb0b8c842013-03-25 15:51:15 +0200226
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100227 /* Check for TX FIFO threshold & set tx_loadsz */
228 if ((of_property_read_u32(ofdev->dev.of_node, "tx-threshold",
229 &tx_threshold) == 0) &&
230 (tx_threshold < port8250.port.fifosize))
231 port8250.tx_loadsz = port8250.port.fifosize - tx_threshold;
Heikki Krogerusb0b8c842013-03-25 15:51:15 +0200232
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100233 if (of_property_read_bool(ofdev->dev.of_node, "auto-flow-control"))
234 port8250.capabilities |= UART_CAP_AFE;
Thor Thayerffea0432016-09-22 14:56:15 -0500235
Darwin Dingel6d7f6772018-12-10 11:29:09 +1300236 if (of_property_read_u32(ofdev->dev.of_node,
237 "overrun-throttle-ms",
238 &port8250.overrun_backoff_time_ms) != 0)
239 port8250.overrun_backoff_time_ms = 0;
240
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100241 ret = serial8250_register_8250_port(&port8250);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100242 if (ret < 0)
Alexey Khoroshilovfa9ba3ac2017-07-19 11:32:37 +0300243 goto err_dispose;
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100244
Ishizaki Koue34b9c92007-05-31 19:33:04 +1000245 info->type = port_type;
246 info->line = ret;
Jingoo Han696faed2013-05-23 19:39:36 +0900247 platform_set_drvdata(ofdev, info);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100248 return 0;
Alexey Khoroshilovfa9ba3ac2017-07-19 11:32:37 +0300249err_dispose:
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100250 irq_dispose_mapping(port8250.port.irq);
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -0500251 pm_runtime_put_sync(&ofdev->dev);
252 pm_runtime_disable(&ofdev->dev);
253 clk_disable_unprepare(info->clk);
Alexey Khoroshilovfa9ba3ac2017-07-19 11:32:37 +0300254err_free:
255 kfree(info);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100256 return ret;
257}
258
259/*
260 * Release a line
261 */
Grant Likely2dc11582010-08-06 09:25:50 -0600262static int of_platform_serial_remove(struct platform_device *ofdev)
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100263{
Jingoo Han696faed2013-05-23 19:39:36 +0900264 struct of_serial_info *info = platform_get_drvdata(ofdev);
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100265
266 serial8250_unregister_port(info->line);
Murali Karicheri0bbeb3c2012-10-22 11:58:01 -0400267
Joel Stanleye2860e12017-05-29 19:27:52 +0930268 reset_control_assert(info->rst);
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -0500269 pm_runtime_put_sync(&ofdev->dev);
270 pm_runtime_disable(&ofdev->dev);
271 clk_disable_unprepare(info->clk);
Ishizaki Koue34b9c92007-05-31 19:33:04 +1000272 kfree(info);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100273 return 0;
274}
275
Jingchang Lu8ad3b132014-11-11 15:09:05 +0800276#ifdef CONFIG_PM_SLEEP
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100277static int of_serial_suspend(struct device *dev)
Jingchang Lu8ad3b132014-11-11 15:09:05 +0800278{
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100279 struct of_serial_info *info = dev_get_drvdata(dev);
Jingchang Lu8ad3b132014-11-11 15:09:05 +0800280 struct uart_8250_port *port8250 = serial8250_get_port(info->line);
281 struct uart_port *port = &port8250->port;
282
283 serial8250_suspend_port(info->line);
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100284
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -0500285 if (!uart_console(port) || console_suspend_enabled) {
286 pm_runtime_put_sync(dev);
Jingchang Lu8ad3b132014-11-11 15:09:05 +0800287 clk_disable_unprepare(info->clk);
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -0500288 }
Jingchang Lu8ad3b132014-11-11 15:09:05 +0800289 return 0;
290}
291
292static int of_serial_resume(struct device *dev)
293{
294 struct of_serial_info *info = dev_get_drvdata(dev);
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100295 struct uart_8250_port *port8250 = serial8250_get_port(info->line);
296 struct uart_port *port = &port8250->port;
Jingchang Lu8ad3b132014-11-11 15:09:05 +0800297
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -0500298 if (!uart_console(port) || console_suspend_enabled) {
299 pm_runtime_get_sync(dev);
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100300 clk_prepare_enable(info->clk);
Franklin S Cooper Jra2d23eda2017-08-16 15:55:36 -0500301 }
Arnd Bergmannaa42db42017-01-25 23:19:01 +0100302
303 serial8250_resume_port(info->line);
Jingchang Lu8ad3b132014-11-11 15:09:05 +0800304
305 return 0;
306}
307#endif
308static SIMPLE_DEV_PM_OPS(of_serial_pm_ops, of_serial_suspend, of_serial_resume);
309
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100310/*
311 * A few common types, add more as needed.
312 */
Fabian Fredericked0bb232015-03-16 20:17:11 +0100313static const struct of_device_id of_platform_serial_table[] = {
Grant Likely8c6e9112011-02-22 19:12:21 -0700314 { .compatible = "ns8250", .data = (void *)PORT_8250, },
315 { .compatible = "ns16450", .data = (void *)PORT_16450, },
316 { .compatible = "ns16550a", .data = (void *)PORT_16550A, },
317 { .compatible = "ns16550", .data = (void *)PORT_16550, },
318 { .compatible = "ns16750", .data = (void *)PORT_16750, },
319 { .compatible = "ns16850", .data = (void *)PORT_16850, },
Roland Stiggee4305f02012-06-11 21:57:14 +0200320 { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, },
John Crispin9b8777e2014-10-16 21:48:21 +0200321 { .compatible = "ralink,rt2880-uart", .data = (void *)PORT_RT2880, },
Linus Walleij3a503652019-01-27 02:04:04 +0100322 { .compatible = "intel,xscale-uart", .data = (void *)PORT_XSCALE, },
Ley Foon Tane06c93c2013-03-07 10:28:37 +0800323 { .compatible = "altr,16550-FIFO32",
324 .data = (void *)PORT_ALTR_16550_F32, },
325 { .compatible = "altr,16550-FIFO64",
326 .data = (void *)PORT_ALTR_16550_F64, },
327 { .compatible = "altr,16550-FIFO128",
328 .data = (void *)PORT_ALTR_16550_F128, },
Sean Wang1c16ae62017-08-21 01:17:56 +0800329 { .compatible = "mediatek,mtk-btif",
330 .data = (void *)PORT_MTK_BTIF, },
Rob Herring6ad991b2015-01-26 22:50:08 -0600331 { .compatible = "mrvl,mmp-uart",
332 .data = (void *)PORT_XSCALE, },
David Lechnera2d6a982017-01-05 12:54:18 -0600333 { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, },
Jonathan Neuschäfer8465df72021-03-20 19:16:05 +0100334 { .compatible = "nuvoton,wpcm450-uart", .data = (void *)PORT_NPCM, },
Joel Stanleyf597fbc2018-03-05 22:17:38 +1030335 { .compatible = "nuvoton,npcm750-uart", .data = (void *)PORT_NPCM, },
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100336 { /* end of list */ },
337};
Luis de Bethencourt8d58db12015-09-18 20:03:43 +0200338MODULE_DEVICE_TABLE(of, of_platform_serial_table);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100339
Grant Likely793218d2011-02-22 21:10:26 -0700340static struct platform_driver of_platform_serial_driver = {
Grant Likely40182942010-04-13 16:13:02 -0700341 .driver = {
342 .name = "of_serial",
Grant Likely40182942010-04-13 16:13:02 -0700343 .of_match_table = of_platform_serial_table,
Wang Dongsheng434ba162016-01-21 15:59:53 +0800344 .pm = &of_serial_pm_ops,
Grant Likely40182942010-04-13 16:13:02 -0700345 },
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100346 .probe = of_platform_serial_probe,
347 .remove = of_platform_serial_remove,
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100348};
349
Grant Likely940ab882011-10-05 11:29:49 -0600350module_platform_driver(of_platform_serial_driver);
Arnd Bergmann8d38a5b2007-02-13 21:35:38 +0100351
352MODULE_AUTHOR("Arnd Bergmann <arnd@arndb.de>");
353MODULE_LICENSE("GPL");
354MODULE_DESCRIPTION("Serial Port driver for Open Firmware platform devices");