2011-03-17 09:40:29 +01:00
|
|
|
/*
|
|
|
|
* MX35 CPU type detection
|
|
|
|
*
|
|
|
|
* Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <mach/hardware.h>
|
|
|
|
#include <mach/iim.h>
|
|
|
|
|
2011-08-26 07:35:22 +02:00
|
|
|
static int mx35_cpu_rev = -1;
|
2011-03-17 09:40:29 +01:00
|
|
|
|
2011-08-26 07:35:22 +02:00
|
|
|
static int mx35_read_cpu_rev(void)
|
2011-03-17 09:40:29 +01:00
|
|
|
{
|
|
|
|
u32 rev;
|
|
|
|
|
|
|
|
rev = __raw_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
|
|
|
|
switch (rev) {
|
|
|
|
case 0x00:
|
2011-08-26 07:35:22 +02:00
|
|
|
return IMX_CHIP_REVISION_1_0;
|
2011-03-17 09:40:29 +01:00
|
|
|
case 0x10:
|
2011-08-26 07:35:22 +02:00
|
|
|
return IMX_CHIP_REVISION_2_0;
|
2011-03-17 09:40:29 +01:00
|
|
|
case 0x11:
|
2011-08-26 07:35:22 +02:00
|
|
|
return IMX_CHIP_REVISION_2_1;
|
2011-03-17 09:40:29 +01:00
|
|
|
default:
|
2011-08-26 07:35:22 +02:00
|
|
|
return IMX_CHIP_REVISION_UNKNOWN;
|
2011-03-17 09:40:29 +01:00
|
|
|
}
|
2011-08-26 07:35:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int mx35_revision(void)
|
|
|
|
{
|
|
|
|
if (mx35_cpu_rev == -1)
|
|
|
|
mx35_cpu_rev = mx35_read_cpu_rev();
|
2011-03-17 09:40:29 +01:00
|
|
|
|
2011-08-26 07:35:22 +02:00
|
|
|
return mx35_cpu_rev;
|
2011-03-17 09:40:29 +01:00
|
|
|
}
|
2011-08-26 07:35:22 +02:00
|
|
|
EXPORT_SYMBOL(mx35_revision);
|