Linux 5.7.6
[linux/fpc-iii.git] / arch / arm / mach-imx / cpu-imx35.c
blobebb3cdabd50685f1c6d3283003f2d69b8d32ee4b
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * MX35 CPU type detection
5 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
6 */
7 #include <linux/module.h>
8 #include <linux/io.h>
10 #include "hardware.h"
11 #include "iim.h"
13 static int mx35_cpu_rev = -1;
15 static int mx35_read_cpu_rev(void)
17 u32 rev;
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;
32 int mx35_revision(void)
34 if (mx35_cpu_rev == -1)
35 mx35_cpu_rev = mx35_read_cpu_rev();
37 return mx35_cpu_rev;
39 EXPORT_SYMBOL(mx35_revision);