LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Sarthak Garg <sartgarg@codeaurora.org> To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: stummala@codeaurora.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Sarthak Garg <sartgarg@codeaurora.org> Subject: [PATCH V1 1/2] mmc: sdhci: Introduce max_timeout_count variable in sdhci_host Date: Fri, 16 Jul 2021 19:33:01 +0530 [thread overview] Message-ID: <1626444182-2187-2-git-send-email-sartgarg@codeaurora.org> (raw) In-Reply-To: <1626444182-2187-1-git-send-email-sartgarg@codeaurora.org> Introduce max_timeout_count variable in the sdhci_host structure and use in timeout calculation. By default its set to 0xE (max timeout register value as per SDHC spec). But at the same time vendors drivers can update it if they support different max timeout register value than 0xE. Signed-off-by: Sarthak Garg <sartgarg@codeaurora.org> --- drivers/mmc/host/sdhci.c | 15 +++++++++------ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index aba6e10..2debda3 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -939,16 +939,16 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, * timeout value. */ if (host->quirks & SDHCI_QUIRK_BROKEN_TIMEOUT_VAL) - return 0xE; + return host->max_timeout_count; /* Unspecified command, asume max */ if (cmd == NULL) - return 0xE; + return host->max_timeout_count; data = cmd->data; /* Unspecified timeout, assume max */ if (!data && !cmd->busy_timeout) - return 0xE; + return host->max_timeout_count; /* timeout in us */ target_timeout = sdhci_target_timeout(host, cmd, data); @@ -968,15 +968,15 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, while (current_timeout < target_timeout) { count++; current_timeout <<= 1; - if (count >= 0xF) + if (count > host->max_timeout_count) break; } - if (count >= 0xF) { + if (count > host->max_timeout_count) { if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT)) DBG("Too large timeout 0x%x requested for CMD%d!\n", count, cmd->opcode); - count = 0xE; + count = host->max_timeout_count; } else { *too_big = false; } @@ -3940,6 +3940,9 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, */ host->adma_table_cnt = SDHCI_MAX_SEGS * 2 + 1; + if (!host->max_timeout_count) + host->max_timeout_count = 0xE; + return host; } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 074dc18..e8d04e4 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -517,6 +517,7 @@ struct sdhci_host { unsigned int max_clk; /* Max possible freq (MHz) */ unsigned int timeout_clk; /* Timeout freq (KHz) */ + u8 max_timeout_count; /* Vendor specific max timeout count */ unsigned int clk_mul; /* Clock Muliplier value */ unsigned int clock; /* Current clock (MHz) */ -- 2.7.4
next prev parent reply other threads:[~2021-07-16 14:03 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-16 14:03 [PATCH V1 0/2] Introduce max_timeout_count in sdhci_host for vendor needs Sarthak Garg 2021-07-16 14:03 ` Sarthak Garg [this message] 2021-07-16 14:03 ` [PATCH V1 2/2] mmc: sdhci-msm: Use maximum possible data timeout value Sarthak Garg 2021-07-16 23:54 ` Bjorn Andersson 2021-07-29 4:46 ` [PATCH V2 0/2] Introduce max_timeout_count in sdhci_host for vendor Sarthak Garg 2021-07-29 4:46 ` [PATCH V2 1/2] mmc: sdhci: Introduce max_timeout_count variable in sdhci_host Sarthak Garg 2021-08-03 8:23 ` Adrian Hunter 2021-08-06 6:51 ` [PATCH V3 0/2] Introduce max_timeout_count in sdhci_host for vendor Sarthak Garg 2021-08-06 6:54 ` [PATCH V3 0/2] Introduce max_timeout_count in sdhci_host for vendor needs Sarthak Garg 2021-08-06 6:54 ` [PATCH V3 1/2] mmc: sdhci: Introduce max_timeout_count variable in sdhci_host Sarthak Garg 2021-08-06 14:30 ` Adrian Hunter 2021-08-06 6:55 ` [PATCH V3 2/2] mmc: sdhci-msm: Use maximum possible data timeout value Sarthak Garg 2021-08-06 14:31 ` Adrian Hunter 2021-08-16 13:59 ` [PATCH V3 0/2] Introduce max_timeout_count in sdhci_host for vendor needs Ulf Hansson 2021-07-29 4:46 ` [PATCH V2 2/2] mmc: sdhci-msm: Use maximum possible data timeout value Sarthak Garg
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1626444182-2187-2-git-send-email-sartgarg@codeaurora.org \ --to=sartgarg@codeaurora.org \ --cc=adrian.hunter@intel.com \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mmc@vger.kernel.org \ --cc=stummala@codeaurora.org \ --cc=ulf.hansson@linaro.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).