diff options
author | Eduardo Valentin <edubezval@gmail.com> | 2015-08-11 13:21:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-08-14 20:23:25 -0400 |
commit | 9e7b399d6528eac33a6fbfceb2b92af209c3454d (patch) | |
tree | 0d6a624fd74f7312c44ded789a8523c8e0235e05 | |
parent | eafb9eea7622d765effb1a06f8cf5eb31fa018f6 (diff) |
serial: imx: remove unbalanced clk_prepare
The current code attempts to prepare clk_per and clk_ipg
before using the device. However, the result is an extra
prepare call on each clock. Here is the output of uart
clocks (only uart enabled and used as console):
$ grep uart /sys/kernel/debug/clk/clk_summary
uart_serial 1 2 80000000 0 0
uart 1 2 66000000 0 0
This patch balances the calls of prepares. The result is:
$ grep uart /sys/kernel/debug/clk/clk_summary
uart_serial 1 1 80000000 0 0
uart 1 1 66000000 0 0
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/imx.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 9a248eb11308..b27c23256a51 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -1630,12 +1630,12 @@ imx_console_write(struct console *co, const char *s, unsigned int count) | |||
1630 | int locked = 1; | 1630 | int locked = 1; |
1631 | int retval; | 1631 | int retval; |
1632 | 1632 | ||
1633 | retval = clk_enable(sport->clk_per); | 1633 | retval = clk_prepare_enable(sport->clk_per); |
1634 | if (retval) | 1634 | if (retval) |
1635 | return; | 1635 | return; |
1636 | retval = clk_enable(sport->clk_ipg); | 1636 | retval = clk_prepare_enable(sport->clk_ipg); |
1637 | if (retval) { | 1637 | if (retval) { |
1638 | clk_disable(sport->clk_per); | 1638 | clk_disable_unprepare(sport->clk_per); |
1639 | return; | 1639 | return; |
1640 | } | 1640 | } |
1641 | 1641 | ||
@@ -1674,8 +1674,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count) | |||
1674 | if (locked) | 1674 | if (locked) |
1675 | spin_unlock_irqrestore(&sport->port.lock, flags); | 1675 | spin_unlock_irqrestore(&sport->port.lock, flags); |
1676 | 1676 | ||
1677 | clk_disable(sport->clk_ipg); | 1677 | clk_disable_unprepare(sport->clk_ipg); |
1678 | clk_disable(sport->clk_per); | 1678 | clk_disable_unprepare(sport->clk_per); |
1679 | } | 1679 | } |
1680 | 1680 | ||
1681 | /* | 1681 | /* |
@@ -1776,15 +1776,7 @@ imx_console_setup(struct console *co, char *options) | |||
1776 | 1776 | ||
1777 | retval = uart_set_options(&sport->port, co, baud, parity, bits, flow); | 1777 | retval = uart_set_options(&sport->port, co, baud, parity, bits, flow); |
1778 | 1778 | ||
1779 | clk_disable(sport->clk_ipg); | 1779 | clk_disable_unprepare(sport->clk_ipg); |
1780 | if (retval) { | ||
1781 | clk_unprepare(sport->clk_ipg); | ||
1782 | goto error_console; | ||
1783 | } | ||
1784 | |||
1785 | retval = clk_prepare(sport->clk_per); | ||
1786 | if (retval) | ||
1787 | clk_disable_unprepare(sport->clk_ipg); | ||
1788 | 1780 | ||
1789 | error_console: | 1781 | error_console: |
1790 | return retval; | 1782 | return retval; |