aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/drivers/pci/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/drivers/pci/pci.c')
-rw-r--r--arch/sh/drivers/pci/pci.c48
1 files changed, 10 insertions, 38 deletions
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1e9598d2bbf4..194231cb5a70 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -19,6 +19,7 @@
19#include <linux/dma-debug.h> 19#include <linux/dma-debug.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22#include <linux/spinlock.h>
22 23
23unsigned long PCIBIOS_MIN_IO = 0x0000; 24unsigned long PCIBIOS_MIN_IO = 0x0000;
24unsigned long PCIBIOS_MIN_MEM = 0; 25unsigned long PCIBIOS_MIN_MEM = 0;
@@ -56,6 +57,11 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose)
56 } 57 }
57} 58}
58 59
60/*
61 * This interrupt-safe spinlock protects all accesses to PCI
62 * configuration space.
63 */
64DEFINE_RAW_SPINLOCK(pci_config_lock);
59static DEFINE_MUTEX(pci_scan_mutex); 65static DEFINE_MUTEX(pci_scan_mutex);
60 66
61int __devinit register_pci_controller(struct pci_channel *hose) 67int __devinit register_pci_controller(struct pci_channel *hose)
@@ -78,7 +84,7 @@ int __devinit register_pci_controller(struct pci_channel *hose)
78 hose_tail = &hose->next; 84 hose_tail = &hose->next;
79 85
80 /* 86 /*
81 * Do not panic here but later - this might hapen before console init. 87 * Do not panic here but later - this might happen before console init.
82 */ 88 */
83 if (!hose->io_map_base) { 89 if (!hose->io_map_base) {
84 printk(KERN_WARNING 90 printk(KERN_WARNING
@@ -233,40 +239,7 @@ void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
233 239
234int pcibios_enable_device(struct pci_dev *dev, int mask) 240int pcibios_enable_device(struct pci_dev *dev, int mask)
235{ 241{
236 u16 cmd, old_cmd; 242 return pci_enable_resources(dev, mask);
237 int idx;
238 struct resource *r;
239
240 pci_read_config_word(dev, PCI_COMMAND, &cmd);
241 old_cmd = cmd;
242 for (idx=0; idx < PCI_NUM_RESOURCES; idx++) {
243 /* Only set up the requested stuff */
244 if (!(mask & (1<<idx)))
245 continue;
246
247 r = &dev->resource[idx];
248 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
249 continue;
250 if ((idx == PCI_ROM_RESOURCE) &&
251 (!(r->flags & IORESOURCE_ROM_ENABLE)))
252 continue;
253 if (!r->start && r->end) {
254 printk(KERN_ERR "PCI: Device %s not available "
255 "because of resource collisions\n",
256 pci_name(dev));
257 return -EINVAL;
258 }
259 if (r->flags & IORESOURCE_IO)
260 cmd |= PCI_COMMAND_IO;
261 if (r->flags & IORESOURCE_MEM)
262 cmd |= PCI_COMMAND_MEMORY;
263 }
264 if (cmd != old_cmd) {
265 printk("PCI: Enabling device %s (%04x -> %04x)\n",
266 pci_name(dev), old_cmd, cmd);
267 pci_write_config_word(dev, PCI_COMMAND, cmd);
268 }
269 return 0;
270} 243}
271 244
272/* 245/*
@@ -295,7 +268,7 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq)
295 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 268 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
296} 269}
297 270
298char * __devinit pcibios_setup(char *str) 271char * __devinit __weak pcibios_setup(char *str)
299{ 272{
300 return str; 273 return str;
301} 274}
@@ -409,14 +382,13 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
409 struct pci_channel *chan = dev->sysdata; 382 struct pci_channel *chan = dev->sysdata;
410 383
411 if (unlikely(!chan->io_map_base)) { 384 if (unlikely(!chan->io_map_base)) {
412 chan->io_map_base = generic_io_base; 385 chan->io_map_base = sh_io_port_base;
413 386
414 if (pci_domains_supported) 387 if (pci_domains_supported)
415 panic("To avoid data corruption io_map_base MUST be " 388 panic("To avoid data corruption io_map_base MUST be "
416 "set with multiple PCI domains."); 389 "set with multiple PCI domains.");
417 } 390 }
418 391
419
420 return (void __iomem *)(chan->io_map_base + port); 392 return (void __iomem *)(chan->io_map_base + port);
421} 393}
422 394