From: Adrian Hunter <adrian.hunter@intel.com>
To: Chunyan Zhang <zhang.lyra@gmail.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, Baolin Wang <baolin.wang7@gmail.com>,
Orson Zhai <orsonzhai@gmail.com>,
Chunyan Zhang <chunyan.zhang@unisoc.com>,
zhenxiong.lai@unisoc.com, yuelin.tang@unisoc.com,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mmc: sdhci-sprd: Wait until DLL locked after being configured
Date: Mon, 27 Sep 2021 08:48:31 +0300 [thread overview]
Message-ID: <847b5295-ba23-107c-6fee-4e766a86ce7a@intel.com> (raw)
In-Reply-To: <20210926092835.146449-1-zhang.lyra@gmail.com>
On 26/09/21 12:28 pm, Chunyan Zhang wrote:
> From: Zhenxiong Lai <zhenxiong.lai@unisoc.com>
>
> According to the specification, DLL status has to be locked before using it.
>
> Signed-off-by: Zhenxiong Lai <zhenxiong.lai@unisoc.com>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> Changes since v1:
> * Use read_poll_timeout() instead of while loop.
> ---
> drivers/mmc/host/sdhci-sprd.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
> index 11e375579cfb..f33e9349e4e6 100644
> --- a/drivers/mmc/host/sdhci-sprd.c
> +++ b/drivers/mmc/host/sdhci-sprd.c
> @@ -8,6 +8,7 @@
> #include <linux/delay.h>
> #include <linux/dma-mapping.h>
> #include <linux/highmem.h>
> +#include <linux/iopoll.h>
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/of_device.h>
> @@ -39,6 +40,9 @@
> #define SDHCI_SPRD_BIT_POSRD_DLY_INV BIT(21)
> #define SDHCI_SPRD_BIT_NEGRD_DLY_INV BIT(29)
>
> +#define SDHCI_SPRD_REG_32_DLL_STS0 0x210
> +#define SDHCI_SPRD_DLL_LOCKED BIT(18)
> +
> #define SDHCI_SPRD_REG_32_BUSY_POSI 0x250
> #define SDHCI_SPRD_BIT_OUTR_CLK_AUTO_EN BIT(25)
> #define SDHCI_SPRD_BIT_INNR_CLK_AUTO_EN BIT(24)
> @@ -256,6 +260,15 @@ static void sdhci_sprd_enable_phy_dll(struct sdhci_host *host)
> sdhci_writel(host, tmp, SDHCI_SPRD_REG_32_DLL_CFG);
> /* wait 1ms */
> usleep_range(1000, 1250);
> +
> + if (read_poll_timeout(sdhci_readl, tmp, (tmp & SDHCI_SPRD_DLL_LOCKED),
> + 2000, USEC_PER_SEC, false, host, SDHCI_SPRD_REG_32_DLL_STS0)) {
> + pr_err("%s: DLL locked fail!\n", mmc_hostname(host->mmc));
> + pr_info("%s: DLL_STS0 : 0x%x, DLL_CFG : 0x%x\n",
> + mmc_hostname(host->mmc),
> + sdhci_readl(host, SDHCI_SPRD_REG_32_DLL_STS0),
> + sdhci_readl(host, SDHCI_SPRD_REG_32_DLL_CFG));
> + }
> }
>
> static void sdhci_sprd_set_clock(struct sdhci_host *host, unsigned int clock)
>
next prev parent reply other threads:[~2021-09-27 5:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-26 9:28 Chunyan Zhang
2021-09-27 5:48 ` Adrian Hunter [this message]
2021-09-27 22:32 ` Ulf Hansson
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=847b5295-ba23-107c-6fee-4e766a86ce7a@intel.com \
--to=adrian.hunter@intel.com \
--cc=baolin.wang7@gmail.com \
--cc=chunyan.zhang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=ulf.hansson@linaro.org \
--cc=yuelin.tang@unisoc.com \
--cc=zhang.lyra@gmail.com \
--cc=zhenxiong.lai@unisoc.com \
/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
all inboxes | Powered by JetHome®