u-boot/cmd
Kory Maincent 2f84e9cf06 cmd: add support for a new "extension" command
This patch adds a new "extension" command, which aims at detecting
extension boards connected to the hardware platform, and apply the
Device Tree overlays that describe the hardware present on those
extension boards.

In order to enable this mechanism, board-specific code must implement
the extension_board_scan() function that fills in a linked list of
"struct extension", each describing one extension board. In addition,
the board-specific code must select the SUPPORT_EXTENSION_SCAN Kconfig
boolean.

Based on this:

 - "extension scan" makes the generic code call the board-specific
   extension_board_scan() function to retrieve the list of detected
   extension boards.

 - "extension list" allows to list the detected extension boards.

 - "extension apply <number>|all" allows to apply the Device Tree
   overlay(s) corresponding to one, or all, extension boards

The latter requires two environment variables to exist and set one variable
to run:

 - extension_overlay_addr: the RAM address where to load the Device
   Tree overlays

 - extension_overlay_cmd: the U-Boot command to load one overlay.
   Indeed, the location and mechanism to load DT overlays is very setup
   specific.

 - extension_overlay_name: set by the command: the name of the DT which
   will be load during the execution.

When calling the command described in the extension_overlay_cmd
variable, the variable extension_overlay_name will be defined. So a
typical extension_overlay_cmd will look like this:

  extension_overlay_cmd=load mmc 0:1 $extension_overlay_addr /boot/$extension_overlay_name

Here is an example on how to use it:
=> run loadfdt
=> fdt addr $fdtaddr
=> setenv extension_overlay_addr 0x1000
=> setenv extension_overlay_cmd 'load mmc 0:1 ${extension_overlay_addr} /boot/${extension_overlay_name}'
=> extension scan
Found 1 extension board(s).
=> extension apply 0
519 bytes read in 3 ms (168.9 KiB/s)

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
2021-05-13 13:09:05 -04:00
..
arm command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
broadcom cmd: broadcom: add command for chimp handshake 2020-09-09 16:57:35 -04:00
mvebu phy: marvell: add RX training command 2021-04-29 07:45:24 +02:00
riscv cmd/exception: support ebreak exception on RISC-V 2021-05-05 16:13:12 +08:00
sandbox cmd: sandbox: implement exception command 2020-12-13 07:58:17 -07:00
ti common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
x86 x86: Correct regwidth prompt in cbsysinfo 2021-05-10 13:56:12 +08:00
.gitignore cmd: rework "license" command 2017-02-08 15:56:28 -05:00
ab_select.c part: Support getting whole disk from part_get_info_by_dev_and_name_or_num 2021-02-26 15:30:55 +01:00
abootimg.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
acpi.c cmd: Add missing check for CONFIG_SYS_LONGHELP 2021-03-27 15:04:30 +13:00
adc.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
addrmap.c cmd: Add a command to display the address map 2021-03-05 10:25:43 +05:30
adtimg.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
aes.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
armflash.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
avb.c cmd: avb: free partition buffer upon verify completion 2020-05-19 14:01:47 -04:00
axi.c cmd: Drop use of old sequence numbers in commands 2020-12-18 20:32:21 -07:00
bcb.c cmd: bcb: Add support for processing const string literals in bcb_set() 2021-01-31 14:08:56 +01:00
bdinfo.c Merge branch '2021-02-02-drop-asm_global_data-when-unused' 2021-02-15 10:16:45 -05:00
bedbug.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
bind.c cmd: bind: allow to bind driver with driver data 2020-08-22 07:58:39 -06:00
binop.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
blk_common.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
blkcache.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
blob.c crypto: Add blob command support for i.MX8M platforms 2021-04-08 09:18:29 +02:00
bloblist.c cmd: Add missing check for CONFIG_SYS_LONGHELP 2021-03-27 15:04:30 +13:00
bmp.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
boot.c sysreset: provide type of reset in do_reset cmd 2021-04-20 07:31:12 -04:00
bootcount.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
bootefi.c efi_loader: Replace config option for initrd loading 2021-03-25 20:14:26 +01:00
booti.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
bootm.c image: Adjust the workings of fit_check_format() 2021-02-15 22:31:52 -05:00
bootmenu.c bootmenu: Allow to quit it via ESC/CTRL+C 2021-01-16 14:49:09 -05:00
bootstage.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
bootz.c cmd: bootz: fix device-tree overlap test 2020-08-05 08:18:34 -04:00
btrfs.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
button.c dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
cache.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
cbfs.c cbfs: Return the error code from file_cbfs_init() 2020-05-27 14:40:09 +08:00
clk.c cmd: clk: correctly handle depth for clk dump 2020-08-24 11:03:26 +02:00
clone.c cmd: fix clone coverity scan 2020-08-24 14:11:31 -04:00
cls.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
config.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
conitrace.c cmd: conitrace: increase wait for next key 2021-01-13 02:38:01 +01:00
console.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
cpu.c dm: Avoid accessing seq directly 2020-12-18 20:32:21 -07:00
cramfs.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
cros_ec.c cros_ec: Show events in human-readable form 2021-01-30 14:25:41 -07:00
dataflash_mmc_mux.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
date.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
demo.c dm: treewide: Rename dev_get_platdata() to dev_get_plat() 2020-12-13 16:51:09 -07:00
dfu.c cmd: dfu: Propagate error if dfu gadget fails 2021-04-23 08:45:55 +02:00
diag.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
disk.c image: Adjust the workings of fit_check_format() 2021-02-15 22:31:52 -05:00
dm.c cmd: dm: Fixed/Added DM driver listing subcommands 2020-07-07 15:37:13 -04:00
echo.c cmd: change suppress newline in echo command 2021-01-25 01:15:33 +01:00
eeprom.c dm: i2c: use CONFIG_IS_ENABLED macro for DM_I2C/DM_I2C_GPIO 2021-02-21 06:08:00 +01:00
efi.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
efidebug.c efi_loader: simplify efi_get_device_path_text() 2021-04-10 12:00:24 +02:00
elf.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ethsw.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
exit.c cmd: exit: Fix return value 2021-04-12 17:45:40 -04:00
ext2.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
ext4.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
extension_board.c cmd: add support for a new "extension" command 2021-05-13 13:09:05 -04:00
fastboot.c common: Drop linux/stringify.h from common header 2020-05-18 21:19:23 -04:00
fat.c cmd: fat: Use do_save() for fatwrite 2020-10-23 13:33:07 -04:00
fdt.c fdt_support: move fdt_valid from cmd_fdt.c to fdt_support.c 2021-05-13 07:19:34 -04:00
flash.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
fpga.c image: Adjust the workings of fit_check_format() 2021-02-15 22:31:52 -05:00
fpgad.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
fs.c cmd: fs: Add command to list supported fs types 2020-07-07 15:36:59 -04:00
fs_uuid.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
fuse.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
gettime.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
gpio.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
gpt.c cmd: gpt: Add option to write GPT partitions to environment variable 2021-05-04 12:52:46 -04:00
hash.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
help.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
host.c sandbox: Provide a way to bind fixed/removeable devices 2021-03-27 15:04:31 +13:00
i2c.c dm: i2c: use CONFIG_IS_ENABLED macro for DM_I2C/DM_I2C_GPIO 2021-02-21 06:08:00 +01:00
ide.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
ini.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
io.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
iotrace.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
irq.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
itest.c command: Add constants for cmd_get_data_size string / error 2020-12-01 10:33:38 -05:00
jffs2.c common: Drop linux/bug.h from common header 2020-05-18 21:19:23 -04:00
Kconfig cmd: add support for a new "extension" command 2021-05-13 13:09:05 -04:00
led.c dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
legacy-mtd-utils.c cmd: nand/sf: isolate legacy code 2019-12-04 17:10:51 -05:00
legacy-mtd-utils.h cmd: nand/sf: isolate legacy code 2019-12-04 17:10:51 -05:00
legacy_led.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
license.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
load.c cmd/load: support uploading EFI binary via UART 2021-03-25 20:12:49 +01:00
log.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
lsblk.c dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
lzmadec.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mac.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
Makefile cmd: add support for a new "extension" command 2021-05-13 13:09:05 -04:00
mbr.c cmd: Add MBR partition layout control utility 2021-01-15 16:00:32 -05:00
md5sum.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mdio.c net: Drop dm.h header file from phy.h 2020-08-03 22:19:54 -04:00
mem.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
mfsl.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mii.c net: Drop dm.h header file from phy.h 2020-08-03 22:19:54 -04:00
misc.c dm: Avoid accessing seq directly 2020-12-18 20:32:21 -07:00
mmc.c cmd: mmc: check whether bootbus's arguments is valid or not 2021-04-06 18:08:26 +08:00
mp.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mtd.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mtdparts.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
mux.c cmd: Add a mux command 2020-10-28 11:49:31 -04:00
nand.c image: Adjust the workings of fit_check_format() 2021-02-15 22:31:52 -05:00
net.c sntp: use udp framework 2020-09-30 16:55:03 -04:00
nvedit.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
nvedit_efi.c efi_loader: use ':' as separator for setenv -i 2020-08-24 16:37:53 +02:00
nvme.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
onenand.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
optee_rpmb.c cmd: optee_rpmb command for read/write of rpmb from optee 2020-10-23 16:52:09 +05:30
osd.c cmd: Drop use of old sequence numbers in commands 2020-12-18 20:32:21 -07:00
panic.c cmd: add a panic command 2020-07-08 17:21:46 -04:00
part.c cmd: part: Add subcommand to list supported partition tables 2020-07-07 15:22:42 -04:00
pcap.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pci.c dm: Avoid accessing seq directly 2020-12-18 20:32:21 -07:00
pinmux.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pmc.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pmic.c dm: Avoid accessing seq directly 2020-12-18 20:32:21 -07:00
pstore.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
pvblock.c xen: pvblock: Add initial support for para-virtualized block driver 2020-08-14 15:18:30 -04:00
pwm.c cmd: pwm: Rework argc sanity checking 2021-02-24 16:51:48 -05:00
pxe.c cmd: pxe: Add relocation to pxe_sub cmds 2020-09-23 14:29:57 +02:00
pxe_utils.c cmd: pxe_utils: sysboot: Add zboot support to boot x86 Linux kernel image 2021-02-03 23:16:44 +08:00
pxe_utils.h common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
qfw.c x86: qemu: move QFW to its own uclass 2021-04-12 17:44:55 -04:00
read.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
reginfo.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
regulator.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
reiser.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
remoteproc.c dm: core: Access device flags through functions 2021-01-05 12:24:41 -07:00
rng.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
rockusb.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
rtc.c rtc: add rtc command 2020-07-09 06:02:45 +02:00
sata.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
sb.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
scp03.c cmd: SCP03: enable and provision command 2021-03-13 13:14:52 -05:00
scsi.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
setexpr.c setexpr: Add support for strings 2020-12-01 10:33:38 -05:00
sf.c cmd: sf: Print error on test failure 2021-02-26 15:48:00 +05:30
sha1sum.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
sleep.c cmd: misc: Fix return value for the sleep command 2021-01-27 17:07:48 -05:00
smccc.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
sound.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
source.c image: Adjust the workings of fit_check_format() 2021-02-15 22:31:52 -05:00
spi.c spi: Convert CONFIG_DM_SPI* to CONFIG_$(SPL_TPL_)DM_SPI* 2020-06-29 13:34:43 -04:00
spl.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
sqfs.c fs/squashfs: add filesystem commands 2020-08-07 22:31:32 -04:00
stackprot_test.c Add support for stack-protector 2021-04-20 07:31:12 -04:00
strings.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
sysboot.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
terminal.c terminal: only serial_reinit_all if available 2021-04-12 17:44:55 -04:00
test.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
thordown.c thor: add support for the dfu_alt_info reintialization from the flashed script 2021-01-31 14:08:56 +01:00
time.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
timer.c cmd: Split out timer command from the sleep command 2020-10-23 13:33:07 -04:00
tlv_eeprom.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
tpm-common.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
tpm-user-utils.h command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
tpm-v1.c tpm: Switch TPMv1 over to use the new API 2021-03-02 15:53:37 -05:00
tpm-v2.c tpm: use more than sha256 on pcr_extend 2020-12-03 21:22:40 +01:00
tpm_test.c tpm: Switch TPMv1 over to use the new API 2021-03-02 15:53:37 -05:00
trace.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
tsi148.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ubi.c cmd: ubi: don't allow to rename a volume to a name that already exist 2021-01-04 09:10:17 -05:00
ubifs.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ufs.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
universe.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
unlz4.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
unzip.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
usb.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
usb_gadget_sdp.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
usb_mass_storage.c cmd: usb_mass_storage: show device interface name 2021-01-31 14:08:56 +01:00
version.c x86: Make coreboot sysinfo available to any x86 board 2021-03-27 13:59:37 +13:00
virtio.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
w1.c dm: Avoid accessing seq directly 2020-12-18 20:32:21 -07:00
wdt.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
wol.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
ximg.c image: Adjust the workings of fit_check_format() 2021-02-15 22:31:52 -05:00
yaffs2.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
zfs.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
zip.c cmd: zip: fix implicit declaration warning 2020-05-25 11:54:53 -04:00