diff options
| author | Kory Maincent (TI.com) <[email protected]> | 2025-10-30 17:45:01 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-11-03 10:02:39 -0600 |
| commit | 78a06090f4860d52dfd1577619f53a7ec75122c9 (patch) | |
| tree | b0c3de30b114003baf8ffe4c1583d81fdd9a9a6b /include | |
| parent | b7edeac950dae10759527a1ed0d1c306710ec9de (diff) | |
boot: Add UCLASS support for extension boards
Introduce UCLASS-based extension board support to enable more
standardized and automatic loading of extension board device tree
overlays in preparation for integration with bootstd and pxe_utils.
Several #if CONFIG_IS_ENABLED are used in cmd/extension_board.c to ease the
development but don't worry they are removed later in the series.
Signed-off-by: Kory Maincent (TI.com) <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/dm/uclass-id.h | 1 | ||||
| -rw-r--r-- | include/extension_board.h | 71 |
2 files changed, 72 insertions, 0 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 0821dddd8ff..a74a9c67c01 100644 --- a/include/extension_board.h +++ b/include/extension_board.h @@ -7,11 +7,56 @@ #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; /** + * dm_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 *dm_extension_get_list(void); + +/** + * dm_extension_probe - Probe extension device + * @dev: Extension device that needs to be probed + * Return: Zero on success, negative on failure. + */ +int dm_extension_probe(struct udevice *dev); + +/** + * dm_extension_remove - Remove extension device + * @dev: Extension device that needs to be removed + * Return: Zero on success, negative on failure. + */ +int dm_extension_remove(struct udevice *dev); + +/** + * dm_extension_scan - Scan extension boards available. + * Return: Zero on success, negative on failure. + */ +int dm_extension_scan(void); + +/** + * dm_extension_apply - Apply extension board overlay to the devicetree + * @extension_num: Extension number to be applied + * Return: Zero on success, negative on failure. + */ +int dm_extension_apply(int extension_num); + +/** + * dm_extension_apply_all - Apply all extension board overlays to the + * devicetree + * Return: Zero on success, negative on failure. + */ +int dm_extension_apply_all(void); + +/** * extension - Description fields of an extension board * @list: List head * @name: Name of the extension @@ -29,6 +74,32 @@ struct extension { char other[32]; }; +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 = dm_extension_probe, \ + .remove = dm_extension_remove, \ + .ops = &(struct extension_ops) { \ + .scan = _scan_func, \ + }, \ + .priv_auto = sizeof(struct alist), \ + } + /** * extension_board_scan - Add system-specific function to scan extension board. * @param extension_list List of extension board information to update. |
