Skip to content

Commit 941a7ab

Browse files
jmentistorulf
authored andcommitted
mmc: sdhci_am654: Add sdhci_am654_start_signal_voltage_switch
The sdhci_start_signal_voltage_switch function sets V1P8_SIGNAL_ENA by default after switching to 1v8 signaling. V1P8_SIGNAL_ENA determines whether to launch cmd/data on neg edge or pos edge of clock. Due to some eMMC and SD failures seen across am62x platform, do not set V1P8_SIGNAL_ENA by default, only enable the bit for devices that require this bit in order to switch to 1v8 voltage for uhs modes. Signed-off-by: Judith Mendez <jm@ti.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20240913185403.1339115-1-jm@ti.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent cd068d5 commit 941a7ab

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

drivers/mmc/host/sdhci_am654.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ struct sdhci_am654_data {
155155
u32 tuning_loop;
156156

157157
#define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0)
158+
#define SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA BIT(1)
158159
};
159160

160161
struct window {
@@ -356,6 +357,29 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
356357
sdhci_set_clock(host, clock);
357358
}
358359

360+
static int sdhci_am654_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
361+
{
362+
struct sdhci_host *host = mmc_priv(mmc);
363+
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
364+
struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
365+
int ret;
366+
367+
if ((sdhci_am654->quirks & SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA) &&
368+
ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
369+
if (!IS_ERR(mmc->supply.vqmmc)) {
370+
ret = mmc_regulator_set_vqmmc(mmc, ios);
371+
if (ret < 0) {
372+
pr_err("%s: Switching to 1.8V signalling voltage failed,\n",
373+
mmc_hostname(mmc));
374+
return -EIO;
375+
}
376+
}
377+
return 0;
378+
}
379+
380+
return sdhci_start_signal_voltage_switch(mmc, ios);
381+
}
382+
359383
static u8 sdhci_am654_write_power_on(struct sdhci_host *host, u8 val, int reg)
360384
{
361385
writeb(val, host->ioaddr + reg);
@@ -844,6 +868,11 @@ static int sdhci_am654_get_of_property(struct platform_device *pdev,
844868
if (device_property_read_bool(dev, "ti,fails-without-test-cd"))
845869
sdhci_am654->quirks |= SDHCI_AM654_QUIRK_FORCE_CDTEST;
846870

871+
/* Suppress v1p8 ena for eMMC and SD with vqmmc supply */
872+
if (!!of_parse_phandle(dev->of_node, "vmmc-supply", 0) ==
873+
!!of_parse_phandle(dev->of_node, "vqmmc-supply", 0))
874+
sdhci_am654->quirks |= SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA;
875+
847876
sdhci_get_of_property(pdev);
848877

849878
return 0;
@@ -940,6 +969,7 @@ static int sdhci_am654_probe(struct platform_device *pdev)
940969
goto err_pltfm_free;
941970
}
942971

972+
host->mmc_host_ops.start_signal_voltage_switch = sdhci_am654_start_signal_voltage_switch;
943973
host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
944974

945975
pm_runtime_get_noresume(dev);

0 commit comments

Comments
 (0)