2019-06-19 07:11:25

by Anson Huang

[permalink] [raw]
Subject: [PATCH 1/2] clk: imx: Remove __init for imx_register_uart_clocks() API

From: Anson Huang <[email protected]>

Some of i.MX SoCs' clock driver use platform driver model,
and they need to call imx_register_uart_clocks() API, so
imx_register_uart_clocks() API should NOT be in .init section.

Signed-off-by: Anson Huang <[email protected]>
---
drivers/clk/imx/clk.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
index f241189..76457b2 100644
--- a/drivers/clk/imx/clk.c
+++ b/drivers/clk/imx/clk.c
@@ -123,8 +123,8 @@ void imx_cscmr1_fixup(u32 *val)
return;
}

-static int imx_keep_uart_clocks __initdata;
-static struct clk ** const *imx_uart_clocks __initdata;
+static int imx_keep_uart_clocks;
+static struct clk ** const *imx_uart_clocks;

static int __init imx_keep_uart_clocks_param(char *str)
{
@@ -137,7 +137,7 @@ __setup_param("earlycon", imx_keep_uart_earlycon,
__setup_param("earlyprintk", imx_keep_uart_earlyprintk,
imx_keep_uart_clocks_param, 0);

-void __init imx_register_uart_clocks(struct clk ** const clks[])
+void imx_register_uart_clocks(struct clk ** const clks[])
{
if (imx_keep_uart_clocks) {
int i;
--
2.7.4


2019-06-19 07:11:29

by Anson Huang

[permalink] [raw]
Subject: [PATCH 2/2] clk: imx8mq: Keep uart clocks on during system boot

From: Anson Huang <[email protected]>

Call imx_register_uart_clocks() API to keep uart clocks enabled
when earlyprintk or earlycon is active.

Signed-off-by: Anson Huang <[email protected]>
---
drivers/clk/imx/clk-imx8mq.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/clk/imx/clk-imx8mq.c b/drivers/clk/imx/clk-imx8mq.c
index 5fbc2a7..d407a07 100644
--- a/drivers/clk/imx/clk-imx8mq.c
+++ b/drivers/clk/imx/clk-imx8mq.c
@@ -272,6 +272,14 @@ static const char * const imx8mq_clko2_sels[] = {"osc_25m", "sys2_pll_200m", "sy

static struct clk_onecell_data clk_data;

+static struct clk ** const uart_clks[] = {
+ &clks[IMX8MQ_CLK_UART1_ROOT],
+ &clks[IMX8MQ_CLK_UART2_ROOT],
+ &clks[IMX8MQ_CLK_UART3_ROOT],
+ &clks[IMX8MQ_CLK_UART4_ROOT],
+ NULL
+};
+
static int imx8mq_clocks_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -555,6 +563,8 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
err = of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
WARN_ON(err);

+ imx_register_uart_clocks(uart_clks);
+
return err;
}

--
2.7.4

2019-06-24 01:45:57

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH 1/2] clk: imx: Remove __init for imx_register_uart_clocks() API

On Wed, Jun 19, 2019 at 03:12:39PM +0800, [email protected] wrote:
> From: Anson Huang <[email protected]>
>
> Some of i.MX SoCs' clock driver use platform driver model,
> and they need to call imx_register_uart_clocks() API, so
> imx_register_uart_clocks() API should NOT be in .init section.
>
> Signed-off-by: Anson Huang <[email protected]>

Applied both, thanks.