2 * arch/ppc/platforms/spruce_pci.c
4 * PCI support for IBM Spruce
6 * Author: Johnnie Peters
9 * Copyright 2000 MontaVista Software Inc.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 #include <linux/kernel.h>
33 #include <linux/init.h>
34 #include <linux/pci.h>
35 #include <linux/slab.h>
37 #include <asm/byteorder.h>
39 #include <asm/uaccess.h>
40 #include <asm/machdep.h>
41 #include <asm/pci-bridge.h>
42 #include <platforms/spruce.h>
47 spruce_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
49 static char pci_irq_table[][4] =
51 * PCI IDSEL/INTPIN->INTLINE
55 {23, 24, 25, 26}, /* IDSEL 1 - PCI slot 3 */
56 {24, 25, 26, 23}, /* IDSEL 2 - PCI slot 2 */
57 {25, 26, 23, 24}, /* IDSEL 3 - PCI slot 1 */
58 {26, 23, 24, 25}, /* IDSEL 4 - PCI slot 0 */
61 const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
62 return PCI_IRQ_TABLE_LOOKUP;
66 spruce_setup_hose(void)
68 struct pci_controller *hose;
71 hose = pcibios_alloc_controller();
75 hose->first_busno = 0;
76 hose->last_busno = 0xff;
78 pci_init_resource(&hose->io_resource,
84 pci_init_resource(&hose->mem_resources[0],
90 hose->io_space.start = SPRUCE_PCI_LOWER_IO;
91 hose->io_space.end = SPRUCE_PCI_UPPER_IO;
92 hose->mem_space.start = SPRUCE_PCI_LOWER_MEM;
93 hose->mem_space.end = SPRUCE_PCI_UPPER_MEM;
94 hose->io_base_virt = (void *)SPRUCE_ISA_IO_BASE;
96 setup_indirect_pci(hose,
97 SPRUCE_PCI_CONFIG_ADDR,
98 SPRUCE_PCI_CONFIG_DATA);
100 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
102 ppc_md.pci_swizzle = common_swizzle;
103 ppc_md.pci_map_irq = spruce_map_irq;