Skip to content

Commit 2ef7da7

Browse files
committed
mmc: sdhci: Get rid of SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2144641 commit 6fbde9e Author: Adrian Hunter <adrian.hunter@intel.com> Date: Mon, 26 Sep 2022 22:20:21 +0300 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS is used by only ENE controllers but can be replaced by driver code. Amend the ENE code to hook the ->set_ios() mmc host operation and do the reset there. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20220926192022.85660-4-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Mark Salter <msalter@redhat.com>
1 parent 8d2cf18 commit 2ef7da7

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,36 @@ static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
297297
SDHCI_QUIRK_MISSING_CAPS
298298
};
299299

300+
static void ene_714_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
301+
{
302+
struct sdhci_host *host = mmc_priv(mmc);
303+
304+
sdhci_set_ios(mmc, ios);
305+
306+
/*
307+
* Some (ENE) controllers misbehave on some ios operations,
308+
* signalling timeout and CRC errors even on CMD0. Resetting
309+
* it on each ios seems to solve the problem.
310+
*/
311+
if (!(host->flags & SDHCI_DEVICE_DEAD))
312+
sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
313+
}
314+
315+
static int ene_714_probe_slot(struct sdhci_pci_slot *slot)
316+
{
317+
slot->host->mmc_host_ops.set_ios = ene_714_set_ios;
318+
return 0;
319+
}
320+
300321
static const struct sdhci_pci_fixes sdhci_ene_712 = {
301322
.quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
302323
SDHCI_QUIRK_BROKEN_DMA,
303324
};
304325

305326
static const struct sdhci_pci_fixes sdhci_ene_714 = {
306327
.quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
307-
SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS |
308328
SDHCI_QUIRK_BROKEN_DMA,
329+
.probe_slot = ene_714_probe_slot,
309330
};
310331

311332
static const struct sdhci_pci_fixes sdhci_cafe = {

drivers/mmc/host/sdhci.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,14 +2403,6 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
24032403
host->ops->set_clock(host, host->clock);
24042404
} else
24052405
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
2406-
2407-
/*
2408-
* Some (ENE) controllers go apeshit on some ios operation,
2409-
* signalling timeout and CRC errors even on CMD0. Resetting
2410-
* it on each ios seems to solve the problem.
2411-
*/
2412-
if (host->quirks & SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS)
2413-
sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
24142406
}
24152407
EXPORT_SYMBOL_GPL(sdhci_set_ios);
24162408

drivers/mmc/host/sdhci.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,6 @@ struct sdhci_host {
376376
#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
377377
/* Controller doesn't like clearing the power reg before a change */
378378
#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3)
379-
/* Controller has flaky internal state so reset it on each ios change */
380-
#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4)
381379
/* Controller has an unusable DMA engine */
382380
#define SDHCI_QUIRK_BROKEN_DMA (1<<5)
383381
/* Controller has an unusable ADMA engine */

0 commit comments

Comments
 (0)