forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/tty/serial/xilinx_uartps.c
....@@ -9,10 +9,6 @@
99 * in the code.
1010 */
1111
12
-#if defined(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
13
-#define SUPPORT_SYSRQ
14
-#endif
15
-
1612 #include <linux/platform_device.h>
1713 #include <linux/serial.h>
1814 #include <linux/console.h>
....@@ -32,19 +28,19 @@
3228 #define CDNS_UART_NAME "xuartps"
3329 #define CDNS_UART_MAJOR 0 /* use dynamic node allocation */
3430 #define CDNS_UART_MINOR 0 /* works best with devtmpfs */
35
-#define CDNS_UART_NR_PORTS 2
31
+#define CDNS_UART_NR_PORTS 16
3632 #define CDNS_UART_FIFO_SIZE 64 /* FIFO size */
3733 #define CDNS_UART_REGISTER_SPACE 0x1000
3834 #define TX_TIMEOUT 500000
3935
4036 /* Rx Trigger level */
4137 static int rx_trigger_level = 56;
42
-module_param(rx_trigger_level, uint, S_IRUGO);
38
+module_param(rx_trigger_level, uint, 0444);
4339 MODULE_PARM_DESC(rx_trigger_level, "Rx trigger level, 1-63 bytes");
4440
4541 /* Rx Timeout */
4642 static int rx_timeout = 10;
47
-module_param(rx_timeout, uint, S_IRUGO);
43
+module_param(rx_timeout, uint, 0444);
4844 MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");
4945
5046 /* Register offsets for the UART. */
....@@ -160,6 +156,16 @@
160156 #define CDNS_UART_MODEMCR_DTR 0x00000001 /* Data Terminal Ready */
161157
162158 /*
159
+ * Modem Status register:
160
+ * The read/write Modem Status register reports the interface with the modem
161
+ * or data set, or a peripheral device emulating a modem.
162
+ */
163
+#define CDNS_UART_MODEMSR_DCD BIT(7) /* Data Carrier Detect */
164
+#define CDNS_UART_MODEMSR_RI BIT(6) /* Ting Indicator */
165
+#define CDNS_UART_MODEMSR_DSR BIT(5) /* Data Set Ready */
166
+#define CDNS_UART_MODEMSR_CTS BIT(4) /* Clear To Send */
167
+
168
+/*
163169 * Channel Status Register:
164170 * The channel status register (CSR) is provided to enable the control logic
165171 * to monitor the status of bits in the channel interrupt status register,
....@@ -182,6 +188,7 @@
182188 * @port: Pointer to the UART port
183189 * @uartclk: Reference clock
184190 * @pclk: APB clock
191
+ * @cdns_uart_driver: Pointer to UART driver
185192 * @baud: Current baud rate
186193 * @clk_rate_change_nb: Notifier block for clock changes
187194 * @quirks: Flags for RXBS support.
....@@ -190,15 +197,17 @@
190197 struct uart_port *port;
191198 struct clk *uartclk;
192199 struct clk *pclk;
200
+ struct uart_driver *cdns_uart_driver;
193201 unsigned int baud;
194202 struct notifier_block clk_rate_change_nb;
195203 u32 quirks;
204
+ bool cts_override;
196205 };
197206 struct cdns_platform_data {
198207 u32 quirks;
199208 };
200209 #define to_cdns_uart(_nb) container_of(_nb, struct cdns_uart, \
201
- clk_rate_change_nb);
210
+ clk_rate_change_nb)
202211
203212 /**
204213 * cdns_uart_handle_rx - Handle the received bytes along with Rx errors.
....@@ -311,15 +320,16 @@
311320 } else {
312321 numbytes = port->fifosize;
313322 while (numbytes && !uart_circ_empty(&port->state->xmit) &&
314
- !(readl(port->membase + CDNS_UART_SR) & CDNS_UART_SR_TXFULL)) {
323
+ !(readl(port->membase + CDNS_UART_SR) &
324
+ CDNS_UART_SR_TXFULL)) {
315325 /*
316326 * Get the data from the UART circular buffer
317327 * and write it to the cdns_uart's TX_FIFO
318328 * register.
319329 */
320330 writel(
321
- port->state->xmit.buf[port->state->xmit.
322
- tail], port->membase + CDNS_UART_FIFO);
331
+ port->state->xmit.buf[port->state->xmit.tail],
332
+ port->membase + CDNS_UART_FIFO);
323333
324334 port->icount.tx++;
325335
....@@ -365,6 +375,8 @@
365375 isrstatus &= ~CDNS_UART_IXR_TXEMPTY;
366376 }
367377
378
+ isrstatus &= port->read_status_mask;
379
+ isrstatus &= ~port->ignore_status_mask;
368380 /*
369381 * Skip RX processing if RX is disabled as RXEMPTY will never be set
370382 * as read bytes will not be removed from the FIFO.
....@@ -534,7 +546,7 @@
534546
535547 cdns_uart->baud = cdns_uart_set_baud_rate(cdns_uart->port,
536548 cdns_uart->baud);
537
- /* fall through */
549
+ fallthrough;
538550 case ABORT_RATE_CHANGE:
539551 if (!locked)
540552 spin_lock_irqsave(&cdns_uart->port->lock, flags);
....@@ -641,8 +653,8 @@
641653 unsigned int status;
642654
643655 status = readl(port->membase + CDNS_UART_SR) &
644
- CDNS_UART_SR_TXEMPTY;
645
- return status ? TIOCSER_TEMT : 0;
656
+ (CDNS_UART_SR_TXEMPTY | CDNS_UART_SR_TACTIVE);
657
+ return (status == CDNS_UART_SR_TXEMPTY) ? TIOCSER_TEMT : 0;
646658 }
647659
648660 /**
....@@ -681,23 +693,11 @@
681693 static void cdns_uart_set_termios(struct uart_port *port,
682694 struct ktermios *termios, struct ktermios *old)
683695 {
684
- unsigned int cval = 0;
696
+ u32 cval = 0;
685697 unsigned int baud, minbaud, maxbaud;
686698 unsigned long flags;
687
- unsigned int ctrl_reg, mode_reg, val;
688
- int err;
699
+ unsigned int ctrl_reg, mode_reg;
689700
690
- /* Wait for the transmit FIFO to empty before making changes */
691
- if (!(readl(port->membase + CDNS_UART_CR) &
692
- CDNS_UART_CR_TX_DIS)) {
693
- err = readl_poll_timeout(port->membase + CDNS_UART_SR,
694
- val, (val & CDNS_UART_SR_TXEMPTY),
695
- 1000, TX_TIMEOUT);
696
- if (err) {
697
- dev_err(port->dev, "timed out waiting for tx empty");
698
- return;
699
- }
700
- }
701701 spin_lock_irqsave(&port->lock, flags);
702702
703703 /* Disable the TX and RX to set baud rate */
....@@ -801,6 +801,13 @@
801801 }
802802 cval |= mode_reg & 1;
803803 writel(cval, port->membase + CDNS_UART_MR);
804
+
805
+ cval = readl(port->membase + CDNS_UART_MODEMCR);
806
+ if (termios->c_cflag & CRTSCTS)
807
+ cval |= CDNS_UART_MODEMCR_FCM;
808
+ else
809
+ cval &= ~CDNS_UART_MODEMCR_FCM;
810
+ writel(cval, port->membase + CDNS_UART_MODEMCR);
804811
805812 spin_unlock_irqrestore(&port->lock, flags);
806813 }
....@@ -1004,13 +1011,34 @@
10041011 */
10051012 static unsigned int cdns_uart_get_mctrl(struct uart_port *port)
10061013 {
1007
- return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
1014
+ u32 val;
1015
+ unsigned int mctrl = 0;
1016
+ struct cdns_uart *cdns_uart_data = port->private_data;
1017
+
1018
+ if (cdns_uart_data->cts_override)
1019
+ return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
1020
+
1021
+ val = readl(port->membase + CDNS_UART_MODEMSR);
1022
+ if (val & CDNS_UART_MODEMSR_CTS)
1023
+ mctrl |= TIOCM_CTS;
1024
+ if (val & CDNS_UART_MODEMSR_DSR)
1025
+ mctrl |= TIOCM_DSR;
1026
+ if (val & CDNS_UART_MODEMSR_RI)
1027
+ mctrl |= TIOCM_RNG;
1028
+ if (val & CDNS_UART_MODEMSR_DCD)
1029
+ mctrl |= TIOCM_CAR;
1030
+
1031
+ return mctrl;
10081032 }
10091033
10101034 static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
10111035 {
10121036 u32 val;
10131037 u32 mode_reg;
1038
+ struct cdns_uart *cdns_uart_data = port->private_data;
1039
+
1040
+ if (cdns_uart_data->cts_override)
1041
+ return;
10141042
10151043 val = readl(port->membase + CDNS_UART_MODEMCR);
10161044 mode_reg = readl(port->membase + CDNS_UART_MR);
....@@ -1068,8 +1096,6 @@
10681096 cpu_relax();
10691097
10701098 spin_unlock_irqrestore(&port->lock, flags);
1071
-
1072
- return;
10731099 }
10741100 #endif
10751101
....@@ -1109,6 +1135,8 @@
11091135 .poll_put_char = cdns_uart_poll_put_char,
11101136 #endif
11111137 };
1138
+
1139
+static struct uart_driver cdns_uart_uart_driver;
11121140
11131141 #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
11141142 /**
....@@ -1185,7 +1213,7 @@
11851213 unsigned int count)
11861214 {
11871215 struct uart_port *port = console_port;
1188
- unsigned long flags;
1216
+ unsigned long flags = 0;
11891217 unsigned int imr, ctrl;
11901218 int locked = 1;
11911219
....@@ -1210,9 +1238,7 @@
12101238 writel(ctrl, port->membase + CDNS_UART_CR);
12111239
12121240 uart_console_write(port, s, count, cdns_uart_console_putchar);
1213
- while ((readl(port->membase + CDNS_UART_SR) &
1214
- (CDNS_UART_SR_TXEMPTY | CDNS_UART_SR_TACTIVE)) !=
1215
- CDNS_UART_SR_TXEMPTY)
1241
+ while (cdns_uart_tx_empty(port) != TIOCSER_TEMT)
12161242 cpu_relax();
12171243
12181244 /* restore interrupt state */
....@@ -1258,8 +1284,6 @@
12581284 return uart_set_options(port, co, baud, parity, bits, flow);
12591285 }
12601286
1261
-static struct uart_driver cdns_uart_uart_driver;
1262
-
12631287 static struct console cdns_uart_console = {
12641288 .name = CDNS_UART_TTY_NAME,
12651289 .write = cdns_uart_console_write,
....@@ -1271,18 +1295,6 @@
12711295 };
12721296 #endif /* CONFIG_SERIAL_XILINX_PS_UART_CONSOLE */
12731297
1274
-static struct uart_driver cdns_uart_uart_driver = {
1275
- .owner = THIS_MODULE,
1276
- .driver_name = CDNS_UART_NAME,
1277
- .dev_name = CDNS_UART_TTY_NAME,
1278
- .major = CDNS_UART_MAJOR,
1279
- .minor = CDNS_UART_MINOR,
1280
- .nr = CDNS_UART_NR_PORTS,
1281
-#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
1282
- .cons = &cdns_uart_console,
1283
-#endif
1284
-};
1285
-
12861298 #ifdef CONFIG_PM_SLEEP
12871299 /**
12881300 * cdns_uart_suspend - suspend event
....@@ -1293,11 +1305,12 @@
12931305 static int cdns_uart_suspend(struct device *device)
12941306 {
12951307 struct uart_port *port = dev_get_drvdata(device);
1308
+ struct cdns_uart *cdns_uart = port->private_data;
12961309 int may_wake;
12971310
12981311 may_wake = device_may_wakeup(device);
12991312
1300
- if (console_suspend_enabled && may_wake) {
1313
+ if (console_suspend_enabled && uart_console(port) && may_wake) {
13011314 unsigned long flags = 0;
13021315
13031316 spin_lock_irqsave(&port->lock, flags);
....@@ -1316,7 +1329,7 @@
13161329 * Call the API provided in serial_core.c file which handles
13171330 * the suspend.
13181331 */
1319
- return uart_suspend_port(&cdns_uart_uart_driver, port);
1332
+ return uart_suspend_port(cdns_uart->cdns_uart_driver, port);
13201333 }
13211334
13221335 /**
....@@ -1328,15 +1341,14 @@
13281341 static int cdns_uart_resume(struct device *device)
13291342 {
13301343 struct uart_port *port = dev_get_drvdata(device);
1344
+ struct cdns_uart *cdns_uart = port->private_data;
13311345 unsigned long flags = 0;
13321346 u32 ctrl_reg;
13331347 int may_wake;
13341348
13351349 may_wake = device_may_wakeup(device);
13361350
1337
- if (console_suspend_enabled && !may_wake) {
1338
- struct cdns_uart *cdns_uart = port->private_data;
1339
-
1351
+ if (console_suspend_enabled && uart_console(port) && !may_wake) {
13401352 clk_enable(cdns_uart->pclk);
13411353 clk_enable(cdns_uart->uartclk);
13421354
....@@ -1370,7 +1382,7 @@
13701382 spin_unlock_irqrestore(&port->lock, flags);
13711383 }
13721384
1373
- return uart_resume_port(&cdns_uart_uart_driver, port);
1385
+ return uart_resume_port(cdns_uart->cdns_uart_driver, port);
13741386 }
13751387 #endif /* ! CONFIG_PM_SLEEP */
13761388 static int __maybe_unused cdns_runtime_suspend(struct device *dev)
....@@ -1412,6 +1424,9 @@
14121424 };
14131425 MODULE_DEVICE_TABLE(of, cdns_uart_of_match);
14141426
1427
+/* Temporary variable for storing number of instances */
1428
+static int instances;
1429
+
14151430 /**
14161431 * cdns_uart_probe - Platform driver probe
14171432 * @pdev: Pointer to the platform device structure
....@@ -1434,6 +1449,36 @@
14341449 if (!port)
14351450 return -ENOMEM;
14361451
1452
+ /* Look for a serialN alias */
1453
+ id = of_alias_get_id(pdev->dev.of_node, "serial");
1454
+ if (id < 0)
1455
+ id = 0;
1456
+
1457
+ if (id >= CDNS_UART_NR_PORTS) {
1458
+ dev_err(&pdev->dev, "Cannot get uart_port structure\n");
1459
+ return -ENODEV;
1460
+ }
1461
+
1462
+ if (!cdns_uart_uart_driver.state) {
1463
+ cdns_uart_uart_driver.owner = THIS_MODULE;
1464
+ cdns_uart_uart_driver.driver_name = CDNS_UART_NAME;
1465
+ cdns_uart_uart_driver.dev_name = CDNS_UART_TTY_NAME;
1466
+ cdns_uart_uart_driver.major = CDNS_UART_MAJOR;
1467
+ cdns_uart_uart_driver.minor = CDNS_UART_MINOR;
1468
+ cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS;
1469
+#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
1470
+ cdns_uart_uart_driver.cons = &cdns_uart_console;
1471
+#endif
1472
+
1473
+ rc = uart_register_driver(&cdns_uart_uart_driver);
1474
+ if (rc < 0) {
1475
+ dev_err(&pdev->dev, "Failed to register driver\n");
1476
+ return rc;
1477
+ }
1478
+ }
1479
+
1480
+ cdns_uart_data->cdns_uart_driver = &cdns_uart_uart_driver;
1481
+
14371482 match = of_match_node(cdns_uart_of_match, pdev->dev.of_node);
14381483 if (match && match->data) {
14391484 const struct cdns_platform_data *data = match->data;
....@@ -1442,31 +1487,39 @@
14421487 }
14431488
14441489 cdns_uart_data->pclk = devm_clk_get(&pdev->dev, "pclk");
1490
+ if (PTR_ERR(cdns_uart_data->pclk) == -EPROBE_DEFER) {
1491
+ rc = PTR_ERR(cdns_uart_data->pclk);
1492
+ goto err_out_unregister_driver;
1493
+ }
1494
+
14451495 if (IS_ERR(cdns_uart_data->pclk)) {
14461496 cdns_uart_data->pclk = devm_clk_get(&pdev->dev, "aper_clk");
1447
- if (!IS_ERR(cdns_uart_data->pclk))
1448
- dev_err(&pdev->dev, "clock name 'aper_clk' is deprecated.\n");
1449
- }
1450
- if (IS_ERR(cdns_uart_data->pclk)) {
1451
- dev_err(&pdev->dev, "pclk clock not found.\n");
1452
- return PTR_ERR(cdns_uart_data->pclk);
1497
+ if (IS_ERR(cdns_uart_data->pclk)) {
1498
+ rc = PTR_ERR(cdns_uart_data->pclk);
1499
+ goto err_out_unregister_driver;
1500
+ }
1501
+ dev_err(&pdev->dev, "clock name 'aper_clk' is deprecated.\n");
14531502 }
14541503
14551504 cdns_uart_data->uartclk = devm_clk_get(&pdev->dev, "uart_clk");
1505
+ if (PTR_ERR(cdns_uart_data->uartclk) == -EPROBE_DEFER) {
1506
+ rc = PTR_ERR(cdns_uart_data->uartclk);
1507
+ goto err_out_unregister_driver;
1508
+ }
1509
+
14561510 if (IS_ERR(cdns_uart_data->uartclk)) {
14571511 cdns_uart_data->uartclk = devm_clk_get(&pdev->dev, "ref_clk");
1458
- if (!IS_ERR(cdns_uart_data->uartclk))
1459
- dev_err(&pdev->dev, "clock name 'ref_clk' is deprecated.\n");
1460
- }
1461
- if (IS_ERR(cdns_uart_data->uartclk)) {
1462
- dev_err(&pdev->dev, "uart_clk clock not found.\n");
1463
- return PTR_ERR(cdns_uart_data->uartclk);
1512
+ if (IS_ERR(cdns_uart_data->uartclk)) {
1513
+ rc = PTR_ERR(cdns_uart_data->uartclk);
1514
+ goto err_out_unregister_driver;
1515
+ }
1516
+ dev_err(&pdev->dev, "clock name 'ref_clk' is deprecated.\n");
14641517 }
14651518
14661519 rc = clk_prepare_enable(cdns_uart_data->pclk);
14671520 if (rc) {
14681521 dev_err(&pdev->dev, "Unable to enable pclk clock.\n");
1469
- return rc;
1522
+ goto err_out_unregister_driver;
14701523 }
14711524 rc = clk_prepare_enable(cdns_uart_data->uartclk);
14721525 if (rc) {
....@@ -1493,28 +1546,16 @@
14931546 &cdns_uart_data->clk_rate_change_nb))
14941547 dev_warn(&pdev->dev, "Unable to register clock notifier.\n");
14951548 #endif
1496
- /* Look for a serialN alias */
1497
- id = of_alias_get_id(pdev->dev.of_node, "serial");
1498
- if (id < 0)
1499
- id = 0;
1500
-
1501
- if (id >= CDNS_UART_NR_PORTS) {
1502
- dev_err(&pdev->dev, "Cannot get uart_port structure\n");
1503
- rc = -ENODEV;
1504
- goto err_out_notif_unreg;
1505
- }
15061549
15071550 /* At this point, we've got an empty uart_port struct, initialize it */
15081551 spin_lock_init(&port->lock);
1509
- port->membase = NULL;
1510
- port->irq = 0;
15111552 port->type = PORT_UNKNOWN;
15121553 port->iotype = UPIO_MEM32;
15131554 port->flags = UPF_BOOT_AUTOCONF;
15141555 port->ops = &cdns_uart_ops;
15151556 port->fifosize = CDNS_UART_FIFO_SIZE;
1557
+ port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE);
15161558 port->line = id;
1517
- port->dev = NULL;
15181559
15191560 /*
15201561 * Register the port.
....@@ -1533,6 +1574,7 @@
15331574 pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT);
15341575 pm_runtime_set_active(&pdev->dev);
15351576 pm_runtime_enable(&pdev->dev);
1577
+ device_init_wakeup(port->dev, true);
15361578
15371579 #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
15381580 /*
....@@ -1541,8 +1583,10 @@
15411583 * If register_console() don't assign value, then console_port pointer
15421584 * is cleanup.
15431585 */
1544
- if (cdns_uart_uart_driver.cons->index == -1)
1586
+ if (!console_port) {
1587
+ cdns_uart_console.index = id;
15451588 console_port = port;
1589
+ }
15461590 #endif
15471591
15481592 rc = uart_add_one_port(&cdns_uart_uart_driver, port);
....@@ -1554,9 +1598,17 @@
15541598
15551599 #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
15561600 /* This is not port which is used for console that's why clean it up */
1557
- if (cdns_uart_uart_driver.cons->index == -1)
1601
+ if (console_port == port &&
1602
+ !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) {
15581603 console_port = NULL;
1604
+ cdns_uart_console.index = -1;
1605
+ }
15591606 #endif
1607
+
1608
+ cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node,
1609
+ "cts-override");
1610
+
1611
+ instances++;
15601612
15611613 return 0;
15621614
....@@ -1564,7 +1616,6 @@
15641616 pm_runtime_disable(&pdev->dev);
15651617 pm_runtime_set_suspended(&pdev->dev);
15661618 pm_runtime_dont_use_autosuspend(&pdev->dev);
1567
-err_out_notif_unreg:
15681619 #ifdef CONFIG_COMMON_CLK
15691620 clk_notifier_unregister(cdns_uart_data->uartclk,
15701621 &cdns_uart_data->clk_rate_change_nb);
....@@ -1573,7 +1624,9 @@
15731624 clk_disable_unprepare(cdns_uart_data->uartclk);
15741625 err_out_clk_dis_pclk:
15751626 clk_disable_unprepare(cdns_uart_data->pclk);
1576
-
1627
+err_out_unregister_driver:
1628
+ if (!instances)
1629
+ uart_unregister_driver(cdns_uart_data->cdns_uart_driver);
15771630 return rc;
15781631 }
15791632
....@@ -1594,13 +1647,22 @@
15941647 clk_notifier_unregister(cdns_uart_data->uartclk,
15951648 &cdns_uart_data->clk_rate_change_nb);
15961649 #endif
1597
- rc = uart_remove_one_port(&cdns_uart_uart_driver, port);
1650
+ rc = uart_remove_one_port(cdns_uart_data->cdns_uart_driver, port);
15981651 port->mapbase = 0;
15991652 clk_disable_unprepare(cdns_uart_data->uartclk);
16001653 clk_disable_unprepare(cdns_uart_data->pclk);
16011654 pm_runtime_disable(&pdev->dev);
16021655 pm_runtime_set_suspended(&pdev->dev);
16031656 pm_runtime_dont_use_autosuspend(&pdev->dev);
1657
+ device_init_wakeup(&pdev->dev, false);
1658
+
1659
+#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
1660
+ if (console_port == port)
1661
+ console_port = NULL;
1662
+#endif
1663
+
1664
+ if (!--instances)
1665
+ uart_unregister_driver(cdns_uart_data->cdns_uart_driver);
16041666 return rc;
16051667 }
16061668
....@@ -1617,28 +1679,14 @@
16171679
16181680 static int __init cdns_uart_init(void)
16191681 {
1620
- int retval = 0;
1621
-
1622
- /* Register the cdns_uart driver with the serial core */
1623
- retval = uart_register_driver(&cdns_uart_uart_driver);
1624
- if (retval)
1625
- return retval;
1626
-
16271682 /* Register the platform driver */
1628
- retval = platform_driver_register(&cdns_uart_platform_driver);
1629
- if (retval)
1630
- uart_unregister_driver(&cdns_uart_uart_driver);
1631
-
1632
- return retval;
1683
+ return platform_driver_register(&cdns_uart_platform_driver);
16331684 }
16341685
16351686 static void __exit cdns_uart_exit(void)
16361687 {
16371688 /* Unregister the platform driver */
16381689 platform_driver_unregister(&cdns_uart_platform_driver);
1639
-
1640
- /* Unregister the cdns_uart driver */
1641
- uart_unregister_driver(&cdns_uart_uart_driver);
16421690 }
16431691
16441692 arch_initcall(cdns_uart_init);