2 * PXA CPU information display
4 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #include <linux/compiler.h>
27 #define CPU_MASK_PXA_REVID 0x00f
29 #define CPU_MASK_PXA_PRODID 0x3f0
30 #define CPU_VALUE_PXA25X 0x100
31 #define CPU_VALUE_PXA27X 0x110
33 static uint32_t pxa_get_cpuid(void)
36 asm volatile("mrc p15, 0, %0, c0, c0, 0" : "=r"(cpuid));
40 int cpu_is_pxa25x(void)
42 uint32_t id = pxa_get_cpuid();
43 id &= CPU_MASK_PXA_PRODID;
44 return id == CPU_VALUE_PXA25X;
47 int cpu_is_pxa27x(void)
49 uint32_t id = pxa_get_cpuid();
50 id &= CPU_MASK_PXA_PRODID;
51 return id == CPU_VALUE_PXA27X;
54 #ifdef CONFIG_DISPLAY_CPUINFO
55 static const char *pxa25x_get_revision(void)
57 static __maybe_unused const char * const revs_25x[] = { "A0" };
58 static __maybe_unused const char * const revs_26x[] = {
61 static const char *unknown = "Unknown";
67 id = pxa_get_cpuid() & CPU_MASK_PXA_REVID;
69 /* PXA26x is a sick special case as it can't be told apart from PXA25x :-( */
70 #ifdef CONFIG_CPU_PXA26X
72 case 3: return revs_26x[0];
73 case 5: return revs_26x[1];
74 case 6: return revs_26x[2];
83 static const char *pxa27x_get_revision(void)
85 static const char *const rev[] = { "A0", "A1", "B0", "B1", "C0", "C5" };
86 static const char *unknown = "Unknown";
92 id = pxa_get_cpuid() & CPU_MASK_PXA_REVID;
94 if ((id == 5) || (id == 6) || (id > 7))
97 /* Cap the special PXA270 C5 case. */
104 static int print_cpuinfo_pxa2xx(void)
106 if (cpu_is_pxa25x()) {
107 puts("Marvell PXA25x rev. ");
108 puts(pxa25x_get_revision());
109 } else if (cpu_is_pxa27x()) {
110 puts("Marvell PXA27x rev. ");
111 puts(pxa27x_get_revision());
120 int print_cpuinfo(void)
126 ret = print_cpuinfo_pxa2xx();