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 4/6] mci: Use csd_max_dtr when appropriate
Date: Fri, 31 May 2013 09:14:01 +0200	[thread overview]
Message-ID: <1369984443-8790-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1369984443-8790-1-git-send-email-s.hauer@pengutronix.de>

The csd_max_dtr tells us at which speed a card is able to operate,
so use it to adjust the cards clock where appropriate.

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

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index d7b8fc9..54660dc 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -919,7 +919,7 @@ static int mci_startup_sd(struct mci *mci)
 	if (mci->card_caps & MMC_MODE_HS)
 		mci_set_clock(mci, 50000000);
 	else
-		mci_set_clock(mci, 25000000);
+		mci_set_clock(mci, mci->csd_max_dtr);
 
 	return 0;
 }
@@ -929,6 +929,7 @@ static int mci_startup_mmc(struct mci *mci)
 	struct mci_host *host = mci->host;
 	int err;
 	int idx = 0;
+	int max_dtr;
 	static unsigned ext_csd_bits[] = {
 		EXT_CSD_BUS_WIDTH_4,
 		EXT_CSD_BUS_WIDTH_8,
@@ -941,13 +942,15 @@ static int mci_startup_mmc(struct mci *mci)
 	/* if possible, speed up the transfer */
 	if (mci->card_caps & MMC_MODE_HS) {
 		if (mci->card_caps & MMC_MODE_HS_52MHz)
-			mci_set_clock(mci, 52000000);
+			max_dtr = 52000000;
 		else
-			mci_set_clock(mci, 26000000);
+			max_dtr = 26000000;
 	} else {
-		mci_set_clock(mci, 20000000);
+		max_dtr = mci->csd_max_dtr;
 	}
 
+	mci_set_clock(mci, max_dtr);
+
 	/*
 	 * Unlike SD, MMC cards dont have a configuration register to notify
 	 * supported bus width. So bus test command should be run to identify
-- 
1.8.2.rc2


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

  parent reply	other threads:[~2013-05-31  7:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31  7:13 [PATCH 1/6] mci: print current clock in info Sascha Hauer
2013-05-31  7:13 ` [PATCH 2/6] mci: do not limit clock to card capabilities Sascha Hauer
2013-05-31  7:30   ` Juergen Beisert
2013-05-31  7:14 ` [PATCH 3/6] mci: rename trans_speed field to csd_max_dtr Sascha Hauer
2013-05-31  7:35   ` Juergen Beisert
2013-05-31  7:14 ` Sascha Hauer [this message]
2013-05-31  7:37   ` [PATCH 4/6] mci: Use csd_max_dtr when appropriate Juergen Beisert
2013-05-31  7:14 ` [PATCH 5/6] mci: Add devicetree helper function Sascha Hauer
2013-05-31  7:14 ` [PATCH 6/6] mci: i.MX esdhc: get additional parameters from devicetree Sascha Hauer
2013-05-31  7:33 ` [PATCH 1/6] mci: print current clock in info Juergen Beisert

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=1369984443-8790-4-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