MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / arm / mach-ixp4xx / prpmc1100-pci.c
bloba0aed9ca38342a89773acde74be291b5d9b3a8b1
1 /*
2 * arch/arm/mach-ixp4xx/prpmc1100-pci.c
4 * PrPMC1100 PCI initialization
6 * Copyright (C) 2003-2004 MontaVista Sofwtare, Inc.
7 * Based on IXDP425 code originally (C) Intel Corporation
9 * Author: Deepak Saxena <dsaxena@plexity.net>
11 * PrPMC1100 PCI init code. GPIO usage is similar to that on
12 * IXDP425, but the IRQ routing is completely different and
13 * depends on what carrier you are using. This code is written
14 * to work on the Motorola PrPMC800 ATX carrier board.
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
22 #include <linux/config.h>
23 #include <linux/pci.h>
24 #include <linux/init.h>
26 #include <asm/mach-types.h>
27 #include <asm/irq.h>
28 #include <asm/hardware.h>
30 #include <asm/mach/pci.h>
33 void __init prpmc1100_pci_preinit(void)
35 gpio_line_config(PRPMC1100_PCI_INTA_PIN,
36 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
37 gpio_line_config(PRPMC1100_PCI_INTB_PIN,
38 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
39 gpio_line_config(PRPMC1100_PCI_INTC_PIN,
40 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
41 gpio_line_config(PRPMC1100_PCI_INTD_PIN,
42 IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
44 gpio_line_isr_clear(PRPMC1100_PCI_INTA_PIN);
45 gpio_line_isr_clear(PRPMC1100_PCI_INTB_PIN);
46 gpio_line_isr_clear(PRPMC1100_PCI_INTC_PIN);
47 gpio_line_isr_clear(PRPMC1100_PCI_INTD_PIN);
49 ixp4xx_pci_preinit();
53 static int __init prpmc1100_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
55 int irq = -1;
57 static int pci_irq_table[][4] = {
58 { /* IDSEL 16 - PMC A1 */
59 IRQ_PRPMC1100_PCI_INTD,
60 IRQ_PRPMC1100_PCI_INTA,
61 IRQ_PRPMC1100_PCI_INTB,
62 IRQ_PRPMC1100_PCI_INTC
63 }, { /* IDSEL 17 - PRPMC-A-B */
64 IRQ_PRPMC1100_PCI_INTD,
65 IRQ_PRPMC1100_PCI_INTA,
66 IRQ_PRPMC1100_PCI_INTB,
67 IRQ_PRPMC1100_PCI_INTC
68 }, { /* IDSEL 18 - PMC A1-B */
69 IRQ_PRPMC1100_PCI_INTA,
70 IRQ_PRPMC1100_PCI_INTB,
71 IRQ_PRPMC1100_PCI_INTC,
72 IRQ_PRPMC1100_PCI_INTD
73 }, { /* IDSEL 19 - Unused */
74 0, 0, 0, 0
75 }, { /* IDSEL 20 - P2P Bridge */
76 IRQ_PRPMC1100_PCI_INTA,
77 IRQ_PRPMC1100_PCI_INTB,
78 IRQ_PRPMC1100_PCI_INTC,
79 IRQ_PRPMC1100_PCI_INTD
80 }, { /* IDSEL 21 - PMC A2 */
81 IRQ_PRPMC1100_PCI_INTC,
82 IRQ_PRPMC1100_PCI_INTD,
83 IRQ_PRPMC1100_PCI_INTA,
84 IRQ_PRPMC1100_PCI_INTB
85 }, { /* IDSEL 22 - PMC A2-B */
86 IRQ_PRPMC1100_PCI_INTD,
87 IRQ_PRPMC1100_PCI_INTA,
88 IRQ_PRPMC1100_PCI_INTB,
89 IRQ_PRPMC1100_PCI_INTC
93 if (slot >= PRPMC1100_PCI_MIN_DEVID && slot <= PRPMC1100_PCI_MAX_DEVID
94 && pin >= 1 && pin <= PRPMC1100_PCI_IRQ_LINES) {
95 irq = pci_irq_table[slot - PRPMC1100_PCI_MIN_DEVID][pin - 1];
98 return irq;
102 struct hw_pci prpmc1100_pci __initdata = {
103 .nr_controllers = 1,
104 .preinit = prpmc1100_pci_preinit,
105 .swizzle = pci_std_swizzle,
106 .setup = ixp4xx_setup,
107 .scan = ixp4xx_scan_bus,
108 .map_irq = prpmc1100_map_irq,
111 int __init prpmc1100_pci_init(void)
113 if (machine_is_prpmc1100())
114 pci_common_init(&prpmc1100_pci);
115 return 0;
118 subsys_initcall(prpmc1100_pci_init);