Commit 69d75a02 authored by Shawn Guo's avatar Shawn Guo

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: default avatarShawn Guo <shawn.guo@linaro.org>
parent 974a9af5
...@@ -322,6 +322,7 @@ pxp@8002a000 { ...@@ -322,6 +322,7 @@ pxp@8002a000 {
}; };
ocotp@8002c000 { ocotp@8002c000 {
compatible = "fsl,ocotp";
reg = <0x8002c000 0x2000>; reg = <0x8002c000 0x2000>;
status = "disabled"; status = "disabled";
}; };
......
...@@ -677,6 +677,7 @@ pxp@8002a000 { ...@@ -677,6 +677,7 @@ pxp@8002a000 {
}; };
ocotp@8002c000 { ocotp@8002c000 {
compatible = "fsl,ocotp";
reg = <0x8002c000 0x2000>; reg = <0x8002c000 0x2000>;
status = "disabled"; status = "disabled";
}; };
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <asm/processor.h> /* for cpu_relax() */ #include <asm/processor.h> /* for cpu_relax() */
...@@ -33,7 +35,8 @@ static u32 ocotp_words[OCOTP_WORD_COUNT]; ...@@ -33,7 +35,8 @@ static u32 ocotp_words[OCOTP_WORD_COUNT];
const u32 *mxs_get_ocotp(void) 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; int timeout = 0x400;
size_t i; size_t i;
static int once = 0; static int once = 0;
...@@ -41,6 +44,10 @@ const u32 *mxs_get_ocotp(void) ...@@ -41,6 +44,10 @@ const u32 *mxs_get_ocotp(void)
if (once) if (once)
return ocotp_words; 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); mutex_lock(&ocotp_mutex);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment