]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.20.2/mmc-power-quirk-for-ene-controllers.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.20.2 / mmc-power-quirk-for-ene-controllers.patch
CommitLineData
1bbce966
GKH
1From stable-bounces@linux.kernel.org Mon Feb 26 19:33:30 2007
2From: Darren Salt <linux@youmustbejoking.demon.co.uk>
3Date: Tue, 27 Feb 2007 02:47:18 +0000
4Subject: mmc: Power quirk for ENE controllers
5To: linux-kernel@vger.kernel.org, stable@kernel.org
6Message-ID: <4EBB823D2F%linux@youmustbejoking.demon.co.uk>
7
8From: Darren Salt <linux@youmustbejoking.demon.co.uk>
9
10mmc: Power quirk for ENE controllers
11
12Support for these devices was broken for 2.6.18-rc1 and later by commit
13146ad66eac836c0b976c98f428d73e1f6a75270d, which added voltage level support.
14
15This restores the previous behaviour for these devices by ensuring that when
16the voltage is changed, only one write to set the voltage is performed.
17
18It may be that both writes are needed if the voltage is being changed between
19two non-zero values or that it's safe to ensure that only one write is done
20if the hardware only supports one voltage; I don't know whether either is the
21case nor can I test since I have only the one SD reader (1524:0550), and it
22supports just the one voltage.
23
24Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
25Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
26Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
27
28---
29 drivers/mmc/sdhci.c | 22 +++++++++++++++++++---
30 include/linux/pci_ids.h | 1 +
31 2 files changed, 20 insertions(+), 3 deletions(-)
32
33--- linux-2.6.20.1.orig/drivers/mmc/sdhci.c
34+++ linux-2.6.20.1/drivers/mmc/sdhci.c
35@@ -37,6 +37,7 @@ static unsigned int debug_quirks = 0;
36 #define SDHCI_QUIRK_FORCE_DMA (1<<1)
37 /* Controller doesn't like some resets when there is no card inserted. */
38 #define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
39+#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3)
40
41 static const struct pci_device_id pci_ids[] __devinitdata = {
42 {
43@@ -65,6 +66,14 @@ static const struct pci_device_id pci_id
44 .driver_data = SDHCI_QUIRK_FORCE_DMA,
45 },
46
47+ {
48+ .vendor = PCI_VENDOR_ID_ENE,
49+ .device = PCI_DEVICE_ID_ENE_CB712_SD,
50+ .subvendor = PCI_ANY_ID,
51+ .subdevice = PCI_ANY_ID,
52+ .driver_data = SDHCI_QUIRK_SINGLE_POWER_WRITE,
53+ },
54+
55 { /* Generic SD host controller */
56 PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
57 },
58@@ -674,10 +683,17 @@ static void sdhci_set_power(struct sdhci
59 if (host->power == power)
60 return;
61
62- writeb(0, host->ioaddr + SDHCI_POWER_CONTROL);
63-
64- if (power == (unsigned short)-1)
65+ if (power == (unsigned short)-1) {
66+ writeb(0, host->ioaddr + SDHCI_POWER_CONTROL);
67 goto out;
68+ }
69+
70+ /*
71+ * Spec says that we should clear the power reg before setting
72+ * a new value. Some controllers don't seem to like this though.
73+ */
74+ if (!(host->chip->quirks & SDHCI_QUIRK_SINGLE_POWER_WRITE))
75+ writeb(0, host->ioaddr + SDHCI_POWER_CONTROL);
76
77 pwr = SDHCI_POWER_ON;
78
79--- linux-2.6.20.1.orig/include/linux/pci_ids.h
80+++ linux-2.6.20.1/include/linux/pci_ids.h
81@@ -1971,6 +1971,7 @@
82 #define PCI_DEVICE_ID_TOPIC_TP560 0x0000
83
84 #define PCI_VENDOR_ID_ENE 0x1524
85+#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550
86 #define PCI_DEVICE_ID_ENE_1211 0x1211
87 #define PCI_DEVICE_ID_ENE_1225 0x1225
88 #define PCI_DEVICE_ID_ENE_1410 0x1410