cats-pci.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  17. {
  18. if (dev->irq >= 255)
  19. return -1; /* not a valid interrupt. */
  20. if (dev->irq >= 128)
  21. return dev->irq & 0x1f;
  22. if (dev->irq >= 1 && dev->irq <= 4)
  23. return irqmap_cats[dev->irq - 1];
  24. if (dev->irq != 0)
  25. printk("PCI: device %02x:%02x has unknown irq line %x\n",
  26. dev->bus->number, dev->devfn, dev->irq);
  27. return -1;
  28. }
  29. /*
  30. * why not the standard PCI swizzle? does this prevent 4-port tulip
  31. * cards being used (ie, pci-pci bridge based cards)?
  32. */
  33. static struct hw_pci cats_pci __initdata = {
  34. .swizzle = NULL,
  35. .map_irq = cats_map_irq,
  36. .nr_controllers = 1,
  37. .setup = dc21285_setup,
  38. .scan = dc21285_scan_bus,
  39. .preinit = dc21285_preinit,
  40. .postinit = dc21285_postinit,
  41. };
  42. static int __init cats_pci_init(void)
  43. {
  44. if (machine_is_cats())
  45. pci_common_init(&cats_pci);
  46. return 0;
  47. }
  48. subsys_initcall(cats_pci_init);