From 3505bc5561265f7453bb0f9063a254dc21cbdaa5 Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Mon, 17 Oct 2016 20:12:58 -0600
Subject: [PATCH] Convert CONFIG_SYS_CONSOLE_ENV_OVERWRITE to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_CONSOLE_ENV_OVERWRITE

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
 README                                 | 3 ---
 common/Kconfig                         | 9 +++++++++
 configs/socfpga_arria5_defconfig       | 1 +
 configs/socfpga_cyclone5_defconfig     | 1 +
 configs/socfpga_de0_nano_soc_defconfig | 1 +
 configs/socfpga_is1_defconfig          | 1 +
 configs/socfpga_mcvevk_defconfig       | 1 +
 configs/socfpga_sockit_defconfig       | 1 +
 configs/socfpga_socrates_defconfig     | 1 +
 configs/socfpga_sr1500_defconfig       | 1 +
 configs/socfpga_vining_fpga_defconfig  | 1 +
 include/configs/MIP405.h               | 1 -
 include/configs/MigoR.h                | 1 -
 include/configs/PIP405.h               | 1 -
 include/configs/ap325rxa.h             | 1 -
 include/configs/ap_sh4a_4a.h           | 1 -
 include/configs/armadillo-800eva.h     | 1 -
 include/configs/ecovec.h               | 1 -
 include/configs/kzm9g.h                | 1 -
 include/configs/ms7722se.h             | 1 -
 include/configs/r0p7734.h              | 1 -
 include/configs/rcar-gen2-common.h     | 1 -
 include/configs/rcar-gen3-common.h     | 1 -
 include/configs/sh7752evb.h            | 1 -
 include/configs/sh7753evb.h            | 1 -
 include/configs/sh7757lcr.h            | 1 -
 include/configs/sh7785lcr.h            | 1 -
 include/configs/socfpga_common.h       | 1 -
 scripts/config_whitelist.txt           | 1 -
 29 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/README b/README
index 8697eb21e2..5a892b33c7 100644
--- a/README
+++ b/README
@@ -3533,9 +3533,6 @@ Configuration Settings:
 - CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
 		Enable the call to overwrite_console().
 
-- CONFIG_SYS_CONSOLE_ENV_OVERWRITE
-		Enable overwrite of previous console environment settings.
-
 - CONFIG_SYS_MEMTEST_START, CONFIG_SYS_MEMTEST_END:
 		Begin and End addresses of the area used by the
 		simple memory test.
diff --git a/common/Kconfig b/common/Kconfig
index 3be424488e..e78e91829b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -309,6 +309,15 @@ config SYS_CONSOLE_IS_IN_ENV
 	  environment variables can be updated after boot to change the
 	  input/output devices.
 
+config SYS_CONSOLE_ENV_OVERWRITE
+	bool "Update environment variables during console init"
+	help
+	  The console environment variables (stdout, stdin, stderr) can be
+	  used to determine the correct console devices on start-up. This
+	  option writes the console devices to these variables on console
+	  start-up (after relocation). This causes the environment to be
+	  updated to match the console devices actually chosen.
+
 endmenu
 
 config SYS_NO_FLASH
diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
index 5d311125a7..246ba00b1d 100644
--- a/configs/socfpga_arria5_defconfig
+++ b/configs/socfpga_arria5_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria5_socdk"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
index c930accdde..bc550e5034 100644
--- a/configs/socfpga_cyclone5_defconfig
+++ b/configs/socfpga_cyclone5_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_socdk"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
index 402d9fb1dc..140ac4dbe6 100644
--- a/configs/socfpga_de0_nano_soc_defconfig
+++ b/configs/socfpga_de0_nano_soc_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_de0_nano_soc"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
index cc0313cfa4..6a50f5b690 100644
--- a/configs/socfpga_is1_defconfig
+++ b/configs/socfpga_is1_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_is1"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
index 2462f662e1..cc0938d10d 100644
--- a/configs/socfpga_mcvevk_defconfig
+++ b/configs/socfpga_mcvevk_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_mcvevk"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
index 7b1c4766fa..a208856575 100644
--- a/configs/socfpga_sockit_defconfig
+++ b/configs/socfpga_sockit_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_sockit"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
index 4a26996071..b9e72c82db 100644
--- a/configs/socfpga_socrates_defconfig
+++ b/configs/socfpga_socrates_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_socrates"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
index 770ebcd17a..276682753f 100644
--- a/configs/socfpga_sr1500_defconfig
+++ b/configs/socfpga_sr1500_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_sr1500"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
index 79b0cbae86..c9b017890e 100644
--- a/configs/socfpga_vining_fpga_defconfig
+++ b/configs/socfpga_vining_fpga_defconfig
@@ -7,6 +7,7 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_vining_fpga"
 CONFIG_FIT=y
 CONFIG_BOOTDELAY=5
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
diff --git a/include/configs/MIP405.h b/include/configs/MIP405.h
index 7764b23ee9..0cc8f3726e 100644
--- a/include/configs/MIP405.h
+++ b/include/configs/MIP405.h
@@ -111,7 +111,6 @@
  * defines if the overwrite_console should be stored in the
  * environment
  **************************************************************/
-#undef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 /**************************************************************
  * loads config
diff --git a/include/configs/MigoR.h b/include/configs/MigoR.h
index a4eabe5813..588ddd4e26 100644
--- a/include/configs/MigoR.h
+++ b/include/configs/MigoR.h
@@ -43,7 +43,6 @@
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET	/* Suppress display of console
 								   information at boot */
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(MIGO_R_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + (60 * 1024 * 1024))
diff --git a/include/configs/PIP405.h b/include/configs/PIP405.h
index 786fab0197..c9acb0259d 100644
--- a/include/configs/PIP405.h
+++ b/include/configs/PIP405.h
@@ -107,7 +107,6 @@
  * defines if the overwrite_console should be stored in the
  * environment
  **************************************************************/
-#undef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 /**************************************************************
  * loads config
diff --git a/include/configs/ap325rxa.h b/include/configs/ap325rxa.h
index 32acb080c0..795a7d23eb 100644
--- a/include/configs/ap325rxa.h
+++ b/include/configs/ap325rxa.h
@@ -57,7 +57,6 @@
 /* Suppress display of console information at boot */
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(AP325RXA_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + (60 * 1024 * 1024))
diff --git a/include/configs/ap_sh4a_4a.h b/include/configs/ap_sh4a_4a.h
index d41b624405..fc08d7b854 100644
--- a/include/configs/ap_sh4a_4a.h
+++ b/include/configs/ap_sh4a_4a.h
@@ -73,7 +73,6 @@
 /* Suppress display of console information at boot */
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE	(0x88000000)
diff --git a/include/configs/armadillo-800eva.h b/include/configs/armadillo-800eva.h
index e616da4b6b..3198df5555 100644
--- a/include/configs/armadillo-800eva.h
+++ b/include/configs/armadillo-800eva.h
@@ -60,7 +60,6 @@
 #define	CONFIG_SCIF_A
 #undef	CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef	CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(ARMADILLO_800EVA_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + \
diff --git a/include/configs/ecovec.h b/include/configs/ecovec.h
index c8508fff2d..8ab26e6d7a 100644
--- a/include/configs/ecovec.h
+++ b/include/configs/ecovec.h
@@ -93,7 +93,6 @@
 /* Suppress display of console information at boot */
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE	(0x88000000)
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index a5c872c224..4ea9ba21e5 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -56,7 +56,6 @@
 #define CONFIG_CONS_SCIF4
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(KZM_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END \
diff --git a/include/configs/ms7722se.h b/include/configs/ms7722se.h
index 9b0c166d60..d0b6e5819d 100644
--- a/include/configs/ms7722se.h
+++ b/include/configs/ms7722se.h
@@ -42,7 +42,6 @@
 #define CONFIG_CONS_SCIF0	1
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET			/* Suppress display of console information at boot */
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(MS7722SE_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + (60 * 1024 * 1024))
diff --git a/include/configs/r0p7734.h b/include/configs/r0p7734.h
index 2d7e326f51..408ae21ae1 100644
--- a/include/configs/r0p7734.h
+++ b/include/configs/r0p7734.h
@@ -78,7 +78,6 @@
 /* Suppress display of console information at boot */
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE	(0x88000000)
diff --git a/include/configs/rcar-gen2-common.h b/include/configs/rcar-gen2-common.h
index b24652f316..1891242987 100644
--- a/include/configs/rcar-gen2-common.h
+++ b/include/configs/rcar-gen2-common.h
@@ -42,7 +42,6 @@
 /* console */
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_LONGHELP
 #define CONFIG_SYS_CBSIZE		256
diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h
index 1e9752b5f2..cf1af6687e 100644
--- a/include/configs/rcar-gen3-common.h
+++ b/include/configs/rcar-gen3-common.h
@@ -50,7 +50,6 @@
 /* console */
 #undef  CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_LONGHELP
 #define CONFIG_SYS_CBSIZE		256
diff --git a/include/configs/sh7752evb.h b/include/configs/sh7752evb.h
index cfcde81f31..fd32ddc9ee 100644
--- a/include/configs/sh7752evb.h
+++ b/include/configs/sh7752evb.h
@@ -46,7 +46,6 @@
 #define CONFIG_CONS_SCIF2	1
 #undef	CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef	CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(SH7752EVB_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + \
diff --git a/include/configs/sh7753evb.h b/include/configs/sh7753evb.h
index fefdbb4ff2..57c8e769c0 100644
--- a/include/configs/sh7753evb.h
+++ b/include/configs/sh7753evb.h
@@ -46,7 +46,6 @@
 #define CONFIG_CONS_SCIF2	1
 #undef	CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef	CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(SH7753EVB_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + \
diff --git a/include/configs/sh7757lcr.h b/include/configs/sh7757lcr.h
index 262d390271..cb09a7cca0 100644
--- a/include/configs/sh7757lcr.h
+++ b/include/configs/sh7757lcr.h
@@ -46,7 +46,6 @@
 #define CONFIG_CONS_SCIF2	1
 #undef	CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef	CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(SH7757LCR_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + \
diff --git a/include/configs/sh7785lcr.h b/include/configs/sh7785lcr.h
index 80e61a4f04..6eee51ed8e 100644
--- a/include/configs/sh7785lcr.h
+++ b/include/configs/sh7785lcr.h
@@ -62,7 +62,6 @@
 #define CONFIG_SCIF_EXT_CLOCK	1
 #undef	CONFIG_SYS_CONSOLE_INFO_QUIET
 #undef	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#undef	CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 
 #define CONFIG_SYS_MEMTEST_START	(SH7785LCR_SDRAM_BASE)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + \
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 9bb2227ee2..e76e072bb0 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -252,7 +252,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
  * U-Boot environment
  */
 #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#define CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 #if !defined(CONFIG_ENV_SIZE)
 #define CONFIG_ENV_SIZE			4096
 #endif
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index bc37626ce6..8b49304551 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -4597,7 +4597,6 @@ CONFIG_SYS_CMXFCR_VALUE1
 CONFIG_SYS_CMXFCR_VALUE2
 CONFIG_SYS_CMXFCR_VALUE3
 CONFIG_SYS_CMXSCR_VALUE
-CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 CONFIG_SYS_CONSOLE_INFO_QUIET
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
 CONFIG_SYS_CORE_SRAM
-- 
2.39.5