/arch/frv/mb93090-mb00/pci-irq.c

https://bitbucket.org/evzijst/gittest · C · 70 lines · 44 code · 10 blank · 16 comment · 3 complexity · bb68c177fc1ccba4049f3aa8e1a9bc06 MD5 · raw file

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