Lines Matching +full:legacy +full:- +full:interrupt +full:- +full:controller

1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* National Semiconductor NS87560UBD Super I/O controller used in
14 * (C) Copyright 2003 Grant Grundler <grundler parisc-linux org>
15 * (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org>
21 * Major changes to get basic interrupt infrastructure working to
23 * works with serial. -- John Marvin <jsm@fc.hp.com>
26 * -- Kyle McMartin <kyle@parisc-linux.org>
32 * Function 0 is an IDE controller. It is identical to a PC87415 IDE
33 * controller (and identifies itself as such).
35 * Function 1 is a "Legacy I/O" controller. Under this function is a
36 * whole mess of legacy I/O peripherals. Of course, HP hasn't enabled
41 * A floppy disk controller
43 * Function 2 is a USB controller.
47 * the PCI spec), we need to program the PICs on the legacy I/O port
63 #include <linux/interrupt.h>
99 /* Poll the 8259 to see if there's an interrupt. */ in superio_interrupt()
105 * Bit 7: 1 = active Interrupt; 0 = no Interrupt pending in superio_interrupt()
106 * Bits 6-3: zero in superio_interrupt()
107 * Bits 2-0: highest priority, active requesting interrupt ID (0-7) in superio_interrupt()
111 * We don't know if an interrupt was/is pending and thus in superio_interrupt()
132 printk(KERN_WARNING PFX "spurious interrupt!\n"); in superio_interrupt()
137 /* Call the appropriate device's interrupt */ in superio_interrupt()
140 /* set EOI - forces a new interrupt if a lower priority device in superio_interrupt()
152 struct pci_dev *pdev = sio->lio_pdev; in superio_init()
156 if (sio->suckyio_irq_enabled) in superio_init()
160 BUG_ON(!sio->usb_pdev); in superio_init()
163 pdev->irq = sio->usb_pdev->irq; in superio_init()
166 sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev); in superio_init()
168 printk(KERN_INFO PFX "Found NS87560 Legacy I/O device at %s (IRQ %i)\n", in superio_init()
169 pci_name(pdev), pdev->irq); in superio_init()
171 pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base); in superio_init()
172 sio->sp1_base &= ~1; in superio_init()
173 printk(KERN_INFO PFX "Serial port 1 at 0x%x\n", sio->sp1_base); in superio_init()
175 pci_read_config_dword (pdev, SIO_SP2BAR, &sio->sp2_base); in superio_init()
176 sio->sp2_base &= ~1; in superio_init()
177 printk(KERN_INFO PFX "Serial port 2 at 0x%x\n", sio->sp2_base); in superio_init()
179 pci_read_config_dword (pdev, SIO_PPBAR, &sio->pp_base); in superio_init()
180 sio->pp_base &= ~1; in superio_init()
181 printk(KERN_INFO PFX "Parallel port at 0x%x\n", sio->pp_base); in superio_init()
183 pci_read_config_dword (pdev, SIO_FDCBAR, &sio->fdc_base); in superio_init()
184 sio->fdc_base &= ~1; in superio_init()
185 printk(KERN_INFO PFX "Floppy controller at 0x%x\n", sio->fdc_base); in superio_init()
186 pci_read_config_dword (pdev, SIO_ACPIBAR, &sio->acpi_base); in superio_init()
187 sio->acpi_base &= ~1; in superio_init()
188 printk(KERN_INFO PFX "ACPI at 0x%x\n", sio->acpi_base); in superio_init()
192 request_region (sio->acpi_base, 0x1f, "acpi"); in superio_init()
194 /* Enable the legacy I/O function */ in superio_init()
204 * Next project is programming the onboard interrupt controllers. in superio_init()
208 * space access. PCI is by nature a 32-bit bus and config in superio_init()
212 /* 0x64 - 0x67 : in superio_init()
220 /* 0x68 - 0x6b : in superio_init()
228 /* 0x6c - 0x6f : in superio_init()
236 /* 0x70 - 0x73 : in superio_init()
245 outb (0x00,IC_PIC1+1); /* ICW2: interrupt vector table - not used */ in superio_init()
251 outb (0xc2,IC_PIC1+0); /* OCW2: priority (3-7,0-2) */ in superio_init()
267 outb(1, sio->acpi_base + USB_REG_CR); in superio_init()
268 if (inb(sio->acpi_base + USB_REG_CR) & 1) in superio_init()
273 if (request_irq(pdev->irq, superio_interrupt, 0, in superio_init()
281 sio->suckyio_irq_enabled = 1; in superio_init()
287 unsigned int irq = d->irq; in superio_mask_irq()
296 /* Mask interrupt */ in superio_mask_irq()
305 unsigned int irq = d->irq; in superio_unmask_irq()
314 /* Unmask interrupt */ in superio_unmask_irq()
340 fn = PCI_FUNC(pcidev->devfn); in superio_fixup_irq()
343 if (expected_device[fn] != pcidev->device) { in superio_fixup_irq()
345 return -1; in superio_fixup_irq()
349 pcidev->vendor, pcidev->device, in superio_fixup_irq()
359 * We don't allocate a SuperIO irq for the legacy IO function, in superio_fixup_irq()
361 * each legacy device as they are initialized. in superio_fixup_irq()
364 switch(pcidev->device) { in superio_fixup_irq()
370 return -1; in superio_fixup_irq()
376 local_irq = -1; in superio_fixup_irq()
437 pdev->class |= 0x5; in superio_fixup_pci()
438 pci_write_config_byte(pdev, PCI_CLASS_PROG, pdev->class); in superio_fixup_pci()
458 dev->vendor, dev->device, in superio_probe()
459 dev->subsystem_vendor, dev->subsystem_device, in superio_probe()
460 dev->class); in superio_probe()
462 BUG_ON(!sio->suckyio_irq_enabled); /* Enabled by PCI_FIXUP_FINAL */ in superio_probe()
464 if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */ in superio_probe()
469 } else if (dev->device == PCI_DEVICE_ID_NS_87415) { /* Function 0 */ in superio_probe()
471 } else if (dev->device == PCI_DEVICE_ID_NS_87560_USB) { /* Function 2 */ in superio_probe()
472 DBG_INIT("superio_probe: ignoring USB OHCI controller\n"); in superio_probe()
478 return -ENODEV; in superio_probe()