From: Shawn Guo Date: Fri, 29 Mar 2013 01:59:28 +0000 (+0800) Subject: ARM: mxs: get ocotp base address from device tree X-Git-Tag: v3.10-rc1~63^2~11^2~7 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=69d75a02db28c8bb04a4a70b1a577d571fc8e800;p=linux.git ARM: mxs: get ocotp base address from device tree Instead of using the static definitions, get ocotp base address from device tree with mapping. Signed-off-by: Shawn Guo --- diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi index 30b410b2e243..ad2d79324cd3 100644 --- a/arch/arm/boot/dts/imx23.dtsi +++ b/arch/arm/boot/dts/imx23.dtsi @@ -322,6 +322,7 @@ pxp@8002a000 { }; ocotp@8002c000 { + compatible = "fsl,ocotp"; reg = <0x8002c000 0x2000>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index 56d84bf208c7..64af2381c1b0 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi @@ -677,6 +677,7 @@ pxp@8002a000 { }; ocotp@8002c000 { + compatible = "fsl,ocotp"; reg = <0x8002c000 0x2000>; status = "disabled"; }; diff --git a/arch/arm/mach-mxs/ocotp.c b/arch/arm/mach-mxs/ocotp.c index 1dff46703753..c2002eb2655e 100644 --- a/arch/arm/mach-mxs/ocotp.c +++ b/arch/arm/mach-mxs/ocotp.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include /* 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); /*