ti/common: add support for extension_scan_board function
The BeagleBone platforms all use a common mechanism to discover and
identify extension boards (called "capes"): each extension board has an
I2C-connected EEPROM describing itself.
This patch implements a generic extension_scan_board() feature that can
be used by all BeagleBone platforms to read those I2C EEPROMs and fill
in the list of "extension" structures.
Following commits will enable this common logic on two BeagleBone
platforms.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
diff --git a/board/ti/common/cape_detect.h b/board/ti/common/cape_detect.h
new file mode 100644
index 0000000..b0d5c9f
--- /dev/null
+++ b/board/ti/common/cape_detect.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2021
+ * Köry Maincent, Bootlin, <kory.maincent@bootlin.com>
+ */
+
+#ifndef __CAPE_DETECT_H
+#define __CAPE_DETECT_H
+
+struct am335x_cape_eeprom_id {
+ unsigned int header;
+ char eeprom_rev[2];
+ char board_name[32];
+ char version[4];
+ char manufacturer[16];
+ char part_number[16];
+};
+
+#define CAPE_EEPROM_FIRST_ADDR 0x54
+#define CAPE_EEPROM_LAST_ADDR 0x57
+
+#define CAPE_EEPROM_ADDR_LEN 0x10
+
+#define CAPE_MAGIC 0xEE3355AA
+
+int extension_board_scan(struct list_head *extension_list);
+
+#endif /* __CAPE_DETECT_H */