xref: /openbmc/linux/arch/arm/mach-imx/cpu-imx35.c (revision c67e8ec0)
1 /*
2  * MX35 CPU type detection
3  *
4  * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  */
11 #include <linux/module.h>
12 #include <linux/io.h>
13 
14 #include "hardware.h"
15 #include "iim.h"
16 
17 static int mx35_cpu_rev = -1;
18 
19 static int mx35_read_cpu_rev(void)
20 {
21 	u32 rev;
22 
23 	rev = imx_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
24 	switch (rev) {
25 	case 0x00:
26 		return IMX_CHIP_REVISION_1_0;
27 	case 0x10:
28 		return IMX_CHIP_REVISION_2_0;
29 	case 0x11:
30 		return IMX_CHIP_REVISION_2_1;
31 	default:
32 		return IMX_CHIP_REVISION_UNKNOWN;
33 	}
34 }
35 
36 int mx35_revision(void)
37 {
38 	if (mx35_cpu_rev == -1)
39 		mx35_cpu_rev = mx35_read_cpu_rev();
40 
41 	return mx35_cpu_rev;
42 }
43 EXPORT_SYMBOL(mx35_revision);
44