2 * arch/ppc/platforms/spruce_pci.c
4 * PCI support for IBM Spruce
6 * Author: Johnnie Peters
9 * 2000 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/pci.h>
18 #include <linux/slab.h>
20 #include <asm/byteorder.h>
22 #include <asm/uaccess.h>
23 #include <asm/machdep.h>
24 #include <asm/pci-bridge.h>
25 #include <platforms/spruce.h>
30 spruce_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
32 static char pci_irq_table[][4] =
34 * PCI IDSEL/INTPIN->INTLINE
38 {23, 24, 25, 26}, /* IDSEL 1 - PCI slot 3 */
39 {24, 25, 26, 23}, /* IDSEL 2 - PCI slot 2 */
40 {25, 26, 23, 24}, /* IDSEL 3 - PCI slot 1 */
41 {26, 23, 24, 25}, /* IDSEL 4 - PCI slot 0 */
44 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
45 return PCI_IRQ_TABLE_LOOKUP;
49 spruce_setup_hose(void)
51 struct pci_controller *hose;
54 hose = pcibios_alloc_controller();
58 hose->first_busno = 0;
59 hose->last_busno = 0xff;
61 pci_init_resource(&hose->io_resource,
67 pci_init_resource(&hose->mem_resources[0],
73 hose->io_space.start = SPRUCE_PCI_LOWER_IO;
74 hose->io_space.end = SPRUCE_PCI_UPPER_IO;
75 hose->mem_space.start = SPRUCE_PCI_LOWER_MEM;
76 hose->mem_space.end = SPRUCE_PCI_UPPER_MEM;
77 hose->io_base_virt = (void *)SPRUCE_ISA_IO_BASE;
79 setup_indirect_pci(hose,
80 SPRUCE_PCI_CONFIG_ADDR,
81 SPRUCE_PCI_CONFIG_DATA);
83 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
85 ppc_md.pci_swizzle = common_swizzle;
86 ppc_md.pci_map_irq = spruce_map_irq;