Skip to contentSkip to conversation

rockchip: Fix eMMC performance regression

PATCH Superseded Jonas Karlman 3 participants 13 messages May 6, 2023 – May 12, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/5 mmc: rockchip_sdhci: Skip blocks read workaround on RK3399

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")
---
 drivers/mmc/rockchip_sdhci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/rockchip_sdhci.c +3 -1
index 4f110976f4e8..8e4a158049a9 100644
@@ -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);
Signature · 1 line
2.40.1
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] mmc: rockchip_sdhci: Skip blocks read workaround on RK3399

Quoted 7 lines · Jonas Karlman

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")

Thanks,
- Kever

Quoted 19 lines
---
  drivers/mmc/rockchip_sdhci.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/rockchip_sdhci.c +3 -1
index 4f110976f4e8..8e4a158049a9 100644
@@ -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);
Tested-by on v1 1/5
#3 lore raw

Re: [PATCH 1/5] mmc: rockchip_sdhci: Skip blocks read workaround on RK3399

In reply to Jonas Karlman

Hi Jonas,

Quoted 7 lines · Jonas Karlman

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")

Thanks,
Quentin

Quoted 19 lines
---
  drivers/mmc/rockchip_sdhci.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/rockchip_sdhci.c +3 -1
index 4f110976f4e8..8e4a158049a9 100644
@@ -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);
#4 lore raw

PATCH 2/5 mmc: rockchip_sdhci: Disable DMA mode using a device tree property

In reply to Jonas Karlman

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")
---
 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(-)
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
index e677ae678dab..3423b882c437 100644
@@ -120,6 +120,7 @@
 &sdhci {
 	max-frequency = <200000000>;
 	bootph-all;
+	u-boot,spl-fifo-mode;
 };
 
 &sdmmc {
arch/arm/dts/rk3588s-u-boot.dtsi +1 -0
index 5201ba246d87..3342de4f0256 100644
@@ -67,6 +67,7 @@
 
 &sdhci {
 	bootph-pre-ram;
+	u-boot,spl-fifo-mode;
 };
 
 &uart2 {
configs/rock5b-rk3588_defconfig +0 -1
index d3136ac850fe..3fcc6a26bb51 100644
@@ -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
drivers/mmc/rockchip_sdhci.c +8 -0
index 8e4a158049a9..285332d9f4fd 100644
@@ -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
Signature · 1 line
2.40.1
Reviewed-by on v1 2/5
#5 lore raw

Re: [PATCH 2/5] mmc: rockchip_sdhci: Disable DMA mode using a device tree property

Quoted 14 lines · Jonas Karlman

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.

Quoted 8 lines

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")

Thanks,
- Kever

Quoted 62 lines
---
  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(-)
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
index e677ae678dab..3423b882c437 100644
@@ -120,6 +120,7 @@
  &sdhci {
  	max-frequency = <200000000>;
  	bootph-all;
+	u-boot,spl-fifo-mode;
  };
 
  &sdmmc {
arch/arm/dts/rk3588s-u-boot.dtsi +1 -0
index 5201ba246d87..3342de4f0256 100644
@@ -67,6 +67,7 @@
 
  &sdhci {
  	bootph-pre-ram;
+	u-boot,spl-fifo-mode;
  };
 
  &uart2 {
configs/rock5b-rk3588_defconfig +0 -1
index d3136ac850fe..3fcc6a26bb51 100644
@@ -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
drivers/mmc/rockchip_sdhci.c +8 -0
index 8e4a158049a9..285332d9f4fd 100644
@@ -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
Tested-by on v1 2/5
#6 lore raw

Re: [PATCH 2/5] mmc: rockchip_sdhci: Disable DMA mode using a device tree property

In reply to Jonas Karlman

Hi Jonas,

Quoted 14 lines · Jonas Karlman

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.

Quoted 8 lines

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")

Thanks,
Quentin

#7 lore raw

PATCH 3/5 rockchip: rockpro64: Use SDMA to boost eMMC performance

In reply to Jonas Karlman

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.

---
 arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 5 +++++
 configs/rockpro64-rk3399_defconfig        | 2 ++
 2 files changed, 7 insertions(+)
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi +5 -0
index 32a83b2855ac..bd864d067018 100644
@@ -15,6 +15,11 @@
 	};
 };
 
+&sdhci {
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+};
+
 &spi1 {
 	spi_flash: flash@0 {
 		bootph-all;
configs/rockpro64-rk3399_defconfig +2 -0
index 2b89b1baba51..0ca2cecade25 100644
@@ -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
Signature · 1 line
2.40.1
Reviewed-by on v1 3/5
#8 lore raw

Re: [PATCH 3/5] rockchip: rockpro64: Use SDMA to boost eMMC performance

Quoted 7 lines · Jonas Karlman

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
Quoted 7 lines

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.

Thanks,
- Kever

Quoted 41 lines
---
  arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 5 +++++
  configs/rockpro64-rk3399_defconfig        | 2 ++
  2 files changed, 7 insertions(+)
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi +5 -0
index 32a83b2855ac..bd864d067018 100644
@@ -15,6 +15,11 @@
  	};
  };
 
+&sdhci {
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+};
+
  &spi1 {
  	spi_flash: flash@0 {
  		bootph-all;
configs/rockpro64-rk3399_defconfig +2 -0
index 2b89b1baba51..0ca2cecade25 100644
@@ -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
#9 lore raw

PATCH 4/5 rockchip: rock-pi-4: Use SDMA to boost eMMC performance

In reply to Jonas Karlman

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.

---
 arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi | 6 ++++++
 configs/rock-pi-4-rk3399_defconfig        | 2 ++
 2 files changed, 8 insertions(+)
arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +6 -0
index c17e769f649f..60122f3bcd6c 100644
@@ -12,6 +12,12 @@
 	};
 };
 
+&sdhci {
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+	mmc-hs200-1_8v;
+};
+
 &vdd_log {
 	regulator-init-microvolt = <950000>;
 };
configs/rock-pi-4-rk3399_defconfig +2 -0
index 1e96fa706ac4..ee5b4f395a00 100644
@@ -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
Signature · 1 line
2.40.1
Reviewed-by on v1 4/5
#10 lore raw

Re: [PATCH 4/5] rockchip: rock-pi-4: Use SDMA to boost eMMC performance

Quoted 7 lines · Jonas Karlman

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
Quoted 7 lines

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.

Thanks,
- Kever

Quoted 42 lines
---
  arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi | 6 ++++++
  configs/rock-pi-4-rk3399_defconfig        | 2 ++
  2 files changed, 8 insertions(+)
arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +6 -0
index c17e769f649f..60122f3bcd6c 100644
@@ -12,6 +12,12 @@
  	};
  };
 
+&sdhci {
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+	mmc-hs200-1_8v;
+};
+
  &vdd_log {
  	regulator-init-microvolt = <950000>;
  };
configs/rock-pi-4-rk3399_defconfig +2 -0
index 1e96fa706ac4..ee5b4f395a00 100644
@@ -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
#11 lore raw

PATCH 5/5 rockchip: rockpro64: Build u-boot-rockchip-spi.bin

In reply to Jonas Karlman

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

---
 configs/rockpro64-rk3399_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/rockpro64-rk3399_defconfig +3 -0
index 0ca2cecade25..f41c03067903 100644
@@ -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
Signature · 1 line
2.40.1
Reviewed-by on v1 5/5
#12 lore raw

Re: [PATCH 5/5] rockchip: rockpro64: Build u-boot-rockchip-spi.bin

Quoted 13 lines · Jonas Karlman

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
Quoted 1 line

Thanks,
- Kever

Quoted 32 lines
---
  configs/rockpro64-rk3399_defconfig | 3 +++
  1 file changed, 3 insertions(+)
configs/rockpro64-rk3399_defconfig +3 -0
index 0ca2cecade25..f41c03067903 100644
@@ -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