pci-irq.c 1.6 KB

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