summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-11-03 10:12:05 -0600
committerTom Rini <[email protected]>2025-11-03 10:12:05 -0600
commit9ccda31f54881d3321263a81599454a1d6efb65e (patch)
tree71c250bf67f39df36d05ef55512692132b99fa40 /include
parentc2637036b8f0c90a2cfc59900f7da31eae646b03 (diff)
parente9dc6c12958fc5d909848fc3999e6be5df1cd3ae (diff)
Merge patch series "Convert extension support to UCLASS and adds its support to boot flows"
Kory Maincent (TI.com) <[email protected]> says: This series converts the extension board framework to use UCLASS as requested by Simon Glass, then adds extension support to pxe_utils and bootmeth_efi (not tested) to enable extension boards devicetree load in the standard boot process. I can't test the imx8 extension scan enabled by the imx8mm-cl-iot-gate_defconfig as I don't have this board. I also can't test the efi bootmeth change as I don't have such board. Link: https://lore.kernel.org/r/20251030-feature_sysboot_extension_board-v5-0-cfb77672fc68@bootlin.com
Diffstat (limited to 'include')
-rw-r--r--include/dm/uclass-id.h1
-rw-r--r--include/extension_board.h86
2 files changed, 75 insertions, 12 deletions
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 6be59093160..eb6416b5917 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -63,6 +63,7 @@ enum uclass_id {
UCLASS_ETH, /* Ethernet device */
UCLASS_ETH_PHY, /* Ethernet PHY device */
UCLASS_EXTCON, /* External Connector Class */
+ UCLASS_EXTENSION, /* Extension board */
UCLASS_FFA, /* Arm Firmware Framework for Armv8-A */
UCLASS_FFA_EMUL, /* sandbox FF-A device emulator */
UCLASS_FIRMWARE, /* Firmware */
diff --git a/include/extension_board.h b/include/extension_board.h
index 22e4104bc54..0b9fb99ad7d 100644
--- a/include/extension_board.h
+++ b/include/extension_board.h
@@ -7,10 +7,58 @@
#ifndef __EXTENSION_SUPPORT_H
#define __EXTENSION_SUPPORT_H
+#include <alist.h>
+#include <dm/device.h>
#include <linux/list.h>
+#include <dm/platdata.h>
+extern struct list_head extension_list;
+
+/**
+ * extension_get_list - Get the extension list
+ * Return: The extension alist pointer, or NULL if no such list exists.
+ *
+ * The caller must not free the list.
+ */
+struct alist *extension_get_list(void);
+
+/**
+ * extension_probe - Probe extension device
+ * @dev: Extension device that needs to be probed
+ * Return: Zero on success, negative on failure.
+ */
+int extension_probe(struct udevice *dev);
+
+/**
+ * extension_remove - Remove extension device
+ * @dev: Extension device that needs to be removed
+ * Return: Zero on success, negative on failure.
+ */
+int extension_remove(struct udevice *dev);
+
+/**
+ * extension_scan - Scan extension boards available.
+ * Return: Zero on success, negative on failure.
+ */
+int extension_scan(void);
+
+/**
+ * extension_apply - Apply extension board overlay to the devicetree
+ * @working_fdt: Pointer to working flattened device tree
+ * @size: Size of the devicetree overlay
+ * Return: Zero on success, negative on failure.
+ */
+int extension_apply(struct fdt_header *working_fdt, ulong size);
+
+/**
+ * extension - Description fields of an extension board
+ * @name: Name of the extension
+ * @owner: Owner of the extension
+ * @version: Version of the extension
+ * @overlay: Devicetree overlay name to be loaded for this extension
+ * @other: Other information of this extension
+ */
struct extension {
- struct list_head list;
char name[32];
char owner[32];
char version[32];
@@ -18,16 +66,30 @@ struct extension {
char other[32];
};
-/**
- * extension_board_scan - Add system-specific function to scan extension board.
- * @param extension_list List of extension board information to update.
- * Return: the number of extension.
- *
- * This function is called if CONFIG_CMD_EXTENSION is defined.
- * Needs to fill the list extension_list with elements.
- * Each element need to be allocated to an extension structure.
- *
- */
-int extension_board_scan(struct list_head *extension_list);
+struct extension_ops {
+ /**
+ * scan - Add system-specific function to scan extension boards.
+ * @dev: extension device
+ * @extension_list: alist of extension to expand
+ * Return: The number of extension or a negative value in case of
+ * error.
+ */
+ int (*scan)(struct udevice *dev, struct alist *extension_list);
+};
+
+#define extension_get_ops(dev) ((struct extension_ops *)(dev)->driver->ops)
+
+/* Currently, only one extension driver enabled at a time is supported */
+#define U_BOOT_EXTENSION(_name, _scan_func) \
+ U_BOOT_DRIVER(_name) = { \
+ .name = #_name, \
+ .id = UCLASS_EXTENSION, \
+ .probe = extension_probe, \
+ .remove = extension_remove, \
+ .ops = &(struct extension_ops) { \
+ .scan = _scan_func, \
+ }, \
+ .priv_auto = sizeof(struct alist), \
+ }
#endif /* __EXTENSION_SUPPORT_H */