From 84e9dcc120c59942cc35a1e229e856ce556d7ca2 Mon Sep 17 00:00:00 2001
From: Patrice Chotard <patrice.chotard@st.com>
Date: Wed, 26 Jul 2017 15:48:39 +0200
Subject: [PATCH] serial: stm32x7: Convert CONFIG_STM32X7_SERIAL to Kconfig

Add CONFIG_STM32X7_SERIAL as a Kconfig option.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
---
 configs/stm32f746-disco_defconfig | 1 +
 drivers/serial/Kconfig            | 7 +++++++
 include/configs/stm32f746-disco.h | 1 -
 scripts/config_whitelist.txt      | 1 -
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configs/stm32f746-disco_defconfig b/configs/stm32f746-disco_defconfig
index 0daadde061..439b796282 100644
--- a/configs/stm32f746-disco_defconfig
+++ b/configs/stm32f746-disco_defconfig
@@ -43,6 +43,7 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_STM32=y
 CONFIG_RAM=y
 CONFIG_STM32_SDRAM=y
+CONFIG_STM32X7_SERIAL=y
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 0748a92545..2582c954f2 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -509,6 +509,13 @@ config STI_ASC_SERIAL
 	  on STiH410 SoC. This is a basic implementation,  it supports
 	  following baudrate 9600, 19200, 38400, 57600 and 115200.
 
+config STM32X7_SERIAL
+	bool "STMicroelectronics STM32 SoCs on-chip UART"
+	depends on DM_SERIAL && STM32F7
+	help
+	  If you have a machine based on a STM32 F7 you can enable its
+	  onboard serial ports, say Y to this option. If unsure, say N.
+
 config MPC8XX_CONS
 	bool "Console driver for MPC8XX"
 	depends on 8xx
diff --git a/include/configs/stm32f746-disco.h b/include/configs/stm32f746-disco.h
index 46955b1f1f..3f5ddbc9fa 100644
--- a/include/configs/stm32f746-disco.h
+++ b/include/configs/stm32f746-disco.h
@@ -31,7 +31,6 @@
 #define CONFIG_ENV_SIZE			(8 << 10)
 
 #define CONFIG_STM32_FLASH
-#define CONFIG_STM32X7_SERIAL
 
 #define CONFIG_DW_GMAC_DEFAULT_DMA_PBL	(8)
 #define CONFIG_DW_ALTDESCRIPTOR
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 2d642de729..6889bbd147 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -2340,7 +2340,6 @@ CONFIG_STATIC_BOARD_REV
 CONFIG_STATIC_RELA
 CONFIG_STD_DEVICES_SETTINGS
 CONFIG_STM32F4DISCOVERY
-CONFIG_STM32X7_SERIAL
 CONFIG_STM32_FLASH
 CONFIG_STM32_GPIO
 CONFIG_STM32_HSE_HZ
-- 
2.30.2