]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
1da177e4 LT |
2 | * Copyright (C) 2001 Dave Engebretsen, IBM Corporation |
3 | * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM | |
4 | * | |
5 | * pSeries specific routines for PCI. | |
6 | * | |
1da177e4 LT |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 | */ | |
21 | ||
c5a3c2e5 AB |
22 | #include <linux/init.h> |
23 | #include <linux/ioport.h> | |
1da177e4 | 24 | #include <linux/kernel.h> |
1da177e4 LT |
25 | #include <linux/pci.h> |
26 | #include <linux/string.h> | |
1da177e4 | 27 | |
1da177e4 | 28 | #include <asm/pci-bridge.h> |
c5a3c2e5 | 29 | #include <asm/prom.h> |
d387899f | 30 | #include <asm/ppc-pci.h> |
1da177e4 | 31 | |
1da177e4 LT |
32 | #if 0 |
33 | void pcibios_name_device(struct pci_dev *dev) | |
34 | { | |
35 | struct device_node *dn; | |
36 | ||
37 | /* | |
38 | * Add IBM loc code (slot) as a prefix to the device names for service | |
39 | */ | |
40 | dn = pci_device_to_OF_node(dev); | |
41 | if (dn) { | |
42 | char *loc_code = get_property(dn, "ibm,loc-code", 0); | |
43 | if (loc_code) { | |
44 | int loc_len = strlen(loc_code); | |
45 | if (loc_len < sizeof(dev->dev.name)) { | |
46 | memmove(dev->dev.name+loc_len+1, dev->dev.name, | |
47 | sizeof(dev->dev.name)-loc_len-1); | |
48 | memcpy(dev->dev.name, loc_code, loc_len); | |
49 | dev->dev.name[loc_len] = ' '; | |
50 | dev->dev.name[sizeof(dev->dev.name)-1] = '\0'; | |
51 | } | |
52 | } | |
53 | } | |
54 | } | |
55 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device); | |
56 | #endif | |
57 | ||
1da177e4 LT |
58 | static void __init pSeries_request_regions(void) |
59 | { | |
60 | if (!isa_io_base) | |
61 | return; | |
62 | ||
63 | request_region(0x20,0x20,"pic1"); | |
64 | request_region(0xa0,0x20,"pic2"); | |
65 | request_region(0x00,0x20,"dma1"); | |
66 | request_region(0x40,0x20,"timer"); | |
67 | request_region(0x80,0x10,"dma page reg"); | |
68 | request_region(0xc0,0x20,"dma2"); | |
69 | } | |
70 | ||
71 | void __init pSeries_final_fixup(void) | |
72 | { | |
1da177e4 LT |
73 | pSeries_request_regions(); |
74 | ||
75 | pci_addr_cache_build(); | |
76 | } | |
77 | ||
78 | /* | |
79 | * Assume the winbond 82c105 is the IDE controller on a | |
80 | * p610. We should probably be more careful in case | |
81 | * someone tries to plug in a similar adapter. | |
82 | */ | |
83 | static void fixup_winbond_82c105(struct pci_dev* dev) | |
84 | { | |
85 | int i; | |
86 | unsigned int reg; | |
87 | ||
e8222502 | 88 | if (!machine_is(pseries)) |
1da177e4 LT |
89 | return; |
90 | ||
91 | printk("Using INTC for W82c105 IDE controller.\n"); | |
92 | pci_read_config_dword(dev, 0x40, ®); | |
93 | /* Enable LEGIRQ to use INTC instead of ISA interrupts */ | |
94 | pci_write_config_dword(dev, 0x40, reg | (1<<11)); | |
95 | ||
96 | for (i = 0; i < DEVICE_COUNT_RESOURCE; ++i) { | |
97 | /* zap the 2nd function of the winbond chip */ | |
98 | if (dev->resource[i].flags & IORESOURCE_IO | |
99 | && dev->bus->number == 0 && dev->devfn == 0x81) | |
100 | dev->resource[i].flags &= ~IORESOURCE_IO; | |
101 | } | |
102 | } | |
103 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, | |
104 | fixup_winbond_82c105); |