personal-pci.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * linux/arch/arm/mach-footbridge/personal-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. static int irqmap_personal_server[] __initdata = {
  15. IRQ_IN0, IRQ_IN1, IRQ_IN2, IRQ_IN3, 0, 0, 0,
  16. IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI
  17. };
  18. static int __init personal_server_map_irq(const struct pci_dev *dev, u8 slot,
  19. u8 pin)
  20. {
  21. unsigned char line;
  22. pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line);
  23. if (line > 0x40 && line <= 0x5f) {
  24. /* line corresponds to the bit controlling this interrupt
  25. * in the footbridge. Ignore the first 8 interrupt bits,
  26. * look up the rest in the map. IN0 is bit number 8
  27. */
  28. return irqmap_personal_server[(line & 0x1f) - 8];
  29. } else if (line == 0) {
  30. /* no interrupt */
  31. return 0;
  32. } else
  33. return irqmap_personal_server[(line - 1) & 3];
  34. }
  35. static struct hw_pci personal_server_pci __initdata = {
  36. .map_irq = personal_server_map_irq,
  37. .nr_controllers = 1,
  38. .ops = &dc21285_ops,
  39. .setup = dc21285_setup,
  40. .preinit = dc21285_preinit,
  41. .postinit = dc21285_postinit,
  42. };
  43. static int __init personal_pci_init(void)
  44. {
  45. if (machine_is_personal_server())
  46. pci_common_init(&personal_server_pci);
  47. return 0;
  48. }
  49. subsys_initcall(personal_pci_init);