aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/sdhci.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2006-10-04 05:15:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 10:55:14 -0400
commit8a4da1430f7f2a16df3be9c7b5d55ba4e75b708c (patch)
tree1a4eb2814db6b2f6a14e2955daa784edb2a453de /drivers/mmc/sdhci.c
parent5f25a66f6bbac563c94af94f03491b3ae43c40af (diff)
[PATCH] mmc: avoid some resets without card
Some Ricoh controllers only respect a full reset when there is no card in the slot. As we wait for the reset to complete, we must avoid even requesting those resets on the buggy controllers. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r--drivers/mmc/sdhci.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 9ff9231116a6..20711acb0120 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -35,6 +35,8 @@ static unsigned int debug_quirks = 0;
35 35
36#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) 36#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0)
37#define SDHCI_QUIRK_FORCE_DMA (1<<1) 37#define SDHCI_QUIRK_FORCE_DMA (1<<1)
38/* Controller doesn't like some resets when there is no card inserted. */
39#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
38 40
39static const struct pci_device_id pci_ids[] __devinitdata = { 41static const struct pci_device_id pci_ids[] __devinitdata = {
40 { 42 {
@@ -51,7 +53,8 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
51 .device = PCI_DEVICE_ID_RICOH_R5C822, 53 .device = PCI_DEVICE_ID_RICOH_R5C822,
52 .subvendor = PCI_ANY_ID, 54 .subvendor = PCI_ANY_ID,
53 .subdevice = PCI_ANY_ID, 55 .subdevice = PCI_ANY_ID,
54 .driver_data = SDHCI_QUIRK_FORCE_DMA, 56 .driver_data = SDHCI_QUIRK_FORCE_DMA |
57 SDHCI_QUIRK_NO_CARD_NO_RESET,
55 }, 58 },
56 59
57 { 60 {
@@ -125,6 +128,12 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
125{ 128{
126 unsigned long timeout; 129 unsigned long timeout;
127 130
131 if (host->chip->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
132 if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) &
133 SDHCI_CARD_PRESENT))
134 return;
135 }
136
128 writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET); 137 writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET);
129 138
130 if (mask & SDHCI_RESET_ALL) 139 if (mask & SDHCI_RESET_ALL)
@@ -1174,6 +1183,9 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1174 host = mmc_priv(mmc); 1183 host = mmc_priv(mmc);
1175 host->mmc = mmc; 1184 host->mmc = mmc;
1176 1185
1186 host->chip = chip;
1187 chip->hosts[slot] = host;
1188
1177 host->bar = first_bar + slot; 1189 host->bar = first_bar + slot;
1178 1190
1179 host->addr = pci_resource_start(pdev, host->bar); 1191 host->addr = pci_resource_start(pdev, host->bar);
@@ -1330,9 +1342,6 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1330 sdhci_dumpregs(host); 1342 sdhci_dumpregs(host);
1331#endif 1343#endif
1332 1344
1333 host->chip = chip;
1334 chip->hosts[slot] = host;
1335
1336 mmiowb(); 1345 mmiowb();
1337 1346
1338 mmc_add_host(mmc); 1347 mmc_add_host(mmc);