Skip to contentSkip to conversation

Support SDMA mode on RPI4 target - 32bit

PATCH Superseded Jaehoon Chung 3 participants 12 messages Feb 18, 2020 – Mar 24, 2020 1 message not in the archive MMC, SD and SDIO

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20200218012540epcas1p2889e448f91f64b2f9a90276318ae2f67@epcas1p2.samsung.com

#1 lore raw

v2 cover Support SDMA mode on RPI4 target - 32bit

RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on u-boot side. Then it's too slow about read/write performance. This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

This patch is based on my RFC's patches.RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on u-boot side. Then it's too slow about read/write performance.
This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

This patch is based on my RFC's patches.

Changelog on V2
- Keep printf message instead of debug
- Add Peng's Reviewed-by tag

Jaehoon Chung (3):
mmc: sdhci: use phys2bus macro when dma address is accessed
mmc: sdhci: not return error when SDMA is not supported
configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config

 configs/rpi_4_32b_defconfig |  1 +
 drivers/mmc/sdhci.c         | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
2.25.0
#2 lore raw

PATCH v2 1/3 mmc: sdhci: use phys2bus macro when dma address is accessed

Use phys2bus macro when dma address is accessed. Some targets need to use pyhs2bus macro. (e.g, RPI4) After applied it, SDMA mode can be used.

---
Changelog on V2
- None

 drivers/mmc/sdhci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/sdhci.c +4 -2
index 01fa5a9d4d..93c9049c5d 100644
@@ -15,6 +15,7 @@
 #include <mmc.h>
 #include <sdhci.h>
 #include <dm.h>
+#include <phys2bus.h>
 
 #if defined(CONFIG_FIXED_SDHCI_ALIGNED_BUFFER)
 void *aligned_buffer = (void *)CONFIG_FIXED_SDHCI_ALIGNED_BUFFER;
@@ -164,7 +165,8 @@ static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
 		if (data->flags != MMC_DATA_READ)
 			memcpy(aligned_buffer, data->src, trans_bytes);
 #endif
-		sdhci_writel(host, host->start_addr, SDHCI_DMA_ADDRESS);
+		sdhci_writel(host, phys_to_bus((ulong)host->start_addr),
+				SDHCI_DMA_ADDRESS);
 
 	} else if (host->flags & (USE_ADMA | USE_ADMA64)) {
 		sdhci_prepare_adma_table(host, data);
@@ -220,7 +222,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
 				start_addr &=
 				~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1);
 				start_addr += SDHCI_DEFAULT_BOUNDARY_SIZE;
-				sdhci_writel(host, start_addr,
+				sdhci_writel(host, phys_to_bus((ulong)start_addr),
 					     SDHCI_DMA_ADDRESS);
 			}
 		}
Signature · 1 line
2.25.0
#3 lore raw

PATCH v2 1/3 mmc: sdhci: use phys2bus macro when dma address is accessed

Quoted 37 lines · Jaehoon Chung

Use phys2bus macro when dma address is accessed. Some targets need to use pyhs2bus macro. (e.g, RPI4) After applied it, SDMA mode can be used.

---
Changelog on V2
- None

 drivers/mmc/sdhci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/sdhci.c +3 -1
index 01fa5a9d4d..93c9049c5d 100644
@@ -15,6 +15,7 @@
 #include <mmc.h>
 #include <sdhci.h>
 #include <dm.h>
+#include <phys2bus.h>
 
 #if defined(CONFIG_FIXED_SDHCI_ALIGNED_BUFFER)
 void *aligned_buffer = (void *)CONFIG_FIXED_SDHCI_ALIGNED_BUFFER;
@@ -164,7 +165,8 @@ static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
 		if (data->flags != MMC_DATA_READ)
 			memcpy(aligned_buffer, data->src, trans_bytes);
 #endif
-		sdhci_writel(host, host->start_addr, SDHCI_DMA_ADDRESS);
+		sdhci_writel(host, phys_to_bus((ulong)host->start_addr),
+				SDHCI_DMA_ADDRESS);
 
 	} else if (host->flags & (USE_ADMA | USE_ADMA64)) {
 		sdhci_prepare_adma_table(host, data);

drivers/mmc/sdhci.c static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data) · line 228

Quoted 8 lines
drivers/mmc/sdhci.c +1 -1
@@ -220,7 +222,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
 				start_addr &=
 				~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1);
 				start_addr += SDHCI_DEFAULT_BOUNDARY_SIZE;
-				sdhci_writel(host, start_addr,
+				sdhci_writel(host, phys_to_bus((ulong)start_addr),
 					     SDHCI_DMA_ADDRESS);
 			}
 		}

Thanks,
Minkyu Kang.

#4 lore raw

PATCH v2 2/3 mmc: sdhci: not return error when SDMA is not supported

In reply to Jaehoon Chung

If Host controller doesn't support SDMA, it doesn't need to return error. Because it can be worked with PIO mode.

---
Changelog on V2
- Keep printf message instead of debug

 drivers/mmc/sdhci.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/mmc/sdhci.c +3 -4
index 93c9049c5d..40bf2a5b2c 100644
@@ -729,13 +729,12 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 	debug("%s, caps: 0x%x\n", __func__, caps);
 
 #ifdef CONFIG_MMC_SDHCI_SDMA
-	if (!(caps & SDHCI_CAN_DO_SDMA)) {
+	if ((caps & SDHCI_CAN_DO_SDMA)) {
+		host->flags |= USE_SDMA;
+	} else {
 		printf("%s: Your controller doesn't support SDMA!!\n",
 		       __func__);
-		return -EINVAL;
 	}
-
-	host->flags |= USE_SDMA;
 #endif
 #if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)
 	if (!(caps & SDHCI_CAN_DO_ADMA2)) {
Signature · 1 line
2.25.0
#5 lore raw

PATCH v2 2/3 mmc: sdhci: not return error when SDMA is not supported

Quoted 17 lines · Jaehoon Chung

If Host controller doesn't support SDMA, it doesn't need to return error. Because it can be worked with PIO mode.

---
Changelog on V2
- Keep printf message instead of debug

 drivers/mmc/sdhci.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/mmc/sdhci.c +0 -0
index 93c9049c5d..40bf2a5b2c 100644

drivers/mmc/sdhci.c int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host, · line 732

Quoted 5 lines
drivers/mmc/sdhci.c +1 -1
@@ -729,13 +729,12 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 	debug("%s, caps: 0x%x\n", __func__, caps);
 
 #ifdef CONFIG_MMC_SDHCI_SDMA
-	if (!(caps & SDHCI_CAN_DO_SDMA)) {
+	if ((caps & SDHCI_CAN_DO_SDMA)) {

seems to redundant braces

drivers/mmc/sdhci.c int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host, · line 740

Quoted 12 lines
drivers/mmc/sdhci.c +2 -3
+		host->flags |= USE_SDMA;
+	} else {
 		printf("%s: Your controller doesn't support SDMA!!\n",
 		       __func__);
-		return -EINVAL;
 	}
-
-	host->flags |= USE_SDMA;
 #endif
 #if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)
 	if (!(caps & SDHCI_CAN_DO_ADMA2)) {

Thanks,
Minkyu Kang.

#6 lore raw

PATCH v2 3/3 configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config

In reply to Jaehoon Chung

Enable SDHCI_SDMA configuration.

---
Changelog on V2
- None

 configs/rpi_4_32b_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/rpi_4_32b_defconfig +1 -0
index 72cda5d949..7189914606 100644
@@ -25,6 +25,7 @@ CONFIG_DFU_MMC=y
 CONFIG_DM_KEYBOARD=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_BCM2835=y
 CONFIG_DM_ETH=y
 CONFIG_BCMGENET=y
Signature · 1 line
2.25.0
#7 lore raw

PATCH v2 3/3 configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config

Quoted 17 lines · Jaehoon Chung

Enable SDHCI_SDMA configuration.

---
Changelog on V2
- None

 configs/rpi_4_32b_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/rpi_4_32b_defconfig +0 -0
index 72cda5d949..7189914606 100644

configs/rpi_4_32b_defconfig CONFIG_DFU_MMC=y · line 31

Quoted 7 lines
configs/rpi_4_32b_defconfig +1 -0
@@ -25,6 +25,7 @@ CONFIG_DFU_MMC=y
 CONFIG_DM_KEYBOARD=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_BCM2835=y
 CONFIG_DM_ETH=y
 CONFIG_BCMGENET=y

Thanks,
Minkyu Kang.

#8 lore raw

v2 cover Support SDMA mode on RPI4 target - 32bit

In reply to Jaehoon Chung

Hi

Is there any comment or plan to apply?

Best Regards,
Jaehoon Chung

Quoted 41 lines · Jaehoon Chung

RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on u-boot side. Then it's too slow about read/write performance. This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

This patch is based on my RFC's patches.RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on u-boot side. Then it's too slow about read/write performance.
This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

This patch is based on my RFC's patches.

Changelog on V2
- Keep printf message instead of debug
- Add Peng's Reviewed-by tag

Jaehoon Chung (3):
mmc: sdhci: use phys2bus macro when dma address is accessed
mmc: sdhci: not return error when SDMA is not supported
configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config

 configs/rpi_4_32b_defconfig |  1 +
 drivers/mmc/sdhci.c         | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
#9 lore raw

v2 cover Support SDMA mode on RPI4 target - 32bit

Quoted 5 lines

Subject: Re: [PATCH v2 0/3] Support SDMA mode on RPI4 target - 32bit

Hi

Is there any comment or plan to apply?

Sorry, I missed this patchset. Will pick it up.

Thanks,
Peng.

Quoted 48 lines

Best Regards,
Jaehoon Chung

Quoted 2 lines · Jaehoon Chung

RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on u-boot side. Then it's too slow about read/write

performance.

Quoted 11 lines

This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

Quoted 2 lines

This patch is based on my RFC's patches.RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on

u-boot side. Then it's too slow about read/write performance.

Quoted 26 lines

This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

This patch is based on my RFC's patches.

Changelog on V2
- Keep printf message instead of debug
- Add Peng's Reviewed-by tag

Jaehoon Chung (3):
mmc: sdhci: use phys2bus macro when dma address is accessed
mmc: sdhci: not return error when SDMA is not supported
configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config

 configs/rpi_4_32b_defconfig |  1 +
 drivers/mmc/sdhci.c         | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
#10 lore raw

v2 cover Support SDMA mode on RPI4 target - 32bit

Quoted 7 lines · Peng Fan
Quoted 5 lines

Subject: Re: [PATCH v2 0/3] Support SDMA mode on RPI4 target - 32bit

Hi

Is there any comment or plan to apply?

Sorry, I missed this patchset. Will pick it up.

No problem. :) Thanks!

Best Regards,
Jaehoon Chung

Quoted 53 lines

Thanks,
Peng.

Quoted 48 lines

Best Regards,
Jaehoon Chung

Quoted 2 lines · Jaehoon Chung

RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on u-boot side. Then it's too slow about read/write

performance.

Quoted 11 lines

This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

Quoted 2 lines

This patch is based on my RFC's patches.RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on

u-boot side. Then it's too slow about read/write performance.

Quoted 26 lines

This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

This patch is based on my RFC's patches.

Changelog on V2
- Keep printf message instead of debug
- Add Peng's Reviewed-by tag

Jaehoon Chung (3):
mmc: sdhci: use phys2bus macro when dma address is accessed
mmc: sdhci: not return error when SDMA is not supported
configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config

 configs/rpi_4_32b_defconfig |  1 +
 drivers/mmc/sdhci.c         | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
#11 lore raw

v2 cover Support SDMA mode on RPI4 target - 32bit

Hi Jaehoon,

Quoted 10 lines

Subject: Re: [PATCH v2 0/3] Support SDMA mode on RPI4 target - 32bit

Quoted 7 lines · Peng Fan
Quoted 5 lines

Subject: Re: [PATCH v2 0/3] Support SDMA mode on RPI4 target - 32bit

Hi

Is there any comment or plan to apply?

Sorry, I missed this patchset. Will pick it up.

This patchset could not be applied on master, would you rebase?

Thanks,
Peng.

Quoted 60 lines

No problem. :) Thanks!

Best Regards,
Jaehoon Chung

Quoted 54 lines

Thanks,
Peng.

Quoted 49 lines

Best Regards,
Jaehoon Chung

Quoted 3 lines · Jaehoon Chung

RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on u-boot side. Then it's too slow about read/write

performance.

Quoted 11 lines

This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

Quoted 2 lines

This patch is based on my RFC's patches.RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on

u-boot side. Then it's too slow about read/write performance.

Quoted 26 lines

This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

This patch is based on my RFC's patches.

Changelog on V2
- Keep printf message instead of debug
- Add Peng's Reviewed-by tag

Jaehoon Chung (3):
mmc: sdhci: use phys2bus macro when dma address is accessed
mmc: sdhci: not return error when SDMA is not supported
configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config

 configs/rpi_4_32b_defconfig |  1 +
 drivers/mmc/sdhci.c         | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
#12 lore raw

v2 cover Support SDMA mode on RPI4 target - 32bit

Quoted 7 lines · Peng Fan

Hi Jaehoon,

Quoted 5 lines

Subject: Re: [PATCH v2 0/3] Support SDMA mode on RPI4 target - 32bit

Quoted 2 lines · Peng Fan
Quoted 2 lines

Subject: Re: [PATCH v2 0/3] Support SDMA mode on RPI4 target - 32bit

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

Hi

Is there any comment or plan to apply?

Sorry, I missed this patchset. Will pick it up.

This patchset could not be applied on master, would you rebase?

Sure, i will resend after rebase on latest.

Best Regards,
Jaehoon Chung

Quoted 65 lines

Thanks,
Peng.

Quoted 60 lines

No problem. :) Thanks!

Best Regards,
Jaehoon Chung

Quoted 54 lines

Thanks,
Peng.

Quoted 49 lines

Best Regards,
Jaehoon Chung

Quoted 3 lines · Jaehoon Chung

RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on u-boot side. Then it's too slow about read/write

performance.

Quoted 11 lines

This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

Quoted 2 lines

This patch is based on my RFC's patches.RPI4's SDHCI controller is supported SDMA mode. (Checked on kernel side) But It doesn't use on

u-boot side. Then it's too slow about read/write performance.

Quoted 26 lines

This patchset is supported SDMA mode on RPI4 target(32bit).
- I didn't test on RPI4 64bit.

Read/write time about 8MB file
Before
- Read : 1.472 seconds
- Write : 4.690 seconds
After
- Read : 0.359 seconds
- Write : 0.574 seconds

This patch is based on my RFC's patches.

Changelog on V2
- Keep printf message instead of debug
- Add Peng's Reviewed-by tag

Jaehoon Chung (3):
mmc: sdhci: use phys2bus macro when dma address is accessed
mmc: sdhci: not return error when SDMA is not supported
configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config

 configs/rpi_4_32b_defconfig |  1 +
 drivers/mmc/sdhci.c         | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)