Skip to contentSkip to conversation

mmc: sdhci: assigned to current clock value for host->clock

PATCH New Jaehoon Chung 2 participants 2 messages Oct 29, 2015 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: sdhci: assigned to current clock value for host->clock

There is no place where host->clock is assgined to any value. If real clock is changed to mmc->clock, host->clock can be assigned to mmc->clock. If card request to same clock value, it doesn't need to call sdhci_set_clock() function.

---
 drivers/mmc/sdhci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/sdhci.c +4 -2
index d89e302..3f87a23 100644
@@ -380,8 +380,10 @@ static void sdhci_set_ios(struct mmc *mmc)
 	if (host->set_control_reg)
 		host->set_control_reg(host);
 
-	if (mmc->clock != host->clock)
-		sdhci_set_clock(mmc, mmc->clock);
+	if (mmc->clock != host->clock) {
+		if (!sdhci_set_clock(mmc, mmc->clock))
+			host->clock = mmc->clock;
+	}
 
 	/* Set bus width */
 	ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 mmc: sdhci: assigned to current clock value for host->clock

Hi!

Quoted 15 lines · Jaehoon Chung

There is no place where host->clock is assgined to any value. If real clock is changed to mmc->clock, host->clock can be assigned to mmc->clock. If card request to same clock value, it doesn't need to call sdhci_set_clock() function.

---
 drivers/mmc/sdhci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/sdhci.c +0 -0
index d89e302..3f87a23 100644

drivers/mmc/sdhci.c static void sdhci_set_ios(struct mmc *mmc) · line 385

Quoted 8 lines
drivers/mmc/sdhci.c +3 -2
@@ -380,8 +380,10 @@ static void sdhci_set_ios(struct mmc *mmc)
 	if (host->set_control_reg)
 		host->set_control_reg(host);
 
-	if (mmc->clock != host->clock)
-		sdhci_set_clock(mmc, mmc->clock);
+	if (mmc->clock != host->clock) {
+		if (!sdhci_set_clock(mmc, mmc->clock))
+			host->clock = mmc->clock;

I think it's better to move into sdhci_set_clock function.

drivers/mmc/sdhci.c static void sdhci_set_ios(struct mmc *mmc) · line 389

Quoted 5 lines
drivers/mmc/sdhci.c +1 -0
+	}
 
 	/* Set bus width */
 	ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);

Thanks,
Minkyu Kang.