aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/mmc_ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/mmc_ops.c')
-rw-r--r--drivers/mmc/core/mmc_ops.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 770c3d06f5dc..4d41fa984c93 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/export.h>
13#include <linux/types.h> 14#include <linux/types.h>
14#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
15 16
@@ -233,7 +234,7 @@ static int
233mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, 234mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
234 u32 opcode, void *buf, unsigned len) 235 u32 opcode, void *buf, unsigned len)
235{ 236{
236 struct mmc_request mrq = {0}; 237 struct mmc_request mrq = {NULL};
237 struct mmc_command cmd = {0}; 238 struct mmc_command cmd = {0};
238 struct mmc_data data = {0}; 239 struct mmc_data data = {0};
239 struct scatterlist sg; 240 struct scatterlist sg;
@@ -414,7 +415,7 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
414 return -EBADMSG; 415 return -EBADMSG;
415 } else { 416 } else {
416 if (status & 0xFDFFA000) 417 if (status & 0xFDFFA000)
417 printk(KERN_WARNING "%s: unexpected status %#x after " 418 pr_warning("%s: unexpected status %#x after "
418 "switch", mmc_hostname(card->host), status); 419 "switch", mmc_hostname(card->host), status);
419 if (status & R1_SWITCH_ERROR) 420 if (status & R1_SWITCH_ERROR)
420 return -EBADMSG; 421 return -EBADMSG;
@@ -454,7 +455,7 @@ static int
454mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode, 455mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode,
455 u8 len) 456 u8 len)
456{ 457{
457 struct mmc_request mrq = {0}; 458 struct mmc_request mrq = {NULL};
458 struct mmc_command cmd = {0}; 459 struct mmc_command cmd = {0};
459 struct mmc_data data = {0}; 460 struct mmc_data data = {0};
460 struct scatterlist sg; 461 struct scatterlist sg;
@@ -476,7 +477,7 @@ mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode,
476 else if (len == 4) 477 else if (len == 4)
477 test_buf = testdata_4bit; 478 test_buf = testdata_4bit;
478 else { 479 else {
479 printk(KERN_ERR "%s: Invalid bus_width %d\n", 480 pr_err("%s: Invalid bus_width %d\n",
480 mmc_hostname(host), len); 481 mmc_hostname(host), len);
481 kfree(data_buf); 482 kfree(data_buf);
482 return -EINVAL; 483 return -EINVAL;
@@ -547,3 +548,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); 548 err = mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width);
548 return err; 549 return err;
549} 550}
551
552int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status)
553{
554 struct mmc_command cmd = {0};
555 unsigned int opcode;
556 unsigned int flags;
557 int err;
558
559 opcode = card->ext_csd.hpi_cmd;
560 if (opcode == MMC_STOP_TRANSMISSION)
561 flags = MMC_RSP_R1 | MMC_CMD_AC;
562 else if (opcode == MMC_SEND_STATUS)
563 flags = MMC_RSP_R1 | MMC_CMD_AC;
564
565 cmd.opcode = opcode;
566 cmd.arg = card->rca << 16 | 1;
567 cmd.flags = flags;
568 cmd.cmd_timeout_ms = card->ext_csd.out_of_int_time;
569
570 err = mmc_wait_for_cmd(card->host, &cmd, 0);
571 if (err) {
572 pr_warn("%s: error %d interrupting operation. "
573 "HPI command response %#x\n", mmc_hostname(card->host),
574 err, cmd.resp[0]);
575 return err;
576 }
577 if (status)
578 *status = cmd.resp[0];
579
580 return 0;
581}