aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/altera_jtaguart.c15
-rw-r--r--drivers/tty/serial/altera_uart.c51
-rw-r--r--drivers/tty/serial/apbuart.c11
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_core.c9
-rw-r--r--drivers/tty/serial/mpc52xx_uart.c13
-rw-r--r--drivers/tty/serial/of_serial.c14
-rw-r--r--drivers/tty/serial/sunhv.c8
-rw-r--r--drivers/tty/serial/sunsab.c8
-rw-r--r--drivers/tty/serial/sunsu.c6
-rw-r--r--drivers/tty/serial/sunzilog.c10
-rw-r--r--drivers/tty/serial/uartlite.c103
-rw-r--r--drivers/tty/serial/ucc_uart.c9
12 files changed, 126 insertions, 131 deletions
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index 8f014bb916b7..60e049b041a7 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -466,12 +466,23 @@ static int __devexit altera_jtaguart_remove(struct platform_device *pdev)
466 return 0; 466 return 0;
467} 467}
468 468
469#ifdef CONFIG_OF
470static struct of_device_id altera_jtaguart_match[] = {
471 { .compatible = "ALTR,juart-1.0", },
472 {},
473};
474MODULE_DEVICE_TABLE(of, altera_jtaguart_match);
475#else
476#define altera_jtaguart_match NULL
477#endif /* CONFIG_OF */
478
469static struct platform_driver altera_jtaguart_platform_driver = { 479static struct platform_driver altera_jtaguart_platform_driver = {
470 .probe = altera_jtaguart_probe, 480 .probe = altera_jtaguart_probe,
471 .remove = __devexit_p(altera_jtaguart_remove), 481 .remove = __devexit_p(altera_jtaguart_remove),
472 .driver = { 482 .driver = {
473 .name = DRV_NAME, 483 .name = DRV_NAME,
474 .owner = THIS_MODULE, 484 .owner = THIS_MODULE,
485 .of_match_table = altera_jtaguart_match,
475 }, 486 },
476}; 487};
477 488
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 3a573528555e..6d5b036ac783 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -24,6 +24,7 @@
24#include <linux/serial.h> 24#include <linux/serial.h>
25#include <linux/serial_core.h> 25#include <linux/serial_core.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/of.h>
27#include <linux/io.h> 28#include <linux/io.h>
28#include <linux/altera_uart.h> 29#include <linux/altera_uart.h>
29 30
@@ -507,6 +508,29 @@ static struct uart_driver altera_uart_driver = {
507 .cons = ALTERA_UART_CONSOLE, 508 .cons = ALTERA_UART_CONSOLE,
508}; 509};
509 510
511#ifdef CONFIG_OF
512static int altera_uart_get_of_uartclk(struct platform_device *pdev,
513 struct uart_port *port)
514{
515 int len;
516 const __be32 *clk;
517
518 clk = of_get_property(pdev->dev.of_node, "clock-frequency", &len);
519 if (!clk || len < sizeof(__be32))
520 return -ENODEV;
521
522 port->uartclk = be32_to_cpup(clk);
523
524 return 0;
525}
526#else
527static int altera_uart_get_of_uartclk(struct platform_device *pdev,
528 struct uart_port *port)
529{
530 return -ENODEV;
531}
532#endif /* CONFIG_OF */
533
510static int __devinit altera_uart_probe(struct platform_device *pdev) 534static int __devinit altera_uart_probe(struct platform_device *pdev)
511{ 535{
512 struct altera_uart_platform_uart *platp = pdev->dev.platform_data; 536 struct altera_uart_platform_uart *platp = pdev->dev.platform_data;
@@ -514,6 +538,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
514 struct resource *res_mem; 538 struct resource *res_mem;
515 struct resource *res_irq; 539 struct resource *res_irq;
516 int i = pdev->id; 540 int i = pdev->id;
541 int ret;
517 542
518 /* -1 emphasizes that the platform must have one port, no .N suffix */ 543 /* -1 emphasizes that the platform must have one port, no .N suffix */
519 if (i == -1) 544 if (i == -1)
@@ -538,6 +563,15 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
538 else if (platp->irq) 563 else if (platp->irq)
539 port->irq = platp->irq; 564 port->irq = platp->irq;
540 565
566 /* Check platform data first so we can override device node data */
567 if (platp)
568 port->uartclk = platp->uartclk;
569 else {
570 ret = altera_uart_get_of_uartclk(pdev, port);
571 if (ret)
572 return ret;
573 }
574
541 port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE); 575 port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE);
542 if (!port->membase) 576 if (!port->membase)
543 return -ENOMEM; 577 return -ENOMEM;
@@ -550,7 +584,6 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
550 port->line = i; 584 port->line = i;
551 port->type = PORT_ALTERA_UART; 585 port->type = PORT_ALTERA_UART;
552 port->iotype = SERIAL_IO_MEM; 586 port->iotype = SERIAL_IO_MEM;
553 port->uartclk = platp->uartclk;
554 port->ops = &altera_uart_ops; 587 port->ops = &altera_uart_ops;
555 port->flags = UPF_BOOT_AUTOCONF; 588 port->flags = UPF_BOOT_AUTOCONF;
556 589
@@ -573,13 +606,23 @@ static int __devexit altera_uart_remove(struct platform_device *pdev)
573 return 0; 606 return 0;
574} 607}
575 608
609#ifdef CONFIG_OF
610static struct of_device_id altera_uart_match[] = {
611 { .compatible = "ALTR,uart-1.0", },
612 {},
613};
614MODULE_DEVICE_TABLE(of, altera_uart_match);
615#else
616#define altera_uart_match NULL
617#endif /* CONFIG_OF */
618
576static struct platform_driver altera_uart_platform_driver = { 619static struct platform_driver altera_uart_platform_driver = {
577 .probe = altera_uart_probe, 620 .probe = altera_uart_probe,
578 .remove = __devexit_p(altera_uart_remove), 621 .remove = __devexit_p(altera_uart_remove),
579 .driver = { 622 .driver = {
580 .name = DRV_NAME, 623 .name = DRV_NAME,
581 .owner = THIS_MODULE, 624 .owner = THIS_MODULE,
582 .pm = NULL, 625 .of_match_table = altera_uart_match,
583 }, 626 },
584}; 627};
585 628
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 095a5d562618..1ab999b04ef3 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -553,8 +553,7 @@ static struct uart_driver grlib_apbuart_driver = {
553/* OF Platform Driver */ 553/* OF Platform Driver */
554/* ======================================================================== */ 554/* ======================================================================== */
555 555
556static int __devinit apbuart_probe(struct platform_device *op, 556static int __devinit apbuart_probe(struct platform_device *op)
557 const struct of_device_id *match)
558{ 557{
559 int i = -1; 558 int i = -1;
560 struct uart_port *port = NULL; 559 struct uart_port *port = NULL;
@@ -587,7 +586,7 @@ static struct of_device_id __initdata apbuart_match[] = {
587 {}, 586 {},
588}; 587};
589 588
590static struct of_platform_driver grlib_apbuart_of_driver = { 589static struct platform_driver grlib_apbuart_of_driver = {
591 .probe = apbuart_probe, 590 .probe = apbuart_probe,
592 .driver = { 591 .driver = {
593 .owner = THIS_MODULE, 592 .owner = THIS_MODULE,
@@ -676,10 +675,10 @@ static int __init grlib_apbuart_init(void)
676 return ret; 675 return ret;
677 } 676 }
678 677
679 ret = of_register_platform_driver(&grlib_apbuart_of_driver); 678 ret = platform_driver_register(&grlib_apbuart_of_driver);
680 if (ret) { 679 if (ret) {
681 printk(KERN_ERR 680 printk(KERN_ERR
682 "%s: of_register_platform_driver failed (%i)\n", 681 "%s: platform_driver_register failed (%i)\n",
683 __FILE__, ret); 682 __FILE__, ret);
684 uart_unregister_driver(&grlib_apbuart_driver); 683 uart_unregister_driver(&grlib_apbuart_driver);
685 return ret; 684 return ret;
@@ -697,7 +696,7 @@ static void __exit grlib_apbuart_exit(void)
697 &grlib_apbuart_ports[i]); 696 &grlib_apbuart_ports[i]);
698 697
699 uart_unregister_driver(&grlib_apbuart_driver); 698 uart_unregister_driver(&grlib_apbuart_driver);
700 of_unregister_platform_driver(&grlib_apbuart_of_driver); 699 platform_driver_unregister(&grlib_apbuart_of_driver);
701} 700}
702 701
703module_init(grlib_apbuart_init); 702module_init(grlib_apbuart_init);
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index 8692ff98fc07..a9a6a5fd169e 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -1359,8 +1359,7 @@ static struct uart_driver cpm_reg = {
1359 1359
1360static int probe_index; 1360static int probe_index;
1361 1361
1362static int __devinit cpm_uart_probe(struct platform_device *ofdev, 1362static int __devinit cpm_uart_probe(struct platform_device *ofdev)
1363 const struct of_device_id *match)
1364{ 1363{
1365 int index = probe_index++; 1364 int index = probe_index++;
1366 struct uart_cpm_port *pinfo = &cpm_uart_ports[index]; 1365 struct uart_cpm_port *pinfo = &cpm_uart_ports[index];
@@ -1405,7 +1404,7 @@ static struct of_device_id cpm_uart_match[] = {
1405 {} 1404 {}
1406}; 1405};
1407 1406
1408static struct of_platform_driver cpm_uart_driver = { 1407static struct platform_driver cpm_uart_driver = {
1409 .driver = { 1408 .driver = {
1410 .name = "cpm_uart", 1409 .name = "cpm_uart",
1411 .owner = THIS_MODULE, 1410 .owner = THIS_MODULE,
@@ -1421,7 +1420,7 @@ static int __init cpm_uart_init(void)
1421 if (ret) 1420 if (ret)
1422 return ret; 1421 return ret;
1423 1422
1424 ret = of_register_platform_driver(&cpm_uart_driver); 1423 ret = platform_driver_register(&cpm_uart_driver);
1425 if (ret) 1424 if (ret)
1426 uart_unregister_driver(&cpm_reg); 1425 uart_unregister_driver(&cpm_reg);
1427 1426
@@ -1430,7 +1429,7 @@ static int __init cpm_uart_init(void)
1430 1429
1431static void __exit cpm_uart_exit(void) 1430static void __exit cpm_uart_exit(void)
1432{ 1431{
1433 of_unregister_platform_driver(&cpm_uart_driver); 1432 platform_driver_unregister(&cpm_uart_driver);
1434 uart_unregister_driver(&cpm_reg); 1433 uart_unregister_driver(&cpm_reg);
1435} 1434}
1436 1435
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 126ec7f568ec..a0bcd8a3758d 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -1302,8 +1302,7 @@ static struct of_device_id mpc52xx_uart_of_match[] = {
1302 {}, 1302 {},
1303}; 1303};
1304 1304
1305static int __devinit 1305static int __devinit mpc52xx_uart_of_probe(struct platform_device *op)
1306mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *match)
1307{ 1306{
1308 int idx = -1; 1307 int idx = -1;
1309 unsigned int uartclk; 1308 unsigned int uartclk;
@@ -1311,8 +1310,6 @@ mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *mat
1311 struct resource res; 1310 struct resource res;
1312 int ret; 1311 int ret;
1313 1312
1314 dev_dbg(&op->dev, "mpc52xx_uart_probe(op=%p, match=%p)\n", op, match);
1315
1316 /* Check validity & presence */ 1313 /* Check validity & presence */
1317 for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++) 1314 for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++)
1318 if (mpc52xx_uart_nodes[idx] == op->dev.of_node) 1315 if (mpc52xx_uart_nodes[idx] == op->dev.of_node)
@@ -1453,7 +1450,7 @@ mpc52xx_uart_of_enumerate(void)
1453 1450
1454MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match); 1451MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);
1455 1452
1456static struct of_platform_driver mpc52xx_uart_of_driver = { 1453static struct platform_driver mpc52xx_uart_of_driver = {
1457 .probe = mpc52xx_uart_of_probe, 1454 .probe = mpc52xx_uart_of_probe,
1458 .remove = mpc52xx_uart_of_remove, 1455 .remove = mpc52xx_uart_of_remove,
1459#ifdef CONFIG_PM 1456#ifdef CONFIG_PM
@@ -1497,9 +1494,9 @@ mpc52xx_uart_init(void)
1497 return ret; 1494 return ret;
1498 } 1495 }
1499 1496
1500 ret = of_register_platform_driver(&mpc52xx_uart_of_driver); 1497 ret = platform_driver_register(&mpc52xx_uart_of_driver);
1501 if (ret) { 1498 if (ret) {
1502 printk(KERN_ERR "%s: of_register_platform_driver failed (%i)\n", 1499 printk(KERN_ERR "%s: platform_driver_register failed (%i)\n",
1503 __FILE__, ret); 1500 __FILE__, ret);
1504 uart_unregister_driver(&mpc52xx_uart_driver); 1501 uart_unregister_driver(&mpc52xx_uart_driver);
1505 return ret; 1502 return ret;
@@ -1514,7 +1511,7 @@ mpc52xx_uart_exit(void)
1514 if (psc_ops->fifoc_uninit) 1511 if (psc_ops->fifoc_uninit)
1515 psc_ops->fifoc_uninit(); 1512 psc_ops->fifoc_uninit();
1516 1513
1517 of_unregister_platform_driver(&mpc52xx_uart_of_driver); 1514 platform_driver_unregister(&mpc52xx_uart_of_driver);
1518 uart_unregister_driver(&mpc52xx_uart_driver); 1515 uart_unregister_driver(&mpc52xx_uart_driver);
1519} 1516}
1520 1517
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 6a18ca6ddaa9..0e8eec516df4 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -80,14 +80,16 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
80/* 80/*
81 * Try to register a serial port 81 * Try to register a serial port
82 */ 82 */
83static int __devinit of_platform_serial_probe(struct platform_device *ofdev, 83static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
84 const struct of_device_id *id)
85{ 84{
86 struct of_serial_info *info; 85 struct of_serial_info *info;
87 struct uart_port port; 86 struct uart_port port;
88 int port_type; 87 int port_type;
89 int ret; 88 int ret;
90 89
90 if (!ofdev->dev.of_match)
91 return -EINVAL;
92
91 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) 93 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
92 return -EBUSY; 94 return -EBUSY;
93 95
@@ -95,7 +97,7 @@ static int __devinit of_platform_serial_probe(struct platform_device *ofdev,
95 if (info == NULL) 97 if (info == NULL)
96 return -ENOMEM; 98 return -ENOMEM;
97 99
98 port_type = (unsigned long)id->data; 100 port_type = (unsigned long)ofdev->dev.of_match->data;
99 ret = of_platform_serial_setup(ofdev, port_type, &port); 101 ret = of_platform_serial_setup(ofdev, port_type, &port);
100 if (ret) 102 if (ret)
101 goto out; 103 goto out;
@@ -174,7 +176,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
174 { /* end of list */ }, 176 { /* end of list */ },
175}; 177};
176 178
177static struct of_platform_driver of_platform_serial_driver = { 179static struct platform_driver of_platform_serial_driver = {
178 .driver = { 180 .driver = {
179 .name = "of_serial", 181 .name = "of_serial",
180 .owner = THIS_MODULE, 182 .owner = THIS_MODULE,
@@ -186,13 +188,13 @@ static struct of_platform_driver of_platform_serial_driver = {
186 188
187static int __init of_platform_serial_init(void) 189static int __init of_platform_serial_init(void)
188{ 190{
189 return of_register_platform_driver(&of_platform_serial_driver); 191 return platform_driver_register(&of_platform_serial_driver);
190} 192}
191module_init(of_platform_serial_init); 193module_init(of_platform_serial_init);
192 194
193static void __exit of_platform_serial_exit(void) 195static void __exit of_platform_serial_exit(void)
194{ 196{
195 return of_unregister_platform_driver(&of_platform_serial_driver); 197 return platform_driver_unregister(&of_platform_serial_driver);
196}; 198};
197module_exit(of_platform_serial_exit); 199module_exit(of_platform_serial_exit);
198 200
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index c9014868297d..c0b7246d7339 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -519,7 +519,7 @@ static struct console sunhv_console = {
519 .data = &sunhv_reg, 519 .data = &sunhv_reg,
520}; 520};
521 521
522static int __devinit hv_probe(struct platform_device *op, const struct of_device_id *match) 522static int __devinit hv_probe(struct platform_device *op)
523{ 523{
524 struct uart_port *port; 524 struct uart_port *port;
525 unsigned long minor; 525 unsigned long minor;
@@ -629,7 +629,7 @@ static const struct of_device_id hv_match[] = {
629}; 629};
630MODULE_DEVICE_TABLE(of, hv_match); 630MODULE_DEVICE_TABLE(of, hv_match);
631 631
632static struct of_platform_driver hv_driver = { 632static struct platform_driver hv_driver = {
633 .driver = { 633 .driver = {
634 .name = "hv", 634 .name = "hv",
635 .owner = THIS_MODULE, 635 .owner = THIS_MODULE,
@@ -644,12 +644,12 @@ static int __init sunhv_init(void)
644 if (tlb_type != hypervisor) 644 if (tlb_type != hypervisor)
645 return -ENODEV; 645 return -ENODEV;
646 646
647 return of_register_platform_driver(&hv_driver); 647 return platform_driver_register(&hv_driver);
648} 648}
649 649
650static void __exit sunhv_exit(void) 650static void __exit sunhv_exit(void)
651{ 651{
652 of_unregister_platform_driver(&hv_driver); 652 platform_driver_unregister(&hv_driver);
653} 653}
654 654
655module_init(sunhv_init); 655module_init(sunhv_init);
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 5b246b18f42f..b5fa2a57b9da 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -1006,7 +1006,7 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up,
1006 return 0; 1006 return 0;
1007} 1007}
1008 1008
1009static int __devinit sab_probe(struct platform_device *op, const struct of_device_id *match) 1009static int __devinit sab_probe(struct platform_device *op)
1010{ 1010{
1011 static int inst; 1011 static int inst;
1012 struct uart_sunsab_port *up; 1012 struct uart_sunsab_port *up;
@@ -1092,7 +1092,7 @@ static const struct of_device_id sab_match[] = {
1092}; 1092};
1093MODULE_DEVICE_TABLE(of, sab_match); 1093MODULE_DEVICE_TABLE(of, sab_match);
1094 1094
1095static struct of_platform_driver sab_driver = { 1095static struct platform_driver sab_driver = {
1096 .driver = { 1096 .driver = {
1097 .name = "sab", 1097 .name = "sab",
1098 .owner = THIS_MODULE, 1098 .owner = THIS_MODULE,
@@ -1130,12 +1130,12 @@ static int __init sunsab_init(void)
1130 } 1130 }
1131 } 1131 }
1132 1132
1133 return of_register_platform_driver(&sab_driver); 1133 return platform_driver_register(&sab_driver);
1134} 1134}
1135 1135
1136static void __exit sunsab_exit(void) 1136static void __exit sunsab_exit(void)
1137{ 1137{
1138 of_unregister_platform_driver(&sab_driver); 1138 platform_driver_unregister(&sab_driver);
1139 if (sunsab_reg.nr) { 1139 if (sunsab_reg.nr) {
1140 sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr); 1140 sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr);
1141 } 1141 }
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 551ebfe3ccbb..92aa54550e84 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -1406,7 +1406,7 @@ static enum su_type __devinit su_get_type(struct device_node *dp)
1406 return SU_PORT_PORT; 1406 return SU_PORT_PORT;
1407} 1407}
1408 1408
1409static int __devinit su_probe(struct platform_device *op, const struct of_device_id *match) 1409static int __devinit su_probe(struct platform_device *op)
1410{ 1410{
1411 static int inst; 1411 static int inst;
1412 struct device_node *dp = op->dev.of_node; 1412 struct device_node *dp = op->dev.of_node;
@@ -1543,7 +1543,7 @@ static const struct of_device_id su_match[] = {
1543}; 1543};
1544MODULE_DEVICE_TABLE(of, su_match); 1544MODULE_DEVICE_TABLE(of, su_match);
1545 1545
1546static struct of_platform_driver su_driver = { 1546static struct platform_driver su_driver = {
1547 .driver = { 1547 .driver = {
1548 .name = "su", 1548 .name = "su",
1549 .owner = THIS_MODULE, 1549 .owner = THIS_MODULE,
@@ -1586,7 +1586,7 @@ static int __init sunsu_init(void)
1586 return err; 1586 return err;
1587 } 1587 }
1588 1588
1589 err = of_register_platform_driver(&su_driver); 1589 err = platform_driver_register(&su_driver);
1590 if (err && num_uart) 1590 if (err && num_uart)
1591 sunserial_unregister_minors(&sunsu_reg, num_uart); 1591 sunserial_unregister_minors(&sunsu_reg, num_uart);
1592 1592
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index c1967ac1c07f..99ff9abf57ce 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -1399,7 +1399,7 @@ static void __devinit sunzilog_init_hw(struct uart_sunzilog_port *up)
1399 1399
1400static int zilog_irq = -1; 1400static int zilog_irq = -1;
1401 1401
1402static int __devinit zs_probe(struct platform_device *op, const struct of_device_id *match) 1402static int __devinit zs_probe(struct platform_device *op)
1403{ 1403{
1404 static int kbm_inst, uart_inst; 1404 static int kbm_inst, uart_inst;
1405 int inst; 1405 int inst;
@@ -1540,7 +1540,7 @@ static const struct of_device_id zs_match[] = {
1540}; 1540};
1541MODULE_DEVICE_TABLE(of, zs_match); 1541MODULE_DEVICE_TABLE(of, zs_match);
1542 1542
1543static struct of_platform_driver zs_driver = { 1543static struct platform_driver zs_driver = {
1544 .driver = { 1544 .driver = {
1545 .name = "zs", 1545 .name = "zs",
1546 .owner = THIS_MODULE, 1546 .owner = THIS_MODULE,
@@ -1576,7 +1576,7 @@ static int __init sunzilog_init(void)
1576 goto out_free_tables; 1576 goto out_free_tables;
1577 } 1577 }
1578 1578
1579 err = of_register_platform_driver(&zs_driver); 1579 err = platform_driver_register(&zs_driver);
1580 if (err) 1580 if (err)
1581 goto out_unregister_uart; 1581 goto out_unregister_uart;
1582 1582
@@ -1604,7 +1604,7 @@ out:
1604 return err; 1604 return err;
1605 1605
1606out_unregister_driver: 1606out_unregister_driver:
1607 of_unregister_platform_driver(&zs_driver); 1607 platform_driver_unregister(&zs_driver);
1608 1608
1609out_unregister_uart: 1609out_unregister_uart:
1610 if (num_sunzilog) { 1610 if (num_sunzilog) {
@@ -1619,7 +1619,7 @@ out_free_tables:
1619 1619
1620static void __exit sunzilog_exit(void) 1620static void __exit sunzilog_exit(void)
1621{ 1621{
1622 of_unregister_platform_driver(&zs_driver); 1622 platform_driver_unregister(&zs_driver);
1623 1623
1624 if (zilog_irq != -1) { 1624 if (zilog_irq != -1) {
1625 struct uart_sunzilog_port *up = sunzilog_irq_chain; 1625 struct uart_sunzilog_port *up = sunzilog_irq_chain;
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index d2fce865b731..8af1ed83a4c0 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -19,22 +19,11 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
23#include <linux/of.h> 22#include <linux/of.h>
24#include <linux/of_address.h> 23#include <linux/of_address.h>
25#include <linux/of_device.h> 24#include <linux/of_device.h>
26#include <linux/of_platform.h> 25#include <linux/of_platform.h>
27 26
28/* Match table for of_platform binding */
29static struct of_device_id ulite_of_match[] __devinitdata = {
30 { .compatible = "xlnx,opb-uartlite-1.00.b", },
31 { .compatible = "xlnx,xps-uartlite-1.00.a", },
32 {}
33};
34MODULE_DEVICE_TABLE(of, ulite_of_match);
35
36#endif
37
38#define ULITE_NAME "ttyUL" 27#define ULITE_NAME "ttyUL"
39#define ULITE_MAJOR 204 28#define ULITE_MAJOR 204
40#define ULITE_MINOR 187 29#define ULITE_MINOR 187
@@ -571,9 +560,29 @@ static int __devexit ulite_release(struct device *dev)
571 * Platform bus binding 560 * Platform bus binding
572 */ 561 */
573 562
563#if defined(CONFIG_OF)
564/* Match table for of_platform binding */
565static struct of_device_id ulite_of_match[] __devinitdata = {
566 { .compatible = "xlnx,opb-uartlite-1.00.b", },
567 { .compatible = "xlnx,xps-uartlite-1.00.a", },
568 {}
569};
570MODULE_DEVICE_TABLE(of, ulite_of_match);
571#else /* CONFIG_OF */
572#define ulite_of_match NULL
573#endif /* CONFIG_OF */
574
574static int __devinit ulite_probe(struct platform_device *pdev) 575static int __devinit ulite_probe(struct platform_device *pdev)
575{ 576{
576 struct resource *res, *res2; 577 struct resource *res, *res2;
578 int id = pdev->id;
579#ifdef CONFIG_OF
580 const __be32 *prop;
581
582 prop = of_get_property(pdev->dev.of_node, "port-number", NULL);
583 if (prop)
584 id = be32_to_cpup(prop);
585#endif
577 586
578 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 587 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
579 if (!res) 588 if (!res)
@@ -583,7 +592,7 @@ static int __devinit ulite_probe(struct platform_device *pdev)
583 if (!res2) 592 if (!res2)
584 return -ENODEV; 593 return -ENODEV;
585 594
586 return ulite_assign(&pdev->dev, pdev->id, res->start, res2->start); 595 return ulite_assign(&pdev->dev, id, res->start, res2->start);
587} 596}
588 597
589static int __devexit ulite_remove(struct platform_device *pdev) 598static int __devexit ulite_remove(struct platform_device *pdev)
@@ -595,72 +604,15 @@ static int __devexit ulite_remove(struct platform_device *pdev)
595MODULE_ALIAS("platform:uartlite"); 604MODULE_ALIAS("platform:uartlite");
596 605
597static struct platform_driver ulite_platform_driver = { 606static struct platform_driver ulite_platform_driver = {
598 .probe = ulite_probe, 607 .probe = ulite_probe,
599 .remove = __devexit_p(ulite_remove), 608 .remove = __devexit_p(ulite_remove),
600 .driver = {
601 .owner = THIS_MODULE,
602 .name = "uartlite",
603 },
604};
605
606/* ---------------------------------------------------------------------
607 * OF bus bindings
608 */
609#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
610static int __devinit
611ulite_of_probe(struct platform_device *op, const struct of_device_id *match)
612{
613 struct resource res;
614 const unsigned int *id;
615 int irq, rc;
616
617 dev_dbg(&op->dev, "%s(%p, %p)\n", __func__, op, match);
618
619 rc = of_address_to_resource(op->dev.of_node, 0, &res);
620 if (rc) {
621 dev_err(&op->dev, "invalid address\n");
622 return rc;
623 }
624
625 irq = irq_of_parse_and_map(op->dev.of_node, 0);
626
627 id = of_get_property(op->dev.of_node, "port-number", NULL);
628
629 return ulite_assign(&op->dev, id ? *id : -1, res.start, irq);
630}
631
632static int __devexit ulite_of_remove(struct platform_device *op)
633{
634 return ulite_release(&op->dev);
635}
636
637static struct of_platform_driver ulite_of_driver = {
638 .probe = ulite_of_probe,
639 .remove = __devexit_p(ulite_of_remove),
640 .driver = { 609 .driver = {
641 .name = "uartlite",
642 .owner = THIS_MODULE, 610 .owner = THIS_MODULE,
611 .name = "uartlite",
643 .of_match_table = ulite_of_match, 612 .of_match_table = ulite_of_match,
644 }, 613 },
645}; 614};
646 615
647/* Registration helpers to keep the number of #ifdefs to a minimum */
648static inline int __init ulite_of_register(void)
649{
650 pr_debug("uartlite: calling of_register_platform_driver()\n");
651 return of_register_platform_driver(&ulite_of_driver);
652}
653
654static inline void __exit ulite_of_unregister(void)
655{
656 of_unregister_platform_driver(&ulite_of_driver);
657}
658#else /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
659/* Appropriate config not enabled; do nothing helpers */
660static inline int __init ulite_of_register(void) { return 0; }
661static inline void __exit ulite_of_unregister(void) { }
662#endif /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
663
664/* --------------------------------------------------------------------- 616/* ---------------------------------------------------------------------
665 * Module setup/teardown 617 * Module setup/teardown
666 */ 618 */
@@ -674,10 +626,6 @@ int __init ulite_init(void)
674 if (ret) 626 if (ret)
675 goto err_uart; 627 goto err_uart;
676 628
677 ret = ulite_of_register();
678 if (ret)
679 goto err_of;
680
681 pr_debug("uartlite: calling platform_driver_register()\n"); 629 pr_debug("uartlite: calling platform_driver_register()\n");
682 ret = platform_driver_register(&ulite_platform_driver); 630 ret = platform_driver_register(&ulite_platform_driver);
683 if (ret) 631 if (ret)
@@ -686,8 +634,6 @@ int __init ulite_init(void)
686 return 0; 634 return 0;
687 635
688err_plat: 636err_plat:
689 ulite_of_unregister();
690err_of:
691 uart_unregister_driver(&ulite_uart_driver); 637 uart_unregister_driver(&ulite_uart_driver);
692err_uart: 638err_uart:
693 printk(KERN_ERR "registering uartlite driver failed: err=%i", ret); 639 printk(KERN_ERR "registering uartlite driver failed: err=%i", ret);
@@ -697,7 +643,6 @@ err_uart:
697void __exit ulite_exit(void) 643void __exit ulite_exit(void)
698{ 644{
699 platform_driver_unregister(&ulite_platform_driver); 645 platform_driver_unregister(&ulite_platform_driver);
700 ulite_of_unregister();
701 uart_unregister_driver(&ulite_uart_driver); 646 uart_unregister_driver(&ulite_uart_driver);
702} 647}
703 648
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 3f4848e2174a..ff51dae1df0c 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1194,8 +1194,7 @@ static void uart_firmware_cont(const struct firmware *fw, void *context)
1194 release_firmware(fw); 1194 release_firmware(fw);
1195} 1195}
1196 1196
1197static int ucc_uart_probe(struct platform_device *ofdev, 1197static int ucc_uart_probe(struct platform_device *ofdev)
1198 const struct of_device_id *match)
1199{ 1198{
1200 struct device_node *np = ofdev->dev.of_node; 1199 struct device_node *np = ofdev->dev.of_node;
1201 const unsigned int *iprop; /* Integer OF properties */ 1200 const unsigned int *iprop; /* Integer OF properties */
@@ -1485,7 +1484,7 @@ static struct of_device_id ucc_uart_match[] = {
1485}; 1484};
1486MODULE_DEVICE_TABLE(of, ucc_uart_match); 1485MODULE_DEVICE_TABLE(of, ucc_uart_match);
1487 1486
1488static struct of_platform_driver ucc_uart_of_driver = { 1487static struct platform_driver ucc_uart_of_driver = {
1489 .driver = { 1488 .driver = {
1490 .name = "ucc_uart", 1489 .name = "ucc_uart",
1491 .owner = THIS_MODULE, 1490 .owner = THIS_MODULE,
@@ -1510,7 +1509,7 @@ static int __init ucc_uart_init(void)
1510 return ret; 1509 return ret;
1511 } 1510 }
1512 1511
1513 ret = of_register_platform_driver(&ucc_uart_of_driver); 1512 ret = platform_driver_register(&ucc_uart_of_driver);
1514 if (ret) 1513 if (ret)
1515 printk(KERN_ERR 1514 printk(KERN_ERR
1516 "ucc-uart: could not register platform driver\n"); 1515 "ucc-uart: could not register platform driver\n");
@@ -1523,7 +1522,7 @@ static void __exit ucc_uart_exit(void)
1523 printk(KERN_INFO 1522 printk(KERN_INFO
1524 "Freescale QUICC Engine UART device driver unloading\n"); 1523 "Freescale QUICC Engine UART device driver unloading\n");
1525 1524
1526 of_unregister_platform_driver(&ucc_uart_of_driver); 1525 platform_driver_unregister(&ucc_uart_of_driver);
1527 uart_unregister_driver(&ucc_uart_driver); 1526 uart_unregister_driver(&ucc_uart_driver);
1528} 1527}
1529 1528