blob: 551d114c9e144a3fad9152c2ef9d99fc98ebb857 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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>
Michael-Luke Jonesddaca4a2007-05-31 12:27:14 +010028#include <linux/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010030#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <asm/mach/pci.h>
32
Krzysztof Hałasa8d3fdf32009-11-17 18:48:23 +010033#define SLOT0_DEVID 0
Krzysztof Hałasa8d3fdf32009-11-17 18:48:23 +010034#define SLOT1_DEVID 1
Krzysztof Hałasa0fd7dc72009-11-18 00:39:01 +010035#define INTA 10 /* slot 1 has INTA and INTB crossed */
36#define INTB 11
Krzysztof Hałasaa8b7b342009-11-16 23:24:57 +010037
Deepak Saxenabdf82b52005-08-29 22:46:30 +010038/*
Deepak Saxenabdf82b52005-08-29 22:46:30 +010039 * Slot 0 isn't actually populated with a card connector but
40 * we initialize it anyway in case a future version has the
41 * slot populated or someone with good soldering skills has
42 * some free time.
43 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070044void __init gtwx5715_pci_preinit(void)
45{
Thomas Gleixner6845664a2011-03-24 13:25:22 +010046 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
47 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 ixp4xx_pci_preinit();
49}
50
51
Ralf Baechled5341942011-06-10 15:30:21 +010052static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
Linus Torvalds1da177e2005-04-16 15:20:36 -070053{
Krzysztof Hałasa0fd7dc72009-11-18 00:39:01 +010054 int rc = -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
Krzysztof Hałasa0fd7dc72009-11-18 00:39:01 +010056 if ((slot == SLOT0_DEVID && pin == 1) ||
57 (slot == SLOT1_DEVID && pin == 2))
58 rc = IXP4XX_GPIO_IRQ(INTA);
59 else if ((slot == SLOT0_DEVID && pin == 2) ||
60 (slot == SLOT1_DEVID && pin == 1))
61 rc = IXP4XX_GPIO_IRQ(INTB);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
Krzysztof Hałasa8d3fdf32009-11-17 18:48:23 +010063 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
64 __func__, slot, pin, rc);
65 return rc;
Linus Torvalds1da177e2005-04-16 15:20:36 -070066}
67
68struct hw_pci gtwx5715_pci __initdata = {
69 .nr_controllers = 1,
Russell Kingc23bfc32012-03-10 12:49:16 +000070 .ops = &ixp4xx_ops,
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 .preinit = gtwx5715_pci_preinit,
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 .setup = ixp4xx_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 .map_irq = gtwx5715_map_irq,
74};
75
76int __init gtwx5715_pci_init(void)
77{
78 if (machine_is_gtwx5715())
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 pci_common_init(&gtwx5715_pci);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
81 return 0;
82}
83
84subsys_initcall(gtwx5715_pci_init);