aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaehoon Chung <jh80.chung@samsung.com>2012-03-11 19:57:27 -0400
committerChris Ball <cjb@laptop.org>2012-03-27 12:20:12 -0400
commit2378975bd5ed583da555c7e5dee121663b7d5f46 (patch)
treea559ad5e1319701473139280a0dded127c8a8a37
parentee698f503442741ca394d55c77b61c9080537686 (diff)
mmc: core: warn when card doesn't support HPI
Someone could use send_hpi_cmd() on a card that doesn't advertise support for HPI. Then maybe didn't work fine. Because card->ext_csd.hpi_cmd didn't set. So if card didn't support hpi, return the warning message. And CMD12's flags is MMC_RSP_R1B. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/core/mmc_ops.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 4d41fa984c9..69370f494e0 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -553,18 +553,22 @@ int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status)
553{ 553{
554 struct mmc_command cmd = {0}; 554 struct mmc_command cmd = {0};
555 unsigned int opcode; 555 unsigned int opcode;
556 unsigned int flags;
557 int err; 556 int err;
558 557
558 if (!card->ext_csd.hpi) {
559 pr_warning("%s: Card didn't support HPI command\n",
560 mmc_hostname(card->host));
561 return -EINVAL;
562 }
563
559 opcode = card->ext_csd.hpi_cmd; 564 opcode = card->ext_csd.hpi_cmd;
560 if (opcode == MMC_STOP_TRANSMISSION) 565 if (opcode == MMC_STOP_TRANSMISSION)
561 flags = MMC_RSP_R1 | MMC_CMD_AC; 566 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
562 else if (opcode == MMC_SEND_STATUS) 567 else if (opcode == MMC_SEND_STATUS)
563 flags = MMC_RSP_R1 | MMC_CMD_AC; 568 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
564 569
565 cmd.opcode = opcode; 570 cmd.opcode = opcode;
566 cmd.arg = card->rca << 16 | 1; 571 cmd.arg = card->rca << 16 | 1;
567 cmd.flags = flags;
568 cmd.cmd_timeout_ms = card->ext_csd.out_of_int_time; 572 cmd.cmd_timeout_ms = card->ext_csd.out_of_int_time;
569 573
570 err = mmc_wait_for_cmd(card->host, &cmd, 0); 574 err = mmc_wait_for_cmd(card->host, &cmd, 0);