MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / arm / mach-ixp4xx / ixdp425-pci.c
blob7baa60c2d52d3bf200537e8bcbd166f07532cb95
1 /*
2 * arch/arm/mach-ixp4xx/ixdp425-pci.c
4 * IXDP425 board-level PCI initialization
6 * Copyright (C) 2002 Intel Corporation.
7 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
17 #include <linux/config.h>
18 #include <linux/pci.h>
19 #include <linux/init.h>
20 #include <linux/delay.h>
22 #include <asm/mach/pci.h>
23 #include <asm/irq.h>
24 #include <asm/hardware.h>
25 #include <asm/mach-types.h>
27 void __init ixdp425_pci_preinit(void)
29 gpio_line_config(IXDP425_PCI_INTA_PIN,
30 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
31 gpio_line_config(IXDP425_PCI_INTB_PIN,
32 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
33 gpio_line_config(IXDP425_PCI_INTC_PIN,
34 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
35 gpio_line_config(IXDP425_PCI_INTD_PIN,
36 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
38 gpio_line_isr_clear(IXDP425_PCI_INTA_PIN);
39 gpio_line_isr_clear(IXDP425_PCI_INTB_PIN);
40 gpio_line_isr_clear(IXDP425_PCI_INTC_PIN);
41 gpio_line_isr_clear(IXDP425_PCI_INTD_PIN);
43 ixp4xx_pci_preinit();
46 static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
48 static int pci_irq_table[IXDP425_PCI_IRQ_LINES] = {
49 IRQ_IXDP425_PCI_INTA,
50 IRQ_IXDP425_PCI_INTB,
51 IRQ_IXDP425_PCI_INTC,
52 IRQ_IXDP425_PCI_INTD
55 int irq = -1;
57 if (slot >= 1 && slot <= IXDP425_PCI_MAX_DEV &&
58 pin >= 1 && pin <= IXDP425_PCI_IRQ_LINES) {
59 irq = pci_irq_table[(slot + pin - 2) % 4];
62 return irq;
65 struct hw_pci ixdp425_pci __initdata = {
66 .nr_controllers = 1,
67 .preinit = ixdp425_pci_preinit,
68 .swizzle = pci_std_swizzle,
69 .setup = ixp4xx_setup,
70 .scan = ixp4xx_scan_bus,
71 .map_irq = ixdp425_map_irq,
74 int __init ixdp425_pci_init(void)
76 if (machine_is_ixdp425() ||
77 machine_is_ixcdp1100() ||
78 machine_is_avila())
79 pci_common_init(&ixdp425_pci);
80 return 0;
83 subsys_initcall(ixdp425_pci_init);