mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Juergen Beisert <jbe@pengutronix.de>
Subject: [PATCH 2/4] mci: Print more info
Date: Mon,  3 Jun 2013 12:49:38 +0200	[thread overview]
Message-ID: <1370256580-3113-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1370256580-3113-1-git-send-email-s.hauer@pengutronix.de>

In devinfo for the card also print:

- capabilities for host and card
- current bus width
- current clock

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/mci-core.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index fc921e5..86600ec 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1366,6 +1366,16 @@ static unsigned extract_mtd_year(struct mci *mci)
 		return UNSTUFF_BITS(mci->cid, 8, 4) + 1997;
 }
 
+static void mci_print_caps(unsigned caps)
+{
+	printf("  capabilities: %s%s%s%s%s\n",
+		caps & MMC_CAP_4_BIT_DATA ? "4bit " : "",
+		caps & MMC_CAP_8_BIT_DATA ? "8bit " : "",
+		caps & MMC_CAP_SD_HIGHSPEED ? "sd-hs " : "",
+		caps & MMC_CAP_MMC_HIGHSPEED ? "mmc-hs " : "",
+		caps & MMC_CAP_MMC_HIGHSPEED_52MHZ ? "mmc-52MHz " : "");
+}
+
 /**
  * Output some valuable information when the user runs 'devinfo' on an MCI device
  * @param mci MCI device instance
@@ -1373,13 +1383,28 @@ static unsigned extract_mtd_year(struct mci *mci)
 static void mci_info(struct device_d *dev)
 {
 	struct mci *mci = container_of(dev, struct mci, dev);
+	struct mci_host *host = mci->host;
+	int bw;
 
 	if (mci->ready_for_use == 0) {
 		printf(" No information available:\n  MCI card not probed yet\n");
 		return;
 	}
 
-	printf(" Card:\n");
+	printf("Host information:\n");
+	printf("  current clock: %d\n", host->clock);
+
+	if (host->bus_width == MMC_BUS_WIDTH_8)
+		bw = 8;
+	else if (host->bus_width == MMC_BUS_WIDTH_4)
+		bw = 4;
+	else
+		bw = 1;
+
+	printf("  current buswidth: %d\n", bw);
+	mci_print_caps(host->host_caps);
+
+	printf("Card information:\n");
 	if (mci->version < SD_VERSION_SD) {
 		printf("  Attached is a MultiMediaCard (Version: %u.%u)\n",
 			(mci->version >> 4) & 0xf, mci->version & 0xf);
@@ -1396,6 +1421,7 @@ static void mci_info(struct device_d *dev)
 	printf("   CSD: %08X-%08X-%08X-%08X\n", mci->csd[0], mci->csd[1],
 		mci->csd[2], mci->csd[3]);
 	printf("  Max. transfer speed: %u Hz\n", mci->tran_speed);
+	mci_print_caps(mci->card_caps);
 	printf("  Manufacturer ID: %02X\n", extract_mid(mci));
 	printf("  OEM/Application ID: %04X\n", extract_oid(mci));
 	printf("  Product name: '%c%c%c%c%c'\n", mci->cid[0] & 0xff,
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-06-03 10:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 10:49 [PATCH 1/4] mci: rename capabilities flags Sascha Hauer
2013-06-03 10:49 ` Sascha Hauer [this message]
2013-06-03 10:49 ` [PATCH 3/4] mci: add mci_caps function Sascha Hauer
2013-06-03 10:49 ` [PATCH 4/4] mci: Use tran_speed field to fix highspeed MMC card clock Sascha Hauer

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=1370256580-3113-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jbe@pengutronix.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