1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#include <linux/pci.h>
26#include <linux/init.h>
27#include <linux/delay.h>
28#include <linux/irq.h>
29#include <asm/mach-types.h>
30#include <mach/hardware.h>
31#include <asm/mach/pci.h>
32
33#define SLOT0_DEVID 0
34#define SLOT1_DEVID 1
35#define INTA 10
36#define INTB 11
37
38
39
40
41
42
43
44void __init gtwx5715_pci_preinit(void)
45{
46 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);
48 ixp4xx_pci_preinit();
49}
50
51
52static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
53{
54 int rc = -1;
55
56 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);
62
63 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
64 __func__, slot, pin, rc);
65 return rc;
66}
67
68struct hw_pci gtwx5715_pci __initdata = {
69 .nr_controllers = 1,
70 .ops = &ixp4xx_ops,
71 .preinit = gtwx5715_pci_preinit,
72 .setup = ixp4xx_setup,
73 .map_irq = gtwx5715_map_irq,
74};
75
76int __init gtwx5715_pci_init(void)
77{
78 if (machine_is_gtwx5715())
79 pci_common_init(>wx5715_pci);
80
81 return 0;
82}
83
84subsys_initcall(gtwx5715_pci_init);
85