[RFC PATCH 1/2] board: ti: common: Add CONFIG_TI_CAPE_DETECT for cape detection

Roger Quadros rogerq at kernel.org
Mon Jul 10 16:50:25 CEST 2023


CONFIG_CMD_EXTENSION may be used on other TI boards that may
not require Cape detection logic.

Add CONFIG_TI_CAPE_DETECT for Cape detection logic so it can
be enabled independently.
Enable it by default only for platforms that require it. i.e. AM335X

Signed-off-by: Roger Quadros <rogerq at kernel.org>
---
 board/ti/am335x/board.c       | 8 ++++++++
 board/ti/common/Kconfig       | 8 ++++++++
 board/ti/common/Makefile      | 2 +-
 board/ti/common/cape_detect.c | 2 +-
 board/ti/common/cape_detect.h | 2 +-
 5 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index ecb9fa02de..8bbabc5da8 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -86,6 +86,14 @@ void do_board_detect(void)
 }
 #endif
 
+int extension_board_scan(struct list_head *extension_list)
+{
+	if (IS_ENABLED(CONFIG_TI_CAPE_DETECT))
+		return ti_cape_extension_board_scan(extension_list);
+	else
+		return -EINVAL;
+}
+
 #ifndef CONFIG_DM_SERIAL
 struct serial_device *default_serial_console(void)
 {
diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig
index 49edd98014..72ee2d6d0e 100644
--- a/board/ti/common/Kconfig
+++ b/board/ti/common/Kconfig
@@ -4,6 +4,14 @@ config TI_I2C_BOARD_DETECT
 	   Support for detection board information on Texas Instrument's
 	   Evaluation Boards which have I2C based EEPROM detection
 
+config TI_CAPE_DETECT
+	bool "Support BeagleBone Cape detection for TI platforms"
+	default y if TARGET_AM335X_EVM
+	depends on SUPPORT_EXTENSION_SCAN
+	help
+	   Support Beagle Bone Cape detection for TI platforms
+	   e.g. AM335x BeagleBone.
+
 config EEPROM_BUS_ADDRESS
 	int "Board EEPROM's I2C bus address"
 	range 0 8
diff --git a/board/ti/common/Makefile b/board/ti/common/Makefile
index 3172d87b46..5db433f77f 100644
--- a/board/ti/common/Makefile
+++ b/board/ti/common/Makefile
@@ -2,4 +2,4 @@
 # Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
 
 obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o
-obj-${CONFIG_CMD_EXTENSION} += cape_detect.o
+obj-${CONFIG_TI_CAPE_DETECT} += cape_detect.o
diff --git a/board/ti/common/cape_detect.c b/board/ti/common/cape_detect.c
index 2e6105cfbf..d345a4d8eb 100644
--- a/board/ti/common/cape_detect.c
+++ b/board/ti/common/cape_detect.c
@@ -21,7 +21,7 @@ static void sanitize_field(char *text, size_t size)
 	}
 }
 
-int extension_board_scan(struct list_head *extension_list)
+int ti_cape_extension_board_scan(struct list_head *extension_list)
 {
 	struct extension *cape;
 	struct am335x_cape_eeprom_id eeprom_header;
diff --git a/board/ti/common/cape_detect.h b/board/ti/common/cape_detect.h
index b0d5c9f18b..ea486adbb2 100644
--- a/board/ti/common/cape_detect.h
+++ b/board/ti/common/cape_detect.h
@@ -23,6 +23,6 @@ struct am335x_cape_eeprom_id {
 
 #define CAPE_MAGIC 0xEE3355AA
 
-int extension_board_scan(struct list_head *extension_list);
+int ti_cape_extension_board_scan(struct list_head *extension_list);
 
 #endif /* __CAPE_DETECT_H */
-- 
2.34.1



More information about the U-Boot mailing list