1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * MX35 CPU type detection
5 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
7 #include <linux/module.h>
8 #include <linux/of_address.h>
14 static int mx35_cpu_rev
= -1;
16 static int mx35_read_cpu_rev(void)
18 void __iomem
*iim_base
;
19 struct device_node
*np
;
22 np
= of_find_compatible_node(NULL
, NULL
, "fsl,imx35-iim");
23 iim_base
= of_iomap(np
, 0);
27 rev
= imx_readl(iim_base
+ MXC_IIMSREV
);
30 return IMX_CHIP_REVISION_1_0
;
32 return IMX_CHIP_REVISION_2_0
;
34 return IMX_CHIP_REVISION_2_1
;
36 return IMX_CHIP_REVISION_UNKNOWN
;
40 int mx35_revision(void)
42 if (mx35_cpu_rev
== -1)
43 mx35_cpu_rev
= mx35_read_cpu_rev();
47 EXPORT_SYMBOL(mx35_revision
);