[PATCH v2] board: ti: cape_detect: Add overlay name lookup table for extension boards

Kory Maincent kory.maincent at bootlin.com
Tue Apr 14 17:36:11 CEST 2026


From: "Kory Maincent (TI)" <kory.maincent at bootlin.com>

Some extension boards have EEPROM part numbers that do not directly match
their devicetree overlay filenames. Introduce a static name_mapping table
and a set_cape_overlay() helper that translates the part number and version
strings read from the EEPROM into the correct overlay filename.

When no entry matches, fall back to the existing behavior of constructing
the overlay name as "<part_number>-<version>.dtbo" directly from the
EEPROM content.

Add an initial entry mapping BB-GREEN-HDMI revision 00A0 to
am335x-bone-hdmi-00a0.dtbo.

Signed-off-by: Kory Maincent (TI) <kory.maincent at bootlin.com>
---

Changes in v2:
- Use ARRAY_SIZE instead of null-terminated array.
- Declare the function static
---
 board/ti/common/cape_detect.c | 42 +++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/board/ti/common/cape_detect.c b/board/ti/common/cape_detect.c
index 88fa6ae81f0..65bd6ef39ec 100644
--- a/board/ti/common/cape_detect.c
+++ b/board/ti/common/cape_detect.c
@@ -13,6 +13,44 @@
 
 #include "cape_detect.h"
 
+struct name_mapping {
+	char part_number[17];
+	char version[5];
+	char overlay[64];
+};
+
+static struct name_mapping extension_mapping[] = {
+	{
+		"BB-GREEN-HDMI",
+		"00A0",
+		"am335x-bone-hdmi-00a0.dtbo",
+	}
+};
+
+static void set_cape_overlay(char *overlay, char *part_number, char *version)
+{
+	struct name_mapping *mapping;
+
+	for (int i = 0; i < ARRAY_SIZE(extension_mapping); i++) {
+		mapping = &extension_mapping[i];
+
+		if (strncmp(mapping->part_number, part_number,
+			    sizeof(mapping->part_number)))
+			continue;
+
+		if (strncmp(mapping->version, version,
+			    sizeof(mapping->version)))
+			continue;
+
+		strlcpy(overlay, mapping->overlay, sizeof(mapping->overlay));
+		return;
+	}
+
+	/* Use default name extracted from the EEPROM */
+	snprintf(overlay, sizeof(extension_mapping[0].overlay), "%s-%s.dtbo",
+		 part_number, version);
+}
+
 static void sanitize_field(char *text, size_t size)
 {
 	char *c = NULL;
@@ -82,8 +120,8 @@ static int ti_extension_board_scan(struct udevice *dev,
 
 		printf("BeagleBone Cape: %s (0x%x)\n", eeprom_header.board_name, addr);
 
-		snprintf(cape.overlay, sizeof(cape.overlay), "%s-%s.dtbo",
-			 process_cape_part_number, process_cape_version);
+		set_cape_overlay(cape.overlay, process_cape_part_number,
+				 process_cape_version);
 		strlcpy(cape.name, eeprom_header.board_name,
 			sizeof(eeprom_header.board_name));
 		strlcpy(cape.version, process_cape_version,
-- 
2.43.0



More information about the U-Boot mailing list