summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc.c
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2016-03-17 21:53:14 -0700
committerTom Rini <trini@konsulko.com>2016-03-27 09:12:24 -0400
commit7863ce589105bdcae9c5c45a33458f0d40536b01 (patch)
tree2d7346b851a6832cb038eb4f04d867ead1e6286d /drivers/mmc/mmc.c
parent53e8e40b4743fffc8d4042cba898107747ed04dd (diff)
mmc: Print send_cmd response only when return value is zero
send_cmd response is valid only when no error happened. If an error occured, let mmc_send_cmd() print the return value to aid debugging. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r--drivers/mmc/mmc.c80
1 files changed, 42 insertions, 38 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index a7f984328c..d3c22abfd5 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -61,46 +61,50 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
printf("CMD_SEND:%d\n", cmd->cmdidx);
printf("\t\tARG\t\t\t 0x%08X\n", cmd->cmdarg);
ret = mmc->cfg->ops->send_cmd(mmc, cmd, data);
- switch (cmd->resp_type) {
- case MMC_RSP_NONE:
- printf("\t\tMMC_RSP_NONE\n");
- break;
- case MMC_RSP_R1:
- printf("\t\tMMC_RSP_R1,5,6,7 \t 0x%08X \n",
- cmd->response[0]);
- break;
- case MMC_RSP_R1b:
- printf("\t\tMMC_RSP_R1b\t\t 0x%08X \n",
- cmd->response[0]);
- break;
- case MMC_RSP_R2:
- printf("\t\tMMC_RSP_R2\t\t 0x%08X \n",
- cmd->response[0]);
- printf("\t\t \t\t 0x%08X \n",
- cmd->response[1]);
- printf("\t\t \t\t 0x%08X \n",
- cmd->response[2]);
- printf("\t\t \t\t 0x%08X \n",
- cmd->response[3]);
- printf("\n");
- printf("\t\t\t\t\tDUMPING DATA\n");
- for (i = 0; i < 4; i++) {
- int j;
- printf("\t\t\t\t\t%03d - ", i*4);
- ptr = (u8 *)&cmd->response[i];
- ptr += 3;
- for (j = 0; j < 4; j++)
- printf("%02X ", *ptr--);
+ if (ret) {
+ printf("\t\tRET\t\t\t %d\n", ret);
+ } else {
+ switch (cmd->resp_type) {
+ case MMC_RSP_NONE:
+ printf("\t\tMMC_RSP_NONE\n");
+ break;
+ case MMC_RSP_R1:
+ printf("\t\tMMC_RSP_R1,5,6,7 \t 0x%08X \n",
+ cmd->response[0]);
+ break;
+ case MMC_RSP_R1b:
+ printf("\t\tMMC_RSP_R1b\t\t 0x%08X \n",
+ cmd->response[0]);
+ break;
+ case MMC_RSP_R2:
+ printf("\t\tMMC_RSP_R2\t\t 0x%08X \n",
+ cmd->response[0]);
+ printf("\t\t \t\t 0x%08X \n",
+ cmd->response[1]);
+ printf("\t\t \t\t 0x%08X \n",
+ cmd->response[2]);
+ printf("\t\t \t\t 0x%08X \n",
+ cmd->response[3]);
printf("\n");
+ printf("\t\t\t\t\tDUMPING DATA\n");
+ for (i = 0; i < 4; i++) {
+ int j;
+ printf("\t\t\t\t\t%03d - ", i*4);
+ ptr = (u8 *)&cmd->response[i];
+ ptr += 3;
+ for (j = 0; j < 4; j++)
+ printf("%02X ", *ptr--);
+ printf("\n");
+ }
+ break;
+ case MMC_RSP_R3:
+ printf("\t\tMMC_RSP_R3,4\t\t 0x%08X \n",
+ cmd->response[0]);
+ break;
+ default:
+ printf("\t\tERROR MMC rsp not supported\n");
+ break;
}
- break;
- case MMC_RSP_R3:
- printf("\t\tMMC_RSP_R3,4\t\t 0x%08X \n",
- cmd->response[0]);
- break;
- default:
- printf("\t\tERROR MMC rsp not supported\n");
- break;
}
#else
ret = mmc->cfg->ops->send_cmd(mmc, cmd, data);