Skip to content

Commit 8ba9d45

Browse files
Josua-SRUlf Hansson
authored andcommitted
mmc: sdhci-esdhc-imx: Implement emmc hardware reset
NXP ESDHC supports control of native emmc reset signal when pinmux is set accordingly, using uSDHCx_SYS_CTRL register IPP_RST_N bit. Documentation is available in NXP i.MX6Q Reference Manual. Implement the hw_reset function in sdhci_ops asserting reset for at least 1us and waiting at least 200us after deassertion. Lower bounds are based on: JEDEC Standard No. 84-B51, 6.15.10 H/W Reset Operation, page 159. Upper bounds are chosen allowing flexibility to the scheduler. Tested on SolidRun i.MX8DXL SoM with a scope, and confirmed that eMMC is still accessible after boot: - eMMC extcsd has RST_N_FUNCTION=0x01 - sdhc node has cap-mmc-hw-reset - pinmux set for EMMC0_RESET_B - Linux v5.15 Signed-off-by: Josua Mayer <josua@solid-run.com> Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Message-ID: <20241101-imx-emmc-reset-v3-1-184965eed476@solid-run.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 53857ce commit 8ba9d45

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/mmc/host/sdhci-esdhc-imx.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "cqhci.h"
3232

3333
#define ESDHC_SYS_CTRL_DTOCV_MASK 0x0f
34+
#define ESDHC_SYS_CTRL_IPP_RST_N BIT(23)
3435
#define ESDHC_CTRL_D3CD 0x08
3536
#define ESDHC_BURST_LEN_EN_INCR (1 << 27)
3637
/* VENDOR SPEC register */
@@ -1407,6 +1408,17 @@ static u32 esdhc_cqhci_irq(struct sdhci_host *host, u32 intmask)
14071408
return 0;
14081409
}
14091410

1411+
static void esdhc_hw_reset(struct sdhci_host *host)
1412+
{
1413+
esdhc_clrset_le(host, ESDHC_SYS_CTRL_IPP_RST_N, 0, ESDHC_SYSTEM_CONTROL);
1414+
/* eMMC spec requires minimum 1us, here delay between 1-10us */
1415+
usleep_range(1, 10);
1416+
esdhc_clrset_le(host, ESDHC_SYS_CTRL_IPP_RST_N,
1417+
ESDHC_SYS_CTRL_IPP_RST_N, ESDHC_SYSTEM_CONTROL);
1418+
/* eMMC spec requires minimum 200us, here delay between 200-300us */
1419+
usleep_range(200, 300);
1420+
}
1421+
14101422
static struct sdhci_ops sdhci_esdhc_ops = {
14111423
.read_l = esdhc_readl_le,
14121424
.read_w = esdhc_readw_le,
@@ -1425,6 +1437,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
14251437
.reset = esdhc_reset,
14261438
.irq = esdhc_cqhci_irq,
14271439
.dump_vendor_regs = esdhc_dump_debug_regs,
1440+
.hw_reset = esdhc_hw_reset,
14281441
};
14291442

14301443
static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {

0 commit comments

Comments
 (0)