1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * arch/arch/mach-ixp4xx/gateway7001-pci.c
4 *
5 * PCI setup routines for Gateway 7001
6 *
7 * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
8 *
9 * based on coyote-pci.c:
10 * Copyright (C) 2002 Jungo Software Technologies.
11 * Copyright (C) 2003 MontaVista Softwrae, Inc.
12 *
13 * Maintainer: Imre Kaloz <kaloz@openwrt.org>
14 */
15
16 #include <linux/kernel.h>
17 #include <linux/pci.h>
18 #include <linux/init.h>
19 #include <linux/irq.h>
20
21 #include <asm/mach-types.h>
22 #include <mach/hardware.h>
23
24 #include <asm/mach/pci.h>
25
26 #include "irqs.h"
27
gateway7001_pci_preinit(void)28 void __init gateway7001_pci_preinit(void)
29 {
30 irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
31 irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
32
33 ixp4xx_pci_preinit();
34 }
35
gateway7001_map_irq(const struct pci_dev * dev,u8 slot,u8 pin)36 static int __init gateway7001_map_irq(const struct pci_dev *dev, u8 slot,
37 u8 pin)
38 {
39 if (slot == 1)
40 return IRQ_IXP4XX_GPIO11;
41 else if (slot == 2)
42 return IRQ_IXP4XX_GPIO10;
43 else return -1;
44 }
45
46 struct hw_pci gateway7001_pci __initdata = {
47 .nr_controllers = 1,
48 .ops = &ixp4xx_ops,
49 .preinit = gateway7001_pci_preinit,
50 .setup = ixp4xx_setup,
51 .map_irq = gateway7001_map_irq,
52 };
53
gateway7001_pci_init(void)54 int __init gateway7001_pci_init(void)
55 {
56 if (machine_is_gateway7001())
57 pci_common_init(&gateway7001_pci);
58 return 0;
59 }
60
61 subsys_initcall(gateway7001_pci_init);
62