From b9d66a061b93e4679bd3afddb24413d5a51dabcc Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 30 Aug 2021 09:16:29 -0400 Subject: [PATCH] imx: Convert SERIAL_TAG support to ENV_VARS_UBOOT_RUNTIME_CONFIG No iMX platforms have supported ATAG-based booting. They have however re-used the CONFIG_SERIAL_TAG option as a way to enable support of reading the OTP fuses and setting the serial# environment variable in some cases. Change the warp7 support to use this symbol, use this for updating the rest of the imx7 code, and update the imx8 conditionals. Cc: Stefano Babic Cc: Fabio Estevam Cc: NXP i.MX U-Boot Team Signed-off-by: Tom Rini --- arch/arm/include/asm/bootm.h | 5 ++++- arch/arm/mach-imx/imx8/cpu.c | 4 ++-- arch/arm/mach-imx/imx8ulp/soc.c | 2 +- arch/arm/mach-imx/mx7/soc.c | 12 +++++++++++- board/warp7/warp7.c | 4 ++-- configs/gwventana_emmc_defconfig | 1 + configs/gwventana_gw5904_defconfig | 1 + configs/gwventana_nand_defconfig | 1 + configs/imx8ulp_evk_defconfig | 1 + configs/puma-rk3399_defconfig | 1 + configs/warp7_bl33_defconfig | 1 + configs/warp7_defconfig | 1 + include/configs/apalis_imx6.h | 1 - include/configs/cm_fx6.h | 1 - include/configs/colibri_imx6.h | 1 - include/configs/gw_ventana.h | 3 --- include/configs/imx8ulp_evk.h | 2 -- include/configs/puma_rk3399.h | 2 -- include/configs/warp7.h | 3 --- 19 files changed, 27 insertions(+), 20 deletions(-) diff --git a/arch/arm/include/asm/bootm.h b/arch/arm/include/asm/bootm.h index a2131ca07c..27f183b93d 100644 --- a/arch/arm/include/asm/bootm.h +++ b/arch/arm/include/asm/bootm.h @@ -41,9 +41,12 @@ extern void udc_disconnect(void); struct tag_serialnr; #ifdef CONFIG_SERIAL_TAG #define BOOTM_ENABLE_SERIAL_TAG 1 -void get_board_serial(struct tag_serialnr *serialnr); #else #define BOOTM_ENABLE_SERIAL_TAG 0 +#endif +#if defined(CONFIG_SERIAL_TAG) || defined(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG) +void get_board_serial(struct tag_serialnr *serialnr); +#else static inline void get_board_serial(struct tag_serialnr *serialnr) { } diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index 02db322f51..ee5cc47903 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -172,7 +172,7 @@ enum boot_device get_boot_device(void) return boot_dev; } -#ifdef CONFIG_SERIAL_TAG +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define FUSE_UNIQUE_ID_WORD0 16 #define FUSE_UNIQUE_ID_WORD1 17 void get_board_serial(struct tag_serialnr *serialnr) @@ -201,7 +201,7 @@ void get_board_serial(struct tag_serialnr *serialnr) serialnr->low = val1; serialnr->high = val2; } -#endif /*CONFIG_SERIAL_TAG*/ +#endif /*CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG*/ #ifdef CONFIG_ENV_IS_IN_MMC __weak int board_mmc_get_env_dev(int devno) diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c index 1c33acc7dd..bba6323f96 100644 --- a/arch/arm/mach-imx/imx8ulp/soc.c +++ b/arch/arm/mach-imx/imx8ulp/soc.c @@ -405,7 +405,7 @@ int dram_init(void) return 0; } -#ifdef CONFIG_SERIAL_TAG +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG void get_board_serial(struct tag_serialnr *serialnr) { u32 uid[4]; diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c index 6f9a30bb5f..9c7d5f18da 100644 --- a/arch/arm/mach-imx/mx7/soc.c +++ b/arch/arm/mach-imx/mx7/soc.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -337,10 +338,19 @@ int arch_cpu_init(void) int arch_misc_init(void) { #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + struct tag_serialnr serialnr; + char serial_string[0x20]; + if (is_mx7d()) env_set("soc", "imx7d"); else env_set("soc", "imx7s"); + + /* Set serial# standard environment variable based on OTP settings */ + get_board_serial(&serialnr); + snprintf(serial_string, sizeof(serial_string), "0x%08x%08x", + serialnr.low, serialnr.high); + env_set("serial#", serial_string); #endif #ifdef CONFIG_FSL_CAAM @@ -351,7 +361,7 @@ int arch_misc_init(void) } #endif -#ifdef CONFIG_SERIAL_TAG +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG /* * OCOTP_TESTER * i.MX 7Solo Applications Processor Reference Manual, Rev. 0.1, 08/2016 diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c index 0f202241dd..c5c5433048 100644 --- a/board/warp7/warp7.c +++ b/board/warp7/warp7.c @@ -134,7 +134,7 @@ int checkboard(void) int board_late_init(void) { struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; -#ifdef CONFIG_SERIAL_TAG +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG struct tag_serialnr serialnr; char serial_string[0x20]; #endif @@ -156,7 +156,7 @@ int board_late_init(void) env_set_ulong(HAB_ENABLED_ENVNAME, 0); #endif -#ifdef CONFIG_SERIAL_TAG +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG /* Set serial# standard environment variable based on OTP settings */ get_board_serial(&serialnr); snprintf(serial_string, sizeof(serial_string), "WaRP7-0x%08x%08x", diff --git a/configs/gwventana_emmc_defconfig b/configs/gwventana_emmc_defconfig index d1074323da..000bdb5949 100644 --- a/configs/gwventana_emmc_defconfig +++ b/configs/gwventana_emmc_defconfig @@ -79,6 +79,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_BOUNCE_BUFFER=y diff --git a/configs/gwventana_gw5904_defconfig b/configs/gwventana_gw5904_defconfig index f579d0fd8d..87851f3524 100644 --- a/configs/gwventana_gw5904_defconfig +++ b/configs/gwventana_gw5904_defconfig @@ -79,6 +79,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_BOUNCE_BUFFER=y diff --git a/configs/gwventana_nand_defconfig b/configs/gwventana_nand_defconfig index b587adefb5..ff5001ef96 100644 --- a/configs/gwventana_nand_defconfig +++ b/configs/gwventana_nand_defconfig @@ -81,6 +81,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_BOUNCE_BUFFER=y diff --git a/configs/imx8ulp_evk_defconfig b/configs/imx8ulp_evk_defconfig index 1c6288d310..f156100888 100644 --- a/configs/imx8ulp_evk_defconfig +++ b/configs/imx8ulp_evk_defconfig @@ -40,6 +40,7 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y CONFIG_SPL_OF_CONTROL=y CONFIG_ENV_IS_IN_MMC=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM=y CONFIG_IMX_RGPIO2P=y diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig index a0a3059a36..afc54fe45c 100644 --- a/configs/puma-rk3399_defconfig +++ b/configs/puma-rk3399_defconfig @@ -46,6 +46,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=1 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/warp7_bl33_defconfig b/configs/warp7_bl33_defconfig index e260bbeef5..d127a4f8d3 100644 --- a/configs/warp7_bl33_defconfig +++ b/configs/warp7_bl33_defconfig @@ -32,6 +32,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_BOUNCE_BUFFER=y CONFIG_DFU_MMC=y diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig index 1b77528286..4b339b47ca 100644 --- a/configs/warp7_defconfig +++ b/configs/warp7_defconfig @@ -38,6 +38,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_BOUNCE_BUFFER=y CONFIG_DFU_MMC=y diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h index 839af489dd..de6e205e39 100644 --- a/include/configs/apalis_imx6.h +++ b/include/configs/apalis_imx6.h @@ -27,7 +27,6 @@ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG #define CONFIG_REVISION_TAG -#define CONFIG_SERIAL_TAG #define CONFIG_MXC_UART_BASE UART1_BASE diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index 2e7d343858..7092def8f9 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -173,7 +173,6 @@ /* Boot */ #define CONFIG_SYS_BOOTMAPSZ (8 << 20) -#define CONFIG_SERIAL_TAG /* misc */ diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h index be0ed457d6..8d628e7a60 100644 --- a/include/configs/colibri_imx6.h +++ b/include/configs/colibri_imx6.h @@ -25,7 +25,6 @@ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG #define CONFIG_REVISION_TAG -#define CONFIG_SERIAL_TAG #define CONFIG_MXC_UART_BASE UART1_BASE diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h index 012c9b6ffe..ed8e50832a 100644 --- a/include/configs/gw_ventana.h +++ b/include/configs/gw_ventana.h @@ -26,9 +26,6 @@ #define CONFIG_MACH_TYPE 4520 /* Gateworks Ventana Platform */ -/* Serial ATAG */ -#define CONFIG_SERIAL_TAG - /* Serial */ #define CONFIG_MXC_UART_BASE UART2_BASE diff --git a/include/configs/imx8ulp_evk.h b/include/configs/imx8ulp_evk.h index 1621b047d7..8e9a159e9b 100644 --- a/include/configs/imx8ulp_evk.h +++ b/include/configs/imx8ulp_evk.h @@ -33,8 +33,6 @@ #endif -#define CONFIG_SERIAL_TAG - #define CONFIG_REMAKE_ELF #define CONFIG_BOARD_EARLY_INIT_F diff --git a/include/configs/puma_rk3399.h b/include/configs/puma_rk3399.h index f52ea014b5..23de326e72 100644 --- a/include/configs/puma_rk3399.h +++ b/include/configs/puma_rk3399.h @@ -10,6 +10,4 @@ #define SDRAM_BANK_SIZE (2UL << 30) -#define CONFIG_SERIAL_TAG - #endif diff --git a/include/configs/warp7.h b/include/configs/warp7.h index bb9ba373eb..0822eaf555 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -18,9 +18,6 @@ #define CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 -/* Switch on SERIAL_TAG */ -#define CONFIG_SERIAL_TAG - #define CONFIG_DFU_ENV_SETTINGS \ "dfu_alt_info=boot raw 0x2 0x1000 mmcpart 1\0" \ -- 2.39.5