2011-03-17 15:40:29 +07: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>
|
2012-09-13 20:18:39 +07:00
|
|
|
|
2012-09-14 13:14:45 +07:00
|
|
|
#include "hardware.h"
|
2012-09-13 20:18:39 +07:00
|
|
|
#include "iim.h"
|
2011-03-17 15:40:29 +07:00
|
|
|
|
2011-08-26 12:35:22 +07:00
|
|
|
static int mx35_cpu_rev = -1;
|
2011-03-17 15:40:29 +07:00
|
|
|
|
2011-08-26 12:35:22 +07:00
|
|
|
static int mx35_read_cpu_rev(void)
|
2011-03-17 15:40:29 +07:00
|
|
|
{
|
|
|
|
u32 rev;
|
|
|
|
|
2016-01-27 23:59:35 +07:00
|
|
|
rev = imx_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
|
2011-03-17 15:40:29 +07:00
|
|
|
switch (rev) {
|
|
|
|
case 0x00:
|
2011-08-26 12:35:22 +07:00
|
|
|
return IMX_CHIP_REVISION_1_0;
|
2011-03-17 15:40:29 +07:00
|
|
|
case 0x10:
|
2011-08-26 12:35:22 +07:00
|
|
|
return IMX_CHIP_REVISION_2_0;
|
2011-03-17 15:40:29 +07:00
|
|
|
case 0x11:
|
2011-08-26 12:35:22 +07:00
|
|
|
return IMX_CHIP_REVISION_2_1;
|
2011-03-17 15:40:29 +07:00
|
|
|
default:
|
2011-08-26 12:35:22 +07:00
|
|
|
return IMX_CHIP_REVISION_UNKNOWN;
|
2011-03-17 15:40:29 +07:00
|
|
|
}
|
2011-08-26 12:35:22 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
int mx35_revision(void)
|
|
|
|
{
|
|
|
|
if (mx35_cpu_rev == -1)
|
|
|
|
mx35_cpu_rev = mx35_read_cpu_rev();
|
2011-03-17 15:40:29 +07:00
|
|
|
|
2011-08-26 12:35:22 +07:00
|
|
|
return mx35_cpu_rev;
|
2011-03-17 15:40:29 +07:00
|
|
|
}
|
2011-08-26 12:35:22 +07:00
|
|
|
EXPORT_SYMBOL(mx35_revision);
|