diff options
Diffstat (limited to 'drivers/mmc/core/mmc_ops.c')
-rw-r--r-- | drivers/mmc/core/mmc_ops.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 4e11d56b3f70..007863eea4fb 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c | |||
@@ -547,3 +547,34 @@ int mmc_bus_test(struct mmc_card *card, u8 bus_width) | |||
547 | err = mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); | 547 | err = mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); |
548 | return err; | 548 | return err; |
549 | } | 549 | } |
550 | |||
551 | int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status) | ||
552 | { | ||
553 | struct mmc_command cmd = {0}; | ||
554 | unsigned int opcode; | ||
555 | unsigned int flags; | ||
556 | int err; | ||
557 | |||
558 | opcode = card->ext_csd.hpi_cmd; | ||
559 | if (opcode == MMC_STOP_TRANSMISSION) | ||
560 | flags = MMC_RSP_R1 | MMC_CMD_AC; | ||
561 | else if (opcode == MMC_SEND_STATUS) | ||
562 | flags = MMC_RSP_R1 | MMC_CMD_AC; | ||
563 | |||
564 | cmd.opcode = opcode; | ||
565 | cmd.arg = card->rca << 16 | 1; | ||
566 | cmd.flags = flags; | ||
567 | cmd.cmd_timeout_ms = card->ext_csd.out_of_int_time; | ||
568 | |||
569 | err = mmc_wait_for_cmd(card->host, &cmd, 0); | ||
570 | if (err) { | ||
571 | pr_warn("%s: error %d interrupting operation. " | ||
572 | "HPI command response %#x\n", mmc_hostname(card->host), | ||
573 | err, cmd.resp[0]); | ||
574 | return err; | ||
575 | } | ||
576 | if (status) | ||
577 | *status = cmd.resp[0]; | ||
578 | |||
579 | return 0; | ||
580 | } | ||