ixdp425-pci.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * arch/arm/mach-ixp4xx/ixdp425-pci.c
  3. *
  4. * IXDP425 board-level PCI initialization
  5. *
  6. * Copyright (C) 2002 Intel Corporation.
  7. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  8. *
  9. * Maintainer: Deepak Saxena <dsaxena@plexity.net>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. *
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/config.h>
  18. #include <linux/pci.h>
  19. #include <linux/init.h>
  20. #include <linux/delay.h>
  21. #include <asm/mach/pci.h>
  22. #include <asm/irq.h>
  23. #include <asm/hardware.h>
  24. #include <asm/mach-types.h>
  25. void __init ixdp425_pci_preinit(void)
  26. {
  27. gpio_line_config(IXDP425_PCI_INTA_PIN,
  28. IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
  29. gpio_line_config(IXDP425_PCI_INTB_PIN,
  30. IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
  31. gpio_line_config(IXDP425_PCI_INTC_PIN,
  32. IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
  33. gpio_line_config(IXDP425_PCI_INTD_PIN,
  34. IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
  35. gpio_line_isr_clear(IXDP425_PCI_INTA_PIN);
  36. gpio_line_isr_clear(IXDP425_PCI_INTB_PIN);
  37. gpio_line_isr_clear(IXDP425_PCI_INTC_PIN);
  38. gpio_line_isr_clear(IXDP425_PCI_INTD_PIN);
  39. ixp4xx_pci_preinit();
  40. }
  41. static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  42. {
  43. static int pci_irq_table[IXDP425_PCI_IRQ_LINES] = {
  44. IRQ_IXDP425_PCI_INTA,
  45. IRQ_IXDP425_PCI_INTB,
  46. IRQ_IXDP425_PCI_INTC,
  47. IRQ_IXDP425_PCI_INTD
  48. };
  49. int irq = -1;
  50. if (slot >= 1 && slot <= IXDP425_PCI_MAX_DEV &&
  51. pin >= 1 && pin <= IXDP425_PCI_IRQ_LINES) {
  52. irq = pci_irq_table[(slot + pin - 2) % 4];
  53. }
  54. return irq;
  55. }
  56. struct hw_pci ixdp425_pci __initdata = {
  57. .nr_controllers = 1,
  58. .preinit = ixdp425_pci_preinit,
  59. .swizzle = pci_std_swizzle,
  60. .setup = ixp4xx_setup,
  61. .scan = ixp4xx_scan_bus,
  62. .map_irq = ixdp425_map_irq,
  63. };
  64. int __init ixdp425_pci_init(void)
  65. {
  66. if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
  67. machine_is_avila() || machine_is_ixdp465())
  68. pci_common_init(&ixdp425_pci);
  69. return 0;
  70. }
  71. subsys_initcall(ixdp425_pci_init);