1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/ioport.h>
7 static unsigned pc873xx_probelist
[] = {0x398, 0x26e, 0};
9 static char *pc873xx_names
[] = {
10 "PC87303", "PC87306", "PC87312", "PC87332", "PC87334"
13 static unsigned int base
, model
;
16 unsigned int __init
pc873xx_get_base()
21 char *__init
pc873xx_get_model()
23 return pc873xx_names
[model
];
26 static unsigned char __init
pc873xx_read(unsigned int base
, int reg
)
32 static void __init
pc873xx_write(unsigned int base
, int reg
, unsigned char data
)
36 local_irq_save(flags
);
39 outb(data
, base
+ 1); /* Must be written twice */
40 local_irq_restore(flags
);
43 int __init
pc873xx_probe(void)
47 while ((base
= pc873xx_probelist
[index
++])) {
49 if (request_region(base
, 2, "Super IO PC873xx") == NULL
)
52 val
= pc873xx_read(base
, REG_SID
);
53 if ((val
& 0xf0) == 0x10) {
56 } else if ((val
& 0xf8) == 0x70) {
59 } else if ((val
& 0xf8) == 0x50) {
62 } else if ((val
& 0xf8) == 0x40) {
67 release_region(base
, 2);
70 return (base
== 0) ? -1 : 1;
73 void __init
pc873xx_enable_epp19(void)
77 printk(KERN_INFO
"PC873xx enabling EPP v1.9\n");
78 data
= pc873xx_read(base
, REG_PCR
);
79 pc873xx_write(base
, REG_PCR
, (data
& 0xFC) | 0x02);
82 void __init
pc873xx_enable_ide(void)
86 printk(KERN_INFO
"PC873xx enabling IDE interrupt\n");
87 data
= pc873xx_read(base
, REG_FER
);
88 pc873xx_write(base
, REG_FER
, data
| 0x40);