[PATCH 2/8] clk: imx25: retain early UART clocks during kernel init

Lucas Stach l.stach at pengutronix.de
Thu Aug 27 09:39:15 PDT 2015


Make sure to keep UART clocks enabled during kernel init if
earlyprintk or earlycon are active.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
 drivers/clk/imx/clk-imx25.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/clk/imx/clk-imx25.c b/drivers/clk/imx/clk-imx25.c
index ec1a4c1dacf1..4322ef409cc6 100644
--- a/drivers/clk/imx/clk-imx25.c
+++ b/drivers/clk/imx/clk-imx25.c
@@ -86,6 +86,16 @@ enum mx25_clks {
 
 static struct clk *clk[clk_max];
 
+static void __init imx25_uart_disable_cb(void)
+{
+	clk_disable_unprepare(clk[uart_ipg_per]);
+	clk_disable_unprepare(clk[uart1_ipg]);
+	clk_disable_unprepare(clk[uart2_ipg]);
+	clk_disable_unprepare(clk[uart3_ipg]);
+	clk_disable_unprepare(clk[uart4_ipg]);
+	clk_disable_unprepare(clk[uart5_ipg]);
+}
+
 static int __init __mx25_clocks_init(unsigned long osc_rate,
 				     void __iomem *ccm_base)
 {
@@ -233,6 +243,16 @@ static int __init __mx25_clocks_init(unsigned long osc_rate,
 	 */
 	clk_set_parent(clk[cko_sel], clk[ipg]);
 
+	if (imx_clk_keep_uart()) {
+		clk_prepare_enable(clk[uart_ipg_per]);
+		clk_prepare_enable(clk[uart1_ipg]);
+		clk_prepare_enable(clk[uart2_ipg]);
+		clk_prepare_enable(clk[uart3_ipg]);
+		clk_prepare_enable(clk[uart4_ipg]);
+		clk_prepare_enable(clk[uart5_ipg]);
+		imx_clk_set_uart_disable_callback(imx25_uart_disable_cb);
+	}
+
 	return 0;
 }
 
-- 
2.5.0




More information about the linux-arm-kernel mailing list