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

Now that imx35 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-imx35.c

index ebb3cdabd50685f1c6d3283003f2d69b8d32ee4b..80e7d8ab9f1bb81ad4a70fb8805a45bb170ff01f 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
  */
 #include <linux/module.h>
+#include <linux/of_address.h>
 #include <linux/io.h>
 
 #include "hardware.h"
@@ -14,9 +15,15 @@ static int mx35_cpu_rev = -1;
 
 static int mx35_read_cpu_rev(void)
 {
+       void __iomem *iim_base;
+       struct device_node *np;
        u32 rev;
 
-       rev = imx_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx35-iim");
+       iim_base = of_iomap(np, 0);
+       BUG_ON(!iim_base);
+
+       rev = imx_readl(iim_base + MXC_IIMSREV);
        switch (rev) {
        case 0x00:
                return IMX_CHIP_REVISION_1_0;