[PATCH 4/6] MCI/Core: honor transmission limits at the card's side

Juergen Beisert jbe at pengutronix.de
Fri Apr 26 05:31:50 EDT 2013


The host limits are only one limit we must honor when changing the transmission frequency.
The SD cards have their own limits, so take them also into account.

Signed-off-by: Juergen Beisert <jbe at pengutronix.de>
---
 drivers/mci/mci-core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 9aeaa4d..42e3d4b 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -605,13 +605,17 @@ static void mci_set_clock(struct mci *mci, unsigned clock)
 {
 	struct mci_host *host = mci->host;
 
-	/* check against any given limits */
+	/* check against any given limits at the host's side */
 	if (clock > host->f_max)
 		clock = host->f_max;
 
 	if (clock < host->f_min)
 		clock = host->f_min;
 
+	/* check against the limit at the card's side */
+	if (mci->tran_speed != 0 && clock > mci->tran_speed)
+		clock = mci->tran_speed;
+
 	host->clock = clock;	/* the new target frequency */
 	mci_set_ios(mci);
 }
-- 
1.8.2.rc2




More information about the barebox mailing list