From patchwork Fri Mar 27 04:08:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 244384 List-Id: U-Boot discussion From: jh80.chung at samsung.com (Jaehoon Chung) Date: Fri, 27 Mar 2020 13:08:00 +0900 Subject: [Patch V4 1/3] mmc: sdhci: use phys2bus macro when dma address is accessed In-Reply-To: <20200327040802.30103-1-jh80.chung@samsung.com> References: <20200327040802.30103-1-jh80.chung@samsung.com> Message-ID: <20200327040802.30103-2-jh80.chung@samsung.com> 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 Reviewed-by: Peng Fan Reviewed-by: Minkyu Kang --- 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 #include #include +#include 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); } } From patchwork Fri Mar 27 04:08:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 244383 List-Id: U-Boot discussion From: jh80.chung at samsung.com (Jaehoon Chung) Date: Fri, 27 Mar 2020 13:08:01 +0900 Subject: [Patch V4 2/3] mmc: sdhci: not return error when SDMA is not supported In-Reply-To: <20200327040802.30103-1-jh80.chung@samsung.com> References: <20200327040802.30103-1-jh80.chung@samsung.com> Message-ID: <20200327040802.30103-3-jh80.chung@samsung.com> 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 Reviewed-by: Peng Fan Reviewed-by: Minkyu Kang --- 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)) { From patchwork Fri Mar 27 04:08:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 244385 List-Id: U-Boot discussion From: jh80.chung at samsung.com (Jaehoon Chung) Date: Fri, 27 Mar 2020 13:08:02 +0900 Subject: [Patch V4 3/3] configs: rpi_4 : enable SDHCI_SDMA config In-Reply-To: <20200327040802.30103-1-jh80.chung@samsung.com> References: <20200327040802.30103-1-jh80.chung@samsung.com> Message-ID: <20200327040802.30103-4-jh80.chung@samsung.com> Enable SDHCI_SDMA configuration. Signed-off-by: Jaehoon Chung Reviewed-by: Peng Fan Reviewed-by: Minkyu Kang --- configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + 2 files changed, 2 insertions(+) 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 diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index 6d148dab07..454d28ea2b 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_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