]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fastboot: add command to select the eMMC boot configuration
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Wed, 27 Jan 2021 13:46:49 +0000 (14:46 +0100)
committerMarek Vasut <marex@denx.de>
Sun, 7 Feb 2021 18:22:55 +0000 (19:22 +0100)
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>
doc/android/fastboot.rst
drivers/fastboot/Kconfig
drivers/fastboot/fb_command.c
include/fastboot.h

index d8cb64261cdcd7082ab6d2437118c939a6c28675..16b11399b30837c60e961d2a5bd2f8652ef96ed0 100644 (file)
@@ -25,6 +25,7 @@ The following OEM commands are supported (if enabled):
 - ``oem format`` - this executes ``gpt write mmc %x $partitions``
 - ``oem partconf`` - this executes ``mmc partconf %x <arg> 0`` to configure eMMC
   with <arg> = boot_ack boot_partition
+- ``oem bootbus``  - this executes ``mmc bootbus %x %s`` to configure eMMC
 
 Support for both eMMC and NAND devices is included.
 
index 1bcc8d4ab9924e4c42c18493153153c12d60c12b..a17e488714d6ad6765e4c15fd94d7c7becc7c3d8 100644 (file)
@@ -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
index ae4a7dc7fb823eb3f86e7a6efb6e9417c8019851..41fc8d7904d7e559c9341860ed3bb046e5bc48bd 100644 (file)
@@ -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
index 80dd8255aa2dd64b82c17030d4fc467d76d754d0..797d7dfd52920ed8352f8ac9eca5b17aae9df3f8 100644 (file)
@@ -41,6 +41,9 @@ enum {
 #if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF)
        FASTBOOT_COMMAND_OEM_PARTCONF,
 #endif
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS)
+       FASTBOOT_COMMAND_OEM_BOOTBUS,
+#endif
 
        FASTBOOT_COMMAND_COUNT
 };