public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* mmc: core: negotiate ocr during resume
@ 2013-04-04 14:35 Prasanna NAVARATNA
  2013-04-09  8:43 ` Prasanna NAVARATNA
  0 siblings, 1 reply; 2+ messages in thread
From: Prasanna NAVARATNA @ 2013-04-04 14:35 UTC (permalink / raw)
  To: linux-mmc

>From f43005e05f1e9d93705ec6b3ab98cfa5215c1896 Mon Sep 17 00:00:00 2001
From: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
Date: Thu, 4 Apr 2013 19:55:19 +0530
Subject: [PATCH] mmc: core: negotiate ocr during resume

Save the card ocr into struct mmc_card when read from sd card and
negotiate ocr mask during mmc_sd_init_card with host->ocr & card->ocr.
---
 drivers/mmc/core/sd.c    |    7 +++++++
 include/linux/mmc/card.h |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 9e645e1..8ee27e8 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -910,6 +910,10 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 
ocr,
 	BUG_ON(!host);
 	WARN_ON(!host->claimed);
 
+	/* Negotiate OCR with oldcard->ocr */
+	if (oldcard)
+		ocr &= oldcard->ocr;
+
 	err = mmc_sd_get_cid(host, ocr, cid, &rocr);
 	if (err)
 		return err;
@@ -1185,6 +1189,9 @@ int mmc_attach_sd(struct mmc_host *host)
 		ocr &= ~MMC_VDD_165_195;
 	}
 
+	/* Save the card OCR */
+	host->card->ocr = ocr;
+
 	host->ocr = mmc_select_voltage(host, ocr);
 
 	/*
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index f31725b..1bbec2f 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -273,6 +273,7 @@ struct mmc_card {
 	u32			raw_cid[4];	/* raw card CID */
 	u32			raw_csd[4];	/* raw card CSD */
 	u32			raw_scr[2];	/* raw card SCR */
+	u32			ocr;		/* card OCR */
 	struct mmc_cid		cid;		/* card identification */
 	struct mmc_csd		csd;		/* card specific */
 	struct mmc_ext_csd	ext_csd;	/* mmc v4 extended card 
specific */
-- 
1.7.6



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-09  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-04 14:35 mmc: core: negotiate ocr during resume Prasanna NAVARATNA
2013-04-09  8:43 ` Prasanna NAVARATNA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox