aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/mpsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/mpsc.c')
-rw-r--r--drivers/serial/mpsc.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index efe79b1fd431..8f83e4007ecd 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -52,6 +52,8 @@
52 * 4) AFAICT, hardware flow control isn't supported by the controller --MAG. 52 * 4) AFAICT, hardware flow control isn't supported by the controller --MAG.
53 */ 53 */
54 54
55#include <linux/platform_device.h>
56
55#include "mpsc.h" 57#include "mpsc.h"
56 58
57/* 59/*
@@ -1100,6 +1102,8 @@ mpsc_start_rx(struct mpsc_port_info *pi)
1100{ 1102{
1101 pr_debug("mpsc_start_rx[%d]: Starting...\n", pi->port.line); 1103 pr_debug("mpsc_start_rx[%d]: Starting...\n", pi->port.line);
1102 1104
1105 /* Issue a Receive Abort to clear any receive errors */
1106 writel(MPSC_CHR_2_RA, pi->mpsc_base + MPSC_CHR_2);
1103 if (pi->rcv_data) { 1107 if (pi->rcv_data) {
1104 mpsc_enter_hunt(pi); 1108 mpsc_enter_hunt(pi);
1105 mpsc_sdma_cmd(pi, SDMA_SDCM_ERD); 1109 mpsc_sdma_cmd(pi, SDMA_SDCM_ERD);
@@ -1547,15 +1551,14 @@ mpsc_shared_unmap_regs(void)
1547} 1551}
1548 1552
1549static int 1553static int
1550mpsc_shared_drv_probe(struct device *dev) 1554mpsc_shared_drv_probe(struct platform_device *dev)
1551{ 1555{
1552 struct platform_device *pd = to_platform_device(dev);
1553 struct mpsc_shared_pdata *pdata; 1556 struct mpsc_shared_pdata *pdata;
1554 int rc = -ENODEV; 1557 int rc = -ENODEV;
1555 1558
1556 if (pd->id == 0) { 1559 if (dev->id == 0) {
1557 if (!(rc = mpsc_shared_map_regs(pd))) { 1560 if (!(rc = mpsc_shared_map_regs(dev))) {
1558 pdata = (struct mpsc_shared_pdata *)dev->platform_data; 1561 pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data;
1559 1562
1560 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; 1563 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val;
1561 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; 1564 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val;
@@ -1573,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev)
1573} 1576}
1574 1577
1575static int 1578static int
1576mpsc_shared_drv_remove(struct device *dev) 1579mpsc_shared_drv_remove(struct platform_device *dev)
1577{ 1580{
1578 struct platform_device *pd = to_platform_device(dev);
1579 int rc = -ENODEV; 1581 int rc = -ENODEV;
1580 1582
1581 if (pd->id == 0) { 1583 if (dev->id == 0) {
1582 mpsc_shared_unmap_regs(); 1584 mpsc_shared_unmap_regs();
1583 mpsc_shared_regs.MPSC_MRR_m = 0; 1585 mpsc_shared_regs.MPSC_MRR_m = 0;
1584 mpsc_shared_regs.MPSC_RCRR_m = 0; 1586 mpsc_shared_regs.MPSC_RCRR_m = 0;
@@ -1591,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev)
1591 return rc; 1593 return rc;
1592} 1594}
1593 1595
1594static struct device_driver mpsc_shared_driver = { 1596static struct platform_driver mpsc_shared_driver = {
1595 .name = MPSC_SHARED_NAME,
1596 .bus = &platform_bus_type,
1597 .probe = mpsc_shared_drv_probe, 1597 .probe = mpsc_shared_drv_probe,
1598 .remove = mpsc_shared_drv_remove, 1598 .remove = mpsc_shared_drv_remove,
1599 .driver = {
1600 .name = MPSC_SHARED_NAME,
1601 },
1599}; 1602};
1600 1603
1601/* 1604/*
@@ -1728,19 +1731,18 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
1728} 1731}
1729 1732
1730static int 1733static int
1731mpsc_drv_probe(struct device *dev) 1734mpsc_drv_probe(struct platform_device *dev)
1732{ 1735{
1733 struct platform_device *pd = to_platform_device(dev);
1734 struct mpsc_port_info *pi; 1736 struct mpsc_port_info *pi;
1735 int rc = -ENODEV; 1737 int rc = -ENODEV;
1736 1738
1737 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); 1739 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id);
1738 1740
1739 if (pd->id < MPSC_NUM_CTLRS) { 1741 if (dev->id < MPSC_NUM_CTLRS) {
1740 pi = &mpsc_ports[pd->id]; 1742 pi = &mpsc_ports[dev->id];
1741 1743
1742 if (!(rc = mpsc_drv_map_regs(pi, pd))) { 1744 if (!(rc = mpsc_drv_map_regs(pi, dev))) {
1743 mpsc_drv_get_platform_data(pi, pd, pd->id); 1745 mpsc_drv_get_platform_data(pi, dev, dev->id);
1744 1746
1745 if (!(rc = mpsc_make_ready(pi))) 1747 if (!(rc = mpsc_make_ready(pi)))
1746 if (!(rc = uart_add_one_port(&mpsc_reg, 1748 if (!(rc = uart_add_one_port(&mpsc_reg,
@@ -1760,27 +1762,26 @@ mpsc_drv_probe(struct device *dev)
1760} 1762}
1761 1763
1762static int 1764static int
1763mpsc_drv_remove(struct device *dev) 1765mpsc_drv_remove(struct platform_device *dev)
1764{ 1766{
1765 struct platform_device *pd = to_platform_device(dev); 1767 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
1766
1767 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id);
1768 1768
1769 if (pd->id < MPSC_NUM_CTLRS) { 1769 if (dev->id < MPSC_NUM_CTLRS) {
1770 uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); 1770 uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
1771 mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port); 1771 mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port);
1772 mpsc_drv_unmap_regs(&mpsc_ports[pd->id]); 1772 mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
1773 return 0; 1773 return 0;
1774 } 1774 }
1775 else 1775 else
1776 return -ENODEV; 1776 return -ENODEV;
1777} 1777}
1778 1778
1779static struct device_driver mpsc_driver = { 1779static struct platform_driver mpsc_driver = {
1780 .name = MPSC_CTLR_NAME,
1781 .bus = &platform_bus_type,
1782 .probe = mpsc_drv_probe, 1780 .probe = mpsc_drv_probe,
1783 .remove = mpsc_drv_remove, 1781 .remove = mpsc_drv_remove,
1782 .driver = {
1783 .name = MPSC_CTLR_NAME,
1784 },
1784}; 1785};
1785 1786
1786static int __init 1787static int __init
@@ -1794,9 +1795,9 @@ mpsc_drv_init(void)
1794 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1795 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
1795 1796
1796 if (!(rc = uart_register_driver(&mpsc_reg))) { 1797 if (!(rc = uart_register_driver(&mpsc_reg))) {
1797 if (!(rc = driver_register(&mpsc_shared_driver))) { 1798 if (!(rc = platform_driver_register(&mpsc_shared_driver))) {
1798 if ((rc = driver_register(&mpsc_driver))) { 1799 if ((rc = platform_driver_register(&mpsc_driver))) {
1799 driver_unregister(&mpsc_shared_driver); 1800 platform_driver_unregister(&mpsc_shared_driver);
1800 uart_unregister_driver(&mpsc_reg); 1801 uart_unregister_driver(&mpsc_reg);
1801 } 1802 }
1802 } 1803 }
@@ -1811,8 +1812,8 @@ mpsc_drv_init(void)
1811static void __exit 1812static void __exit
1812mpsc_drv_exit(void) 1813mpsc_drv_exit(void)
1813{ 1814{
1814 driver_unregister(&mpsc_driver); 1815 platform_driver_unregister(&mpsc_driver);
1815 driver_unregister(&mpsc_shared_driver); 1816 platform_driver_unregister(&mpsc_shared_driver);
1816 uart_unregister_driver(&mpsc_reg); 1817 uart_unregister_driver(&mpsc_reg);
1817 memset(mpsc_ports, 0, sizeof(mpsc_ports)); 1818 memset(mpsc_ports, 0, sizeof(mpsc_ports));
1818 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1819 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));