提交 28eb4274 编写于 作者: H Huang Shijie 提交者: Greg Kroah-Hartman

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: NHuang Shijie <b32955@freescale.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 e943f58e
......@@ -700,6 +700,14 @@ static int imx_startup(struct uart_port *port)
int retval;
unsigned long flags, temp;
retval = clk_prepare_enable(sport->clk_per);
if (retval)
goto error_out1;
retval = clk_prepare_enable(sport->clk_ipg);
if (retval)
goto error_out1;
imx_setup_ufcr(sport, 0);
/* disable the DREN bit (Data Ready interrupt enable) before
......@@ -885,6 +893,9 @@ static void imx_shutdown(struct uart_port *port)
writel(temp, sport->port.membase + UCR1);
spin_unlock_irqrestore(&sport->port.lock, flags);
clk_disable_unprepare(sport->clk_per);
clk_disable_unprepare(sport->clk_ipg);
}
static void
......@@ -1563,6 +1574,9 @@ static int serial_imx_probe(struct platform_device *pdev)
goto deinit;
platform_set_drvdata(pdev, sport);
clk_disable_unprepare(sport->clk_per);
clk_disable_unprepare(sport->clk_ipg);
return 0;
deinit:
if (pdata && pdata->exit)
......@@ -1584,9 +1598,6 @@ static int serial_imx_remove(struct platform_device *pdev)
uart_remove_one_port(&imx_reg, &sport->port);
clk_disable_unprepare(sport->clk_per);
clk_disable_unprepare(sport->clk_ipg);
if (pdata && pdata->exit)
pdata->exit(pdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册