diff options
Diffstat (limited to 'arch/sh/drivers/pci/pci.c')
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 3d546ba329cf..1f5e23e8b163 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -1,21 +1,25 @@ | |||
1 | /* arch/sh/kernel/pci.c | 1 | /* |
2 | * $Id: pci.c,v 1.1 2003/08/24 19:15:45 lethal Exp $ | 2 | * arch/sh/drivers/pci/pci.c |
3 | * | 3 | * |
4 | * Copyright (c) 2002 M. R. Brown <mrbrown@linux-sh.org> | 4 | * Copyright (c) 2002 M. R. Brown <mrbrown@linux-sh.org> |
5 | * | 5 | * Copyright (c) 2004, 2005 Paul Mundt <lethal@linux-sh.org> |
6 | * | 6 | * |
7 | * These functions are collected here to reduce duplication of common | 7 | * These functions are collected here to reduce duplication of common |
8 | * code amongst the many platform-specific PCI support code files. | 8 | * code amongst the many platform-specific PCI support code files. |
9 | * | 9 | * |
10 | * These routines require the following board-specific routines: | 10 | * These routines require the following board-specific routines: |
11 | * void pcibios_fixup_irqs(); | 11 | * void pcibios_fixup_irqs(); |
12 | * | 12 | * |
13 | * See include/asm-sh/pci.h for more information. | 13 | * See include/asm-sh/pci.h for more information. |
14 | * | ||
15 | * This file is subject to the terms and conditions of the GNU General Public | ||
16 | * License. See the file "COPYING" in the main directory of this archive | ||
17 | * for more details. | ||
14 | */ | 18 | */ |
15 | |||
16 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
17 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
18 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <asm/io.h> | ||
19 | 23 | ||
20 | static int __init pcibios_init(void) | 24 | static int __init pcibios_init(void) |
21 | { | 25 | { |
@@ -26,9 +30,8 @@ static int __init pcibios_init(void) | |||
26 | #ifdef CONFIG_PCI_AUTO | 30 | #ifdef CONFIG_PCI_AUTO |
27 | /* assign resources */ | 31 | /* assign resources */ |
28 | busno = 0; | 32 | busno = 0; |
29 | for (p = board_pci_channels; p->pci_ops != NULL; p++) { | 33 | for (p = board_pci_channels; p->pci_ops != NULL; p++) |
30 | busno = pciauto_assign_resources(busno, p) + 1; | 34 | busno = pciauto_assign_resources(busno, p) + 1; |
31 | } | ||
32 | #endif | 35 | #endif |
33 | 36 | ||
34 | /* scan the buses */ | 37 | /* scan the buses */ |
@@ -61,13 +64,17 @@ pcibios_update_resource(struct pci_dev *dev, struct resource *root, | |||
61 | new |= PCI_ROM_ADDRESS_ENABLE; | 64 | new |= PCI_ROM_ADDRESS_ENABLE; |
62 | reg = dev->rom_base_reg; | 65 | reg = dev->rom_base_reg; |
63 | } else { | 66 | } else { |
64 | /* Somebody might have asked allocation of a non-standard resource */ | 67 | /* |
68 | * Somebody might have asked allocation of a non-standard | ||
69 | * resource | ||
70 | */ | ||
65 | return; | 71 | return; |
66 | } | 72 | } |
67 | 73 | ||
68 | pci_write_config_dword(dev, reg, new); | 74 | pci_write_config_dword(dev, reg, new); |
69 | pci_read_config_dword(dev, reg, &check); | 75 | pci_read_config_dword(dev, reg, &check); |
70 | if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) { | 76 | if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? |
77 | PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) { | ||
71 | printk(KERN_ERR "PCI: Error while updating region " | 78 | printk(KERN_ERR "PCI: Error while updating region " |
72 | "%s/%d (%08x != %08x)\n", pci_name(dev), resource, | 79 | "%s/%d (%08x != %08x)\n", pci_name(dev), resource, |
73 | new, check); | 80 | new, check); |
@@ -145,7 +152,8 @@ void pcibios_set_master(struct pci_dev *dev) | |||
145 | lat = pcibios_max_latency; | 152 | lat = pcibios_max_latency; |
146 | else | 153 | else |
147 | return; | 154 | return; |
148 | printk(KERN_INFO "PCI: Setting latency timer of device %s to %d\n", pci_name(dev), lat); | 155 | printk(KERN_INFO "PCI: Setting latency timer of device %s to %d\n", |
156 | pci_name(dev), lat); | ||
149 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); | 157 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); |
150 | } | 158 | } |
151 | 159 | ||
@@ -153,3 +161,29 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq) | |||
153 | { | 161 | { |
154 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | 162 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); |
155 | } | 163 | } |
164 | |||
165 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
166 | { | ||
167 | unsigned long start = pci_resource_start(dev, bar); | ||
168 | unsigned long len = pci_resource_len(dev, bar); | ||
169 | unsigned long flags = pci_resource_flags(dev, bar); | ||
170 | |||
171 | if (!len || !start) | ||
172 | return NULL; | ||
173 | if (maxlen && len > maxlen) | ||
174 | len = maxlen; | ||
175 | if (flags & IORESOURCE_IO) | ||
176 | return ioport_map(start, len); | ||
177 | if (flags & IORESOURCE_MEM) | ||
178 | return ioremap(start, len); | ||
179 | |||
180 | return NULL; | ||
181 | } | ||
182 | |||
183 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | ||
184 | { | ||
185 | iounmap(addr); | ||
186 | } | ||
187 | |||
188 | EXPORT_SYMBOL(pci_iomap); | ||
189 | EXPORT_SYMBOL(pci_iounmap); | ||