From 7a0ca5ba8ffd8b84bcf6738bc07cce3d3889a760 Mon Sep 17 00:00:00 2001
From: Rex-BC Chen <rex-bc.chen@mediatek.com>
Date: Mon, 13 Jun 2022 19:01:51 +0800
Subject: soc/mediatek: Move FLASH_DUAL_READ to common

FLASH_DUAL_READ is a common configuration for all MediaTek SoCs, so we
move it to common folder and select it in SoCs' Kconfig.

As suggested in CB:58837, we also rename FLASH_DUAL_READ to
FLASH_DUAL_IO_READ to reduce confusion.

TEST=build pass
BUG=b:233720142

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: If267a332519412a7919c5b7817047fabe4a564c8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65620
Reviewed-by: Yidi Lin <yidilin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
---
 src/soc/mediatek/common/Kconfig            | 7 +++++++
 src/soc/mediatek/common/flash_controller.c | 2 +-
 src/soc/mediatek/mt8186/Kconfig            | 8 +-------
 src/soc/mediatek/mt8192/Kconfig            | 8 +-------
 src/soc/mediatek/mt8195/Kconfig            | 8 +-------
 5 files changed, 11 insertions(+), 22 deletions(-)

(limited to 'src')

diff --git a/src/soc/mediatek/common/Kconfig b/src/soc/mediatek/common/Kconfig
index 2adb34458d..119746b497 100644
--- a/src/soc/mediatek/common/Kconfig
+++ b/src/soc/mediatek/common/Kconfig
@@ -56,4 +56,11 @@ config USE_CBMEM_DRAM_INFO
 	  The DRAM initialization will keep and return DRAM information (size,
 	  geometry and other DDR info) so we can fill that into the CBMEM.
 
+config FLASH_DUAL_IO_READ
+	bool
+	default n
+	help
+	  When this option is enabled, the flash controller provides the ability
+	  to dual IO read mode.
+
 endif
diff --git a/src/soc/mediatek/common/flash_controller.c b/src/soc/mediatek/common/flash_controller.c
index 3fe17f8612..c4c758ef19 100644
--- a/src/soc/mediatek/common/flash_controller.c
+++ b/src/soc/mediatek/common/flash_controller.c
@@ -142,7 +142,7 @@ static int nor_read(const struct spi_flash *flash, u32 addr, size_t len,
 		}
 	}
 
-	if (CONFIG(FLASH_DUAL_READ)) {
+	if (CONFIG(FLASH_DUAL_IO_READ)) {
 		setbits8(&mtk_nor->read_dual, SFLASH_READ_DUAL_EN);
 		write8(&mtk_nor->prgdata[3], SFLASH_1_1_2_READ);
 	}
diff --git a/src/soc/mediatek/mt8186/Kconfig b/src/soc/mediatek/mt8186/Kconfig
index 61843e3a97..db5bed217f 100644
--- a/src/soc/mediatek/mt8186/Kconfig
+++ b/src/soc/mediatek/mt8186/Kconfig
@@ -11,6 +11,7 @@ config SOC_MEDIATEK_MT8186
 	select SOC_MEDIATEK_COMMON
 	select MEDIATEK_BLOB_FAST_INIT
 	select USE_CBMEM_DRAM_INFO
+	select FLASH_DUAL_IO_READ
 
 if SOC_MEDIATEK_MT8186
 
@@ -32,11 +33,4 @@ config SSPM_FIRMWARE
 	help
 	  The file name of the MediaTek SSPM firmware.
 
-config FLASH_DUAL_READ
-	bool
-	default y
-	help
-	  When this option is enabled, the flash controller provides the ability
-	  to dual IO read mode.
-
 endif
diff --git a/src/soc/mediatek/mt8192/Kconfig b/src/soc/mediatek/mt8192/Kconfig
index 9b55295612..3693dad1a6 100644
--- a/src/soc/mediatek/mt8192/Kconfig
+++ b/src/soc/mediatek/mt8192/Kconfig
@@ -11,6 +11,7 @@ config SOC_MEDIATEK_MT8192
 	select HAVE_UART_SPECIAL
 	select SOC_MEDIATEK_COMMON
 	select MEDIATEK_DRAM_DVFS
+	select FLASH_DUAL_IO_READ
 
 if SOC_MEDIATEK_MT8192
 
@@ -50,13 +51,6 @@ config SSPM_FIRMWARE
 	help
 	  The file name of the MediaTek SSPM firmware.
 
-config FLASH_DUAL_READ
-	bool
-	default y
-	help
-	  When this option is enabled, the flash controller provides the ability
-	  to dual IO read mode.
-
 config SRCLKEN_RC_SUPPORT
 	bool
 	default y
diff --git a/src/soc/mediatek/mt8195/Kconfig b/src/soc/mediatek/mt8195/Kconfig
index dab1590aa1..5aea90bd0a 100644
--- a/src/soc/mediatek/mt8195/Kconfig
+++ b/src/soc/mediatek/mt8195/Kconfig
@@ -11,6 +11,7 @@ config SOC_MEDIATEK_MT8195
 	select SOC_MEDIATEK_COMMON
 	select DPM_FOUR_CHANNEL
 	select PCI
+	select FLASH_DUAL_IO_READ
 
 if SOC_MEDIATEK_MT8195
 
@@ -50,11 +51,4 @@ config SSPM_FIRMWARE
 	help
 	  The file name of the MediaTek SSPM firmware.
 
-config FLASH_DUAL_READ
-	bool
-	default y
-	help
-	  When this option is enabled, the flash controller provides the ability
-	  to dual IO read mode.
-
 endif
-- 
cgit v1.2.3