Skip to content

Commit aab6e25

Browse files
huzijistorulf
authored andcommitted
mmc: sdhci-xenon: Support HS400 Enhanced Strobe feature
Support HS400 Enhanced Strobe feature in Xenon. Enable Enhanced Strobe together with Data Strobe. Disable Enhanced Strobe when eMMC is not in HS400 mode. Signed-off-by: Hu Ziji <[email protected]> Signed-off-by: Zhoujie Wu <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 1284c24 commit aab6e25

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

drivers/mmc/host/sdhci-xenon-phy.c

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,17 +409,30 @@ static int xenon_emmc_phy_config_tuning(struct sdhci_host *host)
409409
return 0;
410410
}
411411

412-
static void xenon_emmc_phy_disable_data_strobe(struct sdhci_host *host)
412+
static void xenon_emmc_phy_disable_strobe(struct sdhci_host *host)
413413
{
414+
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
415+
struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
414416
u32 reg;
415417

416-
/* Disable SDHC Data Strobe */
418+
/* Disable both SDHC Data Strobe and Enhanced Strobe */
417419
reg = sdhci_readl(host, XENON_SLOT_EMMC_CTRL);
418-
reg &= ~XENON_ENABLE_DATA_STROBE;
420+
reg &= ~(XENON_ENABLE_DATA_STROBE | XENON_ENABLE_RESP_STROBE);
419421
sdhci_writel(host, reg, XENON_SLOT_EMMC_CTRL);
422+
423+
/* Clear Strobe line Pull down or Pull up */
424+
if (priv->phy_type == EMMC_5_0_PHY) {
425+
reg = sdhci_readl(host, XENON_EMMC_5_0_PHY_PAD_CONTROL);
426+
reg &= ~(XENON_EMMC5_FC_QSP_PD | XENON_EMMC5_FC_QSP_PU);
427+
sdhci_writel(host, reg, XENON_EMMC_5_0_PHY_PAD_CONTROL);
428+
} else {
429+
reg = sdhci_readl(host, XENON_EMMC_PHY_PAD_CONTROL1);
430+
reg &= ~(XENON_EMMC5_1_FC_QSP_PD | XENON_EMMC5_1_FC_QSP_PU);
431+
sdhci_writel(host, reg, XENON_EMMC_PHY_PAD_CONTROL1);
432+
}
420433
}
421434

422-
/* Set HS400 Data Strobe */
435+
/* Set HS400 Data Strobe and Enhanced Strobe */
423436
static void xenon_emmc_phy_strobe_delay_adj(struct sdhci_host *host)
424437
{
425438
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -439,6 +452,15 @@ static void xenon_emmc_phy_strobe_delay_adj(struct sdhci_host *host)
439452
/* Enable SDHC Data Strobe */
440453
reg = sdhci_readl(host, XENON_SLOT_EMMC_CTRL);
441454
reg |= XENON_ENABLE_DATA_STROBE;
455+
/*
456+
* Enable SDHC Enhanced Strobe if supported
457+
* Xenon Enhanced Strobe should be enabled only when
458+
* 1. card is in HS400 mode and
459+
* 2. SDCLK is higher than 52MHz
460+
* 3. DLL is enabled
461+
*/
462+
if (host->mmc->ios.enhanced_strobe)
463+
reg |= XENON_ENABLE_RESP_STROBE;
442464
sdhci_writel(host, reg, XENON_SLOT_EMMC_CTRL);
443465

444466
/* Set Data Strobe Pull down */
@@ -615,7 +637,7 @@ static void xenon_emmc_phy_set(struct sdhci_host *host,
615637
sdhci_writel(host, phy_regs->logic_timing_val,
616638
phy_regs->logic_timing_adj);
617639
else
618-
xenon_emmc_phy_disable_data_strobe(host);
640+
xenon_emmc_phy_disable_strobe(host);
619641

620642
phy_init:
621643
xenon_emmc_phy_init(host);
@@ -705,7 +727,7 @@ void xenon_soc_pad_ctrl(struct sdhci_host *host,
705727

706728
/*
707729
* Setting PHY when card is working in High Speed Mode.
708-
* HS400 set data strobe line.
730+
* HS400 set Data Strobe and Enhanced Strobe if it is supported.
709731
* HS200/SDR104 set tuning config to prepare for tuning.
710732
*/
711733
static int xenon_hs_delay_adj(struct sdhci_host *host)

drivers/mmc/host/sdhci-xenon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define XENON_TUNING_STEP_DIVIDER BIT(6)
3434

3535
#define XENON_SLOT_EMMC_CTRL 0x0130
36+
#define XENON_ENABLE_RESP_STROBE BIT(25)
3637
#define XENON_ENABLE_DATA_STROBE BIT(24)
3738

3839
#define XENON_SLOT_RETUNING_REQ_CTRL 0x0144

0 commit comments

Comments
 (0)