]>
Commit | Line | Data |
---|---|---|
27ad4bf7 UKK |
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> | |
17c342ae | 13 | |
50f2de61 | 14 | #include "hardware.h" |
17c342ae | 15 | #include "iim.h" |
27ad4bf7 | 16 | |
8d75a262 | 17 | static int mx35_cpu_rev = -1; |
27ad4bf7 | 18 | |
8d75a262 | 19 | static int mx35_read_cpu_rev(void) |
27ad4bf7 UKK |
20 | { |
21 | u32 rev; | |
27ad4bf7 | 22 | |
c553138f | 23 | rev = imx_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV)); |
27ad4bf7 UKK |
24 | switch (rev) { |
25 | case 0x00: | |
8d75a262 | 26 | return IMX_CHIP_REVISION_1_0; |
27ad4bf7 | 27 | case 0x10: |
8d75a262 | 28 | return IMX_CHIP_REVISION_2_0; |
27ad4bf7 | 29 | case 0x11: |
8d75a262 | 30 | return IMX_CHIP_REVISION_2_1; |
27ad4bf7 | 31 | default: |
8d75a262 | 32 | return IMX_CHIP_REVISION_UNKNOWN; |
27ad4bf7 | 33 | } |
8d75a262 JL |
34 | } |
35 | ||
36 | int mx35_revision(void) | |
37 | { | |
38 | if (mx35_cpu_rev == -1) | |
39 | mx35_cpu_rev = mx35_read_cpu_rev(); | |
27ad4bf7 | 40 | |
8d75a262 | 41 | return mx35_cpu_rev; |
27ad4bf7 | 42 | } |
8d75a262 | 43 | EXPORT_SYMBOL(mx35_revision); |