From: Raffaele Recalcati <lamiaposta71@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 3/3][v4] mmc: trace added
Date: Fri, 11 Mar 2011 13:01:14 +0100 [thread overview]
Message-ID: <1299844874-7605-4-git-send-email-lamiaposta71@gmail.com> (raw)
In-Reply-To: <1299844874-7605-1-git-send-email-lamiaposta71@gmail.com>
From: Raffaele Recalcati <raffaele.recalcati@bticino.it>
Defining CONFIG_MMC_TRACE in the include board file it is possible to activate
a tracing support.
This code helps in case of eMMC hw failure or to investigate possible eMMC
initialization issues.
Signed-off-by: Raffaele Recalcati <raffaele.recalcati@bticino.it>
---
drivers/mmc/mmc.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 5bea476..3395d7c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -45,7 +45,60 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc)__attribute__((weak,
int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
{
+#ifdef CONFIG_MMC_TRACE
+ int ret;
+ int i;
+ u8 *ptr;
+
+ printf("CMD_SEND:%d\n", cmd->cmdidx);
+ printf("\t\tARG\t\t\t 0x%08X\n", cmd->cmdarg);
+ printf("\t\tFLAG\t\t\t %d\n", cmd->flags);
+ ret = mmc->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 = &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;
+ }
+ return ret;
+#else
return mmc->send_cmd(mmc, cmd, data);
+#endif
}
int mmc_send_status(struct mmc *mmc, int timeout)
@@ -74,6 +127,10 @@ int mmc_send_status(struct mmc *mmc, int timeout)
}
} while (timeout--);
+#ifdef CONFIG_MMC_TRACE
+ status = (cmd.response[0] & MMC_STATUS_CURR_STATE) >> 9;
+ printf("CURR STATE:%d\n", status);
+#endif
if (!timeout) {
printf("Timeout waiting card ready\n");
return TIMEOUT;
--
1.7.0.4
prev parent reply other threads:[~2011-03-11 12:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 12:01 [U-Boot] [RFC 0/3][v4] mmc inizialization steps enhanced Raffaele Recalcati
2011-03-11 12:01 ` [U-Boot] [RFC 1/3][v4] mmc: checking status after commands with R1b response Raffaele Recalcati
2011-03-11 12:18 ` Lei Wen
2011-08-06 12:07 ` Marek Vasut
2011-08-06 12:18 ` Lei Wen
2011-03-11 12:01 ` [U-Boot] [RFC 2/3][v4] mmc: SEND_OP_COND considers card capabilities (voltage) Raffaele Recalcati
2011-03-11 12:18 ` Lei Wen
2011-04-13 11:24 ` Andy Fleming
2011-04-14 7:48 ` Raffaele Recalcati
2011-07-28 19:25 ` Gary Thomas
2011-08-17 2:51 ` Andy Fleming
2011-03-11 12:01 ` Raffaele Recalcati [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299844874-7605-4-git-send-email-lamiaposta71@gmail.com \
--to=lamiaposta71@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox