1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * MX25 CPU type detection
6 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved
8 #include <linux/module.h>
11 #include <linux/of_address.h>
16 static int mx25_cpu_rev = -1;
18 static int mx25_read_cpu_rev(void)
21 void __iomem *iim_base;
22 struct device_node *np;
24 np = of_find_compatible_node(NULL, NULL, "fsl,imx25-iim");
25 iim_base = of_iomap(np, 0);
28 rev = readl(iim_base + MXC_IIMSREV);
33 return IMX_CHIP_REVISION_1_0;
35 return IMX_CHIP_REVISION_1_1;
37 return IMX_CHIP_REVISION_1_2;
39 return IMX_CHIP_REVISION_UNKNOWN;
43 int mx25_revision(void)
45 if (mx25_cpu_rev == -1)
46 mx25_cpu_rev = mx25_read_cpu_rev();
50 EXPORT_SYMBOL(mx25_revision);