[PATCH v2 04/13] gpio: Introduce CONFIG_ONLY_GENERIC_GPIO to cleanup #ifdefs

Masami Hiramatsu masami.hiramatsu at linaro.org
Sat Apr 17 01:37:54 CEST 2021


Many architecture do not have specific asm/arch/gpio.h, so instead
of adding !defined(CONFIG_ARCH_xxx), introduce CONFIG_ONLY_GENERIC_GPIO
and select it.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu at linaro.org>
---
 arch/arm/Kconfig             |   17 +++++++++++++++++
 arch/arm/include/asm/gpio.h  |    8 +-------
 board/cortina/common/Kconfig |    1 +
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3307f2b3fc..fba28323cd 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -89,6 +89,11 @@ config HAS_VBAR
 config HAS_THUMB2
 	bool
 
+config ONLY_GENERIC_GPIO
+	bool
+	help
+	  The target has no arch-xxxx/gpio.h and use only asm-generic/gpio.h.
+
 # Used for compatibility with asm files copied from the kernel
 config ARM_ASM_UNIFIED
 	bool
@@ -634,18 +639,21 @@ config ARCH_BCM283X
 
 config ARCH_BCM63158
 	bool "Broadcom BCM63158 family"
+	select ONLY_GENERIC_GPIO
 	select DM
 	select OF_CONTROL
 	imply CMD_DM
 
 config ARCH_BCM68360
 	bool "Broadcom BCM68360 family"
+	select ONLY_GENERIC_GPIO
 	select DM
 	select OF_CONTROL
 	imply CMD_DM
 
 config ARCH_BCM6858
 	bool "Broadcom BCM6858 family"
+	select ONLY_GENERIC_GPIO
 	select DM
 	select OF_CONTROL
 	imply CMD_DM
@@ -716,6 +724,7 @@ config TARGET_BCMNS2
 config TARGET_BCMNS3
 	bool "Support Broadcom NS3"
 	select ARM64
+	select ONLY_GENERIC_GPIO
 	select BOARD_LATE_INIT
 	help
 	  Support for Broadcom Northstar 3 SoCs. NS3 is a octo-core 64-bit
@@ -784,6 +793,7 @@ config ARCH_KEYSTONE
 
 config ARCH_K3
 	bool "Texas Instruments' K3 Architecture"
+	select ONLY_GENERIC_GPIO
 	select SPL
 	select SUPPORT_SPL
 	select FIT
@@ -929,6 +939,7 @@ config ARCH_OWL
 
 config ARCH_QEMU
 	bool "QEMU Virtual Platform"
+	select ONLY_GENERIC_GPIO
 	select DM
 	select DM_SERIAL
 	select OF_CONTROL
@@ -1061,6 +1072,7 @@ config ARCH_SUNXI
 config ARCH_U8500
 	bool "ST-Ericsson U8500 Series"
 	select CPU_V7A
+	select ONLY_GENERIC_GPIO
 	select DM
 	select DM_GPIO
 	select DM_MMC if MMC
@@ -1203,6 +1215,7 @@ config TARGET_VEXPRESS64_JUNO
 config TARGET_TOTAL_COMPUTE
 	bool "Support Total Compute Platform"
 	select ARM64
+	select ONLY_GENERIC_GPIO
 	select PL01X_SERIAL
 	select DM
 	select DM_SERIAL
@@ -1633,6 +1646,7 @@ config TARGET_COLIBRI_PXA270
 
 config ARCH_UNIPHIER
 	bool "Socionext UniPhier SoCs"
+	select ONLY_GENERIC_GPIO
 	select BOARD_LATE_INIT
 	select DM
 	select DM_ETH
@@ -1670,6 +1684,7 @@ config ARCH_STM32
 
 config ARCH_STI
 	bool "Support STMicrolectronics SoCs"
+	select ONLY_GENERIC_GPIO
 	select BLK
 	select CPU_V7A
 	select DM
@@ -1717,6 +1732,7 @@ config ARCH_STM32MP
 
 config ARCH_ROCKCHIP
 	bool "Support Rockchip SoCs"
+	select ONLY_GENERIC_GPIO
 	select BLK
 	select BINMAN if SPL_OPTEE
 	select DM
@@ -1778,6 +1794,7 @@ config TARGET_THUNDERX_88XX
 
 config ARCH_ASPEED
 	bool "Support Aspeed SoCs"
+	select ONLY_GENERIC_GPIO
 	select DM
 	select OF_CONTROL
 	imply CMD_DM
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 7609367884..bf1f239f81 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -1,10 +1,4 @@
-#if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \
-	!defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM68360) && \
-	!defined(CONFIG_ARCH_BCM6858) && !defined(CONFIG_ARCH_BCM63158) && \
-	!defined(CONFIG_ARCH_ROCKCHIP) && !defined(CONFIG_ARCH_ASPEED) && \
-	!defined(CONFIG_ARCH_U8500) && !defined(CONFIG_CORTINA_PLATFORM) && \
-	!defined(CONFIG_TARGET_BCMNS3) && !defined(CONFIG_TARGET_TOTAL_COMPUTE) && \
-	!defined(CONFIG_ARCH_QEMU)
+#if !defined(CONFIG_ONLY_GENERIC_GPIO)
 #include <asm/arch/gpio.h>
 #endif
 #include <asm-generic/gpio.h>
diff --git a/board/cortina/common/Kconfig b/board/cortina/common/Kconfig
index 00c709e70f..3f1be84d21 100644
--- a/board/cortina/common/Kconfig
+++ b/board/cortina/common/Kconfig
@@ -1,6 +1,7 @@
 config CORTINA_PLATFORM
        bool "Cortina-Access Platform"
        default y
+       select ONLY_GENERIC_GPIO
        help
          Select this option for Cortina-Access platforms
 	 to enables selection of CAxxxx drivers



More information about the U-Boot mailing list