aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQipan Li <Qipan.Li@csr.com>2014-01-03 02:44:07 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-07 20:09:04 -0500
commit388faf9ffdaf92c81243514a2dd4c6ce04d28874 (patch)
tree30369709d7115a7d53663a66a25674e06ce032f8
parent99e626f50477e3b14c9be43892c33ab75b2e5bf9 (diff)
serial: sirf: provide pm entries of uart_ops
this patch provides PM entry of uart_ops, then drop clk enable and disable because serial core will do it. the patch also fixes the issue that uart hang in resume caused by not-enabled clock. Signed-off-by: Qipan Li <Qipan.Li@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/sirfsoc_uart.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c
index 6fea79b96bb9..a6c38ab1eeb2 100644
--- a/drivers/tty/serial/sirfsoc_uart.c
+++ b/drivers/tty/serial/sirfsoc_uart.c
@@ -1033,6 +1033,16 @@ static void sirfsoc_uart_set_termios(struct uart_port *port,
1033 spin_unlock_irqrestore(&port->lock, flags); 1033 spin_unlock_irqrestore(&port->lock, flags);
1034} 1034}
1035 1035
1036static void sirfsoc_uart_pm(struct uart_port *port, unsigned int state,
1037 unsigned int oldstate)
1038{
1039 struct sirfsoc_uart_port *sirfport = to_sirfport(port);
1040 if (!state)
1041 clk_prepare_enable(sirfport->clk);
1042 else
1043 clk_disable_unprepare(sirfport->clk);
1044}
1045
1036static unsigned int sirfsoc_uart_init_tx_dma(struct uart_port *port) 1046static unsigned int sirfsoc_uart_init_tx_dma(struct uart_port *port)
1037{ 1047{
1038 struct sirfsoc_uart_port *sirfport = to_sirfport(port); 1048 struct sirfsoc_uart_port *sirfport = to_sirfport(port);
@@ -1264,6 +1274,7 @@ static struct uart_ops sirfsoc_uart_ops = {
1264 .startup = sirfsoc_uart_startup, 1274 .startup = sirfsoc_uart_startup,
1265 .shutdown = sirfsoc_uart_shutdown, 1275 .shutdown = sirfsoc_uart_shutdown,
1266 .set_termios = sirfsoc_uart_set_termios, 1276 .set_termios = sirfsoc_uart_set_termios,
1277 .pm = sirfsoc_uart_pm,
1267 .type = sirfsoc_uart_type, 1278 .type = sirfsoc_uart_type,
1268 .release_port = sirfsoc_uart_release_port, 1279 .release_port = sirfsoc_uart_release_port,
1269 .request_port = sirfsoc_uart_request_port, 1280 .request_port = sirfsoc_uart_request_port,
@@ -1486,7 +1497,6 @@ usp_no_flow_control:
1486 ret = PTR_ERR(sirfport->clk); 1497 ret = PTR_ERR(sirfport->clk);
1487 goto err; 1498 goto err;
1488 } 1499 }
1489 clk_prepare_enable(sirfport->clk);
1490 port->uartclk = clk_get_rate(sirfport->clk); 1500 port->uartclk = clk_get_rate(sirfport->clk);
1491 1501
1492 port->ops = &sirfsoc_uart_ops; 1502 port->ops = &sirfsoc_uart_ops;
@@ -1502,7 +1512,6 @@ usp_no_flow_control:
1502 return 0; 1512 return 0;
1503 1513
1504port_err: 1514port_err:
1505 clk_disable_unprepare(sirfport->clk);
1506 clk_put(sirfport->clk); 1515 clk_put(sirfport->clk);
1507err: 1516err:
1508 return ret; 1517 return ret;
@@ -1512,7 +1521,6 @@ static int sirfsoc_uart_remove(struct platform_device *pdev)
1512{ 1521{
1513 struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev); 1522 struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev);
1514 struct uart_port *port = &sirfport->port; 1523 struct uart_port *port = &sirfport->port;
1515 clk_disable_unprepare(sirfport->clk);
1516 clk_put(sirfport->clk); 1524 clk_put(sirfport->clk);
1517 uart_remove_one_port(&sirfsoc_uart_drv, port); 1525 uart_remove_one_port(&sirfsoc_uart_drv, port);
1518 return 0; 1526 return 0;