blob: 24622d89b1ca4d01c6257943eea7e9a877c22708 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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
8#include <linux/config.h>
9#include <linux/types.h>
10#include <linux/kernel.h>
11#include <linux/pci.h>
12#include <linux/init.h>
13#include <linux/slab.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16
17#include <asm/io.h>
18#include <asm/smp.h>
19#include <asm/irq-routing.h>
20
21#include "pci-frv.h"
22
23/*
24 * DEVICE DEVNO INT#A INT#B INT#C INT#D
25 * ======= ======= ======= ======= ======= =======
26 * MB86943 0 fpga.10 - - -
27 * RTL8029 16 fpga.12 - - -
28 * SLOT 1 19 fpga.6 fpga.5 fpga.4 fpga.3
29 * SLOT 2 18 fpga.5 fpga.4 fpga.3 fpga.6
30 * SLOT 3 17 fpga.4 fpga.3 fpga.6 fpga.5
31 *
32 */
33
34static const uint8_t __initdata pci_bus0_irq_routing[32][4] = {
35 [0 ] { IRQ_FPGA_MB86943_PCI_INTA },
36 [16] { IRQ_FPGA_RTL8029_INTA },
37 [17] { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB },
38 [18] { IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA },
39 [19] { IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD },
40};
41
42void __init pcibios_irq_init(void)
43{
44}
45
46void __init pcibios_fixup_irqs(void)
47{
48 struct pci_dev *dev = NULL;
49 uint8_t line, pin;
50
51 while (dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev),
52 dev != NULL
53 ) {
54 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
55 if (pin) {
56 dev->irq = pci_bus0_irq_routing[PCI_SLOT(dev->devfn)][pin - 1];
57 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
58 }
59 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line);
60 }
61}
62
David Howells8080f232005-11-28 13:43:51 -080063void __init pcibios_penalize_isa_irq(int irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -070064{
65}
66
67void pcibios_enable_irq(struct pci_dev *dev)
68{
69 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
70}