aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Getz <rgetz@blackfin.uclinux.org>2008-10-10 06:21:45 -0400
committerBryan Wu <cooloney@kernel.org>2008-10-10 06:21:45 -0400
commite482cad241c0b7108cbc94959307a73d19ba17d5 (patch)
tree7cde7e1af828d74d55ec059d1955c5129b89a892
parent6d0b8c993dc0a26fe7a9ee8b839d1964bd0debd4 (diff)
Blackfin arch: print out error/warning if you are running on the incorrect CPU type
Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org> Signed-off-by: Bryan Wu <cooloney@kernel.org>
-rw-r--r--arch/blackfin/include/asm/processor.h6
-rw-r--r--arch/blackfin/kernel/setup.c43
-rw-r--r--arch/blackfin/mach-bf527/include/mach/bf527.h19
-rw-r--r--arch/blackfin/mach-bf533/include/mach/bf533.h10
-rw-r--r--arch/blackfin/mach-bf537/include/mach/bf537.h10
-rw-r--r--arch/blackfin/mach-bf548/include/mach/bf548.h23
-rw-r--r--arch/blackfin/mach-bf561/include/mach/bf561.h6
7 files changed, 76 insertions, 41 deletions
diff --git a/arch/blackfin/include/asm/processor.h b/arch/blackfin/include/asm/processor.h
index 6f3995b119d8..e3e9b41fa8db 100644
--- a/arch/blackfin/include/asm/processor.h
+++ b/arch/blackfin/include/asm/processor.h
@@ -134,6 +134,12 @@ static inline uint32_t __pure bfin_revid(void)
134 return revid; 134 return revid;
135} 135}
136 136
137static inline uint16_t __pure bfin_cpuid(void)
138{
139 return (bfin_read_CHIPID() & CHIPID_FAMILY) >> 12;
140
141}
142
137static inline uint32_t __pure bfin_compiled_revid(void) 143static inline uint32_t __pure bfin_compiled_revid(void)
138{ 144{
139#if defined(CONFIG_BF_REV_0_0) 145#if defined(CONFIG_BF_REV_0_0)
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 4267523912bd..74370f3707b9 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -813,17 +813,23 @@ void __init setup_arch(char **cmdline_p)
813 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU); 813 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
814 else 814 else
815 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid()); 815 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
816 if (bfin_revid() != bfin_compiled_revid()) { 816
817 if (bfin_compiled_revid() == -1) 817 if (unlikely(CPUID != bfin_cpuid()))
818 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n", 818 printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n",
819 bfin_revid()); 819 CPU, bfin_cpuid(), bfin_revid());
820 else if (bfin_compiled_revid() != 0xffff) 820 else {
821 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n", 821 if (bfin_revid() != bfin_compiled_revid()) {
822 bfin_compiled_revid(), bfin_revid()); 822 if (bfin_compiled_revid() == -1)
823 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
824 bfin_revid());
825 else if (bfin_compiled_revid() != 0xffff)
826 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
827 bfin_compiled_revid(), bfin_revid());
828 }
829 if (bfin_revid() <= CONFIG_BF_REV_MIN || bfin_revid() > CONFIG_BF_REV_MAX)
830 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
831 CPU, bfin_revid());
823 } 832 }
824 if (bfin_revid() <= CONFIG_BF_REV_MIN || bfin_revid() > CONFIG_BF_REV_MAX)
825 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
826 CPU, bfin_revid());
827 833
828 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n"); 834 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
829 835
@@ -997,13 +1003,18 @@ static int show_cpuinfo(struct seq_file *m, void *v)
997 } 1003 }
998 1004
999 seq_printf(m, "processor\t: %d\n" 1005 seq_printf(m, "processor\t: %d\n"
1000 "vendor_id\t: %s\n" 1006 "vendor_id\t: %s\n",
1001 "cpu family\t: 0x%x\n"
1002 "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n"
1003 "stepping\t: %d\n",
1004 *(unsigned int *)v, 1007 *(unsigned int *)v,
1005 vendor, 1008 vendor);
1006 (bfin_read_CHIPID() & CHIPID_FAMILY), 1009
1010 if (CPUID == bfin_cpuid())
1011 seq_printf(m, "cpu family\t: 0x%04x\n", CPUID);
1012 else
1013 seq_printf(m, "cpu family\t: Compiled for:0x%04x, running on:0x%04x\n",
1014 CPUID, bfin_cpuid());
1015
1016 seq_printf(m, "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n"
1017 "stepping\t: %d\n",
1007 cpu, cclk/1000000, sclk/1000000, 1018 cpu, cclk/1000000, sclk/1000000,
1008#ifdef CONFIG_MPU 1019#ifdef CONFIG_MPU
1009 "mpu on", 1020 "mpu on",
diff --git a/arch/blackfin/mach-bf527/include/mach/bf527.h b/arch/blackfin/mach-bf527/include/mach/bf527.h
index 330041fde546..144f08d3f8ea 100644
--- a/arch/blackfin/mach-bf527/include/mach/bf527.h
+++ b/arch/blackfin/mach-bf527/include/mach/bf527.h
@@ -110,16 +110,31 @@
110 110
111#ifdef CONFIG_BF527 111#ifdef CONFIG_BF527
112#define CPU "BF527" 112#define CPU "BF527"
113#define CPUID 0x27e4
114#endif
115#ifdef CONFIG_BF526
116#define CPU "BF526"
117#define CPUID 0x27e4
113#endif 118#endif
114#ifdef CONFIG_BF525 119#ifdef CONFIG_BF525
115#define CPU "BF525" 120#define CPU "BF525"
121#define CPUID 0x27e4
122#endif
123#ifdef CONFIG_BF524
124#define CPU "BF524"
125#define CPUID 0x27e4
126#endif
127#ifdef CONFIG_BF523
128#define CPU "BF523"
129#define CPUID 0x27e4
116#endif 130#endif
117#ifdef CONFIG_BF522 131#ifdef CONFIG_BF522
118#define CPU "BF522" 132#define CPU "BF522"
133#define CPUID 0x27e4
119#endif 134#endif
135
120#ifndef CPU 136#ifndef CPU
121#define CPU "UNKNOWN" 137#error Unknown CPU type - This kernel doesn't seem to be configured properly
122#define CPUID 0x0
123#endif 138#endif
124 139
125#endif /* __MACH_BF527_H__ */ 140#endif /* __MACH_BF527_H__ */
diff --git a/arch/blackfin/mach-bf533/include/mach/bf533.h b/arch/blackfin/mach-bf533/include/mach/bf533.h
index 949801112303..dfc8c1ad2d7a 100644
--- a/arch/blackfin/mach-bf533/include/mach/bf533.h
+++ b/arch/blackfin/mach-bf533/include/mach/bf533.h
@@ -141,19 +141,19 @@
141 141
142#ifdef CONFIG_BF533 142#ifdef CONFIG_BF533
143#define CPU "BF533" 143#define CPU "BF533"
144#define CPUID 0x027a5000 144#define CPUID 0x27a5
145#endif 145#endif
146#ifdef CONFIG_BF532 146#ifdef CONFIG_BF532
147#define CPU "BF532" 147#define CPU "BF532"
148#define CPUID 0x0275A000 148#define CPUID 0x275A
149#endif 149#endif
150#ifdef CONFIG_BF531 150#ifdef CONFIG_BF531
151#define CPU "BF531" 151#define CPU "BF531"
152#define CPUID 0x027a5000 152#define CPUID 0x27a5
153#endif 153#endif
154
154#ifndef CPU 155#ifndef CPU
155#define CPU "UNKNOWN" 156#error Unknown CPU type - This kernel doesn't seem to be configured properly
156#define CPUID 0x0
157#endif 157#endif
158 158
159#endif /* __MACH_BF533_H__ */ 159#endif /* __MACH_BF533_H__ */
diff --git a/arch/blackfin/mach-bf537/include/mach/bf537.h b/arch/blackfin/mach-bf537/include/mach/bf537.h
index 7a047e04e383..24d5c9d42323 100644
--- a/arch/blackfin/mach-bf537/include/mach/bf537.h
+++ b/arch/blackfin/mach-bf537/include/mach/bf537.h
@@ -121,19 +121,19 @@
121 121
122#ifdef CONFIG_BF537 122#ifdef CONFIG_BF537
123#define CPU "BF537" 123#define CPU "BF537"
124#define CPUID 0x027c8000 124#define CPUID 0x27c8
125#endif 125#endif
126#ifdef CONFIG_BF536 126#ifdef CONFIG_BF536
127#define CPU "BF536" 127#define CPU "BF536"
128#define CPUID 0x027c8000 128#define CPUID 0x27c8
129#endif 129#endif
130#ifdef CONFIG_BF534 130#ifdef CONFIG_BF534
131#define CPU "BF534" 131#define CPU "BF534"
132#define CPUID 0x027c6000 132#define CPUID 0x27c6
133#endif 133#endif
134
134#ifndef CPU 135#ifndef CPU
135#define CPU "UNKNOWN" 136#error Unknown CPU type - This kernel doesn't seem to be configured properly
136#define CPUID 0x0
137#endif 137#endif
138 138
139#endif /* __MACH_BF537_H__ */ 139#endif /* __MACH_BF537_H__ */
diff --git a/arch/blackfin/mach-bf548/include/mach/bf548.h b/arch/blackfin/mach-bf548/include/mach/bf548.h
index 14f8a7b84544..49f9b403d458 100644
--- a/arch/blackfin/mach-bf548/include/mach/bf548.h
+++ b/arch/blackfin/mach-bf548/include/mach/bf548.h
@@ -106,20 +106,23 @@
106 106
107#if defined(CONFIG_BF542) 107#if defined(CONFIG_BF542)
108# define CPU "BF542" 108# define CPU "BF542"
109# define CPUID 0x027c8000 109# define CPUID 0x27de
110#elif defined(CONFIG_BF544) 110#elif defined(CONFIG_BF544)
111# define CPU "BF544" 111# define CPU "BF544"
112# define CPUID 0x027c8000 112# define CPUID 0x27de
113#elif defined(CONFIG_BF547) 113#elif defined(CONFIG_BF547)
114# define CPU "BF547" 114# define CPU "BF547"
115# define CPUID 0x27de
115#elif defined(CONFIG_BF548) 116#elif defined(CONFIG_BF548)
116# define CPU "BF548" 117# define CPU "BF548"
117# define CPUID 0x027c6000 118# define CPUID 0x27de
118#elif defined(CONFIG_BF549) 119#elif defined(CONFIG_BF549)
119# define CPU "BF549" 120# define CPU "BF549"
120#else 121# define CPUID 0x27de
121# define CPU "UNKNOWN" 122#endif
122# define CPUID 0x0 123
124#ifndef CPU
125#error Unknown CPU type - This kernel doesn't seem to be configured properly
123#endif 126#endif
124 127
125#endif /* __MACH_BF48_H__ */ 128#endif /* __MACH_BF48_H__ */
diff --git a/arch/blackfin/mach-bf561/include/mach/bf561.h b/arch/blackfin/mach-bf561/include/mach/bf561.h
index 7787caad3555..18b1b3a223ab 100644
--- a/arch/blackfin/mach-bf561/include/mach/bf561.h
+++ b/arch/blackfin/mach-bf561/include/mach/bf561.h
@@ -211,11 +211,11 @@
211 211
212#ifdef CONFIG_BF561 212#ifdef CONFIG_BF561
213#define CPU "BF561" 213#define CPU "BF561"
214#define CPUID 0x027bb000 214#define CPUID 0x27bb
215#endif 215#endif
216
216#ifndef CPU 217#ifndef CPU
217#define CPU "UNKNOWN" 218#error Unknown CPU type - This kernel doesn't seem to be configured properly
218#define CPUID 0x0
219#endif 219#endif
220 220
221#endif /* __MACH_BF561_H__ */ 221#endif /* __MACH_BF561_H__ */