diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/pci/fixup-ocelot.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/mips/pci/fixup-ocelot.c')
-rw-r--r-- | arch/mips/pci/fixup-ocelot.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/mips/pci/fixup-ocelot.c b/arch/mips/pci/fixup-ocelot.c new file mode 100644 index 000000000000..99629bd047ce --- /dev/null +++ b/arch/mips/pci/fixup-ocelot.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Copyright 2001 MontaVista Software Inc. | ||
3 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net | ||
4 | * | ||
5 | * arch/mips/gt64120/momenco_ocelot/pci.c | ||
6 | * Board-specific PCI routines for gt64120 controller. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/pci.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <asm/pci.h> | ||
18 | |||
19 | |||
20 | void __devinit pcibios_fixup_bus(struct pci_bus *bus) | ||
21 | { | ||
22 | struct pci_bus *current_bus = bus; | ||
23 | struct pci_dev *devices; | ||
24 | struct list_head *devices_link; | ||
25 | u16 cmd; | ||
26 | |||
27 | list_for_each(devices_link, &(current_bus->devices)) { | ||
28 | |||
29 | devices = pci_dev_b(devices_link); | ||
30 | if (devices == NULL) | ||
31 | continue; | ||
32 | |||
33 | if (PCI_SLOT(devices->devfn) == 1) { | ||
34 | /* | ||
35 | * Slot 1 is primary ether port, i82559 | ||
36 | * we double-check against that assumption | ||
37 | */ | ||
38 | if ((devices->vendor != 0x8086) || | ||
39 | (devices->device != 0x1209)) { | ||
40 | panic("pcibios_fixup_bus: found " | ||
41 | "unexpected PCI device in slot 1."); | ||
42 | } | ||
43 | devices->irq = 2; /* irq_nr is 2 for INT0 */ | ||
44 | } else if (PCI_SLOT(devices->devfn) == 2) { | ||
45 | /* | ||
46 | * Slot 2 is secondary ether port, i21143 | ||
47 | * we double-check against that assumption | ||
48 | */ | ||
49 | if ((devices->vendor != 0x1011) || | ||
50 | (devices->device != 0x19)) { | ||
51 | panic("galileo_pcibios_fixup_bus: " | ||
52 | "found unexpected PCI device in slot 2."); | ||
53 | } | ||
54 | devices->irq = 3; /* irq_nr is 3 for INT1 */ | ||
55 | } else if (PCI_SLOT(devices->devfn) == 4) { | ||
56 | /* PMC Slot 1 */ | ||
57 | devices->irq = 8; /* irq_nr is 8 for INT6 */ | ||
58 | } else if (PCI_SLOT(devices->devfn) == 5) { | ||
59 | /* PMC Slot 1 */ | ||
60 | devices->irq = 9; /* irq_nr is 9 for INT7 */ | ||
61 | } else { | ||
62 | /* We don't have assign interrupts for other devices. */ | ||
63 | devices->irq = 0xff; | ||
64 | } | ||
65 | |||
66 | /* Assign an interrupt number for the device */ | ||
67 | bus->ops->write_byte(devices, PCI_INTERRUPT_LINE, | ||
68 | devices->irq); | ||
69 | |||
70 | /* enable master */ | ||
71 | bus->ops->read_word(devices, PCI_COMMAND, &cmd); | ||
72 | cmd |= PCI_COMMAND_MASTER; | ||
73 | bus->ops->write_word(devices, PCI_COMMAND, cmd); | ||
74 | } | ||
75 | } | ||