summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2017-08-21 20:49:44 +0200
committerStefan Agner <stefan.agner@toradex.com>2017-10-02 15:16:53 +0200
commit7b02a99744e495f630bdb5081c516d40e8112685 (patch)
tree2d85e9f65870f658a4fa93d2905a33eb15f96459 /arch
parent4e35498518a41c46fe42b686202475f04a6690ef (diff)
imx: Fix 'Expose SoC unique ID' for newer i.MX6
i.MX6 SL/UL/ULL use a different node in the device tree for with ocotp. So change to the relevant compatible string for these SoCs. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Stefan Agner <stefan.agner@toradex.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/cpu.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index 912b5da548d2..ec0baab1da4a 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -86,24 +86,39 @@ static unsigned long long __init imx_get_soc_uid(void)
void __iomem *ocotp_base;
u64 uid = 0ull;
- if (__mxc_cpu_type == MXC_CPU_IMX6SL || __mxc_cpu_type == MXC_CPU_IMX6DL ||
- __mxc_cpu_type == MXC_CPU_IMX6SX || __mxc_cpu_type == MXC_CPU_IMX6Q ||
- __mxc_cpu_type == MXC_CPU_IMX6UL || __mxc_cpu_type == MXC_CPU_IMX6ULL) {
+ if (__mxc_cpu_type == MXC_CPU_IMX6DL || __mxc_cpu_type == MXC_CPU_IMX6SX ||
+ __mxc_cpu_type == MXC_CPU_IMX6Q) {
np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-ocotp");
+ } else if (__mxc_cpu_type == MXC_CPU_IMX6SL) {
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-ocotp");
+ } else if (__mxc_cpu_type == MXC_CPU_IMX6UL) {
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-ocotp");
+ } else if (__mxc_cpu_type == MXC_CPU_IMX6ULL) {
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx6ull-ocotp");;
} else if (__mxc_cpu_type == MXC_CPU_IMX7D) {
np = of_find_compatible_node(NULL, NULL, "fsl,imx7d-ocotp");
} else {
return uid;
}
+ if (!np) {
+ pr_warn("failed to find ocotp node\n");
+ return uid;
+ }
+
ocotp_base = of_iomap(np, 0);
- WARN_ON(!ocotp_base);
+ if (!ocotp_base) {
+ pr_warn("failed to map ocotp\n");
+ goto put_node;
+ }
uid = readl_relaxed(ocotp_base + 0x420);
uid = (uid << 0x20);
uid |= readl_relaxed(ocotp_base + 0x410);
iounmap(ocotp_base);
+
+put_node:
of_node_put(np);
return uid;