diff mbox

[RFC] PCI: deal with device incorrectly reporting I/O decoding being enabled

Message ID 20091107135615.GE18639@mail.wantstofly.org (mailing list archive)
State RFC, archived
Headers show

Commit Message

Lennert Buytenhek Nov. 7, 2009, 1:56 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 8096819..cf170b9 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -662,11 +662,17 @@  int pcibios_enable_device(struct pci_dev *dev, int mask)
 	if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)
 		cmd |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
 
-	if (cmd != old_cmd) {
+	/*
+	 * Some devices (e.g. the Lava Quattro quad-port 16550A card)
+	 * can incorrectly report I/O decoding being enabled while it
+	 * is in fact not, so unconditionally perform the config space
+	 * write.
+	 */
+	if (cmd != old_cmd)
 		printk("PCI: enabling device %s (%04x -> %04x)\n",
 		       pci_name(dev), old_cmd, cmd);
-		pci_write_config_word(dev, PCI_COMMAND, cmd);
-	}
+	pci_write_config_word(dev, PCI_COMMAND, cmd);
+
 	return 0;
 }
 
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 706f82d..96fe13d 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -322,10 +322,16 @@  int pci_enable_resources(struct pci_dev *dev, int mask)
 			cmd |= PCI_COMMAND_MEMORY;
 	}
 
-	if (cmd != old_cmd) {
+	/*
+	 * Some devices (e.g. the Lava Quattro quad-port 16550A card)
+	 * can incorrectly report I/O decoding being enabled while it
+	 * is in fact not, so unconditionally perform the config space
+	 * write.
+	 */
+	if (cmd != old_cmd)
 		dev_info(&dev->dev, "enabling device (%04x -> %04x)\n",
 			 old_cmd, cmd);
-		pci_write_config_word(dev, PCI_COMMAND, cmd);
-	}
+	pci_write_config_word(dev, PCI_COMMAND, cmd);
+
 	return 0;
 }