IXP4xx: move Gemtek GTWX5715 platform macros to the platform code.
[deliverable/linux.git] / arch / arm / mach-ixp4xx / gtwx5715-pci.c
CommitLineData
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 28#include <linux/irq.h>
1da177e4 29#include <asm/mach-types.h>
a09e64fb 30#include <mach/hardware.h>
1da177e4
LT
31#include <asm/mach/pci.h>
32
a8b7b340
KH
33#define GTWX5715_PCI_SLOT0_DEVID 0
34#define GTWX5715_PCI_SLOT0_INTA_GPIO 10
35#define GTWX5715_PCI_SLOT0_INTB_GPIO 11
36#define GTWX5715_PCI_SLOT0_INTA_IRQ IRQ_IXP4XX_GPIO10
37#define GTWX5715_PCI_SLOT0_INTB_IRQ IRQ_IXP4XX_GPIO11
38
39#define GTWX5715_PCI_SLOT1_DEVID 1
40#define GTWX5715_PCI_SLOT1_INTA_GPIO 11
41#define GTWX5715_PCI_SLOT1_INTB_GPIO 10
42#define GTWX5715_PCI_SLOT1_INTA_IRQ IRQ_IXP4XX_GPIO11
43#define GTWX5715_PCI_SLOT1_INTB_IRQ IRQ_IXP4XX_GPIO10
44
45#define GTWX5715_PCI_SLOT_COUNT 2
46#define GTWX5715_PCI_INT_PIN_COUNT 2
47
bdf82b59 48/*
bdf82b59
DS
49 * Slot 0 isn't actually populated with a card connector but
50 * we initialize it anyway in case a future version has the
51 * slot populated or someone with good soldering skills has
52 * some free time.
53 */
1da177e4
LT
54void __init gtwx5715_pci_preinit(void)
55{
6cab4860
DB
56 set_irq_type(GTWX5715_PCI_SLOT0_INTA_IRQ, IRQ_TYPE_LEVEL_LOW);
57 set_irq_type(GTWX5715_PCI_SLOT0_INTB_IRQ, IRQ_TYPE_LEVEL_LOW);
58 set_irq_type(GTWX5715_PCI_SLOT1_INTA_IRQ, IRQ_TYPE_LEVEL_LOW);
59 set_irq_type(GTWX5715_PCI_SLOT1_INTB_IRQ, IRQ_TYPE_LEVEL_LOW);
1da177e4
LT
60
61 ixp4xx_pci_preinit();
62}
63
64
65static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
66{
67 int rc;
68 static int gtwx5715_irqmap
69 [GTWX5715_PCI_SLOT_COUNT]
70 [GTWX5715_PCI_INT_PIN_COUNT] = {
71 {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ},
72 {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ},
73};
74
75 if (slot >= GTWX5715_PCI_SLOT_COUNT ||
76 pin >= GTWX5715_PCI_INT_PIN_COUNT) rc = -1;
77 else
78 rc = gtwx5715_irqmap[slot][pin-1];
79
8e86f427 80 printk("%s: Mapped slot %d pin %d to IRQ %d\n", __func__, slot, pin, rc);
1da177e4
LT
81 return(rc);
82}
83
84struct hw_pci gtwx5715_pci __initdata = {
85 .nr_controllers = 1,
86 .preinit = gtwx5715_pci_preinit,
87 .swizzle = pci_std_swizzle,
88 .setup = ixp4xx_setup,
89 .scan = ixp4xx_scan_bus,
90 .map_irq = gtwx5715_map_irq,
91};
92
93int __init gtwx5715_pci_init(void)
94{
95 if (machine_is_gtwx5715())
96 {
97 pci_common_init(&gtwx5715_pci);
98 }
99
100 return 0;
101}
102
103subsys_initcall(gtwx5715_pci_init);
This page took 0.408266 seconds and 5 git commands to generate.