linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 2/2] mmc: sdhci-of-esdhc: update tuning erratum A-008171
Date: Thu, 16 Jan 2020 15:39:31 +0100	[thread overview]
Message-ID: <CAPDyKFqdkvHvTHdGP4oBJz8tZBBU8Rv7NRzj7NhDKXPJAE6+sQ@mail.gmail.com> (raw)
In-Reply-To: <20191212075219.48625-2-yangbo.lu@nxp.com>

On Thu, 12 Dec 2019 at 08:53, Yangbo Lu <yangbo.lu@nxp.com> wrote:
>
> There is an official update for eSDHC tuning erratum A-008171.
> This patch is to implement the changes,
> - Affect all revisions of SoC.
> - Changes for tuning window checking.
> - Hardware hits a new condition that tuning succeeds although
>   the eSDHC might not have tuned properly for type2 SoCs
>   (soc_tuning_erratum_type2[] array in driver). So check
>   tuning window after tuning succeeds.
>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-of-esdhc.c | 39 ++++++++++++++++++++++++++-------------
>  1 file changed, 26 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index cd0f21e..a99c000d 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -848,20 +848,20 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc,
>  }
>
>  static struct soc_device_attribute soc_tuning_erratum_type1[] = {
> -       { .family = "QorIQ T1023", .revision = "1.0", },
> -       { .family = "QorIQ T1040", .revision = "1.0", },
> -       { .family = "QorIQ T2080", .revision = "1.0", },
> -       { .family = "QorIQ LS1021A", .revision = "1.0", },
> +       { .family = "QorIQ T1023", },
> +       { .family = "QorIQ T1040", },
> +       { .family = "QorIQ T2080", },
> +       { .family = "QorIQ LS1021A", },
>         { },
>  };
>
>  static struct soc_device_attribute soc_tuning_erratum_type2[] = {
> -       { .family = "QorIQ LS1012A", .revision = "1.0", },
> -       { .family = "QorIQ LS1043A", .revision = "1.*", },
> -       { .family = "QorIQ LS1046A", .revision = "1.0", },
> -       { .family = "QorIQ LS1080A", .revision = "1.0", },
> -       { .family = "QorIQ LS2080A", .revision = "1.0", },
> -       { .family = "QorIQ LA1575A", .revision = "1.0", },
> +       { .family = "QorIQ LS1012A", },
> +       { .family = "QorIQ LS1043A", },
> +       { .family = "QorIQ LS1046A", },
> +       { .family = "QorIQ LS1080A", },
> +       { .family = "QorIQ LS2080A", },
> +       { .family = "QorIQ LA1575A", },
>         { },
>  };
>
> @@ -929,13 +929,13 @@ static void esdhc_prepare_sw_tuning(struct sdhci_host *host, u8 *window_start,
>         /* Write 32'hFFFF_FFFF to IRQSTAT register */
>         sdhci_writel(host, 0xFFFFFFFF, SDHCI_INT_STATUS);
>
> -       /* If TBSTAT[15:8]-TBSTAT[7:0] > 4 * div_ratio
> -        * or TBSTAT[7:0]-TBSTAT[15:8] > 4 * div_ratio,
> +       /* If TBSTAT[15:8]-TBSTAT[7:0] > (4 * div_ratio) + 2
> +        * or TBSTAT[7:0]-TBSTAT[15:8] > (4 * div_ratio) + 2,
>          * then program TBPTR[TB_WNDW_END_PTR] = 4 * div_ratio
>          * and program TBPTR[TB_WNDW_START_PTR] = 8 * div_ratio.
>          */
>
> -       if (abs(start_ptr - end_ptr) > (4 * esdhc->div_ratio)) {
> +       if (abs(start_ptr - end_ptr) > (4 * esdhc->div_ratio + 2)) {
>                 *window_start = 8 * esdhc->div_ratio;
>                 *window_end = 4 * esdhc->div_ratio;
>         } else {
> @@ -1008,6 +1008,19 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
>                 if (ret)
>                         break;
>
> +               /* For type2 affected platforms of the tuning erratum,
> +                * tuning may succeed although eSDHC might not have
> +                * tuned properly. Need to check tuning window.
> +                */
> +               if (esdhc->quirk_tuning_erratum_type2 &&
> +                   !host->tuning_err) {
> +                       esdhc_tuning_window_ptr(host, &window_start,
> +                                               &window_end);
> +                       if (abs(window_start - window_end) >
> +                           (4 * esdhc->div_ratio + 2))
> +                               host->tuning_err = -EAGAIN;
> +               }
> +
>                 /* If HW tuning fails and triggers erratum,
>                  * try workaround.
>                  */
> --
> 2.7.4
>

  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 [this message]
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

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=CAPDyKFqdkvHvTHdGP4oBJz8tZBBU8Rv7NRzj7NhDKXPJAE6+sQ@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).