Skip to content

Commit b32990f

Browse files
AlvinPaul26gregkh
authored andcommitted
mmc: sdhci-of-arasan: Support for emmc hardware reset
[ Upstream commit 11c7d66 ] Add hw_reset callback to support emmc hardware reset, this callback get called from the mmc core only when "cap-mmc-hw-reset" property is defined in the DT. Signed-off-by: Paul Alvin <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]> Stable-dep-of: e251709 ("mmc: sdhci-of-arasan: Ensure CD logic stabilization before power-up") Signed-off-by: Sasha Levin <[email protected]>
1 parent 1ec1b0d commit b32990f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/mmc/host/sdhci-of-arasan.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
#define FREQSEL_225M_200M 0x7
7777
#define PHY_DLL_TIMEOUT_MS 100
7878

79+
#define SDHCI_HW_RST_EN BIT(4)
80+
7981
/* Default settings for ZynqMP Clock Phases */
8082
#define ZYNQMP_ICLK_PHASE {0, 63, 63, 0, 63, 0, 0, 183, 54, 0, 0}
8183
#define ZYNQMP_OCLK_PHASE {0, 72, 60, 0, 60, 72, 135, 48, 72, 135, 0}
@@ -475,6 +477,21 @@ static void sdhci_arasan_reset(struct sdhci_host *host, u8 mask)
475477
}
476478
}
477479

480+
static void sdhci_arasan_hw_reset(struct sdhci_host *host)
481+
{
482+
u8 reg;
483+
484+
reg = sdhci_readb(host, SDHCI_POWER_CONTROL);
485+
reg |= SDHCI_HW_RST_EN;
486+
sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
487+
/* As per eMMC spec, minimum 1us is required but give it 2us for good measure */
488+
usleep_range(2, 5);
489+
reg &= ~SDHCI_HW_RST_EN;
490+
sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
491+
/* As per eMMC spec, minimum 200us is required but give it 300us for good measure */
492+
usleep_range(300, 500);
493+
}
494+
478495
static int sdhci_arasan_voltage_switch(struct mmc_host *mmc,
479496
struct mmc_ios *ios)
480497
{
@@ -505,6 +522,7 @@ static const struct sdhci_ops sdhci_arasan_ops = {
505522
.reset = sdhci_arasan_reset,
506523
.set_uhs_signaling = sdhci_set_uhs_signaling,
507524
.set_power = sdhci_set_power_and_bus_voltage,
525+
.hw_reset = sdhci_arasan_hw_reset,
508526
};
509527

510528
static u32 sdhci_arasan_cqhci_irq(struct sdhci_host *host, u32 intmask)

0 commit comments

Comments
 (0)