[U-Boot] [PATCH 12/33] mmc: remove tran_speed from struct mmc

Ziyuan Xu xzy.xu at rock-chips.com
Mon May 15 06:07:06 UTC 2017


The clock element is updated by mmc_set_clock every time, it denotes the
current transfer speed.

Signed-off-by: Ziyuan Xu <xzy.xu at rock-chips.com>
---

 cmd/mmc.c                 |  2 +-
 drivers/mmc/mmc.c         | 10 +++++-----
 drivers/mmc/xenon_sdhci.c |  2 +-
 include/mmc.h             |  1 -
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index ef05fa5..6ead27a 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -23,7 +23,7 @@ static void print_mmcinfo(struct mmc *mmc)
 			(mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff,
 			(mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
 
-	printf("Tran Speed: %d\n", mmc->tran_speed);
+	printf("Tran Speed: %d\n", mmc->clock);
 	printf("Rd Block Len: %d\n", mmc->read_bl_len);
 
 	printf("%s version %d.%d", IS_SD(mmc) ? "SD" : "MMC",
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d47cfe6..953ffd8 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1449,7 +1449,7 @@ static bool mmc_can_card_busy(struct mmc *)
 static int mmc_startup(struct mmc *mmc)
 {
 	int err, i;
-	uint mult, freq;
+	uint mult, freq, tran_speed;
 	u64 cmult, csize, capacity;
 	struct mmc_cmd cmd;
 	ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);
@@ -1545,7 +1545,7 @@ static int mmc_startup(struct mmc *mmc)
 	freq = fbase[(cmd.response[0] & 0x7)];
 	mult = multipliers[((cmd.response[0] >> 3) & 0xf)];
 
-	mmc->tran_speed = freq * mult;
+	tran_speed = freq * mult;
 
 	mmc->dsr_imp = ((cmd.response[1] >> 12) & 0x1);
 	mmc->read_bl_len = 1 << ((cmd.response[1] >> 16) & 0xf);
@@ -1792,11 +1792,11 @@ static int mmc_startup(struct mmc *mmc)
 			return err;
 
 		if (mmc->card_caps & MMC_MODE_HS)
-			mmc->tran_speed = 50000000;
+			tran_speed = 50000000;
 		else
-			mmc->tran_speed = 25000000;
+			tran_speed = 25000000;
 
-		mmc_set_clock(mmc, mmc->tran_speed);
+		mmc_set_clock(mmc, tran_speed);
 	}
 
 	/* Fix the block length for DDR mode */
diff --git a/drivers/mmc/xenon_sdhci.c b/drivers/mmc/xenon_sdhci.c
index 7685e15..f18dc8f 100644
--- a/drivers/mmc/xenon_sdhci.c
+++ b/drivers/mmc/xenon_sdhci.c
@@ -318,7 +318,7 @@ static void xenon_mask_cmd_conflict_err(struct sdhci_host *host)
 static void xenon_sdhci_set_ios_post(struct sdhci_host *host)
 {
 	struct xenon_sdhci_priv *priv = host->mmc->priv;
-	uint speed = host->mmc->tran_speed;
+	uint speed = host->mmc->clock;
 	int pwr_18v = 0;
 
 	if ((sdhci_readb(host, SDHCI_POWER_CONTROL) & ~SDHCI_POWER_ON) ==
diff --git a/include/mmc.h b/include/mmc.h
index bde8b37..05bf39d 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -504,7 +504,6 @@ struct mmc {
 	u8 part_attr;
 	u8 wr_rel_set;
 	char part_config;
-	uint tran_speed;
 	uint read_bl_len;
 	uint write_bl_len;
 	uint erase_grp_size;	/* in 512-byte sectors */
-- 
2.7.4




More information about the U-Boot mailing list