cats-pci.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/arch/arm/mach-footbridge/cats-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. /* cats host-specific stuff */
  16. static int irqmap_cats[] = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
  17. static u8 cats_no_swizzle(struct pci_dev *dev, u8 *pin)
  18. {
  19. return 0;
  20. }
  21. static int cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  22. {
  23. if (dev->irq >= 255)
  24. return -1; /* not a valid interrupt. */
  25. if (dev->irq >= 128)
  26. return dev->irq & 0x1f;
  27. if (dev->irq >= 1 && dev->irq <= 4)
  28. return irqmap_cats[dev->irq - 1];
  29. if (dev->irq != 0)
  30. printk("PCI: device %02x:%02x has unknown irq line %x\n",
  31. dev->bus->number, dev->devfn, dev->irq);
  32. return -1;
  33. }
  34. /*
  35. * why not the standard PCI swizzle? does this prevent 4-port tulip
  36. * cards being used (ie, pci-pci bridge based cards)?
  37. */
  38. static struct hw_pci cats_pci __initdata = {
  39. .swizzle = cats_no_swizzle,
  40. .map_irq = cats_map_irq,
  41. .nr_controllers = 1,
  42. .ops = &dc21285_ops,
  43. .setup = dc21285_setup,
  44. .preinit = dc21285_preinit,
  45. .postinit = dc21285_postinit,
  46. };
  47. static int __init cats_pci_init(void)
  48. {
  49. if (machine_is_cats())
  50. pci_common_init(&cats_pci);
  51. return 0;
  52. }
  53. subsys_initcall(cats_pci_init);