[PATCH] soc: imx8m: Increase the clock enable before reading the register

Shawn Guo shawnguo at kernel.org
Thu Nov 10 18:46:07 PST 2022


On Fri, Oct 28, 2022 at 12:14:18PM +0800, Xiaolei Wang wrote:
> When executing kdump to start the second kernel,
> since IMX-OCOTP has turned off the clock, the clock
> needs to be re-enabled, otherwise the system will hang.
> 
> Fixes: ac34de14ac30 ("Revert "soc: imx8m: change to use platform driver"")

Are you saying this fixes a regression caused by ac34de14ac30?

Shawn

> Signed-off-by: Xiaolei Wang <xiaolei.wang at windriver.com>
> ---
>  drivers/soc/imx/soc-imx8m.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
> index cc57a384d74d..28144c699b0c 100644
> --- a/drivers/soc/imx/soc-imx8m.c
> +++ b/drivers/soc/imx/soc-imx8m.c
> @@ -11,6 +11,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/arm-smccc.h>
>  #include <linux/of.h>
> +#include <linux/clk.h>
>  
>  #define REV_B1				0x21
>  
> @@ -56,6 +57,7 @@ static u32 __init imx8mq_soc_revision(void)
>  	void __iomem *ocotp_base;
>  	u32 magic;
>  	u32 rev;
> +	struct clk *clk;
>  
>  	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-ocotp");
>  	if (!np)
> @@ -63,6 +65,13 @@ static u32 __init imx8mq_soc_revision(void)
>  
>  	ocotp_base = of_iomap(np, 0);
>  	WARN_ON(!ocotp_base);
> +	clk = of_clk_get_by_name(np, NULL);
> +	if (!clk) {
> +		WARN_ON(!clk);
> +		return 0;
> +	}
> +
> +	clk_prepare_enable(clk);
>  
>  	/*
>  	 * SOC revision on older imx8mq is not available in fuses so query
> @@ -79,6 +88,8 @@ static u32 __init imx8mq_soc_revision(void)
>  	soc_uid <<= 32;
>  	soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW);
>  
> +	clk_disable_unprepare(clk);
> +	clk_put(clk);
>  	iounmap(ocotp_base);
>  	of_node_put(np);
>  
> -- 
> 2.25.1
> 



More information about the linux-arm-kernel mailing list