From f9f3209a3478b1393180705cfdaed618d5d6ed3a Mon Sep 17 00:00:00 2001
From: Tom Rini <trini@konsulko.com>
Date: Wed, 30 Mar 2022 18:07:21 -0400
Subject: [PATCH] Convert CONFIG_CONS_SCIF0 et al to Kconfig

This converts the following to Kconfig:
   CONFIG_CONS_SCIF0
   CONFIG_CONS_SCIF1
   CONFIG_CONS_SCIF2
   CONFIG_CONS_SCIF4
   CONFIG_CONS_SCIFA0

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 drivers/serial/Kconfig             | 21 +++++++++++++++++++++
 include/configs/alt.h              |  1 -
 include/configs/armadillo-800eva.h |  1 -
 include/configs/gose.h             |  1 -
 include/configs/koelsch.h          |  1 -
 include/configs/kzm9g.h            |  1 -
 include/configs/lager.h            |  1 -
 include/configs/porter.h           |  1 -
 include/configs/r2dplus.h          |  1 -
 include/configs/rcar-gen3-common.h |  1 -
 include/configs/silk.h             |  1 -
 include/configs/stout.h            |  1 -
 12 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 76171e7146..af01e506d5 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -804,6 +804,27 @@ config SCIF_CONSOLE
 	  on systems with RCar or SH SoCs, say Y to this option. If unsure,
 	  say N.
 
+choice
+	prompt "SCIF console port"
+	depends on SCIF_CONSOLE && (!DM_SERIAL || (SPL && !SPL_DM_SERIAL))
+
+config CONS_SCIF0
+	bool "SCIF0"
+
+config CONS_SCIF1
+	bool "SCIF1"
+
+config CONS_SCIF2
+	bool "SCIF2"
+
+config CONS_SCIF4
+	bool "SCIF4"
+
+config CONS_SCIFA0
+	bool "SCIFA0"
+
+endchoice
+
 config SEMIHOSTING_SERIAL
 	bool "Semihosting UART support"
 	depends on SEMIHOSTING && !SERIAL_RX_BUFFER
diff --git a/include/configs/alt.h b/include/configs/alt.h
index acc416de06..1656072ebb 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -42,7 +42,6 @@
 #define CONFIG_SPL_STACK		0xe6340000
 #define CONFIG_SPL_MAX_SIZE		0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF2
 #define CONFIG_SH_SCIF_CLK_FREQ		65000000
 #endif
 
diff --git a/include/configs/armadillo-800eva.h b/include/configs/armadillo-800eva.h
index 18e1e401ae..f144302a71 100644
--- a/include/configs/armadillo-800eva.h
+++ b/include/configs/armadillo-800eva.h
@@ -33,7 +33,6 @@
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 115200 }
 
 /* SCIF */
-#define CONFIG_CONS_SCIF1
 #define SCIF0_BASE		0xe6c40000
 #define SCIF1_BASE		0xe6c50000
 #define SCIF2_BASE		0xe6c60000
diff --git a/include/configs/gose.h b/include/configs/gose.h
index dfa139dc7d..9015cabc2d 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -37,7 +37,6 @@
 #define CONFIG_SPL_STACK		0xe6340000
 #define CONFIG_SPL_MAX_SIZE		0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF0
 #define CONFIG_SH_SCIF_CLK_FREQ		65000000
 #endif
 
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index 84603e3540..3fef4150b2 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -37,7 +37,6 @@
 #define CONFIG_SPL_STACK		0xe6340000
 #define CONFIG_SPL_MAX_SIZE		0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF0
 #define CONFIG_SH_SCIF_CLK_FREQ		65000000
 #endif
 
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index c20ef5f696..f35549d95a 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -27,7 +27,6 @@
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 115200 }
 
 /* SCIF */
-#define CONFIG_CONS_SCIF4
 
 #undef  CONFIG_SYS_LOADS_BAUD_CHANGE
 
diff --git a/include/configs/lager.h b/include/configs/lager.h
index 8cabad2853..df3b4bbce0 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -38,7 +38,6 @@
 #define CONFIG_SPL_STACK		0xe6340000
 #define CONFIG_SPL_MAX_SIZE		0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF0
 #define CONFIG_SH_SCIF_CLK_FREQ		65000000
 #endif
 
diff --git a/include/configs/porter.h b/include/configs/porter.h
index 661b7ea0cd..964ce7def6 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -42,7 +42,6 @@
 #define CONFIG_SPL_STACK		0xe6340000
 #define CONFIG_SPL_MAX_SIZE		0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF0
 #define CONFIG_SH_SCIF_CLK_FREQ		65000000
 #endif
 
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h
index 869f9f52ae..54674094e8 100644
--- a/include/configs/r2dplus.h
+++ b/include/configs/r2dplus.h
@@ -4,7 +4,6 @@
 #define __LITTLE_ENDIAN__	1
 
 /* SCIF */
-#define CONFIG_CONS_SCIF1	1
 
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE		0x8C000000
diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h
index c3759ed19b..5bb6bf3d78 100644
--- a/include/configs/rcar-gen3-common.h
+++ b/include/configs/rcar-gen3-common.h
@@ -60,7 +60,6 @@
 #define CONFIG_SPL_STACK		0xe6304000
 #define CONFIG_SPL_MAX_SIZE		0x7000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF2
 #define CONFIG_SH_SCIF_CLK_FREQ		65000000
 #endif
 
diff --git a/include/configs/silk.h b/include/configs/silk.h
index fa195c62d5..ec8740b382 100644
--- a/include/configs/silk.h
+++ b/include/configs/silk.h
@@ -42,7 +42,6 @@
 #define CONFIG_SPL_STACK		0xe6340000
 #define CONFIG_SPL_MAX_SIZE		0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF2
 #define CONFIG_SH_SCIF_CLK_FREQ		65000000
 #endif
 
diff --git a/include/configs/stout.h b/include/configs/stout.h
index f9574be3f7..4ddbea5b1d 100644
--- a/include/configs/stout.h
+++ b/include/configs/stout.h
@@ -46,7 +46,6 @@
 #define CONFIG_SPL_STACK		0xe6340000
 #define CONFIG_SPL_MAX_SIZE		0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIFA0
 #define CONFIG_SH_SCIF_CLK_FREQ		52000000
 #endif
 
-- 
2.39.5