Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-ixp4xx / gtwx5715-pci.c
blobb18035824e3e386c59a38b2c5d6e6db321fe6258
1 /*
2 * arch/arm/mach-ixp4xx/gtwx5715-pci.c
4 * Gemtek GTWX5715 (Linksys WRV54G) board setup
6 * Copyright (C) 2004 George T. Joseph
7 * Derived from Coyote
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.
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.
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.
25 #include <linux/pci.h>
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <asm/mach-types.h>
29 #include <asm/hardware.h>
30 #include <asm/irq.h>
31 #include <asm/arch/gtwx5715.h>
32 #include <asm/mach/pci.h>
34 extern void ixp4xx_pci_preinit(void);
35 extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
36 extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
39 * The exact GPIO pins and IRQs are defined in arch-ixp4xx/gtwx5715.h
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.
47 static void gtwx5715_init_gpio(u8 pin, u32 style)
49 gpio_line_config(pin, style | IXP4XX_GPIO_ACTIVE_LOW);
51 if (style & IXP4XX_GPIO_IN) gpio_line_isr_clear(pin);
54 void __init gtwx5715_pci_preinit(void)
56 gtwx5715_init_gpio(GTWX5715_PCI_SLOT0_INTA_GPIO, IXP4XX_GPIO_IN);
57 gtwx5715_init_gpio(GTWX5715_PCI_SLOT1_INTA_GPIO, IXP4XX_GPIO_IN);
59 ixp4xx_pci_preinit();
63 static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
65 int rc;
66 static int gtwx5715_irqmap
67 [GTWX5715_PCI_SLOT_COUNT]
68 [GTWX5715_PCI_INT_PIN_COUNT] = {
69 {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ},
70 {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ},
73 if (slot >= GTWX5715_PCI_SLOT_COUNT ||
74 pin >= GTWX5715_PCI_INT_PIN_COUNT) rc = -1;
75 else
76 rc = gtwx5715_irqmap[slot][pin-1];
78 printk("%s: Mapped slot %d pin %d to IRQ %d\n", __FUNCTION__,slot, pin, rc);
79 return(rc);
82 struct hw_pci gtwx5715_pci __initdata = {
83 .nr_controllers = 1,
84 .preinit = gtwx5715_pci_preinit,
85 .swizzle = pci_std_swizzle,
86 .setup = ixp4xx_setup,
87 .scan = ixp4xx_scan_bus,
88 .map_irq = gtwx5715_map_irq,
91 int __init gtwx5715_pci_init(void)
93 if (machine_is_gtwx5715())
95 pci_common_init(&gtwx5715_pci);
98 return 0;
101 subsys_initcall(gtwx5715_pci_init);