summaryrefslogtreecommitdiffstats
path: root/drivers/fastboot
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2021-01-27 14:46:49 +0100
committerMarek Vasut <marex@denx.de>2021-02-07 19:22:55 +0100
commit0c0394b5026ed3271c92ab1c92a65ae67588d65d (patch)
treebddbbbfd276a3ffc0ec38f75c946169fa74bf93b /drivers/fastboot
parentb2f6b97b78b47362c74f2fbe59c1f4f390cb458f (diff)
downloadu-boot-0c0394b5026ed3271c92ab1c92a65ae67588d65d.tar.gz
u-boot-0c0394b5026ed3271c92ab1c92a65ae67588d65d.tar.xz
u-boot-0c0394b5026ed3271c92ab1c92a65ae67588d65d.zip
fastboot: add command to select the eMMC boot configuration
Add command oem bootbus which executes the command ``mmc bootbus <id> <arg>`` on the current fastboot mmc device (<i> = CONFIG_FASTBOOT_FLASH_MMC_DEV) to set the eMMC boot configuration on first update, with <arg> = boot_bus_width reset_boot_bus_width boot_mode $> fastboot oem bootbus:<boot_bus_width> <reset_boot_bus_width> <boot_mode> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'drivers/fastboot')
-rw-r--r--drivers/fastboot/Kconfig7
-rw-r--r--drivers/fastboot/fb_command.c36
2 files changed, 43 insertions, 0 deletions
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 1bcc8d4ab9..a17e488714 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -196,6 +196,13 @@ config FASTBOOT_CMD_OEM_PARTCONF
Add support for the "oem partconf" command from a client. This set
the mmc boot-partition for the selecting eMMC device.
+config FASTBOOT_CMD_OEM_BOOTBUS
+ bool "Enable the 'oem bootbus' command"
+ depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
+ help
+ Add support for the "oem bootbus" command from a client. This set
+ the mmc boot configuration for the selecting eMMC device.
+
endif # FASTBOOT
endmenu
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index ae4a7dc7fb..41fc8d7904 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -45,6 +45,9 @@ static void oem_format(char *, char *);
#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF)
static void oem_partconf(char *, char *);
#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS)
+static void oem_bootbus(char *, char *);
+#endif
static const struct {
const char *command;
@@ -108,6 +111,12 @@ static const struct {
.dispatch = oem_partconf,
},
#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS)
+ [FASTBOOT_COMMAND_OEM_BOOTBUS] = {
+ .command = "oem bootbus",
+ .dispatch = oem_bootbus,
+ },
+#endif
};
/**
@@ -410,3 +419,30 @@ static void oem_partconf(char *cmd_parameter, char *response)
fastboot_okay(NULL, response);
}
#endif
+
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS)
+/**
+ * oem_bootbus() - Execute the OEM bootbus command
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void oem_bootbus(char *cmd_parameter, char *response)
+{
+ char cmdbuf[32];
+
+ if (!cmd_parameter) {
+ fastboot_fail("Expected command parameter", response);
+ return;
+ }
+
+ /* execute 'mmc bootbus' command with cmd_parameter arguments*/
+ snprintf(cmdbuf, sizeof(cmdbuf), "mmc bootbus %x %s",
+ CONFIG_FASTBOOT_FLASH_MMC_DEV, cmd_parameter);
+ printf("Execute: %s\n", cmdbuf);
+ if (run_command(cmdbuf, 0))
+ fastboot_fail("Cannot set oem bootbus", response);
+ else
+ fastboot_okay(NULL, response);
+}
+#endif