pci-irq.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include <linux/types.h>
  8. #include <linux/kernel.h>
  9. #include <linux/pci.h>
  10. #include <linux/init.h>
  11. #include <linux/slab.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/irq.h>
  14. #include <asm/io.h>
  15. #include <asm/smp.h>
  16. #include "pci-frv.h"
  17. /*
  18. * DEVICE DEVNO INT#A INT#B INT#C INT#D
  19. * ======= ======= ======= ======= ======= =======
  20. * MB86943 0 fpga.10 - - -
  21. * RTL8029 16 fpga.12 - - -
  22. * SLOT 1 19 fpga.6 fpga.5 fpga.4 fpga.3
  23. * SLOT 2 18 fpga.5 fpga.4 fpga.3 fpga.6
  24. * SLOT 3 17 fpga.4 fpga.3 fpga.6 fpga.5
  25. *
  26. */
  27. static const uint8_t __initdata pci_bus0_irq_routing[32][4] = {
  28. [0 ] = { IRQ_FPGA_MB86943_PCI_INTA },
  29. [16] = { IRQ_FPGA_RTL8029_INTA },
  30. [17] = { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB },
  31. [18] = { IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA },
  32. [19] = { IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD },
  33. };
  34. void __init pcibios_irq_init(void)
  35. {
  36. }
  37. void __init pcibios_fixup_irqs(void)
  38. {
  39. struct pci_dev *dev = NULL;
  40. uint8_t line, pin;
  41. for_each_pci_dev(dev) {
  42. pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
  43. if (pin) {
  44. dev->irq = pci_bus0_irq_routing[PCI_SLOT(dev->devfn)][pin - 1];
  45. pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
  46. }
  47. pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line);
  48. }
  49. }
  50. void __init pcibios_penalize_isa_irq(int irq)
  51. {
  52. }
  53. void pcibios_enable_irq(struct pci_dev *dev)
  54. {
  55. pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
  56. }