* [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family
@ 2025-07-30 16:46 Biju
2025-07-30 16:46 ` [PATCH v3 1/2] mmc: tmio: Add 64-bit read/write support for SD_BUF0 in polling mode Biju
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Biju @ 2025-07-30 16:46 UTC (permalink / raw)
To: Wolfram Sang, Ulf Hansson
Cc: Biju Das, linux-mmc, linux-renesas-soc, linux-kernel,
Geert Uytterhoeven, Prabhakar Mahadev Lad, Biju Das
From: Biju Das <biju.das.jz@bp.renesas.com>
As per the RZ/{G2L,G3E} HW manual SD_BUF0 can be accessed by 16/32/64
bits. Most of the data transfer in SD/SDIO/eMMC mode is more than 8 bytes.
During testing it is found that, if the DMA buffer is not aligned to 128
bit it fallback to PIO mode. In such cases, 64-bit access is much more
efficient than the current 16-bit.
v2->v3:
* Added header file linux/io.h
* Replaced io{read,write}64_rep->{read,write}sq to fix the build error
reported by the bot.
RFT->v2:
* Collected tags
* Fixed the build error reported by the bot.
Biju Das (2):
mmc: tmio: Add 64-bit read/write support for SD_BUF0 in polling mode
mmc: renesas_sdhi: Enable 64-bit polling mode
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 3 +-
drivers/mmc/host/tmio_mmc.h | 15 +++++++++
drivers/mmc/host/tmio_mmc_core.c | 33 +++++++++++++++++++
include/linux/platform_data/tmio.h | 3 ++
4 files changed, 53 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/2] mmc: tmio: Add 64-bit read/write support for SD_BUF0 in polling mode
2025-07-30 16:46 [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family Biju
@ 2025-07-30 16:46 ` Biju
2025-07-30 16:46 ` [PATCH v3 2/2] mmc: renesas_sdhi: Enable 64-bit " Biju
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Biju @ 2025-07-30 16:46 UTC (permalink / raw)
To: Wolfram Sang, Ulf Hansson
Cc: Biju Das, linux-mmc, linux-renesas-soc, linux-kernel,
Geert Uytterhoeven, Prabhakar Mahadev Lad, Biju Das
From: Biju Das <biju.das.jz@bp.renesas.com>
As per the RZ/{G2L,G3E} HW manual SD_BUF0 can be accessed by 16/32/64
bits. Most of the data transfer in SD/SDIO/eMMC mode is more than 8 bytes.
During testing it is found that, if the DMA buffer is not aligned to 128
bit it fallback to PIO mode. In such cases, 64-bit access is much more
efficient than the current 16-bit.
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2->v3:
* Added header file linux/io.h
* Replaced io{read,write}64_rep->{read,write}sq to fix the build error
reported by the bot.
RFT->v2:
* Collected tags
* Fixed the build error reported by the bot by guarding the code with
CONFIG_64BIT.
---
drivers/mmc/host/tmio_mmc.h | 15 ++++++++++++++
drivers/mmc/host/tmio_mmc_core.c | 33 ++++++++++++++++++++++++++++++
include/linux/platform_data/tmio.h | 3 +++
3 files changed, 51 insertions(+)
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index d730b7633ae1..c8cdb1c0722e 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -16,6 +16,7 @@
#include <linux/dmaengine.h>
#include <linux/highmem.h>
+#include <linux/io.h>
#include <linux/mutex.h>
#include <linux/pagemap.h>
#include <linux/scatterlist.h>
@@ -242,6 +243,20 @@ static inline void sd_ctrl_read32_rep(struct tmio_mmc_host *host, int addr,
ioread32_rep(host->ctl + (addr << host->bus_shift), buf, count);
}
+#ifdef CONFIG_64BIT
+static inline void sd_ctrl_read64_rep(struct tmio_mmc_host *host, int addr,
+ u64 *buf, int count)
+{
+ readsq(host->ctl + (addr << host->bus_shift), buf, count);
+}
+
+static inline void sd_ctrl_write64_rep(struct tmio_mmc_host *host, int addr,
+ const u64 *buf, int count)
+{
+ writesq(host->ctl + (addr << host->bus_shift), buf, count);
+}
+#endif
+
static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr,
u16 val)
{
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 21c2f9095bac..775e0d9353d5 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -349,6 +349,39 @@ static void tmio_mmc_transfer_data(struct tmio_mmc_host *host,
/*
* Transfer the data
*/
+#ifdef CONFIG_64BIT
+ if (host->pdata->flags & TMIO_MMC_64BIT_DATA_PORT) {
+ u64 *buf64 = (u64 *)buf;
+ u64 data = 0;
+
+ if (count >= 8) {
+ if (is_read)
+ sd_ctrl_read64_rep(host, CTL_SD_DATA_PORT,
+ buf64, count >> 3);
+ else
+ sd_ctrl_write64_rep(host, CTL_SD_DATA_PORT,
+ buf64, count >> 3);
+ }
+
+ /* if count was multiple of 8 */
+ if (!(count & 0x7))
+ return;
+
+ buf64 += count >> 3;
+ count %= 8;
+
+ if (is_read) {
+ sd_ctrl_read64_rep(host, CTL_SD_DATA_PORT, &data, 1);
+ memcpy(buf64, &data, count);
+ } else {
+ memcpy(&data, buf64, count);
+ sd_ctrl_write64_rep(host, CTL_SD_DATA_PORT, &data, 1);
+ }
+
+ return;
+ }
+#endif
+
if (host->pdata->flags & TMIO_MMC_32BIT_DATA_PORT) {
u32 data = 0;
u32 *buf32 = (u32 *)buf;
diff --git a/include/linux/platform_data/tmio.h b/include/linux/platform_data/tmio.h
index b060124ba1ae..426291713b83 100644
--- a/include/linux/platform_data/tmio.h
+++ b/include/linux/platform_data/tmio.h
@@ -47,6 +47,9 @@
/* Some controllers have a CBSY bit */
#define TMIO_MMC_HAVE_CBSY BIT(11)
+/* Some controllers have a 64-bit wide data port register */
+#define TMIO_MMC_64BIT_DATA_PORT BIT(12)
+
struct tmio_mmc_data {
void *chan_priv_tx;
void *chan_priv_rx;
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 2/2] mmc: renesas_sdhi: Enable 64-bit polling mode
2025-07-30 16:46 [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family Biju
2025-07-30 16:46 ` [PATCH v3 1/2] mmc: tmio: Add 64-bit read/write support for SD_BUF0 in polling mode Biju
@ 2025-07-30 16:46 ` Biju
2025-08-18 10:55 ` [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family Ulf Hansson
2025-08-29 9:51 ` Geert Uytterhoeven
3 siblings, 0 replies; 8+ messages in thread
From: Biju @ 2025-07-30 16:46 UTC (permalink / raw)
To: Wolfram Sang, Ulf Hansson
Cc: Biju Das, linux-mmc, linux-renesas-soc, linux-kernel,
Geert Uytterhoeven, Prabhakar Mahadev Lad, Biju Das
From: Biju Das <biju.das.jz@bp.renesas.com>
Enable 64-bit polling mode for R-Car gen3 and RZ/G2L SoCs.
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2->v3:
* No change
RFT->v2:
* Collected tags
---
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 4b389e92399e..9e3ed0bcddd6 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -107,7 +107,8 @@ static const struct renesas_sdhi_of_data of_data_rza2 = {
static const struct renesas_sdhi_of_data of_data_rcar_gen3 = {
.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_CLK_ACTUAL |
- TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,
+ TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2 |
+ TMIO_MMC_64BIT_DATA_PORT,
.capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
MMC_CAP_CMD23 | MMC_CAP_WAIT_WHILE_BUSY,
.capabilities2 = MMC_CAP2_NO_WRITE_PROTECT | MMC_CAP2_MERGE_CAPABLE,
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family
2025-07-30 16:46 [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family Biju
2025-07-30 16:46 ` [PATCH v3 1/2] mmc: tmio: Add 64-bit read/write support for SD_BUF0 in polling mode Biju
2025-07-30 16:46 ` [PATCH v3 2/2] mmc: renesas_sdhi: Enable 64-bit " Biju
@ 2025-08-18 10:55 ` Ulf Hansson
2025-08-29 9:51 ` Geert Uytterhoeven
3 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2025-08-18 10:55 UTC (permalink / raw)
To: Biju
Cc: Wolfram Sang, Biju Das, linux-mmc, linux-renesas-soc,
linux-kernel, Geert Uytterhoeven, Prabhakar Mahadev Lad
On Wed, 30 Jul 2025 at 18:46, Biju <biju.das.au@gmail.com> wrote:
>
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> As per the RZ/{G2L,G3E} HW manual SD_BUF0 can be accessed by 16/32/64
> bits. Most of the data transfer in SD/SDIO/eMMC mode is more than 8 bytes.
> During testing it is found that, if the DMA buffer is not aligned to 128
> bit it fallback to PIO mode. In such cases, 64-bit access is much more
> efficient than the current 16-bit.
>
> v2->v3:
> * Added header file linux/io.h
> * Replaced io{read,write}64_rep->{read,write}sq to fix the build error
> reported by the bot.
> RFT->v2:
> * Collected tags
> * Fixed the build error reported by the bot.
>
> Biju Das (2):
> mmc: tmio: Add 64-bit read/write support for SD_BUF0 in polling mode
> mmc: renesas_sdhi: Enable 64-bit polling mode
>
> drivers/mmc/host/renesas_sdhi_internal_dmac.c | 3 +-
> drivers/mmc/host/tmio_mmc.h | 15 +++++++++
> drivers/mmc/host/tmio_mmc_core.c | 33 +++++++++++++++++++
> include/linux/platform_data/tmio.h | 3 ++
> 4 files changed, 53 insertions(+), 1 deletion(-)
>
The series applied for next, thanks!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family
2025-07-30 16:46 [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family Biju
` (2 preceding siblings ...)
2025-08-18 10:55 ` [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family Ulf Hansson
@ 2025-08-29 9:51 ` Geert Uytterhoeven
2025-08-29 10:26 ` Wolfram Sang
3 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2025-08-29 9:51 UTC (permalink / raw)
To: Biju
Cc: Wolfram Sang, Ulf Hansson, Biju Das, linux-mmc, linux-renesas-soc,
linux-kernel, Geert Uytterhoeven, Prabhakar Mahadev Lad
Hi Biju,
On Wed, 30 Jul 2025 at 18:46, Biju <biju.das.au@gmail.com> wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> As per the RZ/{G2L,G3E} HW manual SD_BUF0 can be accessed by 16/32/64
> bits. Most of the data transfer in SD/SDIO/eMMC mode is more than 8 bytes.
> During testing it is found that, if the DMA buffer is not aligned to 128
> bit it fallback to PIO mode. In such cases, 64-bit access is much more
> efficient than the current 16-bit.
Thanks for your series!
I believe some of the SoCs that do not support 64-bit accesses, do
support 32-bit accesses. Do you think it would be worthwhile adding
support for that, too?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family
2025-08-29 9:51 ` Geert Uytterhoeven
@ 2025-08-29 10:26 ` Wolfram Sang
2025-08-29 11:04 ` Geert Uytterhoeven
0 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2025-08-29 10:26 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Biju, Ulf Hansson, Biju Das, linux-mmc, linux-renesas-soc,
linux-kernel, Geert Uytterhoeven, Prabhakar Mahadev Lad
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
> I believe some of the SoCs that do not support 64-bit accesses, do
> support 32-bit accesses. Do you think it would be worthwhile adding
> support for that, too?
We have that already? Check the context after the chunk added to
tmio_mmc_core.c:
if (host->pdata->flags & TMIO_MMC_32BIT_DATA_PORT) {
u32 data = 0;
u32 *buf32 = (u32 *)buf;
...
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family
2025-08-29 10:26 ` Wolfram Sang
@ 2025-08-29 11:04 ` Geert Uytterhoeven
2025-08-29 11:24 ` Wolfram Sang
0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2025-08-29 11:04 UTC (permalink / raw)
To: Wolfram Sang
Cc: Biju, Ulf Hansson, Biju Das, linux-mmc, linux-renesas-soc,
linux-kernel, Geert Uytterhoeven, Prabhakar Mahadev Lad
Hi Wolfram,
On Fri, 29 Aug 2025 at 12:26, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> > I believe some of the SoCs that do not support 64-bit accesses, do
> > support 32-bit accesses. Do you think it would be worthwhile adding
> > support for that, too?
>
> We have that already? Check the context after the chunk added to
> tmio_mmc_core.c:
>
> if (host->pdata->flags & TMIO_MMC_32BIT_DATA_PORT) {
> u32 data = 0;
> u32 *buf32 = (u32 *)buf;
> ...
OK, thanks, then I misremembered what exactly is supported and what
is not...
But this is set only on RZ/A1, so my question should be: are there
any other SoCs where TMIO_MMC_32BIT_DATA_PORT should be set?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family
2025-08-29 11:04 ` Geert Uytterhoeven
@ 2025-08-29 11:24 ` Wolfram Sang
0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2025-08-29 11:24 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Biju, Ulf Hansson, Biju Das, linux-mmc, linux-renesas-soc,
linux-kernel, Geert Uytterhoeven, Prabhakar Mahadev Lad
> But this is set only on RZ/A1, so my question should be: are there
> any other SoCs where TMIO_MMC_32BIT_DATA_PORT should be set?
I can check if it makes a difference on R-Car boards I have.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-08-29 11:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-30 16:46 [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family Biju
2025-07-30 16:46 ` [PATCH v3 1/2] mmc: tmio: Add 64-bit read/write support for SD_BUF0 in polling mode Biju
2025-07-30 16:46 ` [PATCH v3 2/2] mmc: renesas_sdhi: Enable 64-bit " Biju
2025-08-18 10:55 ` [PATCH v3 0/2] Enable 64-bit polling mode for R-Car Gen3 and RZ/G2+ family Ulf Hansson
2025-08-29 9:51 ` Geert Uytterhoeven
2025-08-29 10:26 ` Wolfram Sang
2025-08-29 11:04 ` Geert Uytterhoeven
2025-08-29 11:24 ` Wolfram Sang
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).