Skip to content

Beefier command queue recovery #6221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,18 @@ int mmc_cqe_recovery(struct mmc_host *host)
* Recovery is expected seldom, if at all, but it reduces performance,
* so make sure it is not completely silent.
*/
pr_warn("%s: running CQE recovery\n", mmc_hostname(host));
pr_warn_ratelimited("%s: running CQE recovery\n", mmc_hostname(host));

host->cqe_ops->cqe_recovery_start(host);

err = mmc_detect_card_removed(host);
if (err) {
host->cqe_ops->cqe_recovery_finish(host);
host->cqe_ops->cqe_off(host);
mmc_retune_release(host);
return err;
}

memset(&cmd, 0, sizeof(cmd));
cmd.opcode = MMC_STOP_TRANSMISSION;
cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
Expand Down
19 changes: 16 additions & 3 deletions drivers/mmc/host/sdhci-brcmstb.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,21 @@ static void sdhci_brcmstb_cqe_enable(struct mmc_host *mmc)

sdhci_cqe_enable(mmc);

/* Reset CMD13 polling timer back to eMMC specification default */
cqhci_writel(cq_host, 0x00011000, CQHCI_SSC1);
/*
* The controller resets this register to a very short default interval
* whenever CQHCI is disabled.
*
* For removable cards CBC needs to be clear or card removal can hang
* the CQE. In polling mode, a CIT of 0x4000 "cycles" seems to produce the best
* throughput.
*
* For nonremovable cards, the specification default of CBC=1 CIT=0x1000
* suffices.
*/
if (mmc->caps & MMC_CAP_NONREMOVABLE)
cqhci_writel(cq_host, 0x00011000, CQHCI_SSC1);
else
cqhci_writel(cq_host, 0x00004000, CQHCI_SSC1);
}

static const struct cqhci_host_ops sdhci_brcmstb_cqhci_ops = {
Expand All @@ -386,7 +399,7 @@ static struct sdhci_ops sdhci_brcmstb_ops_2712 = {
.set_clock = sdhci_bcm2712_set_clock,
.set_power = sdhci_brcmstb_set_power,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
.reset = brcmstb_reset,
.set_uhs_signaling = sdhci_set_uhs_signaling,
.init_sd_express = bcm2712_init_sd_express,
};
Expand Down