Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243490
b: refs/heads/master
c: 16f246e
h: refs/heads/master
v: v3
  • Loading branch information
Dinh Nguyen authored and Sascha Hauer committed Mar 23, 2011
1 parent b58330a commit b125622
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 021ebc2da02a7f3107a8f31d8a0ebfbe4175429e
refs/heads/master: 16f246e69b8857c6a2993f1b6663e92d4d4e5395
39 changes: 39 additions & 0 deletions trunk/arch/arm/mach-mx5/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
static int cpu_silicon_rev = -1;

#define IIM_SREV 0x24
#define MX50_HW_ADADIG_DIGPROG 0xB0

static int get_mx51_srev(void)
{
Expand Down Expand Up @@ -127,6 +128,44 @@ int mx53_revision(void)
}
EXPORT_SYMBOL(mx53_revision);

static int get_mx50_srev(void)
{
void __iomem *anatop = ioremap(MX50_ANATOP_BASE_ADDR, SZ_8K);
u32 rev;

if (!anatop) {
cpu_silicon_rev = -EINVAL;
return 0;
}

rev = readl(anatop + MX50_HW_ADADIG_DIGPROG);
rev &= 0xff;

iounmap(anatop);
if (rev == 0x0)
return IMX_CHIP_REVISION_1_0;
else if (rev == 0x1)
return IMX_CHIP_REVISION_1_1;
return 0;
}

/*
* Returns:
* the silicon revision of the cpu
* -EINVAL - not a mx50
*/
int mx50_revision(void)
{
if (!cpu_is_mx50())
return -EINVAL;

if (cpu_silicon_rev == -1)
cpu_silicon_rev = get_mx50_srev();

return cpu_silicon_rev;
}
EXPORT_SYMBOL(mx50_revision);

static int __init post_cpu_init(void)
{
unsigned int reg;
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/arm/plat-mxc/include/mach/mx50.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,8 @@
#define MX50_INT_APBHDMA_CHAN6 116
#define MX50_INT_APBHDMA_CHAN7 117

#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
extern int mx50_revision(void);
#endif

#endif /* ifndef __MACH_MX50_H__ */

0 comments on commit b125622

Please sign in to comment.