ARM: imx: Init anatop regmap in imx_init_revision_from_anatop
diff mbox series

Message ID 948c912b47f8658e52ab3d65d0ac2fa9f9a4241c.1566499152.git.leonard.crestez@nxp.com
State Superseded
Headers show
Series
  • ARM: imx: Init anatop regmap in imx_init_revision_from_anatop
Related show

Commit Message

Leonard Crestez Aug. 22, 2019, 6:41 p.m. UTC
Restore initialization of the global "anatop" regmap because it's used
from suspend/resume code.

While we're at it use regmap to read digprog as well

Fixes: c901cfe5ada0 ("ARM: imx: Drop imx_anatop_init()")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>

---
This should be squashed into c901cfe5ada0

 arch/arm/mach-imx/anatop.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c
index f2c9fe14198a..7f2246b44c53 100644
--- a/arch/arm/mach-imx/anatop.c
+++ b/arch/arm/mach-imx/anatop.c
@@ -93,25 +93,25 @@  void imx_anatop_post_resume(void)
 }
 
 void __init imx_init_revision_from_anatop(void)
 {
 	struct device_node *np;
-	void __iomem *anatop_base;
 	unsigned int revision;
 	u32 digprog;
 	u16 offset = ANADIG_DIGPROG;
 	u8 major_part, minor_part;
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
-	anatop_base = of_iomap(np, 0);
-	WARN_ON(!anatop_base);
+	WARN_ON(!np);
+	anatop = syscon_regmap_lookup_by_compatible("fsl,imx6q-anatop");
+	WARN_ON(!IS_ERR_OR_NULL(anatop));
+
 	if (of_device_is_compatible(np, "fsl,imx6sl-anatop"))
 		offset = ANADIG_DIGPROG_IMX6SL;
 	if (of_device_is_compatible(np, "fsl,imx7d-anatop"))
 		offset = ANADIG_DIGPROG_IMX7D;
-	digprog = readl_relaxed(anatop_base + offset);
-	iounmap(anatop_base);
+	regmap_read(anatop, offset, &digprog);
 
 	/*
 	 * On i.MX7D digprog value match linux version format, so
 	 * it needn't map again and we can use register value directly.
 	 */