Re: [RFC PATCH v2 4/8] board: rockchip: Move SPI U-Boot offset to config

Alper Nebi Yasak
2022-05-19T11:40:15Z

On 16/05/2022 14:07, Andrew Abbott wrote:
> This needs to be accessible to binman (via CONFIG_ preprocessor macros)
> so it can build SPI images using the correct offset.
>
> The documentation at 'doc/device-tree-bindings/config.txt' says that
> the 'u-boot,spl-payload-offset' device tree option simply overrides
> 'CONFIG_SYS_SPI_U_BOOT_OFFS', so this change should not functionally
> change the offset for any of the affected boards.
>
> Signed-off-by: Andrew Abbott <andrew@mirx.dev>
> ---

This sounds reasonable, but I don't really understand how people started
using the device-tree property instead of changing the config value, so
can't exactly say which one should be preferred.

>
> (no changes since v1)
>
> arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi | 1 -
> arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 4 ----
> arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi | 1 -
> arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 4 ----
> arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 4 ----

I guess this can be done for rk3399-gru-u-boot.dtsi as well, because I
did cargo-cult it there from a previous commit...

> configs/lion-rk3368_defconfig | 1 +
> configs/pinebook-pro-rk3399_defconfig | 1 +
> configs/puma-rk3399_defconfig | 2 +-
> configs/roc-pc-rk3399_defconfig | 1 +
> configs/rockpro64-rk3399_defconfig | 1 +
> 10 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi b/arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi
> index 7826d1e70b..6840182f03 100644
> --- a/arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi
> +++ b/arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi
> @@ -7,7 +7,6 @@
>
> / {
> config {
> - u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */
> u-boot,mmc-env-offset = <0x4000>; /* @ 16KB */
> };
>
> diff --git a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
> index 2d87bea933..d1d0ac460d 100644
> --- a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
> @@ -10,10 +10,6 @@
> chosen {
> u-boot,spl-boot-order = "same-as-spl", &sdhci, &spiflash, &sdmmc;
> };
> -
> - config {
> - u-boot,spl-payload-offset = <0x60000>; /* @ 384KB */
> - };
> };
>
> &edp {
> diff --git a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
> index e0476ab25c..f3f8619716 100644
> --- a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
> @@ -14,7 +14,6 @@
>
> / {
> config {
> - u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */
> u-boot,mmc-env-offset = <0x4000>; /* @ 16KB */
> u-boot,efi-partition-entries-offset = <0x200000>; /* 2MB */
> u-boot,boot-led = "module_led";
> diff --git a/arch/arm/dts/rk3399-roc-pc-u-boot.dtsi b/arch/arm/dts/rk3399-roc-pc-u-boot.dtsi
> index e3c9364e35..a54e554d8a 100644
> --- a/arch/arm/dts/rk3399-roc-pc-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-roc-pc-u-boot.dtsi
> @@ -11,10 +11,6 @@
> u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdhci, &sdmmc;
> };
>
> - config {
> - u-boot,spl-payload-offset = <0x60000>; /* @ 384KB */
> - };
> -
> vcc_hub_en: vcc_hub_en-regulator {
> compatible = "regulator-fixed";
> enable-active-high;
> diff --git a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi
> index 37dff04adf..bd65496df3 100644
> --- a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi
> @@ -9,10 +9,6 @@
> chosen {
> u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdmmc, &sdhci;
> };
> -
> - config {
> - u-boot,spl-payload-offset = <0x60000>; /* @ 384KB */
> - };
> };
>
> &spi1 {
> diff --git a/configs/lion-rk3368_defconfig b/configs/lion-rk3368_defconfig
> index 426913816b..91630c822b 100644
> --- a/configs/lion-rk3368_defconfig
> +++ b/configs/lion-rk3368_defconfig
> @@ -17,6 +17,7 @@ CONFIG_DEBUG_UART_BASE=0xFF180000
> CONFIG_DEBUG_UART_CLOCK=24000000
> CONFIG_SPL_SPI_FLASH_SUPPORT=y
> CONFIG_SPL_SPI=y
> +CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000
> CONFIG_SYS_LOAD_ADDR=0x800800
> CONFIG_DEBUG_UART=y
> CONFIG_FIT=y
> diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
> index 8ca1d0708f..c5ebf62f02 100644
> --- a/configs/pinebook-pro-rk3399_defconfig
> +++ b/configs/pinebook-pro-rk3399_defconfig
> @@ -24,6 +24,7 @@ CONFIG_SPL_STACK_R=y
> CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
> CONFIG_SPL_MTD_SUPPORT=y
> CONFIG_SPL_SPI_LOAD=y
> +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
> CONFIG_TPL=y
> CONFIG_CMD_BOOTZ=y
> CONFIG_CMD_GPIO=y
> diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
> index 7ce2dc0719..6b7898be49 100644
> --- a/configs/puma-rk3399_defconfig
> +++ b/configs/puma-rk3399_defconfig
> @@ -27,7 +27,7 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
> CONFIG_SPL_I2C=y
> CONFIG_SPL_POWER=y
> CONFIG_SPL_SPI_LOAD=y
> -CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
> +CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000
> CONFIG_CMD_BOOTZ=y
> CONFIG_CMD_GPT=y
> CONFIG_CMD_I2C=y
> diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
> index 4684fa6e74..2d7e2ad563 100644
> --- a/configs/roc-pc-rk3399_defconfig
> +++ b/configs/roc-pc-rk3399_defconfig
> @@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y
> CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x20000
> CONFIG_SPL_ENV_SUPPORT=y
> CONFIG_SPL_SPI_LOAD=y
> +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
> CONFIG_TPL=y
> CONFIG_CMD_BOOTZ=y
> CONFIG_CMD_GPT=y
> diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig
> index e6f7a8469a..8c45a6c575 100644
> --- a/configs/rockpro64-rk3399_defconfig
> +++ b/configs/rockpro64-rk3399_defconfig
> @@ -23,6 +23,7 @@ CONFIG_MISC_INIT_R=y
> 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