Skip to content

Commit 836fb30

Browse files
xiaoleiwang123456Shawn Guo
authored andcommitted
soc: imx8m: Enable OCOTP clock before reading the register
Commit 7d98140 ("soc: imx8m: change to use platform driver") ever removed the dependency on bootloader for enabling OCOTP clock. It helped to fix a kexec kernel hang issue. But unfortunately it caused a regression on CAAM driver and got reverted. This is the second try to enable the OCOTP clock by directly calling clock API instead of indirectly enabling the clock via nvmem API. Fixes: ac34de1 ("Revert "soc: imx8m: change to use platform driver"") Signed-off-by: Xiaolei Wang <[email protected]> Reviewed-by: Lucas Stach <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent 2db1fdb commit 836fb30

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/soc/imx/soc-imx8m.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/platform_device.h>
1212
#include <linux/arm-smccc.h>
1313
#include <linux/of.h>
14+
#include <linux/clk.h>
1415

1516
#define REV_B1 0x21
1617

@@ -56,13 +57,21 @@ static u32 __init imx8mq_soc_revision(void)
5657
void __iomem *ocotp_base;
5758
u32 magic;
5859
u32 rev;
60+
struct clk *clk;
5961

6062
np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-ocotp");
6163
if (!np)
6264
return 0;
6365

6466
ocotp_base = of_iomap(np, 0);
6567
WARN_ON(!ocotp_base);
68+
clk = of_clk_get_by_name(np, NULL);
69+
if (!clk) {
70+
WARN_ON(!clk);
71+
return 0;
72+
}
73+
74+
clk_prepare_enable(clk);
6675

6776
/*
6877
* SOC revision on older imx8mq is not available in fuses so query
@@ -79,6 +88,8 @@ static u32 __init imx8mq_soc_revision(void)
7988
soc_uid <<= 32;
8089
soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW);
8190

91+
clk_disable_unprepare(clk);
92+
clk_put(clk);
8293
iounmap(ocotp_base);
8394
of_node_put(np);
8495

0 commit comments

Comments
 (0)