blob: c92e5b82af3686c47fab014cb13d9c6b01da7f0a [file] [log] [blame]
Imre Kalozdcdeeb22007-06-02 15:47:51 +01001/*
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>
Russell Kinga09e64f2008-08-05 16:14:15 +010026#include <mach/hardware.h>
Imre Kalozdcdeeb22007-06-02 15:47:51 +010027
28#include <asm/mach/pci.h>
29
30void __init wg302v2_pci_preinit(void)
31{
Thomas Gleixner6845664a2011-03-24 13:25:22 +010032 irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
33 irq_set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
Imre Kalozdcdeeb22007-06-02 15:47:51 +010034
35 ixp4xx_pci_preinit();
36}
37
Ralf Baechled5341942011-06-10 15:30:21 +010038static int __init wg302v2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
Imre Kalozdcdeeb22007-06-02 15:47:51 +010039{
40 if (slot == 1)
41 return IRQ_IXP4XX_GPIO8;
42 else if (slot == 2)
43 return IRQ_IXP4XX_GPIO9;
44 else return -1;
45}
46
47struct hw_pci wg302v2_pci __initdata = {
48 .nr_controllers = 1,
Russell Kingc23bfc32012-03-10 12:49:16 +000049 .ops = &ixp4xx_ops,
Imre Kalozdcdeeb22007-06-02 15:47:51 +010050 .preinit = wg302v2_pci_preinit,
Imre Kalozdcdeeb22007-06-02 15:47:51 +010051 .setup = ixp4xx_setup,
Imre Kalozdcdeeb22007-06-02 15:47:51 +010052 .map_irq = wg302v2_map_irq,
53};
54
55int __init wg302v2_pci_init(void)
56{
57 if (machine_is_wg302v2())
58 pci_common_init(&wg302v2_pci);
59 return 0;
60}
61
62subsys_initcall(wg302v2_pci_init);