]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ARM: imx31: Retrieve the IIM base address from devicetree
authorFabio Estevam <festevam@gmail.com>
Thu, 17 Sep 2020 00:41:17 +0000 (21:41 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Feb 2023 06:52:35 +0000 (07:52 +0100)
[ Upstream commit 7f6832889d2c85677e995fb339df51405da29744 ]

Now that imx31 has been converted to a devicetree-only platform,
retrieve the IIM base address from devicetree.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Stable-dep-of: 87b30c4b0efb ("ARM: imx: add missing of_node_put()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/mach-imx/cpu-imx31.c

index 3ee684b71006f24c37a72911a5dd571665ebb29d..b9c24b851d1abd1fd18a7e30199b048335addc85 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/of_address.h>
 #include <linux/io.h>
 
 #include "common.h"
@@ -32,10 +33,16 @@ static struct {
 
 static int mx31_read_cpu_rev(void)
 {
+       void __iomem *iim_base;
+       struct device_node *np;
        u32 i, srev;
 
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx31-iim");
+       iim_base = of_iomap(np, 0);
+       BUG_ON(!iim_base);
+
        /* read SREV register from IIM module */
-       srev = imx_readl(MX31_IO_ADDRESS(MX31_IIM_BASE_ADDR + MXC_IIMSREV));
+       srev = imx_readl(iim_base + MXC_IIMSREV);
        srev &= 0xff;
 
        for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++)