aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-05-31 16:25:11 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-06-07 03:25:58 -0400
commit3373c0ae6a51085b10a95fd9d2214a9995ef7563 (patch)
tree0a25f54463f21b90d9c06b9bb4bbecb21880e18c /drivers/mmc
parent71651297a448289353b2493c6c3c183f9be7be7c (diff)
mmc: don't call switch on old cards
Make sure we don't call the switch function on cards too old to support it. They should just ignore it, but some have been reported to lock up instead. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/sd.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 5afac2081185..41bfb5dfe6ff 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -15,6 +15,7 @@
15#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
16#include <linux/mmc/card.h> 16#include <linux/mmc/card.h>
17#include <linux/mmc/mmc.h> 17#include <linux/mmc/mmc.h>
18#include <linux/mmc/sd.h>
18 19
19#include "core.h" 20#include "core.h"
20#include "sysfs.h" 21#include "sysfs.h"
@@ -192,6 +193,16 @@ static int mmc_read_switch(struct mmc_card *card)
192 int err; 193 int err;
193 u8 *status; 194 u8 *status;
194 195
196 if (card->scr.sda_vsn < SCR_SPEC_VER_1)
197 return MMC_ERR_NONE;
198
199 if (!(card->csd.cmdclass & CCC_SWITCH)) {
200 printk(KERN_WARNING "%s: card lacks mandatory switch "
201 "function, performance might suffer.\n",
202 mmc_hostname(card->host));
203 return MMC_ERR_NONE;
204 }
205
195 err = MMC_ERR_FAILED; 206 err = MMC_ERR_FAILED;
196 207
197 status = kmalloc(64, GFP_KERNEL); 208 status = kmalloc(64, GFP_KERNEL);
@@ -204,10 +215,9 @@ static int mmc_read_switch(struct mmc_card *card)
204 215
205 err = mmc_sd_switch(card, 0, 0, 1, status); 216 err = mmc_sd_switch(card, 0, 0, 1, status);
206 if (err != MMC_ERR_NONE) { 217 if (err != MMC_ERR_NONE) {
207 /* 218 printk(KERN_WARNING "%s: problem reading switch "
208 * Card not supporting high-speed will ignore the 219 "capabilities, performance might suffer.\n",
209 * command. 220 mmc_hostname(card->host));
210 */
211 err = MMC_ERR_NONE; 221 err = MMC_ERR_NONE;
212 goto out; 222 goto out;
213 } 223 }
@@ -229,6 +239,12 @@ static int mmc_switch_hs(struct mmc_card *card)
229 int err; 239 int err;
230 u8 *status; 240 u8 *status;
231 241
242 if (card->scr.sda_vsn < SCR_SPEC_VER_1)
243 return MMC_ERR_NONE;
244
245 if (!(card->csd.cmdclass & CCC_SWITCH))
246 return MMC_ERR_NONE;
247
232 if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) 248 if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
233 return MMC_ERR_NONE; 249 return MMC_ERR_NONE;
234 250