2 * arch/arm/mach-ixp4xx/nslu2-pci.c
4 * NSLU2 board-level PCI initialization
6 * based on ixdp425-pci.c:
7 * Copyright (C) 2002 Intel Corporation.
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
10 * Maintainer: http://www.nslu2-linux.org/
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.
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
22 #include <linux/config.h>
23 #include <linux/pci.h>
24 #include <linux/init.h>
25 #include <linux/delay.h>
27 #include <asm/mach/pci.h>
29 #include <asm/hardware.h>
30 #include <asm/mach-types.h>
32 void __init nslu2_pci_preinit(void)
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);
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);
51 static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
53 static int pci_irq_table[NSLU2_PCI_IRQ_LINES] = {
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
70 struct hw_pci __initdata nslu2_pci = {
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,
79 int __init nslu2_pci_init(void) //monkey see, monkey do
81 if (machine_is_nslu2())
82 pci_common_init(&nslu2_pci);
86 subsys_initcall(nslu2_pci_init);