[U-Boot] [PATCH] rockchip: rk3399: correct the env setting

The mmc0(emmc) is the default boot device, so let's use mmc device 0 as default env device. The SPL size in rk3399 is lager than other Rockchip SoC, we need to using a new offset and not to conflict with SPL memory space.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
include/configs/evb_rk3399.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/configs/evb_rk3399.h b/include/configs/evb_rk3399.h index b9fd5b4..bdb1159 100644 --- a/include/configs/evb_rk3399.h +++ b/include/configs/evb_rk3399.h @@ -10,13 +10,14 @@ #include <configs/rk3399_common.h>
#define CONFIG_ENV_IS_IN_MMC -#define CONFIG_SYS_MMC_ENV_DEV 1 +#define CONFIG_SYS_MMC_ENV_DEV 0 /* - * SPL @ 32k for ~36k - * ENV @ 96k - * u-boot @ 128K + * SPL @ 32k for ~128k + * ENV @ 240k + * u-boot @ 256K */ -#define CONFIG_ENV_OFFSET (96 * 1024) +#undef CONFIG_ENV_OFFSET +#define CONFIG_ENV_OFFSET (240 * 1024)
#define SDRAM_BANK_SIZE (2UL << 30)

Kever,
On 19 Jul 2017, at 14:02, Kever Yang kever.yang@rock-chips.com wrote:
The mmc0(emmc) is the default boot device, so let's use mmc device 0 as default env device. The SPL size in rk3399 is lager than other Rockchip SoC, we need to using a new offset and not to conflict with SPL memory space.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
include/configs/evb_rk3399.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/configs/evb_rk3399.h b/include/configs/evb_rk3399.h index b9fd5b4..bdb1159 100644 --- a/include/configs/evb_rk3399.h +++ b/include/configs/evb_rk3399.h @@ -10,13 +10,14 @@ #include <configs/rk3399_common.h>
#define CONFIG_ENV_IS_IN_MMC -#define CONFIG_SYS_MMC_ENV_DEV 1 +#define CONFIG_SYS_MMC_ENV_DEV 0 /*
- SPL @ 32k for ~36k
- ENV @ 96k
- u-boot @ 128K
- SPL @ 32k for ~128k
- ENV @ 240k
- u-boot @ 256K
*/ -#define CONFIG_ENV_OFFSET (96 * 1024) +#undef CONFIG_ENV_OFFSET +#define CONFIG_ENV_OFFSET (240 * 1024)
Can we standardise on using the DTS to configure this for the RK3399 and RK3368? We added 'u-boot,spl-payload-offset’ and 'u-boot,mmc-env-offset’ a while back to make it simple to configure these on a per-board basis, if customers want to override it.
On the RK3399-Q7 and the RK3368-uQ7, I’ve set up SPL to use full OF_CONTROL (in contrast to OF_PLATDATA) and we have the following in our DTS (this is in my patch-queue and hasn’t made it upstream yet):
--- a/arch/arm/dts/rk3399-puma.dtsi +++ b/arch/arm/dts/rk3399-puma.dtsi @@ -12,7 +12,8 @@ compatible = "tsd,rk3399-q7", "tsd,puma", "rockchip,rk3399";
config { - u-boot,spl-payload-offset = <0x40000>; /* 256kbyte */ + u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */ + u-boot,mmc-env-offset = <0x4000>; /* @ 16KB */ u-boot,boot-led = "module_led"; };
If this is agreeable, I could even submit this against rk3399.dtsi and then we could standardise on this across all boards?
#define SDRAM_BANK_SIZE (2UL << 30)
-- 1.9.1

On 19 Jul 2017, at 14:02, Kever Yang kever.yang@rock-chips.com wrote:
The mmc0(emmc) is the default boot device, so let's use mmc device 0 as default env device. The SPL size in rk3399 is lager than other Rockchip SoC, we need to using a new offset and not to conflict with SPL memory space.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
include/configs/evb_rk3399.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/configs/evb_rk3399.h b/include/configs/evb_rk3399.h index b9fd5b4..bdb1159 100644 --- a/include/configs/evb_rk3399.h +++ b/include/configs/evb_rk3399.h @@ -10,13 +10,14 @@ #include <configs/rk3399_common.h>
#define CONFIG_ENV_IS_IN_MMC -#define CONFIG_SYS_MMC_ENV_DEV 1 +#define CONFIG_SYS_MMC_ENV_DEV 0
I think this should either be implemented similarily to 'u-boot,spl-boot-order’ property and allow a list of devices to be searched in a given order for a valid environment… or it should be tied to what device the full U-Boot was booted from.
On an earlier board we had the SPL inject a property into the FDT used by the full U-Boot to indicate what device it had been booted from… and I might update and extend this for this purpose.
/*
- SPL @ 32k for ~36k
- ENV @ 96k
- u-boot @ 128K
- SPL @ 32k for ~128k
- ENV @ 240k
- u-boot @ 256K
*/ -#define CONFIG_ENV_OFFSET (96 * 1024) +#undef CONFIG_ENV_OFFSET
This #undef is necessary due to rockchip-common.h also defining this symbol. I have a patch on our production tree to the same effect (and adding an #ifdef check to rockchip-common.h), but am generally unhappy about how these config files work.
Could you clean this up across all our configs, so we don’t end up with a pattern of #define and #undef across various newer boards (that may have largish SPL stages)?
+#define CONFIG_ENV_OFFSET (240 * 1024)
#define SDRAM_BANK_SIZE (2UL << 30)
-- 1.9.1
participants (2)
-
Dr. Philipp Tomsich
-
Kever Yang