avila-pci.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * arch/arm/mach-ixp4xx/avila-pci.c
  3. *
  4. * Gateworks Avila board-level PCI initialization
  5. *
  6. * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
  7. *
  8. * Based on ixdp-pci.c
  9. * Copyright (C) 2002 Intel Corporation.
  10. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  11. *
  12. * Maintainer: Deepak Saxena <dsaxena@plexity.net>
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. *
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/pci.h>
  21. #include <linux/init.h>
  22. #include <linux/irq.h>
  23. #include <linux/delay.h>
  24. #include <asm/mach/pci.h>
  25. #include <asm/irq.h>
  26. #include <mach/hardware.h>
  27. #include <asm/mach-types.h>
  28. void __init avila_pci_preinit(void)
  29. {
  30. set_irq_type(IRQ_AVILA_PCI_INTA, IRQ_TYPE_LEVEL_LOW);
  31. set_irq_type(IRQ_AVILA_PCI_INTB, IRQ_TYPE_LEVEL_LOW);
  32. set_irq_type(IRQ_AVILA_PCI_INTC, IRQ_TYPE_LEVEL_LOW);
  33. set_irq_type(IRQ_AVILA_PCI_INTD, IRQ_TYPE_LEVEL_LOW);
  34. ixp4xx_pci_preinit();
  35. }
  36. static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  37. {
  38. static int pci_irq_table[AVILA_PCI_IRQ_LINES] = {
  39. IRQ_AVILA_PCI_INTA,
  40. IRQ_AVILA_PCI_INTB,
  41. IRQ_AVILA_PCI_INTC,
  42. IRQ_AVILA_PCI_INTD
  43. };
  44. int irq = -1;
  45. if (slot >= 1 &&
  46. slot <= (machine_is_loft() ? LOFT_PCI_MAX_DEV : AVILA_PCI_MAX_DEV) &&
  47. pin >= 1 && pin <= AVILA_PCI_IRQ_LINES) {
  48. irq = pci_irq_table[(slot + pin - 2) % 4];
  49. }
  50. return irq;
  51. }
  52. struct hw_pci avila_pci __initdata = {
  53. .nr_controllers = 1,
  54. .preinit = avila_pci_preinit,
  55. .swizzle = pci_std_swizzle,
  56. .setup = ixp4xx_setup,
  57. .scan = ixp4xx_scan_bus,
  58. .map_irq = avila_map_irq,
  59. };
  60. int __init avila_pci_init(void)
  61. {
  62. if (machine_is_avila() || machine_is_loft())
  63. pci_common_init(&avila_pci);
  64. return 0;
  65. }
  66. subsys_initcall(avila_pci_init);