personal-pci.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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(struct pci_dev *dev, u8 slot, u8 pin)
  19. {
  20. unsigned char line;
  21. pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line);
  22. if (line > 0x40 && line <= 0x5f) {
  23. /* line corresponds to the bit controlling this interrupt
  24. * in the footbridge. Ignore the first 8 interrupt bits,
  25. * look up the rest in the map. IN0 is bit number 8
  26. */
  27. return irqmap_personal_server[(line & 0x1f) - 8];
  28. } else if (line == 0) {
  29. /* no interrupt */
  30. return 0;
  31. } else
  32. return irqmap_personal_server[(line - 1) & 3];
  33. }
  34. static struct hw_pci personal_server_pci __initdata = {
  35. .map_irq = personal_server_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 personal_pci_init(void)
  43. {
  44. if (machine_is_personal_server())
  45. pci_common_init(&personal_server_pci);
  46. return 0;
  47. }
  48. subsys_initcall(personal_pci_init);