]>
Commit | Line | Data |
---|---|---|
0f185971 MLJ |
1 | /* |
2 | * arch/arm/mach-ixp4xx/avila-pci.c | |
3 | * | |
4 | * Gateworks Avila board-level PCI initialization | |
5 | * | |
6 | * Author: Michael-Luke Jones <mlj28@cam.ac.uk> | |
7 | * | |
8 | * Based on ixdp-pci.c | |
9 | * Copyright (C) 2002 Intel Corporation. | |
10 | * Copyright (C) 2003-2004 MontaVista Software, Inc. | |
11 | * | |
12 | * Maintainer: Deepak Saxena <dsaxena@plexity.net> | |
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 | #include <linux/delay.h> | |
25 | ||
26 | #include <asm/mach/pci.h> | |
27 | #include <asm/irq.h> | |
a09e64fb | 28 | #include <mach/hardware.h> |
0f185971 MLJ |
29 | #include <asm/mach-types.h> |
30 | ||
31 | void __init avila_pci_preinit(void) | |
32 | { | |
6cab4860 DES |
33 | set_irq_type(IRQ_AVILA_PCI_INTA, IRQ_TYPE_LEVEL_LOW); |
34 | set_irq_type(IRQ_AVILA_PCI_INTB, IRQ_TYPE_LEVEL_LOW); | |
35 | set_irq_type(IRQ_AVILA_PCI_INTC, IRQ_TYPE_LEVEL_LOW); | |
36 | set_irq_type(IRQ_AVILA_PCI_INTD, IRQ_TYPE_LEVEL_LOW); | |
0f185971 MLJ |
37 | |
38 | ixp4xx_pci_preinit(); | |
39 | } | |
40 | ||
41 | static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |
42 | { | |
43 | static int pci_irq_table[AVILA_PCI_IRQ_LINES] = { | |
44 | IRQ_AVILA_PCI_INTA, | |
45 | IRQ_AVILA_PCI_INTB, | |
46 | IRQ_AVILA_PCI_INTC, | |
47 | IRQ_AVILA_PCI_INTD | |
48 | }; | |
49 | ||
50 | int irq = -1; | |
51 | ||
52 | if (slot >= 1 && | |
53 | slot <= (machine_is_loft() ? LOFT_PCI_MAX_DEV : AVILA_PCI_MAX_DEV) && | |
54 | pin >= 1 && pin <= AVILA_PCI_IRQ_LINES) { | |
55 | irq = pci_irq_table[(slot + pin - 2) % 4]; | |
56 | } | |
57 | ||
58 | return irq; | |
59 | } | |
60 | ||
61 | struct hw_pci avila_pci __initdata = { | |
62 | .nr_controllers = 1, | |
63 | .preinit = avila_pci_preinit, | |
64 | .swizzle = pci_std_swizzle, | |
65 | .setup = ixp4xx_setup, | |
66 | .scan = ixp4xx_scan_bus, | |
67 | .map_irq = avila_map_irq, | |
68 | }; | |
69 | ||
70 | int __init avila_pci_init(void) | |
71 | { | |
72 | if (machine_is_avila() || machine_is_loft()) | |
73 | pci_common_init(&avila_pci); | |
74 | return 0; | |
75 | } | |
76 | ||
77 | subsys_initcall(avila_pci_init); | |
78 |