aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2014-02-21 12:48:01 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-02-25 06:37:49 -0500
commit27e8efdbf1aecb65dd712fd93766f1a04b86ac22 (patch)
tree9b792ac60d58397fc2be04943cd55b0ce7d6d0b6
parentdb38ee874c48713d0723221d08332242e0088970 (diff)
ARM: 7986/1: bios32: use pci_enable_resource to enable PCI resources
This patch moves bios32 over to using the generic code for enabling PCI resources. Since the core code takes care of bridge resources too, we can also drop the explicit IO and MEMORY enabling for them in the arch code. A side-effect of this change is that we no longer explicitly enable devices when running in PCI_PROBE_ONLY mode. This stays closer to the meaning of the option and prevents us from trying to enable devices without any assigned resources (the core code refuses to enable resources without parents). Tested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Tested-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/kernel/bios32.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 317da88ae65b..91f48804e3bb 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -608,41 +608,10 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
608 */ 608 */
609int pcibios_enable_device(struct pci_dev *dev, int mask) 609int pcibios_enable_device(struct pci_dev *dev, int mask)
610{ 610{
611 u16 cmd, old_cmd; 611 if (pci_has_flag(PCI_PROBE_ONLY))
612 int idx; 612 return 0;
613 struct resource *r;
614
615 pci_read_config_word(dev, PCI_COMMAND, &cmd);
616 old_cmd = cmd;
617 for (idx = 0; idx < 6; idx++) {
618 /* Only set up the requested stuff */
619 if (!(mask & (1 << idx)))
620 continue;
621
622 r = dev->resource + idx;
623 if (!r->start && r->end) {
624 printk(KERN_ERR "PCI: Device %s not available because"
625 " of resource collisions\n", pci_name(dev));
626 return -EINVAL;
627 }
628 if (r->flags & IORESOURCE_IO)
629 cmd |= PCI_COMMAND_IO;
630 if (r->flags & IORESOURCE_MEM)
631 cmd |= PCI_COMMAND_MEMORY;
632 }
633 613
634 /* 614 return pci_enable_resources(dev, mask);
635 * Bridges (eg, cardbus bridges) need to be fully enabled
636 */
637 if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)
638 cmd |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
639
640 if (cmd != old_cmd) {
641 printk("PCI: enabling device %s (%04x -> %04x)\n",
642 pci_name(dev), old_cmd, cmd);
643 pci_write_config_word(dev, PCI_COMMAND, cmd);
644 }
645 return 0;
646} 615}
647 616
648int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 617int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,