]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/openslug-kernel-2.6.11.2/nslu2-pci.c
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / openslug-kernel-2.6.11.2 / nslu2-pci.c
1 /*
2  * arch/arm/mach-ixp4xx/nslu2-pci.c
3  *
4  * NSLU2 board-level PCI initialization
5  *
6  * based on ixdp425-pci.c:
7  *      Copyright (C) 2002 Intel Corporation.
8  *      Copyright (C) 2003-2004 MontaVista Software, Inc.
9  *
10  * Maintainer: http://www.nslu2-linux.org/
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2 as
14  * published by the Free Software Foundation.
15  *
16  */
17 // GPIO 8 is used as the power input so is not free for use as a PCI IRQ
18 // However, all the common PCI setup code presumes the standard 4 PCI
19 // interrupts are available.  So we compromise...we don't enable the
20 // IRQ on Pin 8 but we let
21
22 #include <linux/config.h>
23 #include <linux/pci.h>
24 #include <linux/init.h>
25 #include <linux/delay.h>
26
27 #include <asm/mach/pci.h>
28 #include <asm/irq.h>
29 #include <asm/hardware.h>
30 #include <asm/mach-types.h>
31
32 void __init nslu2_pci_preinit(void)
33 {
34         gpio_line_config(NSLU2_PCI_INTA_PIN,
35                                 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
36         gpio_line_config(NSLU2_PCI_INTB_PIN,
37                                 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
38         gpio_line_config(NSLU2_PCI_INTC_PIN,
39                                 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
40 //      gpio_line_config(NSLU2_PCI_INTD_PIN,
41 //                              IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
42
43         gpio_line_isr_clear(NSLU2_PCI_INTA_PIN);
44         gpio_line_isr_clear(NSLU2_PCI_INTB_PIN);
45         gpio_line_isr_clear(NSLU2_PCI_INTC_PIN);
46 //      gpio_line_isr_clear(NSLU2_PCI_INTD_PIN);
47
48         ixp4xx_pci_preinit();
49 }
50
51 static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
52 {
53         static int pci_irq_table[NSLU2_PCI_IRQ_LINES] = {
54                 IRQ_NSLU2_PCI_INTA,
55                 IRQ_NSLU2_PCI_INTB,
56                 IRQ_NSLU2_PCI_INTC,
57 //              IRQ_NSLU2_PCI_INTD
58         };
59
60         int irq = -1;
61
62         if (slot >= 1 && slot <= NSLU2_PCI_MAX_DEV &&
63                 pin >= 1 && pin <= NSLU2_PCI_IRQ_LINES) {
64                 irq = pci_irq_table[(slot + pin - 2) % 3]; // ! % 4 kas11
65         }
66
67         return irq;
68 }
69
70 struct hw_pci __initdata nslu2_pci = {
71         .nr_controllers = 1,
72         .preinit        = nslu2_pci_preinit,
73         .swizzle        = pci_std_swizzle,
74         .setup          = ixp4xx_setup,
75         .scan           = ixp4xx_scan_bus,
76         .map_irq        = nslu2_map_irq,
77 };
78
79 int __init nslu2_pci_init(void)         //monkey see, monkey do
80 {
81         if (machine_is_nslu2())
82                 pci_common_init(&nslu2_pci);
83         return 0;
84 }
85
86 subsys_initcall(nslu2_pci_init);
87