Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[pandora-kernel.git] / arch / cris / arch-v32 / kernel / setup.c
1 /*
2  * Display CPU info in /proc/cpuinfo.
3  *
4  * Copyright (C) 2003, Axis Communications AB.
5  */
6
7 #include <linux/config.h>
8 #include <linux/seq_file.h>
9 #include <linux/proc_fs.h>
10 #include <linux/delay.h>
11 #include <linux/param.h>
12
13 #ifdef CONFIG_PROC_FS
14
15 #define HAS_FPU         0x0001
16 #define HAS_MMU         0x0002
17 #define HAS_ETHERNET100 0x0004
18 #define HAS_TOKENRING   0x0008
19 #define HAS_SCSI        0x0010
20 #define HAS_ATA         0x0020
21 #define HAS_USB         0x0040
22 #define HAS_IRQ_BUG     0x0080
23 #define HAS_MMU_BUG     0x0100
24
25 struct cpu_info {
26         char *cpu_model;
27         unsigned short rev;
28         unsigned short cache_size;
29         unsigned short flags;
30 };
31
32 /* Some of these model are here for historical reasons only. */
33 static struct cpu_info cpinfo[] = {
34         {"ETRAX 1", 0, 0, 0},
35         {"ETRAX 2", 1, 0, 0},
36         {"ETRAX 3", 2, 0, 0},
37         {"ETRAX 4", 3, 0, 0},
38         {"Simulator", 7, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA},
39         {"ETRAX 100", 8, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_IRQ_BUG},
40         {"ETRAX 100", 9, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA},
41
42         {"ETRAX 100LX", 10, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
43                              | HAS_MMU | HAS_MMU_BUG},
44
45         {"ETRAX 100LX v2", 11, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
46                                 | HAS_MMU},
47
48         {"ETRAX FS", 32, 32, HAS_ETHERNET100 | HAS_ATA | HAS_MMU},
49
50         {"Unknown", 0, 0, 0}
51 };
52
53 int
54 show_cpuinfo(struct seq_file *m, void *v)
55 {
56         int i;
57         int cpu = (int)v - 1;
58         int entries;
59         unsigned long revision;
60         struct cpu_info *info;
61
62         entries = sizeof cpinfo / sizeof(struct cpu_info);
63         info = &cpinfo[entries - 1];
64
65 #ifdef CONFIG_SMP
66         if (!cpu_online(cpu))
67                 return 0;
68 #endif
69
70         revision = rdvr();
71
72         for (i = 0; i < entries; i++) {
73                 if (cpinfo[i].rev == revision) {
74                         info = &cpinfo[i];
75                         break;
76                 }
77         }
78
79         return seq_printf(m,
80                 "processor\t: %d\n"
81                 "cpu\t\t: CRIS\n"
82                 "cpu revision\t: %lu\n"
83                 "cpu model\t: %s\n"
84                 "cache size\t: %d KB\n"
85                 "fpu\t\t: %s\n"
86                 "mmu\t\t: %s\n"
87                 "mmu DMA bug\t: %s\n"
88                 "ethernet\t: %s Mbps\n"
89                 "token ring\t: %s\n"
90                 "scsi\t\t: %s\n"
91                 "ata\t\t: %s\n"
92                 "usb\t\t: %s\n"
93                 "bogomips\t: %lu.%02lu\n\n",
94
95                 cpu,
96                 revision,
97                 info->cpu_model,
98                 info->cache_size,
99                 info->flags & HAS_FPU ? "yes" : "no",
100                 info->flags & HAS_MMU ? "yes" : "no",
101                 info->flags & HAS_MMU_BUG ? "yes" : "no",
102                 info->flags & HAS_ETHERNET100 ? "10/100" : "10",
103                 info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
104                 info->flags & HAS_SCSI ? "yes" : "no",
105                 info->flags & HAS_ATA ? "yes" : "no",
106                 info->flags & HAS_USB ? "yes" : "no",
107                 (loops_per_jiffy * HZ + 500) / 500000,
108                 ((loops_per_jiffy * HZ + 500) / 5000) % 100);
109 }
110
111 #endif /* CONFIG_PROC_FS */
112
113 void
114 show_etrax_copyright(void)
115 {
116         printk(KERN_INFO
117                "Linux/CRISv32 port on ETRAX FS (C) 2003, 2004 Axis Communications AB\n");
118 }