Skip to content

Commit

Permalink
serial: sh-sci: Kill off per-port enable/disable callbacks.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pmundt committed Jun 28, 2011
1 parent 7f405f9 commit 23241d4
Showing 1 changed file with 32 additions and 47 deletions.
79 changes: 32 additions & 47 deletions drivers/tty/serial/sh-sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ struct sci_port {
/* Platform configuration */
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 */
struct timer_list break_timer;
int break_flag;
Expand Down Expand Up @@ -366,6 +360,29 @@ static int sci_probe_regmap(struct plat_sci_port *cfg)
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)

#ifdef CONFIG_CONSOLE_POLL
Expand Down Expand Up @@ -651,8 +668,7 @@ static void sci_break_timer(unsigned long data)
{
struct sci_port *port = (struct sci_port *)data;

if (port->enable)
port->enable(&port->port);
sci_port_enable(port);

if (sci_rxd_in(&port->port) == 0) {
port->break_flag = 1;
Expand All @@ -664,8 +680,7 @@ static void sci_break_timer(unsigned long data)
} else
port->break_flag = 0;

if (port->disable)
port->disable(&port->port);
sci_port_disable(port);
}

static int sci_handle_errors(struct uart_port *port)
Expand Down Expand Up @@ -939,27 +954,6 @@ static int sci_notifier(struct notifier_block *self,
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)
{
int i;
Expand Down Expand Up @@ -1537,8 +1531,7 @@ static int sci_startup(struct uart_port *port)

dev_dbg(port->dev, "%s(%d)\n", __func__, port->line);

if (s->enable)
s->enable(port);
sci_port_enable(s);

ret = sci_request_irq(s);
if (unlikely(ret < 0))
Expand All @@ -1564,8 +1557,7 @@ static void sci_shutdown(struct uart_port *port)
sci_free_dma(port);
sci_free_irq(s);

if (s->disable)
s->disable(port);
sci_port_disable(s);
}

static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps,
Expand Down Expand Up @@ -1612,8 +1604,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
if (likely(baud && port->uartclk))
t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, port->uartclk);

if (s->enable)
s->enable(port);
sci_port_enable(s);

do {
status = sci_in(port, SCxSR);
Expand Down Expand Up @@ -1683,8 +1674,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
if ((termios->c_cflag & CREAD) != 0)
sci_start_rx(port);

if (s->disable)
s->disable(port);
sci_port_disable(s);
}

static const char *sci_type(struct uart_port *port)
Expand Down Expand Up @@ -1870,8 +1860,6 @@ static int __devinit sci_init_single(struct platform_device *dev,
if (IS_ERR(sci_port->fclk))
sci_port->fclk = NULL;

sci_port->enable = sci_clk_enable;
sci_port->disable = sci_clk_disable;
port->dev = &dev->dev;

pm_runtime_enable(&dev->dev);
Expand Down Expand Up @@ -1950,8 +1938,7 @@ static void serial_console_write(struct console *co, const char *s,
struct uart_port *port = &sci_port->port;
unsigned short bits;

if (sci_port->enable)
sci_port->enable(port);
sci_port_enable(sci_port);

uart_console_write(port, s, count, serial_console_putchar);

Expand All @@ -1960,8 +1947,7 @@ static void serial_console_write(struct console *co, const char *s,
while ((sci_in(port, SCxSR) & bits) != bits)
cpu_relax();

if (sci_port->disable)
sci_port->disable(port);
sci_port_disable(sci_port);
}

static int __devinit serial_console_setup(struct console *co, char *options)
Expand Down Expand Up @@ -1993,8 +1979,7 @@ static int __devinit serial_console_setup(struct console *co, char *options)
if (unlikely(ret != 0))
return ret;

if (sci_port->enable)
sci_port->enable(port);
sci_port_enable(sci_port);

if (options)
uart_parse_options(options, &baud, &parity, &bits, &flow);
Expand Down

0 comments on commit 23241d4

Please sign in to comment.