blob: 96ec64b5ff7d3e056ddfdea0f3918278732ea0c1 [file] [log] [blame]
Jason Liud27536c2011-08-26 13:35:19 +08001/*
2 * MX25 CPU type detection
3 *
4 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
5 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12#include <linux/module.h>
13#include <linux/io.h>
Shawn Guo17c342a2012-09-13 21:18:39 +080014
15#include "iim.h"
Shawn Guo50f2de62012-09-14 14:14:45 +080016#include "hardware.h"
Jason Liud27536c2011-08-26 13:35:19 +080017
18static int mx25_cpu_rev = -1;
19
20static int mx25_read_cpu_rev(void)
21{
22 u32 rev;
23
24 rev = __raw_readl(MX25_IO_ADDRESS(MX25_IIM_BASE_ADDR + MXC_IIMSREV));
25 switch (rev) {
26 case 0x00:
27 return IMX_CHIP_REVISION_1_0;
28 case 0x01:
29 return IMX_CHIP_REVISION_1_1;
30 default:
31 return IMX_CHIP_REVISION_UNKNOWN;
32 }
33}
34
35int mx25_revision(void)
36{
37 if (mx25_cpu_rev == -1)
38 mx25_cpu_rev = mx25_read_cpu_rev();
39
40 return mx25_cpu_rev;
41}
42EXPORT_SYMBOL(mx25_revision);