]> git.ipfire.org Git - thirdparty/linux.git/blob - arch/arm/mach-ixp4xx/wg302v2-pci.c
ARM: ixp4xx: Convert to SPARSE_IRQ
[thirdparty/linux.git] / arch / arm / mach-ixp4xx / wg302v2-pci.c
1 /*
2 * arch/arch/mach-ixp4xx/wg302v2-pci.c
3 *
4 * PCI setup routines for the Netgear WG302 v2 and WAG302 v2
5 *
6 * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
7 *
8 * based on coyote-pci.c:
9 * Copyright (C) 2002 Jungo Software Technologies.
10 * Copyright (C) 2003 MontaVista Software, Inc.
11 *
12 * Maintainer: Imre Kaloz <kaloz@openwrt.org>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 *
18 */
19
20 #include <linux/kernel.h>
21 #include <linux/pci.h>
22 #include <linux/init.h>
23 #include <linux/irq.h>
24
25 #include <asm/mach-types.h>
26 #include <mach/hardware.h>
27
28 #include <asm/mach/pci.h>
29
30 #include "irqs.h"
31
32 void __init wg302v2_pci_preinit(void)
33 {
34 irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
35 irq_set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
36
37 ixp4xx_pci_preinit();
38 }
39
40 static int __init wg302v2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
41 {
42 if (slot == 1)
43 return IRQ_IXP4XX_GPIO8;
44 else if (slot == 2)
45 return IRQ_IXP4XX_GPIO9;
46 else return -1;
47 }
48
49 struct hw_pci wg302v2_pci __initdata = {
50 .nr_controllers = 1,
51 .ops = &ixp4xx_ops,
52 .preinit = wg302v2_pci_preinit,
53 .setup = ixp4xx_setup,
54 .map_irq = wg302v2_map_irq,
55 };
56
57 int __init wg302v2_pci_init(void)
58 {
59 if (machine_is_wg302v2())
60 pci_common_init(&wg302v2_pci);
61 return 0;
62 }
63
64 subsys_initcall(wg302v2_pci_init);