From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Cc: Stefano Babic <sbabic@denx.de>,
Fabio Estevam <festevam@gmail.com>,
"NXP i . MX U-Boot Team" <uboot-imx@nxp.com>
Subject: [PATCH 2/5] imx: Convert SERIAL_TAG support to ENV_VARS_UBOOT_RUNTIME_CONFIG
Date: Mon, 30 Aug 2021 09:16:29 -0400 [thread overview]
Message-ID: <20210830131632.18780-2-trini@konsulko.com> (raw)
In-Reply-To: <20210830131632.18780-1-trini@konsulko.com>
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 <sbabic@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
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 a2131ca07c52..27f183b93d6b 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 02db322f51af..ee5cc479039b 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 1c33acc7dd6e..bba6323f96fa 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 fda25ba66a36..285c8d5682d8 100644
--- a/arch/arm/mach-imx/mx7/soc.c
+++ b/arch/arm/mach-imx/mx7/soc.c
@@ -15,6 +15,7 @@
#include <asm/arch/imx-rdc.h>
#include <asm/mach-imx/boot_mode.h>
#include <asm/arch/crm_regs.h>
+#include <asm/bootm.h>
#include <dm.h>
#include <env.h>
#include <imx_thermal.h>
@@ -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 0f202241dd78..c5c5433048dd 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 9e764f40a229..ca15a720f69f 100644
--- a/configs/gwventana_emmc_defconfig
+++ b/configs/gwventana_emmc_defconfig
@@ -76,6 +76,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 bab61e7daad0..51665012a40d 100644
--- a/configs/gwventana_gw5904_defconfig
+++ b/configs/gwventana_gw5904_defconfig
@@ -76,6 +76,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 e59efebab777..894f55fefeb6 100644
--- a/configs/gwventana_nand_defconfig
+++ b/configs/gwventana_nand_defconfig
@@ -78,6 +78,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 2a97c6dc4472..12d59bac8609 100644
--- a/configs/imx8ulp_evk_defconfig
+++ b/configs/imx8ulp_evk_defconfig
@@ -37,6 +37,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 eaa3cddd4e1c..349787b0d782 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -44,6 +44,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 ec078178abf8..f3b9727ea286 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 19c0c183f7e5..9642ec1dac27 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 12de0105c6c7..32c5e44fd8fb 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
/* Size of malloc() pool */
#define CONFIG_SYS_MALLOC_LEN (32 * 1024 * 1024)
diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
index a496a80e02e5..5ff33a3505cc 100644
--- a/include/configs/cm_fx6.h
+++ b/include/configs/cm_fx6.h
@@ -186,7 +186,6 @@
/* Boot */
#define CONFIG_SYS_BOOTMAPSZ (8 << 20)
-#define CONFIG_SERIAL_TAG
/* misc */
#define CONFIG_SYS_MALLOC_LEN (10 * 1024 * 1024)
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index 804a144a03e1..8b608f097990 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
/* Size of malloc() pool */
#define CONFIG_SYS_MALLOC_LEN (32 * 1024 * 1024)
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index 4f2727363477..3244baa28849 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
-
/* Size of malloc() pool */
#define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M)
diff --git a/include/configs/imx8ulp_evk.h b/include/configs/imx8ulp_evk.h
index 32f8773b241e..782c2bfe0a63 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 f52ea014b5d6..23de326e7208 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 a5d52e3977fd..0d642b4cc67c 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -21,9 +21,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.17.1
next prev parent reply other threads:[~2021-08-30 13:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-30 13:16 [PATCH 1/5] Convert CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig Tom Rini
2021-08-30 13:16 ` Tom Rini [this message]
2021-09-08 2:31 ` [PATCH 2/5] imx: Convert SERIAL_TAG support to ENV_VARS_UBOOT_RUNTIME_CONFIG Tom Rini
2021-08-30 13:16 ` [PATCH 3/5] arm: Disable ATAGs support Tom Rini
2021-09-04 16:29 ` Stephan Gerhold
2021-09-04 16:54 ` Tom Rini
2021-09-08 2:31 ` Tom Rini
2021-08-30 13:16 ` [PATCH 4/5] arm: Add Kconfig entry for MACH_TYPE Tom Rini
2021-09-08 2:32 ` Tom Rini
2021-08-30 13:16 ` [PATCH 5/5] arm: Finish migration of CONFIG_MACH_TYPE Tom Rini
2021-09-08 2:32 ` Tom Rini
2021-09-08 2:31 ` [PATCH 1/5] Convert CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210830131632.18780-2-trini@konsulko.com \
--to=trini@konsulko.com \
--cc=festevam@gmail.com \
--cc=sbabic@denx.de \
--cc=u-boot@lists.denx.de \
--cc=uboot-imx@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.