2 * MX25 CPU type detection
4 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
5 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved
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.
12 #include <linux/module.h>
15 #include <linux/of_address.h>
20 static int mx25_cpu_rev
= -1;
22 static int mx25_read_cpu_rev(void)
25 void __iomem
*iim_base
;
26 struct device_node
*np
;
28 np
= of_find_compatible_node(NULL
, NULL
, "fsl,imx25-iim");
29 iim_base
= of_iomap(np
, 0);
31 rev
= readl(iim_base
+ MXC_IIMSREV
);
36 return IMX_CHIP_REVISION_1_0
;
38 return IMX_CHIP_REVISION_1_1
;
40 return IMX_CHIP_REVISION_UNKNOWN
;
44 int mx25_revision(void)
46 if (mx25_cpu_rev
== -1)
47 mx25_cpu_rev
= mx25_read_cpu_rev();
51 EXPORT_SYMBOL(mx25_revision
);