rockchip: rk3328: Add IO-domain driver and speed up boot
Subsystems (4)
cover rockchip: rk3328: Add IO-domain driver and speed up boot
This series adds support for RK3328 to the IO-domain driver, it also enabled ARMv8 crypto extensions and OF_LIVE to speed up boot on rk3328 boards.
Before this series init time is around 4 seconds on a Rock64 v2.0:
=> bootstage report
Timer summary in microseconds (9 records):
Mark Elapsed Stage
0 0 reset
337,470 337,470 board_init_f
956,864 619,394 board_init_r
2,780,894 1,824,030 eth_common_init
3,935,118 1,154,224 eth_initialize
3,935,373 255 main_loop
3,940,666 5,293 cli_loopAccumulated time:
12,313 dm_r
327,343 dm_fAfter this series init time is around 1.1 seconds on same Rock64 v2.0:
=> bootstage report
Timer summary in microseconds (10 records):
Mark Elapsed Stage
0 0 reset
265,803 265,803 board_init_f
904,140 638,337 board_init_r
979,531 75,391 eth_common_init
1,148,105 168,574 eth_initialize
1,148,308 203 main_loop
1,298,735 150,427 cli_loopAccumulated time:
6,793 of_live
17,891 dm_r
344,821 dm_fDo not fully understand why OF_LIVE have such big impact on init time. It does not have such big impact on e.g. a RK3308 board.
Jonas Karlman (3):
rockchip: rk3328: Sort imply statements alphabetically
rockchip: rk3328: Enable ARMv8 crypto extensions
rockchip: io-domain: Add support for RK3328
arch/arm/mach-rockchip/Kconfig | 14 +++---- arch/arm/mach-rockchip/rk3328/syscon_rk3328.c | 3 ++ configs/evb-rk3328_defconfig | 1 + drivers/misc/Kconfig | 2 +- drivers/misc/rockchip-io-domain.c | 38 +++++++++++++++++++ 5 files changed, 50 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.2
PATCH 1/3 rockchip: rk3328: Sort imply statements alphabetically
Sort imply statements under ROCKCHIP_RK3328 alphabetically and remove ENABLE_ARM_SOC_BOOT0_HOOK, DEBUG_UART_BOARD_INIT and SYS_NS16550, they are already implyed or selected by ARCH_ROCKCHIP.
--- arch/arm/mach-rockchip/Kconfig | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
arch/arm/mach-rockchip/Kconfig +4 -7
@@ -191,18 +191,15 @@ config ROCKCHIP_RK3328 select SUPPORT_TPL select TPL select TPL_NEEDS_SEPARATE_STACK if TPL + imply MISC + imply MISC_INIT_R imply ROCKCHIP_COMMON_BOARD + imply ROCKCHIP_EFUSE imply ROCKCHIP_SDRAM_COMMON imply SPL_ROCKCHIP_COMMON_BOARD + imply SPL_SEPARATE_BSS imply SPL_SERIAL imply TPL_SERIAL - imply SPL_SEPARATE_BSS - select ENABLE_ARM_SOC_BOOT0_HOOK - select DEBUG_UART_BOARD_INIT - select SYS_NS16550 - imply MISC - imply ROCKCHIP_EFUSE - imply MISC_INIT_R help The Rockchip RK3328 is a ARM-based SoC with a quad-core Cortex-A53. including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
Signature · 1 line
2.43.2
PATCH 2/3 rockchip: rk3328: Enable ARMv8 crypto extensions
In reply to Jonas KarlmanThe RK3328 SoC support ARMv8 Cryptography Extensions and use of the ARMv8 crypto extensions help speed up FIT checksum validation in SPL.
Imply ARMV8_SET_SMPEN and ARMV8_CRYPTO to take advantage of the crypto extensions for SHA256 when validating checksum of FIT images.
Also imply OF_LIVE to help speed up init of U-Boot proper.
--- arch/arm/mach-rockchip/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mach-rockchip/Kconfig +3 -0
@@ -191,8 +191,11 @@ config ROCKCHIP_RK3328 select SUPPORT_TPL select TPL select TPL_NEEDS_SEPARATE_STACK if TPL + imply ARMV8_CRYPTO + imply ARMV8_SET_SMPEN imply MISC imply MISC_INIT_R + imply OF_LIVE imply ROCKCHIP_COMMON_BOARD imply ROCKCHIP_EFUSE imply ROCKCHIP_SDRAM_COMMON
Signature · 1 line
2.43.2
PATCH 3/3 rockchip: io-domain: Add support for RK3328
In reply to Jonas KarlmanPort the RK3328 part of the Rockchip IO-domain driver from linux.
This differs from linux version in that pmu io iodomain bit is enabled in the write ops instead of in an init ops as in linux, this way we can avoid keeping a full state of all supply that have been configured.
Enable by default on all RK3328 boards, skip rk3328-evb because this target is typically also used on miscellaneous boards and boxes not fully supported by U-Boot.
--- arch/arm/mach-rockchip/rk3328/syscon_rk3328.c | 3 ++ configs/evb-rk3328_defconfig | 1 + drivers/misc/Kconfig | 2 +- drivers/misc/rockchip-io-domain.c | 38 +++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3328/syscon_rk3328.c +3 -0
@@ -17,4 +17,7 @@ U_BOOT_DRIVER(rockchip_rk3328_grf) = { .name = "rockchip_rk3328_grf", .id = UCLASS_SYSCON, .of_match = rk3328_syscon_ids, +#if CONFIG_IS_ENABLED (OF_REAL ) + .bind = dm_scan_fdt_dev, +#endif };
configs/evb-rk3328_defconfig +1 -0
@@ -57,6 +57,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +# CONFIG_ROCKCHIP_IODOMAIN is not set CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_PHY_MOTORCOMM=y
drivers/misc/Kconfig +1 -1
@@ -104,7 +104,7 @@ config ROCKCHIP_OTP config ROCKCHIP_IODOMAIN bool "Rockchip IO-domain driver support" depends on DM_REGULATOR && ARCH_ROCKCHIP - default y if ROCKCHIP_RK3568 + default y if ROCKCHIP_RK3328 || ROCKCHIP_RK3568 help Enable support for IO-domains in Rockchip SoCs. It is necessary for the IO-domain setting of the SoC to match the voltage supplied
drivers/misc/rockchip-io-domain.c +38 -0
@@ -27,6 +27,10 @@#define MAX_VOLTAGE_1_8 1980000#define MAX_VOLTAGE_3_3 3600000 +#define RK3328_SOC_CON4 0x410 +#define RK3328_SOC_CON4_VCCIO2 BIT(7) +#define RK3328_SOC_VCCIO2_SUPPLY_NUM 1 +#define RK3399_PMUGRF_CON0 0x180#define RK3399_PMUGRF_CON0_VSEL BIT(8)#define RK3399_PMUGRF_VSEL_SUPPLY_NUM 9
@@ -95,6 +99,22 @@ static int rockchip_iodomain_write(struct regmap *grf, uint offset, int idx, intreturn regmap_write (grf, offset, val); } +static int rk3328_iodomain_write (struct regmap *grf,uint offset,int idx,int uV) +{ +int ret =rockchip_iodomain_write (grf, offset, idx, uV); + +if (!ret && idx ==RK3328_SOC_VCCIO2_SUPPLY_NUM ) { +/* +* set vccio2 iodomain to also use this framework +* instead of a special gpio. +*/ +u32 val =RK3328_SOC_CON4_VCCIO2 | (RK3328_SOC_CON4_VCCIO2 <<16 ); + ret =regmap_write (grf,RK3328_SOC_CON4 , val); + } + +return ret; +} +static int rk3399_pmu_iodomain_write (struct regmap *grf,uint offset,int idx,int uV) {int ret =rockchip_iodomain_write (grf, offset, idx, uV);
@@ -111,6 +131,20 @@ static int rk3399_pmu_iodomain_write(struct regmap *grf, uint offset, int idx, ireturn ret; } +static const struct rockchip_iodomain_soc_data soc_data_rk3328 = { + .grf_offset =0x410 , + .supply_names = { +"vccio1-supply" , +"vccio2-supply" , +"vccio3-supply" , +"vccio4-supply" , +"vccio5-supply" , +"vccio6-supply" , +"pmuio-supply" , + }, + .write = rk3328_iodomain_write, +}; +static const struct rockchip_iodomain_soc_data soc_data_rk3399 = { .grf_offset =0xe640 , .supply_names = {
@@ -156,6 +190,10 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = { };static const struct udevice_id rockchip_iodomain_ids[] = { + { + .compatible ="rockchip,rk3328-io-voltage-domain" , + .data = (ulong)&soc_data_rk3328, + }, { .compatible ="rockchip,rk3399-io-voltage-domain" , .data = (ulong)&soc_data_rk3399,
Signature · 1 line
2.43.2