aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/sh-sci.c16
-rw-r--r--drivers/tty/serial/sh-sci.h16
2 files changed, 23 insertions, 9 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index f35b8fb94b83..ebd8629c108d 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -41,6 +41,7 @@
41#include <linux/platform_device.h> 41#include <linux/platform_device.h>
42#include <linux/serial_sci.h> 42#include <linux/serial_sci.h>
43#include <linux/notifier.h> 43#include <linux/notifier.h>
44#include <linux/pm_runtime.h>
44#include <linux/cpufreq.h> 45#include <linux/cpufreq.h>
45#include <linux/clk.h> 46#include <linux/clk.h>
46#include <linux/ctype.h> 47#include <linux/ctype.h>
@@ -560,6 +561,9 @@ static void sci_break_timer(unsigned long data)
560{ 561{
561 struct sci_port *port = (struct sci_port *)data; 562 struct sci_port *port = (struct sci_port *)data;
562 563
564 if (port->enable)
565 port->enable(&port->port);
566
563 if (sci_rxd_in(&port->port) == 0) { 567 if (sci_rxd_in(&port->port) == 0) {
564 port->break_flag = 1; 568 port->break_flag = 1;
565 sci_schedule_break_timer(port); 569 sci_schedule_break_timer(port);
@@ -569,6 +573,9 @@ static void sci_break_timer(unsigned long data)
569 sci_schedule_break_timer(port); 573 sci_schedule_break_timer(port);
570 } else 574 } else
571 port->break_flag = 0; 575 port->break_flag = 0;
576
577 if (port->disable)
578 port->disable(&port->port);
572} 579}
573 580
574static int sci_handle_errors(struct uart_port *port) 581static int sci_handle_errors(struct uart_port *port)
@@ -837,6 +844,8 @@ static void sci_clk_enable(struct uart_port *port)
837{ 844{
838 struct sci_port *sci_port = to_sci_port(port); 845 struct sci_port *sci_port = to_sci_port(port);
839 846
847 pm_runtime_get_sync(port->dev);
848
840 clk_enable(sci_port->iclk); 849 clk_enable(sci_port->iclk);
841 sci_port->port.uartclk = clk_get_rate(sci_port->iclk); 850 sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
842 clk_enable(sci_port->fclk); 851 clk_enable(sci_port->fclk);
@@ -848,6 +857,8 @@ static void sci_clk_disable(struct uart_port *port)
848 857
849 clk_disable(sci_port->fclk); 858 clk_disable(sci_port->fclk);
850 clk_disable(sci_port->iclk); 859 clk_disable(sci_port->iclk);
860
861 pm_runtime_put_sync(port->dev);
851} 862}
852 863
853static int sci_request_irq(struct sci_port *port) 864static int sci_request_irq(struct sci_port *port)
@@ -1756,6 +1767,8 @@ static int __devinit sci_init_single(struct platform_device *dev,
1756 sci_port->enable = sci_clk_enable; 1767 sci_port->enable = sci_clk_enable;
1757 sci_port->disable = sci_clk_disable; 1768 sci_port->disable = sci_clk_disable;
1758 port->dev = &dev->dev; 1769 port->dev = &dev->dev;
1770
1771 pm_runtime_enable(&dev->dev);
1759 } 1772 }
1760 1773
1761 sci_port->break_timer.data = (unsigned long)sci_port; 1774 sci_port->break_timer.data = (unsigned long)sci_port;
@@ -1775,7 +1788,7 @@ static int __devinit sci_init_single(struct platform_device *dev,
1775 * 1788 *
1776 * For the muxed case there's nothing more to do. 1789 * For the muxed case there's nothing more to do.
1777 */ 1790 */
1778 port->irq = p->irqs[SCIx_TXI_IRQ]; 1791 port->irq = p->irqs[SCIx_RXI_IRQ];
1779 1792
1780 if (p->dma_dev) 1793 if (p->dma_dev)
1781 dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n", 1794 dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n",
@@ -1936,6 +1949,7 @@ static int sci_remove(struct platform_device *dev)
1936 clk_put(port->iclk); 1949 clk_put(port->iclk);
1937 clk_put(port->fclk); 1950 clk_put(port->fclk);
1938 1951
1952 pm_runtime_disable(&dev->dev);
1939 return 0; 1953 return 0;
1940} 1954}
1941 1955
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
index 5fefed53fa42..b04d937c9110 100644
--- a/drivers/tty/serial/sh-sci.h
+++ b/drivers/tty/serial/sh-sci.h
@@ -270,12 +270,12 @@
270#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 270#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
271 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 271 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
272 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 272 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
273 defined(CONFIG_ARCH_SH73A0) || \ 273 defined(CONFIG_ARCH_SH7367)
274 defined(CONFIG_ARCH_SH7367) || \
275 defined(CONFIG_ARCH_SH7377)
276#define SCIF_FNS(name, scif_offset, scif_size) \ 274#define SCIF_FNS(name, scif_offset, scif_size) \
277 CPU_SCIF_FNS(name, scif_offset, scif_size) 275 CPU_SCIF_FNS(name, scif_offset, scif_size)
278#elif defined(CONFIG_ARCH_SH7372) 276#elif defined(CONFIG_ARCH_SH7377) || \
277 defined(CONFIG_ARCH_SH7372) || \
278 defined(CONFIG_ARCH_SH73A0)
279#define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scifb_offset, sh4_scifb_size) \ 279#define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scifb_offset, sh4_scifb_size) \
280 CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scifb_offset, sh4_scifb_size) 280 CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scifb_offset, sh4_scifb_size)
281#define SCIF_FNS(name, scif_offset, scif_size) \ 281#define SCIF_FNS(name, scif_offset, scif_size) \
@@ -313,9 +313,7 @@
313#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 313#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
314 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 314 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
315 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 315 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
316 defined(CONFIG_ARCH_SH73A0) || \ 316 defined(CONFIG_ARCH_SH7367)
317 defined(CONFIG_ARCH_SH7367) || \
318 defined(CONFIG_ARCH_SH7377)
319 317
320SCIF_FNS(SCSMR, 0x00, 16) 318SCIF_FNS(SCSMR, 0x00, 16)
321SCIF_FNS(SCBRR, 0x04, 8) 319SCIF_FNS(SCBRR, 0x04, 8)
@@ -326,7 +324,9 @@ SCIF_FNS(SCFDR, 0x1c, 16)
326SCIF_FNS(SCxTDR, 0x20, 8) 324SCIF_FNS(SCxTDR, 0x20, 8)
327SCIF_FNS(SCxRDR, 0x24, 8) 325SCIF_FNS(SCxRDR, 0x24, 8)
328SCIF_FNS(SCLSR, 0x00, 0) 326SCIF_FNS(SCLSR, 0x00, 0)
329#elif defined(CONFIG_ARCH_SH7372) 327#elif defined(CONFIG_ARCH_SH7377) || \
328 defined(CONFIG_ARCH_SH7372) || \
329 defined(CONFIG_ARCH_SH73A0)
330SCIF_FNS(SCSMR, 0x00, 16) 330SCIF_FNS(SCSMR, 0x00, 16)
331SCIF_FNS(SCBRR, 0x04, 8) 331SCIF_FNS(SCBRR, 0x04, 8)
332SCIF_FNS(SCSCR, 0x08, 16) 332SCIF_FNS(SCSCR, 0x08, 16)