Skip to content

Commit 029e247

Browse files
BOUGH CHENstorulf
authored andcommitted
mmc: sdhci-esdhc-imx: add HS400_ES support for i.MX8QXP
Add an new esdhc_soc_data for i.MX8QXP, and add HS400_ES mode support. Signed-off-by: Haibo Chen <[email protected]> Acked-by: Adrian Hunter <[email protected]> [Ulf: Rebased on top of latest changes] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 2b0efe8 commit 029e247

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#define ESDHC_MIX_CTRL_AUTO_TUNE_EN (1 << 24)
5151
#define ESDHC_MIX_CTRL_FBCLK_SEL (1 << 25)
5252
#define ESDHC_MIX_CTRL_HS400_EN (1 << 26)
53+
#define ESDHC_MIX_CTRL_HS400_ES_EN (1 << 27)
5354
/* Bits 3 and 6 are not SDHCI standard definitions */
5455
#define ESDHC_MIX_CTRL_SDHCI_MASK 0xb7
5556
/* Tuning bits */
@@ -144,6 +145,8 @@
144145
* exceed 150MHz, for DDR mode, SD card clock can't exceed 45MHz.
145146
*/
146147
#define ESDHC_FLAG_ERR010450 BIT(10)
148+
/* The IP supports HS400ES mode */
149+
#define ESDHC_FLAG_HS400_ES BIT(11)
147150

148151
struct esdhc_soc_data {
149152
u32 flags;
@@ -192,6 +195,12 @@ static const struct esdhc_soc_data usdhc_imx7d_data = {
192195
| ESDHC_FLAG_HS400,
193196
};
194197

198+
static struct esdhc_soc_data usdhc_imx8qxp_data = {
199+
.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
200+
| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200
201+
| ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES,
202+
};
203+
195204
struct pltfm_imx_data {
196205
u32 scratchpad;
197206
struct pinctrl *pinctrl;
@@ -238,6 +247,7 @@ static const struct of_device_id imx_esdhc_dt_ids[] = {
238247
{ .compatible = "fsl,imx6q-usdhc", .data = &usdhc_imx6q_data, },
239248
{ .compatible = "fsl,imx6ull-usdhc", .data = &usdhc_imx6ull_data, },
240249
{ .compatible = "fsl,imx7d-usdhc", .data = &usdhc_imx7d_data, },
250+
{ .compatible = "fsl,imx8qxp-usdhc", .data = &usdhc_imx8qxp_data, },
241251
{ /* sentinel */ }
242252
};
243253
MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids);
@@ -896,6 +906,19 @@ static int esdhc_executing_tuning(struct sdhci_host *host, u32 opcode)
896906
return ret;
897907
}
898908

909+
static void esdhc_hs400_enhanced_strobe(struct mmc_host *mmc, struct mmc_ios *ios)
910+
{
911+
struct sdhci_host *host = mmc_priv(mmc);
912+
u32 m;
913+
914+
m = readl(host->ioaddr + ESDHC_MIX_CTRL);
915+
if (ios->enhanced_strobe)
916+
m |= ESDHC_MIX_CTRL_HS400_ES_EN;
917+
else
918+
m &= ~ESDHC_MIX_CTRL_HS400_ES_EN;
919+
writel(m, host->ioaddr + ESDHC_MIX_CTRL);
920+
}
921+
899922
static int esdhc_change_pinstate(struct sdhci_host *host,
900923
unsigned int uhs)
901924
{
@@ -1377,6 +1400,12 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
13771400
if (imx_data->socdata->flags & ESDHC_FLAG_HS400)
13781401
host->quirks2 |= SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400;
13791402

1403+
if (imx_data->socdata->flags & ESDHC_FLAG_HS400_ES) {
1404+
host->mmc->caps2 |= MMC_CAP2_HS400_ES;
1405+
host->mmc_host_ops.hs400_enhanced_strobe =
1406+
esdhc_hs400_enhanced_strobe;
1407+
}
1408+
13801409
if (of_id)
13811410
err = sdhci_esdhc_imx_probe_dt(pdev, host, imx_data);
13821411
else

0 commit comments

Comments
 (0)