aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sh-sci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/sh-sci.c')
-rw-r--r--drivers/serial/sh-sci.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 304a877d083d..291bc08e2e84 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -82,8 +82,8 @@ struct sci_port {
82 82
83 /* Interface clock */ 83 /* Interface clock */
84 struct clk *iclk; 84 struct clk *iclk;
85 /* Data clock */ 85 /* Function clock */
86 struct clk *dclk; 86 struct clk *fclk;
87 87
88 struct list_head node; 88 struct list_head node;
89 struct dma_chan *chan_tx; 89 struct dma_chan *chan_tx;
@@ -780,10 +780,6 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
780 if ((ssr_status & SCxSR_BRK(port)) && err_enabled) 780 if ((ssr_status & SCxSR_BRK(port)) && err_enabled)
781 ret = sci_br_interrupt(irq, ptr); 781 ret = sci_br_interrupt(irq, ptr);
782 782
783 WARN_ONCE(ret == IRQ_NONE,
784 "%s: %d IRQ %d, status %x, control %x\n", __func__,
785 irq, port->line, ssr_status, scr_status);
786
787 return ret; 783 return ret;
788} 784}
789 785
@@ -803,7 +799,7 @@ static int sci_notifier(struct notifier_block *self,
803 (phase == CPUFREQ_RESUMECHANGE)) { 799 (phase == CPUFREQ_RESUMECHANGE)) {
804 spin_lock_irqsave(&priv->lock, flags); 800 spin_lock_irqsave(&priv->lock, flags);
805 list_for_each_entry(sci_port, &priv->ports, node) 801 list_for_each_entry(sci_port, &priv->ports, node)
806 sci_port->port.uartclk = clk_get_rate(sci_port->dclk); 802 sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
807 spin_unlock_irqrestore(&priv->lock, flags); 803 spin_unlock_irqrestore(&priv->lock, flags);
808 } 804 }
809 805
@@ -814,21 +810,17 @@ static void sci_clk_enable(struct uart_port *port)
814{ 810{
815 struct sci_port *sci_port = to_sci_port(port); 811 struct sci_port *sci_port = to_sci_port(port);
816 812
817 clk_enable(sci_port->dclk); 813 clk_enable(sci_port->iclk);
818 sci_port->port.uartclk = clk_get_rate(sci_port->dclk); 814 sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
819 815 clk_enable(sci_port->fclk);
820 if (sci_port->iclk)
821 clk_enable(sci_port->iclk);
822} 816}
823 817
824static void sci_clk_disable(struct uart_port *port) 818static void sci_clk_disable(struct uart_port *port)
825{ 819{
826 struct sci_port *sci_port = to_sci_port(port); 820 struct sci_port *sci_port = to_sci_port(port);
827 821
828 if (sci_port->iclk) 822 clk_disable(sci_port->fclk);
829 clk_disable(sci_port->iclk); 823 clk_disable(sci_port->iclk);
830
831 clk_disable(sci_port->dclk);
832} 824}
833 825
834static int sci_request_irq(struct sci_port *port) 826static int sci_request_irq(struct sci_port *port)
@@ -1602,10 +1594,10 @@ static struct uart_ops sci_uart_ops = {
1602#endif 1594#endif
1603}; 1595};
1604 1596
1605static void __devinit sci_init_single(struct platform_device *dev, 1597static int __devinit sci_init_single(struct platform_device *dev,
1606 struct sci_port *sci_port, 1598 struct sci_port *sci_port,
1607 unsigned int index, 1599 unsigned int index,
1608 struct plat_sci_port *p) 1600 struct plat_sci_port *p)
1609{ 1601{
1610 struct uart_port *port = &sci_port->port; 1602 struct uart_port *port = &sci_port->port;
1611 1603
@@ -1626,8 +1618,23 @@ static void __devinit sci_init_single(struct platform_device *dev,
1626 } 1618 }
1627 1619
1628 if (dev) { 1620 if (dev) {
1629 sci_port->iclk = p->clk ? clk_get(&dev->dev, p->clk) : NULL; 1621 sci_port->iclk = clk_get(&dev->dev, "sci_ick");
1630 sci_port->dclk = clk_get(&dev->dev, "peripheral_clk"); 1622 if (IS_ERR(sci_port->iclk)) {
1623 sci_port->iclk = clk_get(&dev->dev, "peripheral_clk");
1624 if (IS_ERR(sci_port->iclk)) {
1625 dev_err(&dev->dev, "can't get iclk\n");
1626 return PTR_ERR(sci_port->iclk);
1627 }
1628 }
1629
1630 /*
1631 * The function clock is optional, ignore it if we can't
1632 * find it.
1633 */
1634 sci_port->fclk = clk_get(&dev->dev, "sci_fck");
1635 if (IS_ERR(sci_port->fclk))
1636 sci_port->fclk = NULL;
1637
1631 sci_port->enable = sci_clk_enable; 1638 sci_port->enable = sci_clk_enable;
1632 sci_port->disable = sci_clk_disable; 1639 sci_port->disable = sci_clk_disable;
1633 port->dev = &dev->dev; 1640 port->dev = &dev->dev;
@@ -1654,6 +1661,7 @@ static void __devinit sci_init_single(struct platform_device *dev,
1654#endif 1661#endif
1655 1662
1656 memcpy(&sci_port->irqs, &p->irqs, sizeof(p->irqs)); 1663 memcpy(&sci_port->irqs, &p->irqs, sizeof(p->irqs));
1664 return 0;
1657} 1665}
1658 1666
1659#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE 1667#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
@@ -1803,8 +1811,11 @@ static int sci_remove(struct platform_device *dev)
1803 cpufreq_unregister_notifier(&priv->clk_nb, CPUFREQ_TRANSITION_NOTIFIER); 1811 cpufreq_unregister_notifier(&priv->clk_nb, CPUFREQ_TRANSITION_NOTIFIER);
1804 1812
1805 spin_lock_irqsave(&priv->lock, flags); 1813 spin_lock_irqsave(&priv->lock, flags);
1806 list_for_each_entry(p, &priv->ports, node) 1814 list_for_each_entry(p, &priv->ports, node) {
1807 uart_remove_one_port(&sci_uart_driver, &p->port); 1815 uart_remove_one_port(&sci_uart_driver, &p->port);
1816 clk_put(p->iclk);
1817 clk_put(p->fclk);
1818 }
1808 spin_unlock_irqrestore(&priv->lock, flags); 1819 spin_unlock_irqrestore(&priv->lock, flags);
1809 1820
1810 kfree(priv); 1821 kfree(priv);
@@ -1830,7 +1841,9 @@ static int __devinit sci_probe_single(struct platform_device *dev,
1830 return 0; 1841 return 0;
1831 } 1842 }
1832 1843
1833 sci_init_single(dev, sciport, index, p); 1844 ret = sci_init_single(dev, sciport, index, p);
1845 if (ret)
1846 return ret;
1834 1847
1835 ret = uart_add_one_port(&sci_uart_driver, &sciport->port); 1848 ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
1836 if (ret) 1849 if (ret)