Skip to content

Commit 9d1e827

Browse files
Nathan RossiShawn Guo
authored andcommitted
soc: imx8m: Enable OCOTP clock for imx8mm before reading registers
Commit 836fb30 ("soc: imx8m: Enable OCOTP clock before reading the register") added configuration to enable the OCOTP clock before attempting to read from the associated registers. This same kexec issue is present with the imx8m SoCs that use the imx8mm_soc_uid function (e.g. imx8mp). This requires the imx8mm_soc_uid function to configure the OCOTP clock before accessing the associated registers. This change implements the same clock enable functionality that is present in the imx8mq_soc_revision function for the imx8mm_soc_uid function. Signed-off-by: Nathan Rossi <nathan.rossi@digi.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Fixes: 836fb30 ("soc: imx8m: Enable OCOTP clock before reading the register") Signed-off-by: Shawn Guo <shawnguo@kernel.org>
1 parent 161af16 commit 9d1e827

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/soc/imx/soc-imx8m.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ static void __init imx8mm_soc_uid(void)
100100
{
101101
void __iomem *ocotp_base;
102102
struct device_node *np;
103+
struct clk *clk;
103104
u32 offset = of_machine_is_compatible("fsl,imx8mp") ?
104105
IMX8MP_OCOTP_UID_OFFSET : 0;
105106

@@ -109,11 +110,20 @@ static void __init imx8mm_soc_uid(void)
109110

110111
ocotp_base = of_iomap(np, 0);
111112
WARN_ON(!ocotp_base);
113+
clk = of_clk_get_by_name(np, NULL);
114+
if (IS_ERR(clk)) {
115+
WARN_ON(IS_ERR(clk));
116+
return;
117+
}
118+
119+
clk_prepare_enable(clk);
112120

113121
soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH + offset);
114122
soc_uid <<= 32;
115123
soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW + offset);
116124

125+
clk_disable_unprepare(clk);
126+
clk_put(clk);
117127
iounmap(ocotp_base);
118128
of_node_put(np);
119129
}

0 commit comments

Comments
 (0)