public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: haibo.chen@nxp.com
To: adrian.hunter@intel.com, ulf.hansson@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-imx@nxp.com, haibo.chen@nxp.com
Subject: [PATCH] mmc: sdhci: disable ADMA when PAGE SIZE is 64K
Date: Wed, 27 Oct 2021 10:47:21 +0800	[thread overview]
Message-ID: <1635302841-18997-1-git-send-email-haibo.chen@nxp.com> (raw)

From: Haibo Chen <haibo.chen@nxp.com>

For ADMA with quirks SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC, it limit
the max segment size as 64K-1. Currently, linux kernel support
4K/16K/64K PAGE_SIZE. If choose 64K PAGE_SIZE, sdhci in ADMA mode
with the upper quirks will meet issue.

Though mmc driver give block layer the max segment size through
blk_queue_max_segment_size(), but in this function, it will compare
the argument with PAGE_SIZE, and will choose PAGE_SIZE if the argument
is smaller than PAGE_SIZE. When PAGE_SIZE is 64K, finally the mmc
request queue will get 64K as the max segment size. Once the sg data
length=64K, ADMA will meet issue. For this case, need to disable ADMA
mode.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/mmc/host/sdhci.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index dbe87995596c..47e0c0156b94 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -4187,6 +4187,12 @@ int sdhci_setup_host(struct sdhci_host *host)
 		host->flags &= ~SDHCI_USE_ADMA;
 	}
 
+	if ((host->quirks & SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC) &&
+		PAGE_SIZE >= 65536 && (host->flags & SDHCI_USE_ADMA)) {
+		DBG("Disabling ADMA as it don't support >= 64K PAGE_SIZE\n");
+		host->flags &= ~SDHCI_USE_ADMA;
+	}
+
 	if (sdhci_can_64bit_dma(host))
 		host->flags |= SDHCI_USE_64_BIT_DMA;
 
-- 
2.17.1


             reply	other threads:[~2021-10-27  3:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27  2:47 haibo.chen [this message]
2021-10-27  5:49 ` [PATCH] mmc: sdhci: disable ADMA when PAGE SIZE is 64K Adrian Hunter
2021-10-29 11:40   ` Bough Chen
2021-11-09  8:41     ` Adrian Hunter
2021-11-12  2:02       ` 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=1635302841-18997-1-git-send-email-haibo.chen@nxp.com \
    --to=haibo.chen@nxp.com \
    --cc=adrian.hunter@intel.com \
    --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