]>
Commit | Line | Data |
---|---|---|
1bbce966 GKH |
1 | From stable-bounces@linux.kernel.org Mon Feb 26 19:33:30 2007 |
2 | From: Darren Salt <linux@youmustbejoking.demon.co.uk> | |
3 | Date: Tue, 27 Feb 2007 02:47:18 +0000 | |
4 | Subject: mmc: Power quirk for ENE controllers | |
5 | To: linux-kernel@vger.kernel.org, stable@kernel.org | |
6 | Message-ID: <4EBB823D2F%linux@youmustbejoking.demon.co.uk> | |
7 | ||
8 | From: Darren Salt <linux@youmustbejoking.demon.co.uk> | |
9 | ||
10 | mmc: Power quirk for ENE controllers | |
11 | ||
12 | Support for these devices was broken for 2.6.18-rc1 and later by commit | |
13 | 146ad66eac836c0b976c98f428d73e1f6a75270d, which added voltage level support. | |
14 | ||
15 | This restores the previous behaviour for these devices by ensuring that when | |
16 | the voltage is changed, only one write to set the voltage is performed. | |
17 | ||
18 | It may be that both writes are needed if the voltage is being changed between | |
19 | two non-zero values or that it's safe to ensure that only one write is done | |
20 | if the hardware only supports one voltage; I don't know whether either is the | |
21 | case nor can I test since I have only the one SD reader (1524:0550), and it | |
22 | supports just the one voltage. | |
23 | ||
24 | Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk> | |
25 | Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> | |
26 | Signed-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 |