diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-06-28 00:55:31 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-06-28 00:55:31 -0400 |
commit | 23241d43eac88f63a7f0bf4d5c12bbc496651585 (patch) | |
tree | 18a45892d69880caf370eb72201a448ee24e196d /drivers/tty/serial/sh-sci.c | |
parent | 7f405f9c3117acfa8a9775c467ab433b23abc5a7 (diff) |
serial: sh-sci: Kill off per-port enable/disable callbacks.
Ultimately we want everything to be going through the clock framework and
runtime pm, so kill off the per-port callbacks that enabled ports to
bypass the common infrastructure.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 79 |
1 files changed, 32 insertions, 47 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index fa99b0063158..9c8624d9c803 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -62,12 +62,6 @@ struct sci_port { | |||
62 | /* Platform configuration */ | 62 | /* Platform configuration */ |
63 | struct plat_sci_port *cfg; | 63 | struct plat_sci_port *cfg; |
64 | 64 | ||
65 | /* Port enable callback */ | ||
66 | void (*enable)(struct uart_port *port); | ||
67 | |||
68 | /* Port disable callback */ | ||
69 | void (*disable)(struct uart_port *port); | ||
70 | |||
71 | /* Break timer */ | 65 | /* Break timer */ |
72 | struct timer_list break_timer; | 66 | struct timer_list break_timer; |
73 | int break_flag; | 67 | int break_flag; |
@@ -366,6 +360,29 @@ static int sci_probe_regmap(struct plat_sci_port *cfg) | |||
366 | return 0; | 360 | return 0; |
367 | } | 361 | } |
368 | 362 | ||
363 | static void sci_port_enable(struct sci_port *sci_port) | ||
364 | { | ||
365 | if (!sci_port->port.dev) | ||
366 | return; | ||
367 | |||
368 | pm_runtime_get_sync(sci_port->port.dev); | ||
369 | |||
370 | clk_enable(sci_port->iclk); | ||
371 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); | ||
372 | clk_enable(sci_port->fclk); | ||
373 | } | ||
374 | |||
375 | static void sci_port_disable(struct sci_port *sci_port) | ||
376 | { | ||
377 | if (!sci_port->port.dev) | ||
378 | return; | ||
379 | |||
380 | clk_disable(sci_port->fclk); | ||
381 | clk_disable(sci_port->iclk); | ||
382 | |||
383 | pm_runtime_put_sync(sci_port->port.dev); | ||
384 | } | ||
385 | |||
369 | #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE) | 386 | #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE) |
370 | 387 | ||
371 | #ifdef CONFIG_CONSOLE_POLL | 388 | #ifdef CONFIG_CONSOLE_POLL |
@@ -651,8 +668,7 @@ static void sci_break_timer(unsigned long data) | |||
651 | { | 668 | { |
652 | struct sci_port *port = (struct sci_port *)data; | 669 | struct sci_port *port = (struct sci_port *)data; |
653 | 670 | ||
654 | if (port->enable) | 671 | sci_port_enable(port); |
655 | port->enable(&port->port); | ||
656 | 672 | ||
657 | if (sci_rxd_in(&port->port) == 0) { | 673 | if (sci_rxd_in(&port->port) == 0) { |
658 | port->break_flag = 1; | 674 | port->break_flag = 1; |
@@ -664,8 +680,7 @@ static void sci_break_timer(unsigned long data) | |||
664 | } else | 680 | } else |
665 | port->break_flag = 0; | 681 | port->break_flag = 0; |
666 | 682 | ||
667 | if (port->disable) | 683 | sci_port_disable(port); |
668 | port->disable(&port->port); | ||
669 | } | 684 | } |
670 | 685 | ||
671 | static int sci_handle_errors(struct uart_port *port) | 686 | static int sci_handle_errors(struct uart_port *port) |
@@ -939,27 +954,6 @@ static int sci_notifier(struct notifier_block *self, | |||
939 | return NOTIFY_OK; | 954 | return NOTIFY_OK; |
940 | } | 955 | } |
941 | 956 | ||
942 | static void sci_clk_enable(struct uart_port *port) | ||
943 | { | ||
944 | struct sci_port *sci_port = to_sci_port(port); | ||
945 | |||
946 | pm_runtime_get_sync(port->dev); | ||
947 | |||
948 | clk_enable(sci_port->iclk); | ||
949 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); | ||
950 | clk_enable(sci_port->fclk); | ||
951 | } | ||
952 | |||
953 | static void sci_clk_disable(struct uart_port *port) | ||
954 | { | ||
955 | struct sci_port *sci_port = to_sci_port(port); | ||
956 | |||
957 | clk_disable(sci_port->fclk); | ||
958 | clk_disable(sci_port->iclk); | ||
959 | |||
960 | pm_runtime_put_sync(port->dev); | ||
961 | } | ||
962 | |||
963 | static int sci_request_irq(struct sci_port *port) | 957 | static int sci_request_irq(struct sci_port *port) |
964 | { | 958 | { |
965 | int i; | 959 | int i; |
@@ -1537,8 +1531,7 @@ static int sci_startup(struct uart_port *port) | |||
1537 | 1531 | ||
1538 | dev_dbg(port->dev, "%s(%d)\n", __func__, port->line); | 1532 | dev_dbg(port->dev, "%s(%d)\n", __func__, port->line); |
1539 | 1533 | ||
1540 | if (s->enable) | 1534 | sci_port_enable(s); |
1541 | s->enable(port); | ||
1542 | 1535 | ||
1543 | ret = sci_request_irq(s); | 1536 | ret = sci_request_irq(s); |
1544 | if (unlikely(ret < 0)) | 1537 | if (unlikely(ret < 0)) |
@@ -1564,8 +1557,7 @@ static void sci_shutdown(struct uart_port *port) | |||
1564 | sci_free_dma(port); | 1557 | sci_free_dma(port); |
1565 | sci_free_irq(s); | 1558 | sci_free_irq(s); |
1566 | 1559 | ||
1567 | if (s->disable) | 1560 | sci_port_disable(s); |
1568 | s->disable(port); | ||
1569 | } | 1561 | } |
1570 | 1562 | ||
1571 | static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps, | 1563 | static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps, |
@@ -1612,8 +1604,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1612 | if (likely(baud && port->uartclk)) | 1604 | if (likely(baud && port->uartclk)) |
1613 | t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, port->uartclk); | 1605 | t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, port->uartclk); |
1614 | 1606 | ||
1615 | if (s->enable) | 1607 | sci_port_enable(s); |
1616 | s->enable(port); | ||
1617 | 1608 | ||
1618 | do { | 1609 | do { |
1619 | status = sci_in(port, SCxSR); | 1610 | status = sci_in(port, SCxSR); |
@@ -1683,8 +1674,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1683 | if ((termios->c_cflag & CREAD) != 0) | 1674 | if ((termios->c_cflag & CREAD) != 0) |
1684 | sci_start_rx(port); | 1675 | sci_start_rx(port); |
1685 | 1676 | ||
1686 | if (s->disable) | 1677 | sci_port_disable(s); |
1687 | s->disable(port); | ||
1688 | } | 1678 | } |
1689 | 1679 | ||
1690 | static const char *sci_type(struct uart_port *port) | 1680 | static const char *sci_type(struct uart_port *port) |
@@ -1870,8 +1860,6 @@ static int __devinit sci_init_single(struct platform_device *dev, | |||
1870 | if (IS_ERR(sci_port->fclk)) | 1860 | if (IS_ERR(sci_port->fclk)) |
1871 | sci_port->fclk = NULL; | 1861 | sci_port->fclk = NULL; |
1872 | 1862 | ||
1873 | sci_port->enable = sci_clk_enable; | ||
1874 | sci_port->disable = sci_clk_disable; | ||
1875 | port->dev = &dev->dev; | 1863 | port->dev = &dev->dev; |
1876 | 1864 | ||
1877 | pm_runtime_enable(&dev->dev); | 1865 | pm_runtime_enable(&dev->dev); |
@@ -1950,8 +1938,7 @@ static void serial_console_write(struct console *co, const char *s, | |||
1950 | struct uart_port *port = &sci_port->port; | 1938 | struct uart_port *port = &sci_port->port; |
1951 | unsigned short bits; | 1939 | unsigned short bits; |
1952 | 1940 | ||
1953 | if (sci_port->enable) | 1941 | sci_port_enable(sci_port); |
1954 | sci_port->enable(port); | ||
1955 | 1942 | ||
1956 | uart_console_write(port, s, count, serial_console_putchar); | 1943 | uart_console_write(port, s, count, serial_console_putchar); |
1957 | 1944 | ||
@@ -1960,8 +1947,7 @@ static void serial_console_write(struct console *co, const char *s, | |||
1960 | while ((sci_in(port, SCxSR) & bits) != bits) | 1947 | while ((sci_in(port, SCxSR) & bits) != bits) |
1961 | cpu_relax(); | 1948 | cpu_relax(); |
1962 | 1949 | ||
1963 | if (sci_port->disable) | 1950 | sci_port_disable(sci_port); |
1964 | sci_port->disable(port); | ||
1965 | } | 1951 | } |
1966 | 1952 | ||
1967 | static int __devinit serial_console_setup(struct console *co, char *options) | 1953 | static int __devinit serial_console_setup(struct console *co, char *options) |
@@ -1993,8 +1979,7 @@ static int __devinit serial_console_setup(struct console *co, char *options) | |||
1993 | if (unlikely(ret != 0)) | 1979 | if (unlikely(ret != 0)) |
1994 | return ret; | 1980 | return ret; |
1995 | 1981 | ||
1996 | if (sci_port->enable) | 1982 | sci_port_enable(sci_port); |
1997 | sci_port->enable(port); | ||
1998 | 1983 | ||
1999 | if (options) | 1984 | if (options) |
2000 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 1985 | uart_parse_options(options, &baud, &parity, &bits, &flow); |