]> git.ipfire.org Git - thirdparty/linux.git/blame - arch/arm/mach-ixp4xx/gtwx5715-pci.c
ARM: ixp4xx: Convert to SPARSE_IRQ
[thirdparty/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
dc8ef8cd
LW
33#include "irqs.h"
34
8d3fdf31 35#define SLOT0_DEVID 0
8d3fdf31 36#define SLOT1_DEVID 1
0fd7dc7f
KH
37#define INTA 10 /* slot 1 has INTA and INTB crossed */
38#define INTB 11
a8b7b340 39
bdf82b59 40/*
bdf82b59
DS
41 * Slot 0 isn't actually populated with a card connector but
42 * we initialize it anyway in case a future version has the
43 * slot populated or someone with good soldering skills has
44 * some free time.
45 */
1da177e4
LT
46void __init gtwx5715_pci_preinit(void)
47{
6845664a
TG
48 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
49 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
1da177e4
LT
50 ixp4xx_pci_preinit();
51}
52
53
d5341942 54static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
1da177e4 55{
0fd7dc7f 56 int rc = -1;
1da177e4 57
0fd7dc7f
KH
58 if ((slot == SLOT0_DEVID && pin == 1) ||
59 (slot == SLOT1_DEVID && pin == 2))
60 rc = IXP4XX_GPIO_IRQ(INTA);
61 else if ((slot == SLOT0_DEVID && pin == 2) ||
62 (slot == SLOT1_DEVID && pin == 1))
63 rc = IXP4XX_GPIO_IRQ(INTB);
1da177e4 64
8d3fdf31
KH
65 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
66 __func__, slot, pin, rc);
67 return rc;
1da177e4
LT
68}
69
70struct hw_pci gtwx5715_pci __initdata = {
71 .nr_controllers = 1,
c23bfc38 72 .ops = &ixp4xx_ops,
1da177e4 73 .preinit = gtwx5715_pci_preinit,
1da177e4 74 .setup = ixp4xx_setup,
1da177e4
LT
75 .map_irq = gtwx5715_map_irq,
76};
77
78int __init gtwx5715_pci_init(void)
79{
80 if (machine_is_gtwx5715())
1da177e4 81 pci_common_init(&gtwx5715_pci);
1da177e4
LT
82
83 return 0;
84}
85
86subsys_initcall(gtwx5715_pci_init);