linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: haibo.chen@nxp.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org
Cc: linux-imx@nxp.com, linus.walleij@linaro.org
Subject: Re: [PATCH v3 13/14] mmc: sdhci-esdhc-imx: clear DMA_SEL when disable DMA mode
Date: Tue, 18 Feb 2020 10:00:08 +0200	[thread overview]
Message-ID: <923b58e7-8e75-e06c-0f37-b4827724ca45@intel.com> (raw)
In-Reply-To: <1581324597-31031-8-git-send-email-haibo.chen@nxp.com>

On 10/02/20 10:49 am, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
> 
> Currently, when use standard tuning, driver default disable DMA just before
> send tuning command. But on i.MX8 usdhc, this is not enough. Need also clear
> DMA_SEL. If not, once the DMA_SEL select AMDA2 before, even dma already disabled,
> when send tuning command, usdhc will still prefetch the ADMA script from wrong
> DMA address, then we will see IOMMU report some error which show lack of TLB
> mapping.
> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index dedc067cd0dd..44837e3014e8 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -639,10 +639,24 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
>  			 * For DMA access restore the levels to default value.
>  			 */
>  			m = readl(host->ioaddr + ESDHC_WTMK_LVL);
> -			if (val & SDHCI_TRNS_DMA)
> +			if (val & SDHCI_TRNS_DMA) {
>  				wml = ESDHC_WTMK_LVL_WML_VAL_DEF;
> -			else
> +			} else {
> +				u8 ctrl;
>  				wml = ESDHC_WTMK_LVL_WML_VAL_MAX;
> +
> +				/*
> +				 * Since already disable DMA mode, so also need
> +				 * to clear the DMASEL. Otherwise, for standard
> +				 * tuning, when send tuning command, usdhc will
> +				 * still prefetch the ADMA script from wrong
> +				 * DMA address, then we will see IOMMU report
> +				 * some error which show lack of TLB mapping.
> +				 */
> +				ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
> +				ctrl &= ~SDHCI_CTRL_DMA_MASK;
> +				sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
> +			}
>  			m &= ~(ESDHC_WTMK_LVL_RD_WML_MASK |
>  			       ESDHC_WTMK_LVL_WR_WML_MASK);
>  			m |= (wml << ESDHC_WTMK_LVL_RD_WML_SHIFT) |
> 


  reply	other threads:[~2020-02-18  8:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10  8:49 [PATCH v3 06/14] mmc: sdhci-esdhc-imx: add strobe-dll-delay-target support haibo.chen
2020-02-10  8:49 ` [PATCH v3 07/14] mmc: sdhci-esdhc-imx: optimize the clock setting haibo.chen
2020-02-10  8:49 ` [PATCH v3 08/14] mmc: sdhci-esdhc-imx: optimize the strobe dll setting haibo.chen
2020-02-10  8:49 ` [PATCH v3 09/14] mmc: sdhci-esdhc-imx: add flag ESDHC_FLAG_BROKEN_AUTO_CMD23 haibo.chen
2020-02-18  7:42   ` Adrian Hunter
2020-02-10  8:49 ` [PATCH v3 10/14] mmc: sdhci-esdhc-imx: Add an new esdhc_soc_data for i.MX8MM haibo.chen
2020-02-18  7:42   ` Adrian Hunter
2020-02-10  8:49 ` [PATCH v3 11/14] mmc: sdhci-esdhc-imx: clear pending interrupt and halt cqhci haibo.chen
2020-02-18  7:47   ` Adrian Hunter
2020-02-10  8:49 ` [PATCH v3 12/14] mmc: sdhci-esdhc-imx: restore pin state when resume back haibo.chen
2020-02-18  7:58   ` Adrian Hunter
2020-02-19  7:16     ` BOUGH CHEN
2020-02-19  7:29       ` Hunter, Adrian
2020-02-19  7:37         ` BOUGH CHEN
2020-02-10  8:49 ` [PATCH v3 13/14] mmc: sdhci-esdhc-imx: clear DMA_SEL when disable DMA mode haibo.chen
2020-02-18  8:00   ` Adrian Hunter [this message]
2020-02-10  8:49 ` [PATCH v3 14/14] mmc: queue: create dev->dma_parms before call dma_set_max_seg_size() haibo.chen
2020-02-18  8:15   ` Adrian Hunter
2020-02-19  7:20     ` BOUGH CHEN

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=923b58e7-8e75-e06c-0f37-b4827724ca45@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=haibo.chen@nxp.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-mmc@vger.kernel.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: 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).