[PATCH 0/5] rockchip: Fix eMMC performance regression

The eMMC performance on RK3399 was reduced sigificant by the commit 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command").
That workaround should only have been applied to RK3568 and RK3588. This series fixes that and also help boost eMMC performance on two RK3399 boards even more by enabling use of SDMA.
There is also an extra commit to help build a u-boot-rockchip-spi.bin image that can be used for SPI flash boot on RockPro64.
Jonas Karlman (5): mmc: rockchip_sdhci: Skip blocks read workaround on RK3399 mmc: rockchip_sdhci: Disable DMA mode using a device tree property rockchip: rockpro64: Use SDMA to boost eMMC performance rockchip: rock-pi-4: Use SDMA to boost eMMC performance rockchip: rockpro64: Build u-boot-rockchip-spi.bin
arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi | 6 ++++++ arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 5 +++++ arch/arm/dts/rk3399-u-boot.dtsi | 1 + arch/arm/dts/rk3588s-u-boot.dtsi | 1 + configs/rock-pi-4-rk3399_defconfig | 2 ++ configs/rock5b-rk3588_defconfig | 1 - configs/rockpro64-rk3399_defconfig | 5 +++++ drivers/mmc/rockchip_sdhci.c | 12 +++++++++++- 8 files changed, 31 insertions(+), 2 deletions(-)

The workaround to limit number of blocks to read in a single command should only be applied to RK3568 and RK3588. Change to be more strict when to apply the workaround.
Fixes: 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") Suggested-by: Simon Glass sjg@chromium.org Signed-off-by: Jonas Karlman jonas@kwiboo.se --- drivers/mmc/rockchip_sdhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 4f110976f4e8..8e4a158049a9 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -594,7 +594,9 @@ static int rockchip_sdhci_probe(struct udevice *dev) * triggers Data End Bit Error on RK3568 and RK3588. Limit to reading * max 4 blocks in one command when using PIO mode. */ - if (!(host->flags & USE_DMA)) + if (!(host->flags & USE_DMA) && + (device_is_compatible(dev, "rockchip,rk3568-dwcmshc") || + device_is_compatible(dev, "rockchip,rk3588-dwcmshc"))) cfg->b_max = 4;
return sdhci_probe(dev);

On 2023/5/7 01:41, Jonas Karlman wrote:
The workaround to limit number of blocks to read in a single command should only be applied to RK3568 and RK3588. Change to be more strict when to apply the workaround.
Fixes: 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") Suggested-by: Simon Glass sjg@chromium.org Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
drivers/mmc/rockchip_sdhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 4f110976f4e8..8e4a158049a9 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -594,7 +594,9 @@ static int rockchip_sdhci_probe(struct udevice *dev) * triggers Data End Bit Error on RK3568 and RK3588. Limit to reading * max 4 blocks in one command when using PIO mode. */
- if (!(host->flags & USE_DMA))
if (!(host->flags & USE_DMA) &&
(device_is_compatible(dev, "rockchip,rk3568-dwcmshc") ||
device_is_compatible(dev, "rockchip,rk3588-dwcmshc")))
cfg->b_max = 4;
return sdhci_probe(dev);

Hi Jonas,
On 5/6/23 19:41, Jonas Karlman wrote:
The workaround to limit number of blocks to read in a single command should only be applied to RK3568 and RK3588. Change to be more strict when to apply the workaround.
Fixes: 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") Suggested-by: Simon Glass sjg@chromium.org Signed-off-by: Jonas Karlman jonas@kwiboo.se
Tested-by: Quentin Schulz foss+uboot@0leil.net # RK3399 Puma, RK3588 Tiger
Thanks, Quentin
drivers/mmc/rockchip_sdhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 4f110976f4e8..8e4a158049a9 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -594,7 +594,9 @@ static int rockchip_sdhci_probe(struct udevice *dev) * triggers Data End Bit Error on RK3568 and RK3588. Limit to reading * max 4 blocks in one command when using PIO mode. */
- if (!(host->flags & USE_DMA))
if (!(host->flags & USE_DMA) &&
(device_is_compatible(dev, "rockchip,rk3568-dwcmshc") ||
device_is_compatible(dev, "rockchip,rk3588-dwcmshc")))
cfg->b_max = 4;
return sdhci_probe(dev);

Loading part of TF-A into SRAM from eMMC using DMA fails on RK3399 similar to other Rockchip SoCs. Checksum validation fails with:
## Checking hash(es) for Image atf-2 ... sha256 error! Bad hash value for 'hash' hash node in 'atf-2' image node spl_load_simple_fit: can't load image loadables index 1 (ret = -1) mmc_load_image_raw_sector: mmc block read error SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###
Add a device tree property, u-boot,spl-fifo-mode, to control when the rockchip_sdhci driver should disable the use of DMA and fallback on PIO mode. Same device tree property is used by the rockchip_dw_mmc driver.
In commit 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") the DMA mode was disabled using a CONFIG option on RK3588. Revert that and instead disable DMA using the device tree property for all RK3588 boards, also apply similar workaround for all RK3399 boards.
Fixes: 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") Signed-off-by: Jonas Karlman jonas@kwiboo.se --- arch/arm/dts/rk3399-u-boot.dtsi | 1 + arch/arm/dts/rk3588s-u-boot.dtsi | 1 + configs/rock5b-rk3588_defconfig | 1 - drivers/mmc/rockchip_sdhci.c | 8 ++++++++ 4 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index e677ae678dab..3423b882c437 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -120,6 +120,7 @@ &sdhci { max-frequency = <200000000>; bootph-all; + u-boot,spl-fifo-mode; };
&sdmmc { diff --git a/arch/arm/dts/rk3588s-u-boot.dtsi b/arch/arm/dts/rk3588s-u-boot.dtsi index 5201ba246d87..3342de4f0256 100644 --- a/arch/arm/dts/rk3588s-u-boot.dtsi +++ b/arch/arm/dts/rk3588s-u-boot.dtsi @@ -67,6 +67,7 @@
&sdhci { bootph-pre-ram; + u-boot,spl-fifo-mode; };
&uart2 { diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig index d3136ac850fe..3fcc6a26bb51 100644 --- a/configs/rock5b-rk3588_defconfig +++ b/configs/rock5b-rk3588_defconfig @@ -58,7 +58,6 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y -# CONFIG_SPL_MMC_SDHCI_SDMA is not set CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 8e4a158049a9..285332d9f4fd 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -589,6 +589,14 @@ static int rockchip_sdhci_probe(struct udevice *dev) if (ret) return ret;
+ /* + * Disable use of DMA and force use of PIO mode in SPL to fix an issue + * where loading part of TF-A into SRAM using DMA silently fails. + */ + if (IS_ENABLED(CONFIG_SPL_BUILD) && + dev_read_bool(dev, "u-boot,spl-fifo-mode")) + host->flags &= ~USE_DMA; + /* * Reading more than 4 blocks with a single CMD18 command in PIO mode * triggers Data End Bit Error on RK3568 and RK3588. Limit to reading

On 2023/5/7 01:41, Jonas Karlman wrote:
Loading part of TF-A into SRAM from eMMC using DMA fails on RK3399 similar to other Rockchip SoCs. Checksum validation fails with:
## Checking hash(es) for Image atf-2 ... sha256 error! Bad hash value for 'hash' hash node in 'atf-2' image node spl_load_simple_fit: can't load image loadables index 1 (ret = -1) mmc_load_image_raw_sector: mmc block read error SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###
Add a device tree property, u-boot,spl-fifo-mode, to control when the rockchip_sdhci driver should disable the use of DMA and fallback on PIO mode. Same device tree property is used by the rockchip_dw_mmc driver.
In commit 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") the DMA mode was disabled using a CONFIG option on RK3588. Revert that and instead disable DMA using the device tree property for all RK3588 boards, also apply similar workaround for all RK3399 boards.
Fixes: 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
arch/arm/dts/rk3399-u-boot.dtsi | 1 + arch/arm/dts/rk3588s-u-boot.dtsi | 1 + configs/rock5b-rk3588_defconfig | 1 - drivers/mmc/rockchip_sdhci.c | 8 ++++++++ 4 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index e677ae678dab..3423b882c437 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -120,6 +120,7 @@ &sdhci { max-frequency = <200000000>; bootph-all;
u-boot,spl-fifo-mode; };
&sdmmc {
diff --git a/arch/arm/dts/rk3588s-u-boot.dtsi b/arch/arm/dts/rk3588s-u-boot.dtsi index 5201ba246d87..3342de4f0256 100644 --- a/arch/arm/dts/rk3588s-u-boot.dtsi +++ b/arch/arm/dts/rk3588s-u-boot.dtsi @@ -67,6 +67,7 @@
&sdhci { bootph-pre-ram;
u-boot,spl-fifo-mode; };
&uart2 {
diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig index d3136ac850fe..3fcc6a26bb51 100644 --- a/configs/rock5b-rk3588_defconfig +++ b/configs/rock5b-rk3588_defconfig @@ -58,7 +58,6 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y -# CONFIG_SPL_MMC_SDHCI_SDMA is not set CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 8e4a158049a9..285332d9f4fd 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -589,6 +589,14 @@ static int rockchip_sdhci_probe(struct udevice *dev) if (ret) return ret;
- /*
* Disable use of DMA and force use of PIO mode in SPL to fix an issue
* where loading part of TF-A into SRAM using DMA silently fails.
*/
- if (IS_ENABLED(CONFIG_SPL_BUILD) &&
dev_read_bool(dev, "u-boot,spl-fifo-mode"))
host->flags &= ~USE_DMA;
- /*
- Reading more than 4 blocks with a single CMD18 command in PIO mode
- triggers Data End Bit Error on RK3568 and RK3588. Limit to reading

Hi Jonas,
On 5/6/23 19:41, Jonas Karlman wrote:
Loading part of TF-A into SRAM from eMMC using DMA fails on RK3399 similar to other Rockchip SoCs. Checksum validation fails with:
## Checking hash(es) for Image atf-2 ... sha256 error! Bad hash value for 'hash' hash node in 'atf-2' image node spl_load_simple_fit: can't load image loadables index 1 (ret = -1) mmc_load_image_raw_sector: mmc block read error SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###
Add a device tree property, u-boot,spl-fifo-mode, to control when the rockchip_sdhci driver should disable the use of DMA and fallback on PIO mode. Same device tree property is used by the rockchip_dw_mmc driver.
In commit 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") the DMA mode was disabled using a CONFIG option on RK3588. Revert that and instead disable DMA using the device tree property for all RK3588 boards, also apply similar workaround for all RK3399 boards.
Fixes: 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") Signed-off-by: Jonas Karlman jonas@kwiboo.se
Tested-by: Quentin Schulz foss+uboot@0leil.net # RK3399 Puma, RK3588 Tiger
Thanks, Quentin

Enable the use of SDMA mode to boost eMMC performance on RockPro64. Also add missing flags to indicate the supported MMC modes.
Using mmc read command to read 32 MiB data shows following improvement:
=> time mmc read 10000000 2000 10000
Before: time: 3.178 seconds After: time: 0.402 seconds
This also enables CONFIG_SPL_FIT_SIGNATURE option to help discover any possible future issue with loading TF-A into DRAM/SRAM.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 5 +++++ configs/rockpro64-rk3399_defconfig | 2 ++ 2 files changed, 7 insertions(+)
diff --git a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi index 32a83b2855ac..bd864d067018 100644 --- a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi +++ b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi @@ -15,6 +15,11 @@ }; };
+&sdhci { + cap-mmc-highspeed; + mmc-ddr-1_8v; +}; + &spi1 { spi_flash: flash@0 { bootph-all; diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig index 2b89b1baba51..0ca2cecade25 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig @@ -20,6 +20,7 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_SPL_FIT_SIGNATURE=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_USE_PREBOOT=y @@ -63,6 +64,7 @@ CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_SF_DEFAULT_BUS=1 CONFIG_SPI_FLASH_GIGADEVICE=y

On 2023/5/7 01:41, Jonas Karlman wrote:
Enable the use of SDMA mode to boost eMMC performance on RockPro64. Also add missing flags to indicate the supported MMC modes.
Using mmc read command to read 32 MiB data shows following improvement:
=> time mmc read 10000000 2000 10000
Before: time: 3.178 seconds After: time: 0.402 seconds
This also enables CONFIG_SPL_FIT_SIGNATURE option to help discover any possible future issue with loading TF-A into DRAM/SRAM.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 5 +++++ configs/rockpro64-rk3399_defconfig | 2 ++ 2 files changed, 7 insertions(+)
diff --git a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi index 32a83b2855ac..bd864d067018 100644 --- a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi +++ b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi @@ -15,6 +15,11 @@ }; };
+&sdhci {
- cap-mmc-highspeed;
- mmc-ddr-1_8v;
+};
- &spi1 { spi_flash: flash@0 { bootph-all;
diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig index 2b89b1baba51..0ca2cecade25 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig @@ -20,6 +20,7 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_SPL_FIT_SIGNATURE=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_USE_PREBOOT=y @@ -63,6 +64,7 @@ CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_SF_DEFAULT_BUS=1 CONFIG_SPI_FLASH_GIGADEVICE=y

Enable the use of SDMA mode to boost eMMC performance on ROCK Pi 4. Also add missing flags to indicate the supported MMC modes.
Using mmc read command to read 32 MiB data shows following improvement:
=> time mmc read 10000000 2000 10000
Before: time: 3.178 seconds After: time: 0.402 seconds
This also enables CONFIG_SPL_FIT_SIGNATURE option to help discover any possible future issue with loading TF-A into DRAM/SRAM.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi | 6 ++++++ configs/rock-pi-4-rk3399_defconfig | 2 ++ 2 files changed, 8 insertions(+)
diff --git a/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi b/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi index c17e769f649f..60122f3bcd6c 100644 --- a/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +++ b/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi @@ -12,6 +12,12 @@ }; };
+&sdhci { + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; +}; + &vdd_log { regulator-init-microvolt = <950000>; }; diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig index 1e96fa706ac4..ee5b4f395a00 100644 --- a/configs/rock-pi-4-rk3399_defconfig +++ b/configs/rock-pi-4-rk3399_defconfig @@ -19,6 +19,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y # CONFIG_ANDROID_BOOT_IMAGE is not set +CONFIG_SPL_FIT_SIGNATURE=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4b.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_R=y @@ -56,6 +57,7 @@ CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y

On 2023/5/7 01:41, Jonas Karlman wrote:
Enable the use of SDMA mode to boost eMMC performance on ROCK Pi 4. Also add missing flags to indicate the supported MMC modes.
Using mmc read command to read 32 MiB data shows following improvement:
=> time mmc read 10000000 2000 10000
Before: time: 3.178 seconds After: time: 0.402 seconds
This also enables CONFIG_SPL_FIT_SIGNATURE option to help discover any possible future issue with loading TF-A into DRAM/SRAM.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi | 6 ++++++ configs/rock-pi-4-rk3399_defconfig | 2 ++ 2 files changed, 8 insertions(+)
diff --git a/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi b/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi index c17e769f649f..60122f3bcd6c 100644 --- a/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +++ b/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi @@ -12,6 +12,12 @@ }; };
+&sdhci {
- cap-mmc-highspeed;
- mmc-ddr-1_8v;
- mmc-hs200-1_8v;
+};
- &vdd_log { regulator-init-microvolt = <950000>; };
diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig index 1e96fa706ac4..ee5b4f395a00 100644 --- a/configs/rock-pi-4-rk3399_defconfig +++ b/configs/rock-pi-4-rk3399_defconfig @@ -19,6 +19,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y # CONFIG_ANDROID_BOOT_IMAGE is not set +CONFIG_SPL_FIT_SIGNATURE=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4b.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_R=y @@ -56,6 +57,7 @@ CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y

Enable CONFIG_ROCKCHIP_SPI_IMAGE to build u-boot-rockchip-spi.bin. Define CONFIG_SYS_SPI_U_BOOT_OFFS to write u-boot.itb at the expected offset. Enable CONFIG_LTO to reduce size of SPL so that the mkimage output fit before the 0x60000 offset in u-boot-rockchip-spi.bin.
=> sf probe SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB => load mmc 1:1 10000000 u-boot-rockchip-spi.bin 1442304 bytes read in 27 ms (50.9 MiB/s) => sf update $fileaddr 0 $filesize device 0 offset 0x0, size 0x160200 1421824 bytes written, 20480 bytes skipped in 9.501s, speed 155432 B/s
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- configs/rockpro64-rk3399_defconfig | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig index 0ca2cecade25..f41c03067903 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig @@ -11,6 +11,7 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y +CONFIG_ROCKCHIP_SPI_IMAGE=y CONFIG_TARGET_ROCKPRO64_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 @@ -20,6 +21,7 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_LTO=y CONFIG_SPL_FIT_SIGNATURE=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y @@ -37,6 +39,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000 CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_SPI_LOAD=y +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_TPL=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y

On 2023/5/7 01:41, Jonas Karlman wrote:
Enable CONFIG_ROCKCHIP_SPI_IMAGE to build u-boot-rockchip-spi.bin. Define CONFIG_SYS_SPI_U_BOOT_OFFS to write u-boot.itb at the expected offset. Enable CONFIG_LTO to reduce size of SPL so that the mkimage output fit before the 0x60000 offset in u-boot-rockchip-spi.bin.
=> sf probe SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB => load mmc 1:1 10000000 u-boot-rockchip-spi.bin 1442304 bytes read in 27 ms (50.9 MiB/s) => sf update $fileaddr 0 $filesize device 0 offset 0x0, size 0x160200 1421824 bytes written, 20480 bytes skipped in 9.501s, speed 155432 B/s
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
configs/rockpro64-rk3399_defconfig | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig index 0ca2cecade25..f41c03067903 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig @@ -11,6 +11,7 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y +CONFIG_ROCKCHIP_SPI_IMAGE=y CONFIG_TARGET_ROCKPRO64_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 @@ -20,6 +21,7 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_LTO=y CONFIG_SPL_FIT_SIGNATURE=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y @@ -37,6 +39,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000 CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_SPI_LOAD=y +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_TPL=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y
participants (3)
-
Jonas Karlman
-
Kever Yang
-
Quentin Schulz