1 .. SPDX-License-Identifier: GPL-2.0+
2 .. Copyright 2021, Kory Maincent <kory.maincent@bootlin.com>
4 U-Boot extension board usage (CONFIG_EXTENSION)
5 ===============================================
14 extension apply <extension number|all>
19 The "extension" command proposes a generic U-Boot mechanism to detect
20 extension boards connected to the HW platform, and apply the appropriate
21 Device Tree overlays depending on the detected extension boards.
23 The "extension" command comes with three sub-commands:
25 - "extension scan" makes the generic code call the board-specific
26 extension_board_scan() function to retrieve the list of detected
29 - "extension list" allows to list the detected extension boards.
31 - "extension apply <number>|all" allows to apply the Device Tree
32 overlay(s) corresponding to one, or all, extension boards
34 The latter requires two environment variables to exist:
36 - extension_overlay_addr: the RAM address where to load the Device
39 - extension_overlay_cmd: the U-Boot command to load one overlay.
40 Indeed, the location and mechanism to load DT overlays is very setup
43 In order to enable this mechanism, board-specific code must implement
44 the extension_board_scan() function that fills in a linked list of
45 "struct extension", each describing one extension board. In addition,
46 the board-specific code must select the SUPPORT_EXTENSION_SCAN Kconfig
52 1. Make sure your devicetree is loaded and set as the working fdt tree.
59 2. Prepare the environment variables
63 => setenv extension_overlay_addr 0x88080000
64 => setenv extension_overlay_cmd 'load mmc 0:1 ${extension_overlay_addr} /boot/${extension_overlay_name}'
66 3. Detect the plugged extension board
72 4. List the plugged extension board information and the devicetree
79 5. Apply the appropriate devicetree overlay
81 For apply the selected overlay:
87 For apply all the overlays:
91 => extension apply all
93 Simple extension_board_scan function example
94 --------------------------------------------
98 int extension_board_scan(struct list_head *extension_list)
100 struct extension *extension;
102 extension = calloc(1, sizeof(struct extension));
103 snprintf(extension->overlay, sizeof(extension->overlay), "overlay.dtbo");
104 snprintf(extension->name, sizeof(extension->name), "extension board");
105 snprintf(extension->owner, sizeof(extension->owner), "sandbox");
106 snprintf(extension->version, sizeof(extension->version), "1.1");
107 snprintf(extension->other, sizeof(extension->other), "Extension board information");
108 list_add_tail(&extension->list, extension_list);