From: Sayali Lokhande <sayalil@codeaurora.org>
To: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>,
bjorn.andersson@linaro.org, adrian.hunter@intel.com,
robh+dt@kernel.org, ulf.hansson@linaro.org,
asutoshd@codeaurora.org, stummala@codeaurora.org,
ppvk@codeaurora.org, rampraka@codeaurora.org, sboyd@kernel.org,
georgi.djakov@linaro.org, mka@chromium.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
agross@kernel.org, linux-mmc-owner@vger.kernel.org
Subject: Re: [PATCH RFC] mmc: sdhci-msm: Toggle fifo write clk after ungating sdcc clk
Date: Fri, 28 Feb 2020 12:24:45 +0530 [thread overview]
Message-ID: <f486df9d-072e-6a39-82a8-3d21465653b3@codeaurora.org> (raw)
In-Reply-To: <4e4f1e44-8033-94e9-641c-a74232727895@codeaurora.org>
Hi Veera,
On 2/24/2020 7:19 PM, Veerabhadrarao Badiganti wrote:
>
> On 2/20/2020 2:50 PM, Sayali Lokhande wrote:
>> From: Ram Prakash Gupta <rampraka@codeaurora.org>
>>
>> During GCC level clock gating of MCLK, the async FIFO
>> gets into some hang condition, such that for the next
>> transfer after MCLK ungating, first bit of CMD response
>> doesn't get written in to the FIFO. This cause the CPSM
>> to hang eventually leading to SW timeout.
>>
>> To fix the issue, toggle the FIFO write clock after
>> MCLK ungated to get the FIFO pointers and flags to
>> valid states.
>>
>> Change-Id: Ibef2d1d283ac0b6983c609a4abc98bc574d31fa6
>> Signed-off-by: Ram Prakash Gupta <rampraka@codeaurora.org>
>> Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
>> ---
>> drivers/mmc/host/sdhci-msm.c | 43
>> +++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 43 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
>> index c3a160c..eaa3e95 100644
>> --- a/drivers/mmc/host/sdhci-msm.c
>> +++ b/drivers/mmc/host/sdhci-msm.c
>> @@ -127,6 +127,8 @@
>> #define CQHCI_VENDOR_CFG1 0xA00
>> #define CQHCI_VENDOR_DIS_RST_ON_CQ_EN (0x3 << 13)
>> +#define RCLK_TOGGLE 0x2
>> +
>> struct sdhci_msm_offset {
>> u32 core_hc_mode;
>> u32 core_mci_data_cnt;
>> @@ -1554,6 +1556,43 @@ static void __sdhci_msm_set_clock(struct
>> sdhci_host *host, unsigned int clock)
>> sdhci_enable_clk(host, clk);
>> }
>> +/*
>> + * After MCLK ugating, toggle the FIFO write clock to get
>> + * the FIFO pointers and flags to valid state.
>> + */
>> +static void sdhci_msm_toggle_fifo_write_clk(struct sdhci_host *host)
>> +{
>> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> + struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
>> + const struct sdhci_msm_offset *msm_offset =
>> + msm_host->offset;
>> + struct mmc_card *card = host->mmc->card;
>> +
>> + if (msm_host->tuning_done ||
>> + (card && card->ext_csd.strobe_support &&
>> + card->host->ios.enhanced_strobe)) {
>
> This issue is present on only HS400ES mode.
>
> If(host->ios.enhanced_strob) check should be sufficient, other checks
> are not needed.
Agree, Will update.
>
>> + /*
>> + * set HC_REG_DLL_CONFIG_3[1] to select MCLK as
>> + * DLL input clock
>> + */
>> + writel_relaxed(((readl_relaxed(host->ioaddr +
>> + msm_offset->core_dll_config_3))
>> + | RCLK_TOGGLE), host->ioaddr +
>> + msm_offset->core_dll_config_3);
>> + /* ensure above write as toggling same bit quickly */
>> + wmb();
>> + udelay(2);
>> + /*
>> + * clear HC_REG_DLL_CONFIG_3[1] to select RCLK as
>> + * DLL input clock
>> + */
>> + writel_relaxed(((readl_relaxed(host->ioaddr +
>> + msm_offset->core_dll_config_3))
>> + & ~RCLK_TOGGLE), host->ioaddr +
>> + msm_offset->core_dll_config_3);
>> + }
>> +}
>> +
>> /* sdhci_msm_set_clock - Called with (host->lock) spinlock held. */
>> static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned
>> int clock)
>> {
>> @@ -2149,6 +2188,10 @@ static __maybe_unused int
>> sdhci_msm_runtime_resume(struct device *dev)
>> msm_host->bulk_clks);
>> if (ret)
>> return ret;
>> + if (host->mmc &&
>> + (host->mmc->ios.timing == MMC_TIMING_MMC_HS400))
> These checks are not needed. You can have these checks within
> sdhci_msm_toggle_fifo_write_clk
Agree. Will update.
>> + sdhci_msm_toggle_fifo_write_clk(host);
>> +
>> /*
>> * Whenever core-clock is gated dynamically, it's needed to
>> * restore the SDR DLL settings when the clock is ungated.
next prev parent reply other threads:[~2020-02-28 6:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 9:20 [PATCH RFC] Toggle fifo write clk after ungating sdcc clk Sayali Lokhande
2020-02-20 9:20 ` [PATCH RFC] mmc: sdhci-msm: " Sayali Lokhande
2020-02-20 15:44 ` Bjorn Andersson
2020-02-20 18:02 ` Stephen Boyd
2020-02-24 13:49 ` Veerabhadrarao Badiganti
2020-02-28 6:54 ` Sayali Lokhande [this message]
2020-02-20 15:51 ` [PATCH RFC] " Bjorn Andersson
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=f486df9d-072e-6a39-82a8-3d21465653b3@codeaurora.org \
--to=sayalil@codeaurora.org \
--cc=adrian.hunter@intel.com \
--cc=agross@kernel.org \
--cc=asutoshd@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=georgi.djakov@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc-owner@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mka@chromium.org \
--cc=ppvk@codeaurora.org \
--cc=rampraka@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=stummala@codeaurora.org \
--cc=ulf.hansson@linaro.org \
--cc=vbadigan@codeaurora.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: link
Be 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).