gtwx5715-pci.c 2.7 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 <asm/mach-types.h>
  28. #include <asm/hardware.h>
  29. #include <asm/irq.h>
  30. #include <asm/arch/gtwx5715.h>
  31. #include <asm/mach/pci.h>
  32. extern void ixp4xx_pci_preinit(void);
  33. extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
  34. extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
  35. /*
  36. * The exact GPIO pins and IRQs are defined in arch-ixp4xx/gtwx5715.h
  37. * Slot 0 isn't actually populated with a card connector but
  38. * we initialize it anyway in case a future version has the
  39. * slot populated or someone with good soldering skills has
  40. * some free time.
  41. */
  42. void __init gtwx5715_pci_preinit(void)
  43. {
  44. set_irq_type(GTWX5715_PCI_SLOT0_INTA_IRQ, IRQT_LOW);
  45. set_irq_type(GTWX5715_PCI_SLOT0_INTB_IRQ, IRQT_LOW);
  46. set_irq_type(GTWX5715_PCI_SLOT1_INTA_IRQ, IRQT_LOW);
  47. set_irq_type(GTWX5715_PCI_SLOT1_INTB_IRQ, IRQT_LOW);
  48. ixp4xx_pci_preinit();
  49. }
  50. static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  51. {
  52. int rc;
  53. static int gtwx5715_irqmap
  54. [GTWX5715_PCI_SLOT_COUNT]
  55. [GTWX5715_PCI_INT_PIN_COUNT] = {
  56. {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ},
  57. {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ},
  58. };
  59. if (slot >= GTWX5715_PCI_SLOT_COUNT ||
  60. pin >= GTWX5715_PCI_INT_PIN_COUNT) rc = -1;
  61. else
  62. rc = gtwx5715_irqmap[slot][pin-1];
  63. printk("%s: Mapped slot %d pin %d to IRQ %d\n", __FUNCTION__,slot, pin, rc);
  64. return(rc);
  65. }
  66. struct hw_pci gtwx5715_pci __initdata = {
  67. .nr_controllers = 1,
  68. .preinit = gtwx5715_pci_preinit,
  69. .swizzle = pci_std_swizzle,
  70. .setup = ixp4xx_setup,
  71. .scan = ixp4xx_scan_bus,
  72. .map_irq = gtwx5715_map_irq,
  73. };
  74. int __init gtwx5715_pci_init(void)
  75. {
  76. if (machine_is_gtwx5715())
  77. {
  78. pci_common_init(&gtwx5715_pci);
  79. }
  80. return 0;
  81. }
  82. subsys_initcall(gtwx5715_pci_init);