xref: /openbmc/linux/arch/arm/mach-imx/cpu-imx35.c (revision 7a2eb736)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * MX35 CPU type detection
4  *
5  * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
6  */
7 #include <linux/module.h>
8 #include <linux/io.h>
9 
10 #include "hardware.h"
11 #include "iim.h"
12 
13 static int mx35_cpu_rev = -1;
14 
15 static int mx35_read_cpu_rev(void)
16 {
17 	u32 rev;
18 
19 	rev = imx_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
20 	switch (rev) {
21 	case 0x00:
22 		return IMX_CHIP_REVISION_1_0;
23 	case 0x10:
24 		return IMX_CHIP_REVISION_2_0;
25 	case 0x11:
26 		return IMX_CHIP_REVISION_2_1;
27 	default:
28 		return IMX_CHIP_REVISION_UNKNOWN;
29 	}
30 }
31 
32 int mx35_revision(void)
33 {
34 	if (mx35_cpu_rev == -1)
35 		mx35_cpu_rev = mx35_read_cpu_rev();
36 
37 	return mx35_cpu_rev;
38 }
39 EXPORT_SYMBOL(mx35_revision);
40