aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha/kernel/pc873xx.c
diff options
context:
space:
mode:
authorMorten H. Larsen <m-larsen@post6.tele.dk>2010-06-15 13:22:11 -0400
committerMatt Turner <mattst88@gmail.com>2010-06-15 14:19:08 -0400
commit932e0c201d28a728e25d3b641aa95bd28ceb08b4 (patch)
tree7212f254ae94954f18d7f37d4970011e123e6cb8 /arch/alpha/kernel/pc873xx.c
parent5efa16ff77cb785647a480dcdc70a6b4fc787996 (diff)
alpha: Detect Super IO chip, no IDE on Avanti, enable EPP19
This patch probes for the Super IO chip and reserves the IO range when found. It avoids enabling the IDE interface on the Avanti family, since none has IDE. It enables the Enhanced Parallel Port v1.9 feature. Signed-off-by: Morten H. Larsen <m-larsen@post6.tele.dk> Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'arch/alpha/kernel/pc873xx.c')
-rw-r--r--arch/alpha/kernel/pc873xx.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/arch/alpha/kernel/pc873xx.c b/arch/alpha/kernel/pc873xx.c
new file mode 100644
index 000000000000..27dcbff85613
--- /dev/null
+++ b/arch/alpha/kernel/pc873xx.c
@@ -0,0 +1,88 @@
1#include <linux/ioport.h>
2#include <asm/io.h>
3
4#include "pc873xx.h"
5
6static unsigned pc873xx_probelist[] = {0x398, 0x26e, 0};
7
8static char *pc873xx_names[] = {
9 "PC87303", "PC87306", "PC87312", "PC87332", "PC87334"
10};
11
12static unsigned int base, model;
13
14
15unsigned int __init pc873xx_get_base()
16{
17 return base;
18}
19
20char *__init pc873xx_get_model()
21{
22 return pc873xx_names[model];
23}
24
25static unsigned char __init pc873xx_read(unsigned int base, int reg)
26{
27 outb(reg, base);
28 return inb(base + 1);
29}
30
31static void __init pc873xx_write(unsigned int base, int reg, unsigned char data)
32{
33 unsigned long flags;
34
35 local_irq_save(flags);
36 outb(reg, base);
37 outb(data, base + 1);
38 outb(data, base + 1); /* Must be written twice */
39 local_irq_restore(flags);
40}
41
42int __init pc873xx_probe(void)
43{
44 int val, index = 0;
45
46 while ((base = pc873xx_probelist[index++])) {
47
48 if (request_region(base, 2, "Super IO PC873xx") == NULL)
49 continue;
50
51 val = pc873xx_read(base, REG_SID);
52 if ((val & 0xf0) == 0x10) {
53 model = PC87332;
54 break;
55 } else if ((val & 0xf8) == 0x70) {
56 model = PC87306;
57 break;
58 } else if ((val & 0xf8) == 0x50) {
59 model = PC87334;
60 break;
61 } else if ((val & 0xf8) == 0x40) {
62 model = PC87303;
63 break;
64 }
65
66 release_region(base, 2);
67 }
68
69 return (base == 0) ? -1 : 1;
70}
71
72void __init pc873xx_enable_epp19(void)
73{
74 unsigned char data;
75
76 printk(KERN_INFO "PC873xx enabling EPP v1.9\n");
77 data = pc873xx_read(base, REG_PCR);
78 pc873xx_write(base, REG_PCR, (data & 0xFC) | 0x02);
79}
80
81void __init pc873xx_enable_ide(void)
82{
83 unsigned char data;
84
85 printk(KERN_INFO "PC873xx enabling IDE interrupt\n");
86 data = pc873xx_read(base, REG_FER);
87 pc873xx_write(base, REG_FER, data | 0x40);
88}