Skip to content

Commit

Permalink
ARM: mxs: get ocotp base address from device tree
Browse files Browse the repository at this point in the history
Instead of using the static definitions, get ocotp base address from
device tree with mapping.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
  • Loading branch information
Shawn Guo committed Apr 1, 2013
1 parent 974a9af commit 69d75a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/arm/boot/dts/imx23.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@
};

ocotp@8002c000 {
compatible = "fsl,ocotp";
reg = <0x8002c000 0x2000>;
status = "disabled";
};
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/imx28.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@
};

ocotp@8002c000 {
compatible = "fsl,ocotp";
reg = <0x8002c000 0x2000>;
status = "disabled";
};
Expand Down
9 changes: 8 additions & 1 deletion arch/arm/mach-mxs/ocotp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() */

Expand All @@ -33,14 +35,19 @@ 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;

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);

/*
Expand Down

0 comments on commit 69d75a0

Please sign in to comment.