1 /*
2  * arch/ppc/platforms/pal4_pci.c
3  *
4  * PCI support for SBS Palomar IV
5  *
6  * Author: Dan Cox
7  *
8  * 2002 (c) MontaVista, Software, Inc.  This file is licensed under
9  * the terms of the GNU General Public License version 2.  This program
10  * is licensed "as is" without any warranty of any kind, whether express
11  * or implied.
12  */
13 
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/pci.h>
17 
18 #include <asm/byteorder.h>
19 #include <asm/machdep.h>
20 #include <asm/io.h>
21 #include <asm/pci-bridge.h>
22 #include <asm/uaccess.h>
23 
24 #include "cpc700.h"
25 #include "pal4.h"
26 
27 /* not much to this.... */
28 static inline int __init
pal4_map_irq(struct pci_dev * dev,unsigned char idsel,unsigned char pin)29 pal4_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
30 {
31 	if (idsel == 9)
32 		return PAL4_ETH;
33 	else
34 		return PAL4_INTA + (idsel - 3);
35 }
36 
37 void __init
pal4_find_bridges(void)38 pal4_find_bridges(void)
39 {
40 	struct pci_controller *hose;
41 
42 	hose = pcibios_alloc_controller();
43 	if (!hose)
44 		return;
45 
46 	hose->first_busno = 0;
47 	hose->last_busno = 0xff;
48 	hose->pci_mem_offset = 0;
49 
50 	/* Could snatch these from the CPC700.... */
51 	pci_init_resource(&hose->io_resource,
52 			  0x0,
53 			  0x03ffffff,
54 			  IORESOURCE_IO,
55 			  "PCI host bridge");
56 
57 	pci_init_resource(&hose->mem_resources[0],
58 			  0x90000000,
59 			  0x9fffffff,
60 			  IORESOURCE_MEM,
61 			  "PCI host bridge");
62 
63 	hose->io_space.start = 0x00800000;
64 	hose->io_space.end = 0x03ffffff;
65 	hose->mem_space.start = 0x90000000;
66 	hose->mem_space.end = 0x9fffffff;
67 	hose->io_base_virt = (void *) 0xf8000000;
68 
69 	setup_indirect_pci(hose, CPC700_PCI_CONFIG_ADDR,
70 			   CPC700_PCI_CONFIG_DATA);
71 
72 	hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
73 
74 	ppc_md.pci_swizzle = common_swizzle;
75 	ppc_md.pci_map_irq = pal4_map_irq;
76 }
77