Linux Audio

Check our new training course

Loading...
v3.5.6
 1/*
 2 * MX35 CPU type detection
 3 *
 4 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
 5 *
 6 * This program is free software; you can redistribute it and/or modify
 7 * it under the terms of the GNU General Public License as published by
 8 * the Free Software Foundation; either version 2 of the License, or
 9 * (at your option) any later version.
10 */
11#include <linux/module.h>
12#include <linux/io.h>
13#include <mach/hardware.h>
14#include <mach/iim.h>
15
16static int mx35_cpu_rev = -1;
 
17
18static int mx35_read_cpu_rev(void)
19{
20	u32 rev;
 
21
22	rev = __raw_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
23	switch (rev) {
24	case 0x00:
25		return IMX_CHIP_REVISION_1_0;
 
 
26	case 0x10:
27		return IMX_CHIP_REVISION_2_0;
 
 
28	case 0x11:
29		return IMX_CHIP_REVISION_2_1;
 
 
30	default:
31		return IMX_CHIP_REVISION_UNKNOWN;
 
32	}
33}
34
35int mx35_revision(void)
36{
37	if (mx35_cpu_rev == -1)
38		mx35_cpu_rev = mx35_read_cpu_rev();
39
40	return mx35_cpu_rev;
41}
42EXPORT_SYMBOL(mx35_revision);
v3.1
 1/*
 2 * MX35 CPU type detection
 3 *
 4 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
 5 *
 6 * This program is free software; you can redistribute it and/or modify
 7 * it under the terms of the GNU General Public License as published by
 8 * the Free Software Foundation; either version 2 of the License, or
 9 * (at your option) any later version.
10 */
11#include <linux/module.h>
12#include <linux/io.h>
13#include <mach/hardware.h>
14#include <mach/iim.h>
15
16unsigned int mx35_cpu_rev;
17EXPORT_SYMBOL(mx35_cpu_rev);
18
19void __init mx35_read_cpu_rev(void)
20{
21	u32 rev;
22	char *srev;
23
24	rev = __raw_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
25	switch (rev) {
26	case 0x00:
27		mx35_cpu_rev = IMX_CHIP_REVISION_1_0;
28		srev = "1.0";
29		break;
30	case 0x10:
31		mx35_cpu_rev = IMX_CHIP_REVISION_2_0;
32		srev = "2.0";
33		break;
34	case 0x11:
35		mx35_cpu_rev = IMX_CHIP_REVISION_2_1;
36		srev = "2.1";
37		break;
38	default:
39		mx35_cpu_rev = IMX_CHIP_REVISION_UNKNOWN;
40		srev = "unknown";
41	}
 
 
 
 
 
 
42
43	printk(KERN_INFO "CPU identified as i.MX35, silicon rev %s\n", srev);
44}