]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 | ||
25 | #include <linux/pci.h> | |
26 | #include <linux/init.h> | |
27 | #include <linux/delay.h> | |
ddaca4a2 MLJ |
28 | #include <linux/irq.h> |
29 | ||
1da177e4 | 30 | #include <asm/mach-types.h> |
a09e64fb RK |
31 | #include <mach/hardware.h> |
32 | #include <mach/gtwx5715.h> | |
1da177e4 LT |
33 | #include <asm/mach/pci.h> |
34 | ||
bdf82b59 DS |
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 | */ | |
1da177e4 LT |
42 | void __init gtwx5715_pci_preinit(void) |
43 | { | |
6cab4860 DB |
44 | set_irq_type(GTWX5715_PCI_SLOT0_INTA_IRQ, IRQ_TYPE_LEVEL_LOW); |
45 | set_irq_type(GTWX5715_PCI_SLOT0_INTB_IRQ, IRQ_TYPE_LEVEL_LOW); | |
46 | set_irq_type(GTWX5715_PCI_SLOT1_INTA_IRQ, IRQ_TYPE_LEVEL_LOW); | |
47 | set_irq_type(GTWX5715_PCI_SLOT1_INTB_IRQ, IRQ_TYPE_LEVEL_LOW); | |
1da177e4 LT |
48 | |
49 | ixp4xx_pci_preinit(); | |
50 | } | |
51 | ||
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 | |
57 | [GTWX5715_PCI_SLOT_COUNT] | |
58 | [GTWX5715_PCI_INT_PIN_COUNT] = { | |
59 | {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ}, | |
60 | {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ}, | |
61 | }; | |
62 | ||
63 | if (slot >= GTWX5715_PCI_SLOT_COUNT || | |
64 | pin >= GTWX5715_PCI_INT_PIN_COUNT) rc = -1; | |
65 | else | |
66 | rc = gtwx5715_irqmap[slot][pin-1]; | |
67 | ||
8e86f427 | 68 | printk("%s: Mapped slot %d pin %d to IRQ %d\n", __func__, slot, pin, rc); |
1da177e4 LT |
69 | return(rc); |
70 | } | |
71 | ||
72 | struct hw_pci gtwx5715_pci __initdata = { | |
73 | .nr_controllers = 1, | |
74 | .preinit = gtwx5715_pci_preinit, | |
75 | .swizzle = pci_std_swizzle, | |
76 | .setup = ixp4xx_setup, | |
77 | .scan = ixp4xx_scan_bus, | |
78 | .map_irq = gtwx5715_map_irq, | |
79 | }; | |
80 | ||
81 | int __init gtwx5715_pci_init(void) | |
82 | { | |
83 | if (machine_is_gtwx5715()) | |
84 | { | |
85 | pci_common_init(>wx5715_pci); | |
86 | } | |
87 | ||
88 | return 0; | |
89 | } | |
90 | ||
91 | subsys_initcall(gtwx5715_pci_init); |