ARM: mxs: get ocotp base address from device tree
authorShawn Guo <shawn.guo@linaro.org>
Fri, 29 Mar 2013 01:59:28 +0000 (09:59 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Mon, 1 Apr 2013 12:42:16 +0000 (20:42 +0800)
Instead of using the static definitions, get ocotp base address from
device tree with mapping.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
arch/arm/boot/dts/imx23.dtsi
arch/arm/boot/dts/imx28.dtsi
arch/arm/mach-mxs/ocotp.c

index 30b410b2e2433b366295a7f32ab24932c862361f..ad2d79324cd36bfa9aced19a9ef227c0e3599971 100644 (file)
                        };
 
                        ocotp@8002c000 {
+                               compatible = "fsl,ocotp";
                                reg = <0x8002c000 0x2000>;
                                status = "disabled";
                        };
index 56d84bf208c763f4f9eacc33ce7e764ec3fd74cb..64af2381c1b0cc43a87f2fccca21ca454f036917 100644 (file)
                        };
 
                        ocotp@8002c000 {
+                               compatible = "fsl,ocotp";
                                reg = <0x8002c000 0x2000>;
                                status = "disabled";
                        };
index 1dff46703753f67e96a3efd2a62a29966aba8b71..c2002eb2655e716d7c53ecbc0e8b0930b56c651b 100644 (file)
@@ -15,6 +15,8 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 
 #include <asm/processor.h>     /* for cpu_relax() */
 
@@ -33,7 +35,8 @@ static u32 ocotp_words[OCOTP_WORD_COUNT];
 
 const u32 *mxs_get_ocotp(void)
 {
-       void __iomem *ocotp_base = MXS_IO_ADDRESS(MXS_OCOTP_BASE_ADDR);
+       struct device_node *np;
+       void __iomem *ocotp_base;
        int timeout = 0x400;
        size_t i;
        static int once = 0;
@@ -41,6 +44,10 @@ const u32 *mxs_get_ocotp(void)
        if (once)
                return ocotp_words;
 
+       np = of_find_compatible_node(NULL, NULL, "fsl,ocotp");
+       ocotp_base = of_iomap(np, 0);
+       WARN_ON(!ocotp_base);
+
        mutex_lock(&ocotp_mutex);
 
        /*