From: Jernej Skrabec <jernej.skrabec@gmail.com>
To: Ulf Hansson <ulfh@kernel.org>
Cc: Chen-Yu Tsai <wens@kernel.org>,
Samuel Holland <samuel@sholland.org>,
Andre Przywara <andre.przywara@arm.com>,
Anfernee Cao <anferneemelokc5@gmail.com>,
linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: [PATCH 2/4] mmc: sunxi: Set the IDMA DMA mask
Date: Tue, 3 Nov 2026 19:30:28 +0100 [thread overview]
Message-ID: <20261103183030.81078-3-jernej.skrabec@gmail.com> (raw)
In-Reply-To: <20261103183030.81078-1-jernej.skrabec@gmail.com>
Controllers with a non-zero idma_des_shift (D1, A100 and H616) store
buffer and descriptor addresses shifted right by two, so they can
address 34 bits of physical memory. The driver never sets a DMA mask,
so the default 32-bit mask applies. On boards with DRAM above 4 GiB,
like H616 boards with 4 GiB of DRAM starting at 0x40000000, every
buffer above that limit is needlessly bounced through SWIOTLB.
Set the DMA mask to the range the controller can address. For the
other controllers, it stays at 32 bits.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
drivers/mmc/host/sunxi-mmc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 9744b6b860ac..479420071c2d 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1385,6 +1385,11 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
if (ret)
return ret;
+ ret = dma_set_mask_and_coherent(&pdev->dev,
+ DMA_BIT_MASK(32 + host->cfg->idma_des_shift));
+ if (ret)
+ goto error_disable_mmc;
+
host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
&host->sg_dma, GFP_KERNEL);
if (!host->sg_cpu)
--
2.43.0
next prev parent reply other threads:[~2026-11-03 18:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 18:30 [PATCH 0/4] mmc: sunxi: fixes and preparation for A523 UHS support Jernej Skrabec
2026-11-03 18:30 ` [PATCH 1/4] mmc: sunxi: Report manual stop errors correctly Jernej Skrabec
2026-11-03 18:30 ` Jernej Skrabec [this message]
2026-11-03 18:30 ` [PATCH 3/4] mmc: sunxi: Build IDMA descriptors from mapped SG list Jernej Skrabec
2026-11-03 18:30 ` [PATCH 4/4] mmc: sunxi: Distinguish CRC and timeout errors Jernej Skrabec
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=20261103183030.81078-3-jernej.skrabec@gmail.com \
--to=jernej.skrabec@gmail.com \
--cc=andre.przywara@arm.com \
--cc=anferneemelokc5@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=samuel@sholland.org \
--cc=ulfh@kernel.org \
--cc=wens@kernel.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
all inboxes | Powered by JetHome®