diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2006-06-30 05:22:33 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-07-02 13:02:00 -0400 |
commit | 645289dca5021224279e67b4655796cafdfdad00 (patch) | |
tree | 93b577adc6d6a8c77553525696726eb2d5297fb4 | |
parent | 067da0f4faea4cc077a346d7848eec39a58870b4 (diff) |
[MMC] sdhci: quirk for broken reset
Some controllers fail to complete a reset unless you touch the clock register
first.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | drivers/mmc/sdhci.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index e192f3c9a437..7994c0b70f15 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -32,9 +32,21 @@ static unsigned int debug_nodma = 0; | |||
32 | static unsigned int debug_forcedma = 0; | 32 | static unsigned int debug_forcedma = 0; |
33 | static unsigned int debug_quirks = 0; | 33 | static unsigned int debug_quirks = 0; |
34 | 34 | ||
35 | #define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) | ||
36 | |||
35 | static const struct pci_device_id pci_ids[] __devinitdata = { | 37 | static const struct pci_device_id pci_ids[] __devinitdata = { |
36 | /* handle any SD host controller */ | 38 | { |
37 | {PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)}, | 39 | .vendor = PCI_VENDOR_ID_RICOH, |
40 | .device = PCI_DEVICE_ID_RICOH_R5C822, | ||
41 | .subvendor = PCI_VENDOR_ID_IBM, | ||
42 | .subdevice = PCI_ANY_ID, | ||
43 | .driver_data = SDHCI_QUIRK_CLOCK_BEFORE_RESET, | ||
44 | }, | ||
45 | |||
46 | { /* Generic SD host controller */ | ||
47 | PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00) | ||
48 | }, | ||
49 | |||
38 | { /* end: all zeroes */ }, | 50 | { /* end: all zeroes */ }, |
39 | }; | 51 | }; |
40 | 52 | ||
@@ -808,6 +820,19 @@ static void sdhci_tasklet_finish(unsigned long param) | |||
808 | if ((mrq->cmd->error != MMC_ERR_NONE) || | 820 | if ((mrq->cmd->error != MMC_ERR_NONE) || |
809 | (mrq->data && ((mrq->data->error != MMC_ERR_NONE) || | 821 | (mrq->data && ((mrq->data->error != MMC_ERR_NONE) || |
810 | (mrq->data->stop && (mrq->data->stop->error != MMC_ERR_NONE))))) { | 822 | (mrq->data->stop && (mrq->data->stop->error != MMC_ERR_NONE))))) { |
823 | |||
824 | /* Some controllers need this kick or reset won't work here */ | ||
825 | if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) { | ||
826 | unsigned int clock; | ||
827 | |||
828 | /* This is to force an update */ | ||
829 | clock = host->clock; | ||
830 | host->clock = 0; | ||
831 | sdhci_set_clock(host, clock); | ||
832 | } | ||
833 | |||
834 | /* Spec says we should do both at the same time, but Ricoh | ||
835 | controllers do not like that. */ | ||
811 | sdhci_reset(host, SDHCI_RESET_CMD); | 836 | sdhci_reset(host, SDHCI_RESET_CMD); |
812 | sdhci_reset(host, SDHCI_RESET_DATA); | 837 | sdhci_reset(host, SDHCI_RESET_DATA); |
813 | } | 838 | } |