2 * arch/ppc/platforms/lopec_pci.c
4 * PCI setup routines for the Motorola LoPEC.
7 * danc@mvista.com (or, alternately, source@mvista.com)
9 * Copyright 2001 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.
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/pci.h>
20 #include <linux/slab.h>
22 #include <asm/machdep.h>
23 #include <asm/byteorder.h>
26 #include <asm/uaccess.h>
27 #include <asm/pci-bridge.h>
28 #include <asm/open_pic.h>
29 #include <asm/mpc10x.h>
31 static inline int __init
32 lopec_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
35 static char pci_irq_table[][4] = {
36 {16, 0, 0, 0}, /* ID 11 - Winbond */
37 {22, 0, 0, 0}, /* ID 12 - SCSI */
38 {0, 0, 0, 0}, /* ID 13 - nothing */
39 {17, 0, 0, 0}, /* ID 14 - 82559 Ethernet */
40 {27, 0, 0, 0}, /* ID 15 - USB */
41 {23, 0, 0, 0}, /* ID 16 - PMC slot 1 */
42 {24, 0, 0, 0}, /* ID 17 - PMC slot 2 */
43 {25, 0, 0, 0}, /* ID 18 - PCI slot */
44 {0, 0, 0, 0}, /* ID 19 - nothing */
45 {0, 0, 0, 0}, /* ID 20 - nothing */
46 {0, 0, 0, 0}, /* ID 21 - nothing */
47 {0, 0, 0, 0}, /* ID 22 - nothing */
48 {0, 0, 0, 0}, /* ID 23 - nothing */
49 {0, 0, 0, 0}, /* ID 24 - PMC slot 1b */
50 {0, 0, 0, 0}, /* ID 25 - nothing */
51 {0, 0, 0, 0} /* ID 26 - PMC Slot 2b */
53 const long min_idsel = 11, max_idsel = 26, irqs_per_slot = 4;
55 irq = PCI_IRQ_TABLE_LOOKUP;
63 lopec_setup_winbond_83553(struct pci_controller *hose)
67 devfn = PCI_DEVFN(11,0);
69 /* IDE interrupt routing (primary 14, secondary 15) */
70 early_write_config_byte(hose, 0, devfn, 0x43, 0xef);
71 /* PCI interrupt routing */
72 early_write_config_word(hose, 0, devfn, 0x44, 0x0000);
74 /* ISA-PCI address decoder */
75 early_write_config_byte(hose, 0, devfn, 0x48, 0xf0);
77 /* RTC, kb, not used in PPC */
78 early_write_config_byte(hose, 0, devfn, 0x4d, 0x00);
79 early_write_config_byte(hose, 0, devfn, 0x4e, 0x04);
80 devfn = PCI_DEVFN(11, 1);
81 early_write_config_byte(hose, 0, devfn, 0x09, 0x8f);
82 early_write_config_dword(hose, 0, devfn, 0x40, 0x00ff0011);
86 lopec_find_bridges(void)
88 struct pci_controller *hose;
90 hose = pcibios_alloc_controller();
94 hose->first_busno = 0;
95 hose->last_busno = 0xff;
97 if (mpc10x_bridge_init(hose,
100 MPC10X_MAPB_EUMB_BASE) == 0) {
102 hose->mem_resources[0].end = 0xffffffff;
103 lopec_setup_winbond_83553(hose);
104 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
105 ppc_md.pci_swizzle = common_swizzle;
106 ppc_md.pci_map_irq = lopec_map_irq;