Commit 2378975b authored by Jaehoon Chung's avatar Jaehoon Chung Committed by Chris Ball

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: default avatarJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent ee698f50
...@@ -553,18 +553,22 @@ int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status) ...@@ -553,18 +553,22 @@ int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status)
{ {
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
unsigned int opcode; unsigned int opcode;
unsigned int flags;
int err; int err;
if (!card->ext_csd.hpi) {
pr_warning("%s: Card didn't support HPI command\n",
mmc_hostname(card->host));
return -EINVAL;
}
opcode = card->ext_csd.hpi_cmd; opcode = card->ext_csd.hpi_cmd;
if (opcode == MMC_STOP_TRANSMISSION) if (opcode == MMC_STOP_TRANSMISSION)
flags = MMC_RSP_R1 | MMC_CMD_AC; cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
else if (opcode == MMC_SEND_STATUS) else if (opcode == MMC_SEND_STATUS)
flags = MMC_RSP_R1 | MMC_CMD_AC; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
cmd.opcode = opcode; cmd.opcode = opcode;
cmd.arg = card->rca << 16 | 1; cmd.arg = card->rca << 16 | 1;
cmd.flags = flags;
cmd.cmd_timeout_ms = card->ext_csd.out_of_int_time; cmd.cmd_timeout_ms = card->ext_csd.out_of_int_time;
err = mmc_wait_for_cmd(card->host, &cmd, 0); err = mmc_wait_for_cmd(card->host, &cmd, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment