Commit 31cacbabf07ce00f5250b9826d5e48d4bbee1f94
Committed by
Andy Fleming
1 parent
5d4fc8d907
Exists in
master
and in
54 other branches
mmc: SEND_OP_COND considers card capabilities (voltage)
The first SEND_OP_COND (CMD1) command added is used to ask card capabilities. After it an AND operation is done between card capabilities and host capabilities (at the moment only for the voltage field). Finally the correct value is sent to the MMC, waiting that the card exits from busy state. Signed-off-by: Raffaele Recalcati <raffaele.recalcati@bticino.it> Signed-off-by: Andy Fleming <afleming@freescale.com>
Showing 2 changed files with 20 additions and 3 deletions Side-by-side Diff
drivers/mmc/mmc.c
... | ... | @@ -367,18 +367,33 @@ |
367 | 367 | |
368 | 368 | int mmc_send_op_cond(struct mmc *mmc) |
369 | 369 | { |
370 | - int timeout = 1000; | |
370 | + int timeout = 10000; | |
371 | 371 | struct mmc_cmd cmd; |
372 | 372 | int err; |
373 | 373 | |
374 | 374 | /* Some cards seem to need this */ |
375 | 375 | mmc_go_idle(mmc); |
376 | 376 | |
377 | + /* Asking to the card its capabilities */ | |
378 | + cmd.cmdidx = MMC_CMD_SEND_OP_COND; | |
379 | + cmd.resp_type = MMC_RSP_R3; | |
380 | + cmd.cmdarg = 0; | |
381 | + cmd.flags = 0; | |
382 | + | |
383 | + err = mmc_send_cmd(mmc, &cmd, NULL); | |
384 | + | |
385 | + if (err) | |
386 | + return err; | |
387 | + | |
388 | + udelay(1000); | |
389 | + | |
377 | 390 | do { |
378 | 391 | cmd.cmdidx = MMC_CMD_SEND_OP_COND; |
379 | 392 | cmd.resp_type = MMC_RSP_R3; |
380 | - cmd.cmdarg = OCR_HCS | (mmc_host_is_spi(mmc) ? 0 : | |
381 | - mmc->voltages); | |
393 | + cmd.cmdarg = (mmc_host_is_spi(mmc) ? 0 : | |
394 | + (mmc->voltages & | |
395 | + (cmd.response[0] & OCR_VOLTAGE_MASK)) | | |
396 | + (cmd.response[0] & OCR_ACCESS_MODE)); | |
382 | 397 | cmd.flags = 0; |
383 | 398 | |
384 | 399 | err = mmc_send_cmd(mmc, &cmd, NULL); |
include/mmc.h