Skip to contentSkip to conversation

mmc: Limit MMC speed to 52MHz if not HS200

PATCH RESEND In review Al Cooper 2 participants 2 messages Nov 30, 2012 – Dec 3, 2012 MMC, SD and SDIO

lore
Share & tools
lore

Al Cooper

author
#0 lore raw

PATCH RESEND 1/1 mmc: Limit MMC speed to 52MHz if not HS200

If "caps2" host capabilities does not indicate support for MMC HS200, don't allow clock speeds >52MHz. Currently, for MMC, the clock speed is set to the lesser of the max speed the eMMC module supports (card->ext_csd.hs_max_dtr) or the max base clock of the host controller (host->f_max based on BASE_CLK_FREQ in the host CAPS register). This means that a host controller that doesn't support HS200 mode but has a base clock of 100MHz and an eMMC module that supports HS200 speeds will end up using a 100MHz clock.

---
 drivers/mmc/core/mmc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/mmc/core/mmc.c +2 -0
index 7cc4638..6d669c3 100644
@@ -1051,6 +1051,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	if (mmc_card_highspeed(card) || mmc_card_hs200(card)) {
 		if (max_dtr > card->ext_csd.hs_max_dtr)
 			max_dtr = card->ext_csd.hs_max_dtr;
+		if (mmc_card_highspeed(card) && (max_dtr > 52000000))
+			max_dtr = 52000000;
 	} else if (max_dtr > card->csd.max_dtr) {
 		max_dtr = card->csd.max_dtr;
 	}
Signature · 1 line
1.7.6
#1 lore raw

Hi Al,

Quoted 19 lines · Al Cooper

If "caps2" host capabilities does not indicate support for MMC HS200, don't allow clock speeds >52MHz. Currently, for MMC, the clock speed is set to the lesser of the max speed the eMMC module supports (card->ext_csd.hs_max_dtr) or the max base clock of the host controller (host->f_max based on BASE_CLK_FREQ in the host CAPS register). This means that a host controller that doesn't support HS200 mode but has a base clock of 100MHz and an eMMC module that supports HS200 speeds will end up using a 100MHz clock.

---
 drivers/mmc/core/mmc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/mmc/core/mmc.c +0 -0
index 7cc4638..6d669c3 100644

drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32 ocr, · line 1058

Quoted 8 lines
drivers/mmc/core/mmc.c +2 -0
@@ -1051,6 +1051,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	if (mmc_card_highspeed(card) || mmc_card_hs200(card)) {
 		if (max_dtr > card->ext_csd.hs_max_dtr)
 			max_dtr = card->ext_csd.hs_max_dtr;
+		if (mmc_card_highspeed(card) && (max_dtr > 52000000))
+			max_dtr = 52000000;
 	} else if (max_dtr > card->csd.max_dtr) {
 		max_dtr = card->csd.max_dtr;
 	}

Thanks, pushed to mmc-next for 3.8.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child