gtwx5715-pci.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 SLOT0_DEVID 0
  32. #define SLOT0_INTA 10
  33. #define SLOT0_INTB 11
  34. #define SLOT1_DEVID 1
  35. #define SLOT1_INTA 11
  36. #define SLOT1_INTB 10
  37. #define SLOT_COUNT 2
  38. #define INT_PIN_COUNT 2
  39. /*
  40. * Slot 0 isn't actually populated with a card connector but
  41. * we initialize it anyway in case a future version has the
  42. * slot populated or someone with good soldering skills has
  43. * some free time.
  44. */
  45. void __init gtwx5715_pci_preinit(void)
  46. {
  47. set_irq_type(IXP4XX_GPIO_IRQ(SLOT0_INTA), IRQ_TYPE_LEVEL_LOW);
  48. set_irq_type(IXP4XX_GPIO_IRQ(SLOT0_INTB), IRQ_TYPE_LEVEL_LOW);
  49. set_irq_type(IXP4XX_GPIO_IRQ(SLOT1_INTA), IRQ_TYPE_LEVEL_LOW);
  50. set_irq_type(IXP4XX_GPIO_IRQ(SLOT1_INTB), IRQ_TYPE_LEVEL_LOW);
  51. ixp4xx_pci_preinit();
  52. }
  53. static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  54. {
  55. int rc;
  56. static int gtwx5715_irqmap[SLOT_COUNT][INT_PIN_COUNT] = {
  57. {IXP4XX_GPIO_IRQ(SLOT0_INTA), IXP4XX_GPIO_IRQ(SLOT0_INTB)},
  58. {IXP4XX_GPIO_IRQ(SLOT1_INTA), IXP4XX_GPIO_IRQ(SLOT1_INTB)},
  59. };
  60. if (slot >= SLOT_COUNT || pin >= INT_PIN_COUNT)
  61. rc = -1;
  62. else
  63. rc = gtwx5715_irqmap[slot][pin - 1];
  64. printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
  65. __func__, slot, pin, rc);
  66. return rc;
  67. }
  68. struct hw_pci gtwx5715_pci __initdata = {
  69. .nr_controllers = 1,
  70. .preinit = gtwx5715_pci_preinit,
  71. .swizzle = pci_std_swizzle,
  72. .setup = ixp4xx_setup,
  73. .scan = ixp4xx_scan_bus,
  74. .map_irq = gtwx5715_map_irq,
  75. };
  76. int __init gtwx5715_pci_init(void)
  77. {
  78. if (machine_is_gtwx5715())
  79. pci_common_init(&gtwx5715_pci);
  80. return 0;
  81. }
  82. subsys_initcall(gtwx5715_pci_init);