Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* pci-irq.c: PCI IRQ routing on the FRV motherboard |
| 2 | * |
| 3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * derived from: arch/i386/kernel/pci-irq.c: (c) 1999--2000 Martin Mares <mj@suse.cz> |
| 6 | */ |
| 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <linux/types.h> |
| 9 | #include <linux/kernel.h> |
| 10 | #include <linux/pci.h> |
| 11 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/interrupt.h> |
| 13 | #include <linux/irq.h> |
| 14 | |
| 15 | #include <asm/io.h> |
| 16 | #include <asm/smp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
| 18 | #include "pci-frv.h" |
| 19 | |
| 20 | /* |
| 21 | * DEVICE DEVNO INT#A INT#B INT#C INT#D |
| 22 | * ======= ======= ======= ======= ======= ======= |
| 23 | * MB86943 0 fpga.10 - - - |
| 24 | * RTL8029 16 fpga.12 - - - |
| 25 | * SLOT 1 19 fpga.6 fpga.5 fpga.4 fpga.3 |
| 26 | * SLOT 2 18 fpga.5 fpga.4 fpga.3 fpga.6 |
| 27 | * SLOT 3 17 fpga.4 fpga.3 fpga.6 fpga.5 |
| 28 | * |
| 29 | */ |
| 30 | |
Andi Kleen | 3f3247d | 2012-10-04 17:11:30 -0700 | [diff] [blame] | 31 | static const uint8_t __initconst pci_bus0_irq_routing[32][4] = { |
Al Viro | 576132b | 2006-06-23 02:04:07 -0700 | [diff] [blame] | 32 | [0 ] = { IRQ_FPGA_MB86943_PCI_INTA }, |
| 33 | [16] = { IRQ_FPGA_RTL8029_INTA }, |
| 34 | [17] = { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB }, |
| 35 | [18] = { IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA }, |
| 36 | [19] = { IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | void __init pcibios_irq_init(void) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | void __init pcibios_fixup_irqs(void) |
| 44 | { |
| 45 | struct pci_dev *dev = NULL; |
| 46 | uint8_t line, pin; |
| 47 | |
Jiri Slaby | 3c94792f | 2005-11-06 23:39:33 -0800 | [diff] [blame] | 48 | for_each_pci_dev(dev) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); |
| 50 | if (pin) { |
| 51 | dev->irq = pci_bus0_irq_routing[PCI_SLOT(dev->devfn)][pin - 1]; |
| 52 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); |
| 53 | } |
| 54 | pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line); |
| 55 | } |
| 56 | } |
| 57 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | void pcibios_enable_irq(struct pci_dev *dev) |
| 59 | { |
| 60 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); |
| 61 | } |