mirror of
https://xff.cz/git/u-boot/
synced 2025-09-29 22:41:17 +02:00
mmc: rockchip_sdhci: Use bounce buffer in SPL to fix read performance
The commit3b804b370d
("mmc: rockchip_sdhci: Disable DMA mode using a device tree property") and commit2cc6cde647
("mmc: rockchip_sdhci: Limit number of blocks read in a single command") implemented a workaround to fix loading a part of TF-A into SRAM from eMMC in SPL. This has resulted in very slow read performance of FIT from eMMC in SPL on RK3588. Change to make use of a bounce buffer to significantly improve the read performance when malloc_limit is large enough and use PIO mode as fall back. Also update the size of align_buffer to use SDHCI_DEFAULT_BOUNDARY_SIZE instead of a hardcoded 512 * 1024. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Link: https://patchwork.ozlabs.org/patch/1895377/
This commit is contained in:
committed by
Ondrej Jirman
parent
85316c807e
commit
320e366321
@@ -20,6 +20,9 @@
|
|||||||
#include <syscon.h>
|
#include <syscon.h>
|
||||||
#include <asm/arch-rockchip/clock.h>
|
#include <asm/arch-rockchip/clock.h>
|
||||||
#include <asm/arch-rockchip/hardware.h>
|
#include <asm/arch-rockchip/hardware.h>
|
||||||
|
#include <asm/global_data.h>
|
||||||
|
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
/* DWCMSHC specific Mode Select value */
|
/* DWCMSHC specific Mode Select value */
|
||||||
#define DWCMSHC_CTRL_HS400 0x7
|
#define DWCMSHC_CTRL_HS400 0x7
|
||||||
@@ -606,12 +609,21 @@ static int rockchip_sdhci_probe(struct udevice *dev)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable use of DMA and force use of PIO mode in SPL to fix an issue
|
* Use a bounce buffer or PIO mode in SPL to fix an issue where loading
|
||||||
* where loading part of TF-A into SRAM using DMA silently fails.
|
* part of TF-A directly into SRAM using DMA silently fails.
|
||||||
*/
|
*/
|
||||||
if (IS_ENABLED(CONFIG_SPL_BUILD) &&
|
if (IS_ENABLED(CONFIG_SPL_BUILD) &&
|
||||||
dev_read_bool(dev, "u-boot,spl-fifo-mode"))
|
dev_read_bool(dev, "u-boot,spl-fifo-mode")) {
|
||||||
host->flags &= ~USE_DMA;
|
if (CONFIG_IS_ENABLED(SYS_MALLOC_F) &&
|
||||||
|
gd->malloc_limit > SDHCI_DEFAULT_BOUNDARY_SIZE) {
|
||||||
|
cfg->b_max = SDHCI_DEFAULT_BOUNDARY_SIZE /
|
||||||
|
MMC_MAX_BLOCK_LEN;
|
||||||
|
host->force_align_buffer = true;
|
||||||
|
host->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR;
|
||||||
|
} else {
|
||||||
|
host->flags &= ~USE_DMA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sdhci_probe(dev);
|
return sdhci_probe(dev);
|
||||||
}
|
}
|
||||||
|
@@ -736,7 +736,7 @@ static int sdhci_init(struct mmc *mmc)
|
|||||||
host->force_align_buffer = true;
|
host->force_align_buffer = true;
|
||||||
#else
|
#else
|
||||||
if (host->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) {
|
if (host->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) {
|
||||||
host->align_buffer = memalign(8, 512 * 1024);
|
host->align_buffer = memalign(8, SDHCI_DEFAULT_BOUNDARY_SIZE);
|
||||||
if (!host->align_buffer) {
|
if (!host->align_buffer) {
|
||||||
printf("%s: Aligned buffer alloc failed!!!\n",
|
printf("%s: Aligned buffer alloc failed!!!\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
Reference in New Issue
Block a user