gtwx5715-pci.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * arch/arm/mach-ixp4xx/gtwx5715-pci.c
  3. *
  4. * Gemtek GTWX5715 (Linksys WRV54G) board setup
  5. *
  6. * Copyright (C) 2004 George T. Joseph
  7. * Derived from Coyote
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. #include <linux/pci.h>
  25. #include <linux/init.h>
  26. #include <linux/delay.h>
  27. #include <linux/irq.h>
  28. #include <asm/mach-types.h>
  29. #include <mach/hardware.h>
  30. #include <asm/mach/pci.h>
  31. #define GTWX5715_PCI_SLOT0_DEVID 0
  32. #define GTWX5715_PCI_SLOT0_INTA_GPIO 10
  33. #define GTWX5715_PCI_SLOT0_INTB_GPIO 11
  34. #define GTWX5715_PCI_SLOT0_INTA_IRQ IRQ_IXP4XX_GPIO10
  35. #define GTWX5715_PCI_SLOT0_INTB_IRQ IRQ_IXP4XX_GPIO11
  36. #define GTWX5715_PCI_SLOT1_DEVID 1
  37. #define GTWX5715_PCI_SLOT1_INTA_GPIO 11
  38. #define GTWX5715_PCI_SLOT1_INTB_GPIO 10
  39. #define GTWX5715_PCI_SLOT1_INTA_IRQ IRQ_IXP4XX_GPIO11
  40. #define GTWX5715_PCI_SLOT1_INTB_IRQ IRQ_IXP4XX_GPIO10
  41. #define GTWX5715_PCI_SLOT_COUNT 2
  42. #define GTWX5715_PCI_INT_PIN_COUNT 2
  43. /*
  44. * Slot 0 isn't actually populated with a card connector but
  45. * we initialize it anyway in case a future version has the
  46. * slot populated or someone with good soldering skills has
  47. * some free time.
  48. */
  49. void __init gtwx5715_pci_preinit(void)
  50. {
  51. set_irq_type(GTWX5715_PCI_SLOT0_INTA_IRQ, IRQ_TYPE_LEVEL_LOW);
  52. set_irq_type(GTWX5715_PCI_SLOT0_INTB_IRQ, IRQ_TYPE_LEVEL_LOW);
  53. set_irq_type(GTWX5715_PCI_SLOT1_INTA_IRQ, IRQ_TYPE_LEVEL_LOW);
  54. set_irq_type(GTWX5715_PCI_SLOT1_INTB_IRQ, IRQ_TYPE_LEVEL_LOW);
  55. ixp4xx_pci_preinit();
  56. }
  57. static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  58. {
  59. int rc;
  60. static int gtwx5715_irqmap
  61. [GTWX5715_PCI_SLOT_COUNT]
  62. [GTWX5715_PCI_INT_PIN_COUNT] = {
  63. {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ},
  64. {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ},
  65. };
  66. if (slot >= GTWX5715_PCI_SLOT_COUNT ||
  67. pin >= GTWX5715_PCI_INT_PIN_COUNT) rc = -1;
  68. else
  69. rc = gtwx5715_irqmap[slot][pin-1];
  70. printk("%s: Mapped slot %d pin %d to IRQ %d\n", __func__, slot, pin, rc);
  71. return(rc);
  72. }
  73. struct hw_pci gtwx5715_pci __initdata = {
  74. .nr_controllers = 1,
  75. .preinit = gtwx5715_pci_preinit,
  76. .swizzle = pci_std_swizzle,
  77. .setup = ixp4xx_setup,
  78. .scan = ixp4xx_scan_bus,
  79. .map_irq = gtwx5715_map_irq,
  80. };
  81. int __init gtwx5715_pci_init(void)
  82. {
  83. if (machine_is_gtwx5715())
  84. {
  85. pci_common_init(&gtwx5715_pci);
  86. }
  87. return 0;
  88. }
  89. subsys_initcall(gtwx5715_pci_init);