From: Ulf Hansson <ulf.hansson@linaro.org>
To: Yangbo Lu <yangbo.lu@nxp.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH 1/2] mmc: sdhci-of-esdhc: convert to use esdhc_tuning_window_ptr()
Date: Thu, 16 Jan 2020 15:39:26 +0100 [thread overview]
Message-ID: <CAPDyKFrobSCLT+p0O3EbkdNMQroEH8S9+UkPjbFLLgAPvtuO_g@mail.gmail.com> (raw)
In-Reply-To: <20191212075219.48625-1-yangbo.lu@nxp.com>
On Thu, 12 Dec 2019 at 08:53, Yangbo Lu <yangbo.lu@nxp.com> wrote:
>
> Convert to use a new function esdhc_tuning_window_ptr() to
> get tuning window start point and end point.
>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-of-esdhc.c | 34 +++++++++++++++++++++-------------
> 1 file changed, 21 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 7f87a90..cd0f21e 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -882,20 +882,11 @@ static void esdhc_tuning_block_enable(struct sdhci_host *host, bool enable)
> esdhc_clock_enable(host, true);
> }
>
> -static void esdhc_prepare_sw_tuning(struct sdhci_host *host, u8 *window_start,
> +static void esdhc_tuning_window_ptr(struct sdhci_host *host, u8 *window_start,
> u8 *window_end)
> {
> - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
> - u8 tbstat_15_8, tbstat_7_0;
> u32 val;
>
> - if (esdhc->quirk_tuning_erratum_type1) {
> - *window_start = 5 * esdhc->div_ratio;
> - *window_end = 3 * esdhc->div_ratio;
> - return;
> - }
> -
> /* Write TBCTL[11:8]=4'h8 */
> val = sdhci_readl(host, ESDHC_TBCTL);
> val &= ~(0xf << 8);
> @@ -914,6 +905,25 @@ static void esdhc_prepare_sw_tuning(struct sdhci_host *host, u8 *window_start,
> val = sdhci_readl(host, ESDHC_TBSTAT);
> val = sdhci_readl(host, ESDHC_TBSTAT);
>
> + *window_end = val & 0xff;
> + *window_start = (val >> 8) & 0xff;
> +}
> +
> +static void esdhc_prepare_sw_tuning(struct sdhci_host *host, u8 *window_start,
> + u8 *window_end)
> +{
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
> + u8 start_ptr, end_ptr;
> +
> + if (esdhc->quirk_tuning_erratum_type1) {
> + *window_start = 5 * esdhc->div_ratio;
> + *window_end = 3 * esdhc->div_ratio;
> + return;
> + }
> +
> + esdhc_tuning_window_ptr(host, &start_ptr, &end_ptr);
> +
> /* Reset data lines by setting ESDHCCTL[RSTD] */
> sdhci_reset(host, SDHCI_RESET_DATA);
> /* Write 32'hFFFF_FFFF to IRQSTAT register */
> @@ -924,10 +934,8 @@ static void esdhc_prepare_sw_tuning(struct sdhci_host *host, u8 *window_start,
> * then program TBPTR[TB_WNDW_END_PTR] = 4 * div_ratio
> * and program TBPTR[TB_WNDW_START_PTR] = 8 * div_ratio.
> */
> - tbstat_7_0 = val & 0xff;
> - tbstat_15_8 = (val >> 8) & 0xff;
>
> - if (abs(tbstat_15_8 - tbstat_7_0) > (4 * esdhc->div_ratio)) {
> + if (abs(start_ptr - end_ptr) > (4 * esdhc->div_ratio)) {
> *window_start = 8 * esdhc->div_ratio;
> *window_end = 4 * esdhc->div_ratio;
> } else {
> --
> 2.7.4
>
prev parent reply other threads:[~2020-01-16 14:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 7:52 [PATCH 1/2] mmc: sdhci-of-esdhc: convert to use esdhc_tuning_window_ptr() Yangbo Lu
2019-12-12 7:52 ` [PATCH 2/2] mmc: sdhci-of-esdhc: update tuning erratum A-008171 Yangbo Lu
2019-12-20 7:46 ` Adrian Hunter
2020-01-16 14:39 ` Ulf Hansson
2019-12-13 12:20 ` [PATCH 1/2] mmc: sdhci-of-esdhc: convert to use esdhc_tuning_window_ptr() Adrian Hunter
2019-12-16 3:23 ` Y.b. Lu
2019-12-20 7:45 ` Adrian Hunter
2020-01-16 14:39 ` Ulf Hansson [this message]
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=CAPDyKFrobSCLT+p0O3EbkdNMQroEH8S9+UkPjbFLLgAPvtuO_g@mail.gmail.com \
--to=ulf.hansson@linaro.org \
--cc=adrian.hunter@intel.com \
--cc=linux-mmc@vger.kernel.org \
--cc=yangbo.lu@nxp.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;
as well as URLs for NNTP newsgroup(s).