63 #include <linux/errno.h>
65 #include <linux/module.h>
66 #include <linux/types.h>
69 #include <linux/serial.h>
70 #include <linux/pci.h>
71 #include <linux/parport.h>
74 #include <linux/tty.h>
75 #include <linux/serial_core.h>
86 #undef DEBUG_SUPERIO_INIT
88 #ifdef DEBUG_SUPERIO_INIT
89 #define DBG_INIT(x...) printk(x)
91 #define DBG_INIT(x...)
94 #define SUPERIO "SuperIO"
95 #define PFX SUPERIO ": "
98 superio_interrupt(
int parent_irq,
void *devp)
113 if ((results & 0x80) == 0) {
122 local_irq = results & 0x0f;
124 if (local_irq == 2 || local_irq > 7) {
129 if (local_irq == 7) {
135 if ((results & 0x80) == 0) {
173 pci_name(pdev), pdev->
irq);
222 pci_write_config_dword (pdev, 0x64, 0x82000000U);
230 pci_write_config_dword (pdev,
TRIGGER_2, 0x07654300U);
238 pci_write_config_dword (pdev,
CFG_IR_INTAB, 0x00001000U);
245 pci_write_config_dword (pdev,
CFG_IR_USB, 0x4c880000U);
289 static void superio_mask_irq(
struct irq_data *
d)
291 unsigned int irq = d->
irq;
294 if ((irq < 1) || (irq == 2) || (irq > 7)) {
307 static void superio_unmask_irq(
struct irq_data *d)
309 unsigned int irq = d->
irq;
312 if ((irq < 1) || (irq == 2) || (irq > 7)) {
324 static struct irq_chip superio_interrupt_type = {
326 .irq_unmask = superio_unmask_irq,
327 .irq_mask = superio_mask_irq,
330 #ifdef DEBUG_SUPERIO_INIT
331 static unsigned short expected_device[3] = {
342 #ifdef DEBUG_SUPERIO_INIT
347 if (expected_device[fn] != pcidev->
device) {
351 printk(
"superio_fixup_irq(%s) ven 0x%x dev 0x%x from %pf\n",
354 __builtin_return_address(0));
357 for (i = 0; i < 16; i++) {
358 irq_set_chip_and_handler(i, &superio_interrupt_type,
373 sio_dev.lio_pdev =
pcidev;
376 sio_dev.usb_pdev =
pcidev;
388 static void __init superio_serial_init(
void)
390 #ifdef CONFIG_SERIAL_8250
394 memset(&serial_port, 0,
sizeof(serial_port));
397 serial_port.uartclk = 115200*16;
398 serial_port.fifosize = 16;
401 serial_port.iobase = sio_dev.sp1_base;
403 serial_port.line = 0;
411 serial_port.iobase = sio_dev.sp2_base;
413 serial_port.line = 1;
421 static void __init superio_parport_init(
void)
423 #ifdef CONFIG_PARPORT_PC
436 static void superio_fixup_pci(
struct pci_dev *pdev)
444 printk(
"PCI: Enabled native mode for NS87415 (pif=0x%x)\n", prog);
459 DBG_INIT(
"superio_probe(%s) ven 0x%x dev 0x%x sv 0x%x sd 0x%x class 0x%x\n",
468 superio_parport_init();
469 superio_serial_init();
473 DBG_INIT(
"superio_probe: ignoring IDE 87415\n");
475 DBG_INIT(
"superio_probe: ignoring USB OHCI controller\n");
477 DBG_INIT(
"superio_probe: WTF? Fire Extinguisher?\n");
493 .id_table = superio_tbl,
494 .probe = superio_probe,
497 static int __init superio_modinit(
void)
499 return pci_register_driver(&superio_driver);
502 static void __exit superio_exit(
void)