aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorHuang Shijie <b32955@freescale.com>2013-06-03 21:59:33 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-06 16:05:38 -0400
commit28eb4274e7ec3ddba6711e3d13e374046b3c2230 (patch)
treec72d2e58524ba3d6bc065cdc4caccce085c3ef11 /drivers/tty
parente943f58ea84a80cc88dfceb6a5ed788d0ba24a1e (diff)
serial: imx: enable the clocks only when the uart is used
Current code opens the clocks when the uart driver is probed. This will wastes some power if several uarts are enabled, but not really used. So close these clocks for uart, and enable the clocks only when the uart is used. Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/imx.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 381a2d79593c..831324a9745b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -700,6 +700,14 @@ static int imx_startup(struct uart_port *port)
700 int retval; 700 int retval;
701 unsigned long flags, temp; 701 unsigned long flags, temp;
702 702
703 retval = clk_prepare_enable(sport->clk_per);
704 if (retval)
705 goto error_out1;
706
707 retval = clk_prepare_enable(sport->clk_ipg);
708 if (retval)
709 goto error_out1;
710
703 imx_setup_ufcr(sport, 0); 711 imx_setup_ufcr(sport, 0);
704 712
705 /* disable the DREN bit (Data Ready interrupt enable) before 713 /* disable the DREN bit (Data Ready interrupt enable) before
@@ -885,6 +893,9 @@ static void imx_shutdown(struct uart_port *port)
885 893
886 writel(temp, sport->port.membase + UCR1); 894 writel(temp, sport->port.membase + UCR1);
887 spin_unlock_irqrestore(&sport->port.lock, flags); 895 spin_unlock_irqrestore(&sport->port.lock, flags);
896
897 clk_disable_unprepare(sport->clk_per);
898 clk_disable_unprepare(sport->clk_ipg);
888} 899}
889 900
890static void 901static void
@@ -1563,6 +1574,9 @@ static int serial_imx_probe(struct platform_device *pdev)
1563 goto deinit; 1574 goto deinit;
1564 platform_set_drvdata(pdev, sport); 1575 platform_set_drvdata(pdev, sport);
1565 1576
1577 clk_disable_unprepare(sport->clk_per);
1578 clk_disable_unprepare(sport->clk_ipg);
1579
1566 return 0; 1580 return 0;
1567deinit: 1581deinit:
1568 if (pdata && pdata->exit) 1582 if (pdata && pdata->exit)
@@ -1584,9 +1598,6 @@ static int serial_imx_remove(struct platform_device *pdev)
1584 1598
1585 uart_remove_one_port(&imx_reg, &sport->port); 1599 uart_remove_one_port(&imx_reg, &sport->port);
1586 1600
1587 clk_disable_unprepare(sport->clk_per);
1588 clk_disable_unprepare(sport->clk_ipg);
1589
1590 if (pdata && pdata->exit) 1601 if (pdata && pdata->exit)
1591 pdata->exit(pdev); 1602 pdata->exit(pdev);
1592 1603