提交 23241d43 编写于 作者: P Paul Mundt

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: NPaul Mundt <lethal@linux-sh.org>
上级 7f405f9c
...@@ -62,12 +62,6 @@ struct sci_port { ...@@ -62,12 +62,6 @@ struct sci_port {
/* Platform configuration */ /* Platform configuration */
struct plat_sci_port *cfg; struct plat_sci_port *cfg;
/* Port enable callback */
void (*enable)(struct uart_port *port);
/* Port disable callback */
void (*disable)(struct uart_port *port);
/* Break timer */ /* Break timer */
struct timer_list break_timer; struct timer_list break_timer;
int break_flag; int break_flag;
...@@ -366,6 +360,29 @@ static int sci_probe_regmap(struct plat_sci_port *cfg) ...@@ -366,6 +360,29 @@ static int sci_probe_regmap(struct plat_sci_port *cfg)
return 0; return 0;
} }
static void sci_port_enable(struct sci_port *sci_port)
{
if (!sci_port->port.dev)
return;
pm_runtime_get_sync(sci_port->port.dev);
clk_enable(sci_port->iclk);
sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
clk_enable(sci_port->fclk);
}
static void sci_port_disable(struct sci_port *sci_port)
{
if (!sci_port->port.dev)
return;
clk_disable(sci_port->fclk);
clk_disable(sci_port->iclk);
pm_runtime_put_sync(sci_port->port.dev);
}
#if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE) #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE)
#ifdef CONFIG_CONSOLE_POLL #ifdef CONFIG_CONSOLE_POLL
...@@ -651,8 +668,7 @@ static void sci_break_timer(unsigned long data) ...@@ -651,8 +668,7 @@ static void sci_break_timer(unsigned long data)
{ {
struct sci_port *port = (struct sci_port *)data; struct sci_port *port = (struct sci_port *)data;
if (port->enable) sci_port_enable(port);
port->enable(&port->port);
if (sci_rxd_in(&port->port) == 0) { if (sci_rxd_in(&port->port) == 0) {
port->break_flag = 1; port->break_flag = 1;
...@@ -664,8 +680,7 @@ static void sci_break_timer(unsigned long data) ...@@ -664,8 +680,7 @@ static void sci_break_timer(unsigned long data)
} else } else
port->break_flag = 0; port->break_flag = 0;
if (port->disable) sci_port_disable(port);
port->disable(&port->port);
} }
static int sci_handle_errors(struct uart_port *port) static int sci_handle_errors(struct uart_port *port)
...@@ -939,27 +954,6 @@ static int sci_notifier(struct notifier_block *self, ...@@ -939,27 +954,6 @@ static int sci_notifier(struct notifier_block *self,
return NOTIFY_OK; return NOTIFY_OK;
} }
static void sci_clk_enable(struct uart_port *port)
{
struct sci_port *sci_port = to_sci_port(port);
pm_runtime_get_sync(port->dev);
clk_enable(sci_port->iclk);
sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
clk_enable(sci_port->fclk);
}
static void sci_clk_disable(struct uart_port *port)
{
struct sci_port *sci_port = to_sci_port(port);
clk_disable(sci_port->fclk);
clk_disable(sci_port->iclk);
pm_runtime_put_sync(port->dev);
}
static int sci_request_irq(struct sci_port *port) static int sci_request_irq(struct sci_port *port)
{ {
int i; int i;
...@@ -1537,8 +1531,7 @@ static int sci_startup(struct uart_port *port) ...@@ -1537,8 +1531,7 @@ static int sci_startup(struct uart_port *port)
dev_dbg(port->dev, "%s(%d)\n", __func__, port->line); dev_dbg(port->dev, "%s(%d)\n", __func__, port->line);
if (s->enable) sci_port_enable(s);
s->enable(port);
ret = sci_request_irq(s); ret = sci_request_irq(s);
if (unlikely(ret < 0)) if (unlikely(ret < 0))
...@@ -1564,8 +1557,7 @@ static void sci_shutdown(struct uart_port *port) ...@@ -1564,8 +1557,7 @@ static void sci_shutdown(struct uart_port *port)
sci_free_dma(port); sci_free_dma(port);
sci_free_irq(s); sci_free_irq(s);
if (s->disable) sci_port_disable(s);
s->disable(port);
} }
static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps, 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,8 +1604,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
if (likely(baud && port->uartclk)) if (likely(baud && port->uartclk))
t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, port->uartclk); t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, port->uartclk);
if (s->enable) sci_port_enable(s);
s->enable(port);
do { do {
status = sci_in(port, SCxSR); status = sci_in(port, SCxSR);
...@@ -1683,8 +1674,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -1683,8 +1674,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
if ((termios->c_cflag & CREAD) != 0) if ((termios->c_cflag & CREAD) != 0)
sci_start_rx(port); sci_start_rx(port);
if (s->disable) sci_port_disable(s);
s->disable(port);
} }
static const char *sci_type(struct uart_port *port) static const char *sci_type(struct uart_port *port)
...@@ -1870,8 +1860,6 @@ static int __devinit sci_init_single(struct platform_device *dev, ...@@ -1870,8 +1860,6 @@ static int __devinit sci_init_single(struct platform_device *dev,
if (IS_ERR(sci_port->fclk)) if (IS_ERR(sci_port->fclk))
sci_port->fclk = NULL; sci_port->fclk = NULL;
sci_port->enable = sci_clk_enable;
sci_port->disable = sci_clk_disable;
port->dev = &dev->dev; port->dev = &dev->dev;
pm_runtime_enable(&dev->dev); pm_runtime_enable(&dev->dev);
...@@ -1950,8 +1938,7 @@ static void serial_console_write(struct console *co, const char *s, ...@@ -1950,8 +1938,7 @@ static void serial_console_write(struct console *co, const char *s,
struct uart_port *port = &sci_port->port; struct uart_port *port = &sci_port->port;
unsigned short bits; unsigned short bits;
if (sci_port->enable) sci_port_enable(sci_port);
sci_port->enable(port);
uart_console_write(port, s, count, serial_console_putchar); uart_console_write(port, s, count, serial_console_putchar);
...@@ -1960,8 +1947,7 @@ static void serial_console_write(struct console *co, const char *s, ...@@ -1960,8 +1947,7 @@ static void serial_console_write(struct console *co, const char *s,
while ((sci_in(port, SCxSR) & bits) != bits) while ((sci_in(port, SCxSR) & bits) != bits)
cpu_relax(); cpu_relax();
if (sci_port->disable) sci_port_disable(sci_port);
sci_port->disable(port);
} }
static int __devinit serial_console_setup(struct console *co, char *options) 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,8 +1979,7 @@ static int __devinit serial_console_setup(struct console *co, char *options)
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ret; return ret;
if (sci_port->enable) sci_port_enable(sci_port);
sci_port->enable(port);
if (options) if (options)
uart_parse_options(options, &baud, &parity, &bits, &flow); uart_parse_options(options, &baud, &parity, &bits, &flow);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册