cats-pci.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * linux/arch/arm/mach-footbridge/cats-pci.c
  3. *
  4. * PCI bios-type initialisation for PCI machines
  5. *
  6. * Bits taken from various places.
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/pci.h>
  10. #include <linux/init.h>
  11. #include <asm/irq.h>
  12. #include <asm/mach/pci.h>
  13. #include <asm/mach-types.h>
  14. /* cats host-specific stuff */
  15. static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
  16. static u8 cats_no_swizzle(struct pci_dev *dev, u8 *pin)
  17. {
  18. return 0;
  19. }
  20. static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  21. {
  22. if (dev->irq >= 255)
  23. return -1; /* not a valid interrupt. */
  24. if (dev->irq >= 128)
  25. return dev->irq & 0x1f;
  26. if (dev->irq >= 1 && dev->irq <= 4)
  27. return irqmap_cats[dev->irq - 1];
  28. if (dev->irq != 0)
  29. printk("PCI: device %02x:%02x has unknown irq line %x\n",
  30. dev->bus->number, dev->devfn, dev->irq);
  31. return -1;
  32. }
  33. /*
  34. * why not the standard PCI swizzle? does this prevent 4-port tulip
  35. * cards being used (ie, pci-pci bridge based cards)?
  36. */
  37. static struct hw_pci cats_pci __initdata = {
  38. .swizzle = cats_no_swizzle,
  39. .map_irq = cats_map_irq,
  40. .nr_controllers = 1,
  41. .ops = &dc21285_ops,
  42. .setup = dc21285_setup,
  43. .preinit = dc21285_preinit,
  44. .postinit = dc21285_postinit,
  45. };
  46. static int __init cats_pci_init(void)
  47. {
  48. if (machine_is_cats())
  49. pci_common_init(&cats_pci);
  50. return 0;
  51. }
  52. subsys_initcall(cats_pci_init);