Josh Boyer 220cb1c
From 65ff02dff67bf26a9c27d9aa11a30eaf3d28469e Mon Sep 17 00:00:00 2001
Josh Boyer 220cb1c
From: Josh Boyer <jwboyer@redhat.com>
Josh Boyer 220cb1c
Date: Wed, 5 Oct 2011 11:29:57 -0400
Josh Boyer 220cb1c
Subject: [PATCH] mmc: Always check for lower base frequency quirk for Ricoh
Josh Boyer 220cb1c
 1180:e823
Josh Boyer 220cb1c
Josh Boyer 220cb1c
Commit 15bed0f2f added a quirk for the e823 Ricoh card reader to lower the
Josh Boyer 220cb1c
base frequency.  However, the quirk first checks to see if the proprietary
Josh Boyer 220cb1c
MMC controller is disabled, and returns if so.  On some devices, such as the
Josh Boyer 220cb1c
Lenovo X220, the MMC controller is already disabled by firmware it seems,
Josh Boyer 220cb1c
but the frequency change is still needed so sdhci-pci can talk to the cards.
Josh Boyer 220cb1c
Since the MMC controller is disabled, the frequency fixup was never being run
Josh Boyer 220cb1c
on these machines.
Josh Boyer 220cb1c
Josh Boyer 220cb1c
This moves the e823 check above the MMC controller check so that it always
Josh Boyer 220cb1c
gets run.
Josh Boyer 220cb1c
Josh Boyer 220cb1c
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=722509
Josh Boyer 220cb1c
Josh Boyer 220cb1c
Signed-off-by: Josh Boyer <jwboyer@redhat.com>
Josh Boyer 220cb1c
---
Josh Boyer 220cb1c
 drivers/pci/quirks.c |   28 ++++++++++++++--------------
Josh Boyer 220cb1c
 1 files changed, 14 insertions(+), 14 deletions(-)
Josh Boyer 220cb1c
Josh Boyer 220cb1c
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
Josh Boyer 220cb1c
index 1196f61..cec4629 100644
Josh Boyer 220cb1c
--- a/drivers/pci/quirks.c
Josh Boyer 220cb1c
+++ b/drivers/pci/quirks.c
Josh Boyer 220cb1c
@@ -2745,20 +2745,6 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
Josh Boyer 220cb1c
 	/* disable must be done via function #0 */
Josh Boyer 220cb1c
 	if (PCI_FUNC(dev->devfn))
Josh Boyer 220cb1c
 		return;
Josh Boyer 220cb1c
-
Josh Boyer 220cb1c
-	pci_read_config_byte(dev, 0xCB, &disable);
Josh Boyer 220cb1c
-
Josh Boyer 220cb1c
-	if (disable & 0x02)
Josh Boyer 220cb1c
-		return;
Josh Boyer 220cb1c
-
Josh Boyer 220cb1c
-	pci_read_config_byte(dev, 0xCA, &write_enable);
Josh Boyer 220cb1c
-	pci_write_config_byte(dev, 0xCA, 0x57);
Josh Boyer 220cb1c
-	pci_write_config_byte(dev, 0xCB, disable | 0x02);
Josh Boyer 220cb1c
-	pci_write_config_byte(dev, 0xCA, write_enable);
Josh Boyer 220cb1c
-
Josh Boyer 220cb1c
-	dev_notice(&dev->dev, "proprietary Ricoh MMC controller disabled (via firewire function)\n");
Josh Boyer 220cb1c
-	dev_notice(&dev->dev, "MMC cards are now supported by standard SDHCI controller\n");
Josh Boyer 220cb1c
-
Josh Boyer 220cb1c
 	/*
Josh Boyer 220cb1c
 	 * RICOH 0xe823 SD/MMC card reader fails to recognize
Josh Boyer 220cb1c
 	 * certain types of SD/MMC cards. Lowering the SD base
Josh Boyer 220cb1c
@@ -2781,6 +2767,20 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
Josh Boyer 220cb1c
 
Josh Boyer 220cb1c
 		dev_notice(&dev->dev, "MMC controller base frequency changed to 50Mhz.\n");
Josh Boyer 220cb1c
 	}
Josh Boyer 220cb1c
+
Josh Boyer 220cb1c
+	pci_read_config_byte(dev, 0xCB, &disable);
Josh Boyer 220cb1c
+
Josh Boyer 220cb1c
+	if (disable & 0x02)
Josh Boyer 220cb1c
+		return;
Josh Boyer 220cb1c
+
Josh Boyer 220cb1c
+	pci_read_config_byte(dev, 0xCA, &write_enable);
Josh Boyer 220cb1c
+	pci_write_config_byte(dev, 0xCA, 0x57);
Josh Boyer 220cb1c
+	pci_write_config_byte(dev, 0xCB, disable | 0x02);
Josh Boyer 220cb1c
+	pci_write_config_byte(dev, 0xCA, write_enable);
Josh Boyer 220cb1c
+
Josh Boyer 220cb1c
+	dev_notice(&dev->dev, "proprietary Ricoh MMC controller disabled (via firewire function)\n");
Josh Boyer 220cb1c
+	dev_notice(&dev->dev, "MMC cards are now supported by standard SDHCI controller\n");
Josh Boyer 220cb1c
+
Josh Boyer 220cb1c
 }
Josh Boyer 220cb1c
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
Josh Boyer 220cb1c
 DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
Josh Boyer 220cb1c
-- 
Josh Boyer 220cb1c
1.7.6.4
Josh Boyer 220cb1c