Skip to contentSkip to conversation

mmc: support hs400 enhanced strobe mode

PATCH New Peng Fan 2 participants 2 messages Apr 16, 2019 MMC, SD and SDIO

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 mmc: support hs400 enhanced strobe mode

eMMC 5.1+ supports HS400 Enhances Strobe mode without the need for tuning procedure.
The flow is as following:
- set HS_TIMIMG (Highspeed)
- Host change freq to <= 52Mhz
- set the bus width to Enhanced strobe and DDR8Bit(CMD6), EXT_CSD[183] = 0x86 instead of 0x80
- set HS_TIMING to 0x3 (HS400)
- Host change freq to <= 200Mhz
- Host select HS400 enhanced strobe complete

---

This is actually a resend of https://patchwork.ozlabs.org/patch/1018188/
which got no response.
Rebased on master.

 drivers/mmc/Kconfig      | 12 ++++++++
 drivers/mmc/mmc-uclass.c | 15 +++++++++
 drivers/mmc/mmc.c        | 79 +++++++++++++++++++++++++++++++++++++++++++++++-
 include/mmc.h            | 15 +++++++++
 4 files changed, 120 insertions(+), 1 deletion(-)
drivers/mmc/Kconfig +12 -0
index 04a4e7716f..3ef7580a43 100644
@@ -111,6 +111,18 @@ config SPL_MMC_UHS_SUPPORT
 	  cards. The IO voltage must be switchable from 3.3v to 1.8v. The bus
 	  frequency can go up to 208MHz (SDR104)
 
+config MMC_HS400_ES_SUPPORT
+	bool "enable HS400 Enhanced Strobe support"
+	help
+	  The HS400 Enhanced Strobe mode is support by some eMMC. The bus frequency is up to
+	  200MHz. This mode does not tune the IO.
+
+config SPL_MMC_HS400_ES_SUPPORT
+	bool "enable HS400 Enhanced Strobe support in SPL"
+	help
+	  The HS400 Enhanced Strobe mode is support by some eMMC. The bus frequency is up to
+	  200MHz. This mode does not tune the IO.
+
 config MMC_HS400_SUPPORT
 	bool "enable HS400 support"
 	select MMC_HS200_SUPPORT
drivers/mmc/mmc-uclass.c +15 -0
index a9c8f335c1..5d04fc6f0a 100644
@@ -120,6 +120,21 @@ int mmc_execute_tuning(struct mmc *mmc, uint opcode)
 }
 #endif
 
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
+void dm_mmc_set_enhanced_strobe(struct udevice *dev)
+{
+	struct dm_mmc_ops *ops = mmc_get_ops(dev);
+
+	if (ops->set_enhanced_strobe)
+		ops->set_enhanced_strobe(dev);
+}
+
+void mmc_set_enhanced_strobe(struct mmc *mmc)
+{
+	dm_mmc_set_enhanced_strobe(mmc->dev);
+}
+#endif
+
 int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
 {
 	int val;
drivers/mmc/mmc.c +78 -1

133 lines not on this page · raw message

include/mmc.h +15 -0
index 1f30f71d25..0d480b56a9 100644
@@ -65,6 +65,7 @@
 #define MMC_MODE_DDR_52MHz	MMC_CAP(MMC_DDR_52)
 #define MMC_MODE_HS200		MMC_CAP(MMC_HS_200)
 #define MMC_MODE_HS400		MMC_CAP(MMC_HS_400)
+#define MMC_MODE_HS400_ES	MMC_CAP(MMC_HS_400_ES)
 
 #define MMC_MODE_8BIT		BIT(30)
 #define MMC_MODE_4BIT		BIT(29)
@@ -219,6 +220,7 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
 #define EXT_CSD_BOOT_BUS_WIDTH		177
 #define EXT_CSD_PART_CONF		179	/* R/W */
 #define EXT_CSD_BUS_WIDTH		183	/* R/W */
+#define EXT_CSD_STROBE_SUPPORT		184	/* R/W */
 #define EXT_CSD_HS_TIMING		185	/* R/W */
 #define EXT_CSD_REV			192	/* RO */
 #define EXT_CSD_CARD_TYPE		196	/* RO */
@@ -260,11 +262,13 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
 #define EXT_CSD_DDR_BUS_WIDTH_4	5	/* Card is in 4 bit DDR mode */
 #define EXT_CSD_DDR_BUS_WIDTH_8	6	/* Card is in 8 bit DDR mode */
 #define EXT_CSD_DDR_FLAG	BIT(2)	/* Flag for DDR mode */
+#define EXT_CSD_BUS_WIDTH_STROBE BIT(7)	/* Enhanced strobe mode */
 
 #define EXT_CSD_TIMING_LEGACY	0	/* no high speed */
 #define EXT_CSD_TIMING_HS	1	/* HS */
 #define EXT_CSD_TIMING_HS200	2	/* HS200 */
 #define EXT_CSD_TIMING_HS400	3	/* HS400 */
+#define EXT_CSD_DRV_STR_SHIFT	4	/* Driver Strength shift */
 
 #define EXT_CSD_BOOT_ACK_ENABLE			(1 << 6)
 #define EXT_CSD_BOOT_PARTITION_ENABLE		(1 << 3)
@@ -461,6 +465,11 @@ struct dm_mmc_ops {
 	 */
 	int (*wait_dat0)(struct udevice *dev, int state, int timeout);
 #endif
+
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
+	/* set_enhanced_strobe() - set HS400 enhanced strobe */
+	void (*set_enhanced_strobe)(struct udevice *dev);
+#endif
 };
 
 #define mmc_get_ops(dev)        ((struct dm_mmc_ops *)(dev)->driver->ops)
@@ -481,6 +490,7 @@ int mmc_getcd(struct mmc *mmc);
 int mmc_getwp(struct mmc *mmc);
 int mmc_execute_tuning(struct mmc *mmc, uint opcode);
 int mmc_wait_dat0(struct mmc *mmc, int state, int timeout);
+void mmc_set_enhanced_strobe(struct mmc *mmc);
 
 #else
 struct mmc_ops {
@@ -526,6 +536,7 @@ enum bus_mode {
 	UHS_SDR104,
 	MMC_HS_200,
 	MMC_HS_400,
+	MMC_HS_400_ES,
 	MMC_MODES_END
 };
 
@@ -543,6 +554,10 @@ static inline bool mmc_is_mode_ddr(enum bus_mode mode)
 #if CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
 	else if (mode == MMC_HS_400)
 		return true;
+#endif
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
+	else if (mode == MMC_HS_400_ES)
+		return true;
 #endif
 	else
 		return false;
Signature · 1 line
2.16.4
#1 lore raw

PATCH 1/1 mmc: support hs400 enhanced strobe mode

Hi Peng,

Quoted 31 lines · Peng Fan

eMMC 5.1+ supports HS400 Enhances Strobe mode without the need for tuning procedure.
The flow is as following:
- set HS_TIMIMG (Highspeed)
- Host change freq to <= 52Mhz
- set the bus width to Enhanced strobe and DDR8Bit(CMD6), EXT_CSD[183] = 0x86 instead of 0x80
- set HS_TIMING to 0x3 (HS400)
- Host change freq to <= 200Mhz
- Host select HS400 enhanced strobe complete

---

This is actually a resend of https://patchwork.ozlabs.org/patch/1018188/
which got no response.
Rebased on master.

 drivers/mmc/Kconfig      | 12 ++++++++
 drivers/mmc/mmc-uclass.c | 15 +++++++++
 drivers/mmc/mmc.c        | 79 +++++++++++++++++++++++++++++++++++++++++++++++-
 include/mmc.h            | 15 +++++++++
 4 files changed, 120 insertions(+), 1 deletion(-)
drivers/mmc/Kconfig +0 -0
index 04a4e7716f..3ef7580a43 100644

drivers/mmc/Kconfig config SPL_MMC_UHS_SUPPORT · line 118

Quoted 8 lines
drivers/mmc/Kconfig +5 -0
@@ -111,6 +111,18 @@ config SPL_MMC_UHS_SUPPORT
          cards. The IO voltage must be switchable from 3.3v to 1.8v. The bus
          frequency can go up to 208MHz (SDR104)
 
+config MMC_HS400_ES_SUPPORT
+       bool "enable HS400 Enhanced Strobe support"
+       help
+         The HS400 Enhanced Strobe mode is support by some eMMC. The bus frequency is up to
+         200MHz. This mode does not tune the IO.

Is there any board that can select this option?

Otherwise it will be just dead code.

Thanks