* [PATCH v3 0/3] Support SDMA mode on RPI4 target - 32bit
[not found] <CGME20200324225852epcas1p319422d642625e38efb9febdb4f1385f9@epcas1p3.samsung.com>
@ 2020-03-24 22:58 ` Jaehoon Chung
[not found] ` <CGME20200324225852epcas1p2956b4c12ca37492f1bae49dbca6250fd@epcas1p2.samsung.com>
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jaehoon Chung @ 2020-03-24 22:58 UTC (permalink / raw)
To: u-boot
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
Changelog on V3
- Rebased on latest u-boot-mmc
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(-)
--
2.25.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/3] mmc: sdhci: use phys2bus macro when dma address is accessed
[not found] ` <CGME20200324225852epcas1p2956b4c12ca37492f1bae49dbca6250fd@epcas1p2.samsung.com>
@ 2020-03-24 22:58 ` Jaehoon Chung
0 siblings, 0 replies; 7+ messages in thread
From: Jaehoon Chung @ 2020-03-24 22:58 UTC (permalink / raw)
To: u-boot
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.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
---
drivers/mmc/sdhci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 520c9f9feb..2b7493fbac 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -16,6 +16,7 @@
#include <sdhci.h>
#include <dm.h>
#include <linux/dma-mapping.h>
+#include <phys2bus.h>
static void sdhci_reset(struct sdhci_host *host, u8 mask)
{
@@ -150,7 +151,8 @@ static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
mmc_get_dma_dir(data));
if (host->flags & USE_SDMA) {
- 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);
@@ -204,7 +206,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);
}
}
--
2.25.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] mmc: sdhci: not return error when SDMA is not supported
[not found] ` <CGME20200324225852epcas1p208ec771c4f4205786eba6a61c79fb854@epcas1p2.samsung.com>
@ 2020-03-24 22:58 ` Jaehoon Chung
0 siblings, 0 replies; 7+ messages in thread
From: Jaehoon Chung @ 2020-03-24 22:58 UTC (permalink / raw)
To: u-boot
If Host controller doesn't support SDMA, it doesn't need to return
error. Because it can be worked with PIO mode.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
---
drivers/mmc/sdhci.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 2b7493fbac..49e67fc7bd 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -741,13 +741,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)) {
--
2.25.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config
[not found] ` <CGME20200324225852epcas1p49db843af21ff2b0c19718af029aee773@epcas1p4.samsung.com>
@ 2020-03-24 22:58 ` Jaehoon Chung
2020-03-25 16:09 ` Matthias Brugger
0 siblings, 1 reply; 7+ messages in thread
From: Jaehoon Chung @ 2020-03-24 22:58 UTC (permalink / raw)
To: u-boot
Enable SDHCI_SDMA configuration.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
---
configs/rpi_4_32b_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
index 72cda5d949..7189914606 100644
--- a/configs/rpi_4_32b_defconfig
+++ b/configs/rpi_4_32b_defconfig
@@ -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
--
2.25.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config
2020-03-24 22:58 ` [PATCH v3 3/3] configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config Jaehoon Chung
@ 2020-03-25 16:09 ` Matthias Brugger
2020-03-26 4:51 ` Jaehoon Chung
0 siblings, 1 reply; 7+ messages in thread
From: Matthias Brugger @ 2020-03-25 16:09 UTC (permalink / raw)
To: u-boot
On 24/03/2020 23:58, Jaehoon Chung wrote:
> Enable SDHCI_SDMA configuration.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
> ---
> configs/rpi_4_32b_defconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
> index 72cda5d949..7189914606 100644
> --- a/configs/rpi_4_32b_defconfig
> +++ b/configs/rpi_4_32b_defconfig
> @@ -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
RPi4 can only do DMA transfers to the first GiB of memory. I wasn't sucessfull
in understanding the mmc/sdhci code to see where we take the dma-ranges property
into account so that we don't use an address > 1 GiB.
Are we safe in this regard? If we are, then we can also enable this for
rpi_4_defconfig and rpi_arm64_defconfig I think.
Regards,
Matthias
> CONFIG_MMC_SDHCI_BCM2835=y
> CONFIG_DM_ETH=y
> CONFIG_BCMGENET=y
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config
2020-03-25 16:09 ` Matthias Brugger
@ 2020-03-26 4:51 ` Jaehoon Chung
2020-03-26 8:46 ` Matthias Brugger
0 siblings, 1 reply; 7+ messages in thread
From: Jaehoon Chung @ 2020-03-26 4:51 UTC (permalink / raw)
To: u-boot
On 3/26/20 1:09 AM, Matthias Brugger wrote:
>
>
> On 24/03/2020 23:58, Jaehoon Chung wrote:
>> Enable SDHCI_SDMA configuration.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> Reviewed-by: Peng Fan <peng.fan@nxp.com>
>> Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
>> ---
>> configs/rpi_4_32b_defconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
>> index 72cda5d949..7189914606 100644
>> --- a/configs/rpi_4_32b_defconfig
>> +++ b/configs/rpi_4_32b_defconfig
>> @@ -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
>
> RPi4 can only do DMA transfers to the first GiB of memory. I wasn't sucessfull
> in understanding the mmc/sdhci code to see where we take the dma-ranges property
> into account so that we don't use an address > 1 GiB.
Sorry i don't understand clearly what you said.
>
> Are we safe in this regard? If we are, then we can also enable this for
> rpi_4_defconfig and rpi_arm64_defconfig I think.
I checked rpi_arm64_defconfig history. it's unified config for RPi3/RPI4.
As i know, RPi3 doesn't support SDMA mode. So i don't have a plan to apply rpi_arm64_defconfig.
(If i understood wrong, let me know,plz.)
I have tested SDMA mode With rpi_4_defconfig / rpi_4_32b_defconfig.
Test Environment
- Target : RPI4 (1G/2G/4G) target
- config : rpi_4_defconfig / rpi_4_32b_defconfig
Read/write some files from Sd-card.
Read/write performance is increased than before.
I will resend with rpi_4_defconfig, except rpi_arm64_defconfig.
Best Regards,
Jaehoon Chung
>
> Regards,
> Matthias
>
>> CONFIG_MMC_SDHCI_BCM2835=y
>> CONFIG_DM_ETH=y
>> CONFIG_BCMGENET=y
>>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config
2020-03-26 4:51 ` Jaehoon Chung
@ 2020-03-26 8:46 ` Matthias Brugger
0 siblings, 0 replies; 7+ messages in thread
From: Matthias Brugger @ 2020-03-26 8:46 UTC (permalink / raw)
To: u-boot
On 26/03/2020 05:51, Jaehoon Chung wrote:
> On 3/26/20 1:09 AM, Matthias Brugger wrote:
>>
>>
>> On 24/03/2020 23:58, Jaehoon Chung wrote:
>>> Enable SDHCI_SDMA configuration.
>>>
>>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>>> Reviewed-by: Peng Fan <peng.fan@nxp.com>
>>> Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
>>> ---
>>> configs/rpi_4_32b_defconfig | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
>>> index 72cda5d949..7189914606 100644
>>> --- a/configs/rpi_4_32b_defconfig
>>> +++ b/configs/rpi_4_32b_defconfig
>>> @@ -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
>>
>> RPi4 can only do DMA transfers to the first GiB of memory. I wasn't sucessfull
>> in understanding the mmc/sdhci code to see where we take the dma-ranges property
>> into account so that we don't use an address > 1 GiB.
>
> Sorry i don't understand clearly what you said.
>
I'll try to rephrase:
How do we make sure that DMA uses only addresses the in the first GiB of RAM for
it's transactions. That a limitation the RPi4 has.
>>
>> Are we safe in this regard? If we are, then we can also enable this for
>> rpi_4_defconfig and rpi_arm64_defconfig I think.
>
> I checked rpi_arm64_defconfig history. it's unified config for RPi3/RPI4.
> As i know, RPi3 doesn't support SDMA mode. So i don't have a plan to apply rpi_arm64_defconfig.
> (If i understood wrong, let me know,plz.)
>
Yes, well we have two different device tree compatibles for them. We have to
change the driver to make sure only sdhci of RPi4 does enable SDMA.
Regards,
Matthias
> I have tested SDMA mode With rpi_4_defconfig / rpi_4_32b_defconfig.
> Test Environment
> - Target : RPI4 (1G/2G/4G) target
> - config : rpi_4_defconfig / rpi_4_32b_defconfig
>
> Read/write some files from Sd-card.
> Read/write performance is increased than before.
>
> I will resend with rpi_4_defconfig, except rpi_arm64_defconfig.
>
> Best Regards,
> Jaehoon Chung
>
>>
>> Regards,
>> Matthias
>>
>>> CONFIG_MMC_SDHCI_BCM2835=y
>>> CONFIG_DM_ETH=y
>>> CONFIG_BCMGENET=y
>>>
>>
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-26 8:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20200324225852epcas1p319422d642625e38efb9febdb4f1385f9@epcas1p3.samsung.com>
2020-03-24 22:58 ` [PATCH v3 0/3] Support SDMA mode on RPI4 target - 32bit Jaehoon Chung
[not found] ` <CGME20200324225852epcas1p2956b4c12ca37492f1bae49dbca6250fd@epcas1p2.samsung.com>
2020-03-24 22:58 ` [PATCH v3 1/3] mmc: sdhci: use phys2bus macro when dma address is accessed Jaehoon Chung
[not found] ` <CGME20200324225852epcas1p208ec771c4f4205786eba6a61c79fb854@epcas1p2.samsung.com>
2020-03-24 22:58 ` [PATCH v3 2/3] mmc: sdhci: not return error when SDMA is not supported Jaehoon Chung
[not found] ` <CGME20200324225852epcas1p49db843af21ff2b0c19718af029aee773@epcas1p4.samsung.com>
2020-03-24 22:58 ` [PATCH v3 3/3] configs: rpi_4_32b_defconfig: enable SDHCI_SDMA config Jaehoon Chung
2020-03-25 16:09 ` Matthias Brugger
2020-03-26 4:51 ` Jaehoon Chung
2020-03-26 8:46 ` Matthias Brugger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.