summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorKory Maincent (TI.com) <[email protected]>2025-10-30 17:45:03 +0100
committerTom Rini <[email protected]>2025-11-03 10:02:39 -0600
commit58a36be4ac8bc68ce6069eddcf8ee3fe2178404e (patch)
treebdc221b98aef7b648ed0e365e37ddbef9129a6a2 /board
parentb2e7b1df3bb8c88a6d5e27f29e152d61f2ec8eb5 (diff)
board: ti: Convert cape detection to use UCLASS framework
Migrate TI board cape detection from legacy extension support to the new UCLASS-based extension board framework. Signed-off-by: Kory Maincent (TI.com) <[email protected]>
Diffstat (limited to 'board')
-rw-r--r--board/ti/common/Kconfig2
-rw-r--r--board/ti/common/Makefile2
-rw-r--r--board/ti/common/cape_detect.c28
3 files changed, 17 insertions, 15 deletions
diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig
index 9512c5c23f1..feb05b4bf95 100644
--- a/board/ti/common/Kconfig
+++ b/board/ti/common/Kconfig
@@ -20,7 +20,7 @@ config CAPE_EEPROM_BUS_NUM
int "Cape EEPROM's I2C bus address"
range 0 8
default 2
- depends on SUPPORT_EXTENSION_SCAN
+ depends on SUPPORT_DM_EXTENSION_SCAN
config TI_COMMON_CMD_OPTIONS
bool "Enable cmd options on TI platforms"
diff --git a/board/ti/common/Makefile b/board/ti/common/Makefile
index f58935b4103..b42273d3a5a 100644
--- a/board/ti/common/Makefile
+++ b/board/ti/common/Makefile
@@ -2,6 +2,6 @@
# Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/
obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o
-obj-${CONFIG_$(PHASE_)SUPPORT_EXTENSION_SCAN} += cape_detect.o
+obj-${CONFIG_$(PHASE_)SUPPORT_DM_EXTENSION_SCAN} += cape_detect.o
obj-${CONFIG_OF_LIBFDT} += fdt_ops.o
obj-${CONFIG_ARCH_K3} += k3-ddr.o
diff --git a/board/ti/common/cape_detect.c b/board/ti/common/cape_detect.c
index 7786bdda5d1..0bd4a38c187 100644
--- a/board/ti/common/cape_detect.c
+++ b/board/ti/common/cape_detect.c
@@ -22,7 +22,8 @@ static void sanitize_field(char *text, size_t size)
}
}
-int extension_board_scan(struct list_head *extension_list)
+static int ti_extension_board_scan(struct udevice *dev,
+ struct alist *extension_list)
{
unsigned char addr;
int num_capes = 0;
@@ -31,7 +32,7 @@ int extension_board_scan(struct list_head *extension_list)
struct am335x_cape_eeprom_id eeprom_header;
char process_cape_part_number[17] = {'0'};
char process_cape_version[5] = {'0'};
- struct extension *cape;
+ struct extension cape = {0};
struct udevice *dev;
u8 cursor = 0;
int ret, i;
@@ -78,22 +79,23 @@ int extension_board_scan(struct list_head *extension_list)
printf("BeagleBone Cape: %s (0x%x)\n", eeprom_header.board_name, addr);
- cape = calloc(1, sizeof(struct extension));
- if (!cape) {
- printf("Error in memory allocation\n");
- return num_capes;
- }
-
- snprintf(cape->overlay, sizeof(cape->overlay), "%s-%s.dtbo",
+ snprintf(cape.overlay, sizeof(cape.overlay), "%s-%s.dtbo",
process_cape_part_number, process_cape_version);
- strlcpy(cape->name, eeprom_header.board_name,
+ strlcpy(cape.name, eeprom_header.board_name,
sizeof(eeprom_header.board_name));
- strlcpy(cape->version, process_cape_version,
+ strlcpy(cape.version, process_cape_version,
sizeof(process_cape_version));
- strlcpy(cape->owner, eeprom_header.manufacturer,
+ strlcpy(cape.owner, eeprom_header.manufacturer,
sizeof(eeprom_header.manufacturer) + 1);
- list_add_tail(&cape->list, extension_list);
+ if (!alist_add(extension_list, cape))
+ return -ENOMEM;
num_capes++;
}
return num_capes;
}
+
+U_BOOT_EXTENSION(cape, ti_extension_board_scan);
+
+U_BOOT_DRVINFO(cape) = {
+ .name = "cape",
+};