personal-pci.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/arch/arm/mach-footbridge/personal-pci.c
  4. *
  5. * PCI bios-type initialisation for PCI machines
  6. *
  7. * Bits taken from various places.
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/pci.h>
  11. #include <linux/init.h>
  12. #include <asm/irq.h>
  13. #include <asm/mach/pci.h>
  14. #include <asm/mach-types.h>
  15. static int irqmap_personal_server[] __initdata = {
  16. IRQ_IN0, IRQ_IN1, IRQ_IN2, IRQ_IN3, 0, 0, 0,
  17. IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI
  18. };
  19. static int __init personal_server_map_irq(const struct pci_dev *dev, u8 slot,
  20. u8 pin)
  21. {
  22. unsigned char line;
  23. pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line);
  24. if (line > 0x40 && line <= 0x5f) {
  25. /* line corresponds to the bit controlling this interrupt
  26. * in the footbridge. Ignore the first 8 interrupt bits,
  27. * look up the rest in the map. IN0 is bit number 8
  28. */
  29. return irqmap_personal_server[(line & 0x1f) - 8];
  30. } else if (line == 0) {
  31. /* no interrupt */
  32. return 0;
  33. } else
  34. return irqmap_personal_server[(line - 1) & 3];
  35. }
  36. static struct hw_pci personal_server_pci __initdata = {
  37. .map_irq = personal_server_map_irq,
  38. .nr_controllers = 1,
  39. .ops = &dc21285_ops,
  40. .setup = dc21285_setup,
  41. .preinit = dc21285_preinit,
  42. .postinit = dc21285_postinit,
  43. };
  44. static int __init personal_pci_init(void)
  45. {
  46. if (machine_is_personal_server())
  47. pci_common_init(&personal_server_pci);
  48. return 0;
  49. }
  50. subsys_initcall(personal_pci_init);