import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / Documentation / mips / pci / pci.README
1
2 Pete Popov, ppopov@pacbell.net
3 07/11/2001
4
5 This README briefly explains how to use the pci and pci_auto
6 code in arch/mips/kernel.  The code was ported from PowerPC and
7 modified slightly. It has been tested pretty well on PPC on some
8 rather complex systems with multiple bridges and devices behind
9 each bridge. However, at the time this README was written, the
10 mips port was tested only on boards with a single pci bus and
11 no P2P bridges.  It's very possible that on boards with P2P
12 bridges some modifications have to be made. The code will 
13 evolve, no doubt, but currently every single mips board
14 is doing its own pcibios thing and it has become a big
15 mess.  This generic pci code is meant to clean up the mips
16 pci mess and make it easier to add pci support to new boards.
17
18 arch/mips/kernel/pci_auto.c has the pci bus enumeration code.
19 This code scans the pci bus(es) and assigns all of the resources.
20 Thus, you don't need the boot code to that, and many boot codes
21 don't do it correctly anyway.  To enable the pci_auto code, add
22
23 define_bool CONFIG_PCI_AUTO y 
24
25 inside the define for your board in arch/mips/config.in. 
26 For example, the Galileo EV96100 board  looks like this:
27
28 if [ "$CONFIG_MIPS_EV96100" = "y" ]; then
29         define_bool CONFIG_PCI y
30         define_bool CONFIG_MIPS_GT96100 y
31         define_bool CONFIG_NEW_PCI y
32         define_bool CONFIG_PCI_AUTO y
33         define_bool CONFIG_SWAP_IO_SPACE y
34 fi 
35
36
37 Next, if you want to use the arch/mips/kernel/pci code, which has the
38 pcibios_init() function, add
39
40 define_bool CONFIG_NEW_PCI y
41  
42 inside the define for your board. Again, the EV96100 example above
43 show NEW_PCI turned on.
44
45 Note that you can enable CONFIG_NEW_PCI code without enabling 
46 CONFIG_PCI_AUTO. But you can't do the opposite because the pci_auto
47 routines are called from pcibios_init(), which is part of the 
48 CONFIG_NEW_PCI code.
49
50
51 Now you need to add your files to hook in your pci configuration
52 cycles.  Usually you'll need only a couple of files named something
53 like pci_fixups.c and pci_ops.c.  You can copy the templates
54 provided and fill in the code.
55
56 The file pci_ops.c should contain the pci configuration cycles routines.
57 It also has the mips_pci_channels[] array which contains the descriptors
58 of each pci controller.
59
60 The file pci_fixups.c contains a few routines to do interrupt fixups,
61 resources fixups, and, if needed, pci bios fixups.
62
63 Usually you'll put your pci_fixups.c file in your board specific directory, 
64 since the functions in that file are board specific.  The functions in
65 pci_ops.c, on the other hand, are usually pci controller specific so that
66 file could be shared among a few different boards using the same
67 pci controller.