linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yann Gautier <yann.gautier@foss.st.com>
To: Rob Herring <robh+dt@kernel.org>, Ulf Hansson <ulf.hansson@linaro.org>
Cc: <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-mmc@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Christophe Kerello <christophe.kerello@foss.st.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Ludovic Barre <ludovic.barre@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Russell King <linux@armlinux.org.uk>, Marek Vasut <marex@denx.de>,
	<kernel@dh-electronics.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Grzegorz Szymaszek <gszymaszek@short.pl>,
	Yann Gautier <yann.gautier@foss.st.com>
Subject: [PATCH 2/3] mmc: mmci: stm32: manage st,disable-dma-lli property
Date: Fri, 4 Mar 2022 14:51:33 +0100	[thread overview]
Message-ID: <20220304135134.47827-3-yann.gautier@foss.st.com> (raw)
In-Reply-To: <20220304135134.47827-1-yann.gautier@foss.st.com>

This property is used to disable DMA LLI for an SDMMC instance. We cannot
directly modify the variant struct as it will affect all MMC instances.
The parameter is then copied in the struct sdmmc_idma, and force to 0
if the st,disable-dma-lli property is set in DT.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
---
 drivers/mmc/host/mmci_stm32_sdmmc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c
index 9c13f2c31365..02cb0929c465 100644
--- a/drivers/mmc/host/mmci_stm32_sdmmc.c
+++ b/drivers/mmc/host/mmci_stm32_sdmmc.c
@@ -43,6 +43,7 @@ struct sdmmc_lli_desc {
 struct sdmmc_idma {
 	dma_addr_t sg_dma;
 	void *sg_cpu;
+	u8 dma_lli:1;
 };
 
 struct sdmmc_dlyb {
@@ -118,6 +119,7 @@ static void sdmmc_idma_unprep_data(struct mmci_host *host,
 
 static int sdmmc_idma_setup(struct mmci_host *host)
 {
+	struct device_node *np = host->mmc->parent->of_node;
 	struct sdmmc_idma *idma;
 	struct device *dev = mmc_dev(host->mmc);
 
@@ -125,9 +127,13 @@ static int sdmmc_idma_setup(struct mmci_host *host)
 	if (!idma)
 		return -ENOMEM;
 
+	idma->dma_lli = host->variant->dma_lli;
+	if (of_get_property(np, "st,disable-dma-lli", NULL))
+		idma->dma_lli = 0;
+
 	host->dma_priv = idma;
 
-	if (host->variant->dma_lli) {
+	if (idma->dma_lli) {
 		idma->sg_cpu = dmam_alloc_coherent(dev, SDMMC_LLI_BUF_LEN,
 						   &idma->sg_dma, GFP_KERNEL);
 		if (!idma->sg_cpu) {
@@ -154,7 +160,7 @@ static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)
 	struct scatterlist *sg;
 	int i;
 
-	if (!host->variant->dma_lli || data->sg_len == 1) {
+	if (!idma->dma_lli || data->sg_len == 1) {
 		writel_relaxed(sg_dma_address(data->sg),
 			       host->base + MMCI_STM32_IDMABASE0R);
 		writel_relaxed(MMCI_STM32_IDMAEN,
-- 
2.25.1


  parent reply	other threads:[~2022-03-04 13:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 13:51 [PATCH 0/3] mmc: mmci: stm32: updates for SDIO Yann Gautier
2022-03-04 13:51 ` [PATCH 1/3] dt-bindings: mmc: mmci: add a property to disable DMA LLI Yann Gautier
2022-03-08 10:57   ` Ulf Hansson
2022-03-10 15:59     ` Yann Gautier
2022-03-11 15:45       ` Ulf Hansson
2022-03-14 22:43   ` Linus Walleij
2022-03-15  8:26     ` Yann Gautier
2022-03-17 10:00       ` Ulf Hansson
2022-03-17 10:17         ` Yann Gautier
2022-03-17 10:28           ` Ulf Hansson
2022-03-25 20:12       ` Linus Walleij
2022-03-28 14:58         ` Yann Gautier
2022-03-29 15:31       ` Manivannan Sadhasivam
2022-03-29 16:00         ` Yann Gautier
2022-03-29 17:33           ` Manivannan Sadhasivam
2022-03-29 21:16             ` Linus Walleij
2022-03-30 10:25               ` Srinivas Kandagatla
2022-03-04 13:51 ` Yann Gautier [this message]
2022-03-04 13:51 ` [PATCH 3/3] mmc: mmci: manage MMC_PM_KEEP_POWER per variant config Yann Gautier

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=20220304135134.47827-3-yann.gautier@foss.st.com \
    --to=yann.gautier@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=christophe.kerello@foss.st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gszymaszek@short.pl \
    --cc=kernel@dh-electronics.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=ludovic.barre@foss.st.com \
    --cc=mani@kernel.org \
    --cc=marex@denx.de \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@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).