All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT
@ 2020-09-09 13:22 Patrick Delaunay
  2020-09-09 13:22 ` [PATCH 2/4] fastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2 Patrick Delaunay
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Patrick Delaunay @ 2020-09-09 13:22 UTC (permalink / raw)
  To: u-boot

Split userdata and boot partition support for eMMC update
and correct the description (update is supported).

The new configuration CONFIG_FASTBOOT_MMC_USER_SUPPORT
allows to activate support of userdata partition update,
based on target name=CONFIG_FASTBOOT_MMC_USER_NAME

This patch also removes the unnecessary dependency with
ARCH_MEDIATEK and EFI_PARTITION.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 configs/mt8518_ap1_emmc_defconfig |  1 +
 drivers/fastboot/Kconfig          | 22 +++++++++++++++++-----
 drivers/fastboot/fb_mmc.c         |  9 ++++++---
 3 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/configs/mt8518_ap1_emmc_defconfig b/configs/mt8518_ap1_emmc_defconfig
index b95d2c683a..d5fb0ccd48 100644
--- a/configs/mt8518_ap1_emmc_defconfig
+++ b/configs/mt8518_ap1_emmc_defconfig
@@ -25,6 +25,7 @@ CONFIG_FASTBOOT_BUF_SIZE=0x1E00000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT=y
+CONFIG_FASTBOOT_MMC_USER_SUPPORT=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_HS200_SUPPORT=y
 CONFIG_MMC_MTK=y
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index d4436dfc91..45e07d05e0 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -124,14 +124,26 @@ config FASTBOOT_MMC_BOOT1_NAME
 	  defined here.
 	  The default target name for updating EMMC_BOOT1 is "mmc0boot0".
 
+config FASTBOOT_MMC_USER_SUPPORT
+	bool "Enable eMMC userdata partition flash/erase"
+	depends on FASTBOOT_FLASH_MMC
+	help
+	  Define this to enable the support "flash" and "erase" command on
+	  eMMC userdata. The "flash" command only update the MBR and GPT
+	  header when CONFIG_EFI_PARTITION is supported.
+	  The "erase" command erase all the userdata.
+	  This occurs when the specified "partition name" on the
+	  fastboot command line matches the value CONFIG_FASTBOOT_MMC_USER_NAME.
+
 config FASTBOOT_MMC_USER_NAME
-	string "Target name for erasing EMMC_USER"
-	depends on FASTBOOT_FLASH_MMC && EFI_PARTITION && ARCH_MEDIATEK
+	string "Target name for updating EMMC_USER"
+	depends on FASTBOOT_MMC_USER_SUPPORT
 	default "mmc0"
 	help
-	  The fastboot "erase" command supports erasing EMMC_USER. This occurs
-	  when the specified "EMMC_USER name" on the "fastboot erase" commands
-	  match the value defined here.
+	  The fastboot "flash" and "erase" command supports EMMC_USER.
+	  This occurs when the specified "EMMC_USER name" on the
+	  "fastboot flash" and the "fastboot erase" commands match the value
+	  defined here.
 	  The default target name for erasing EMMC_USER is "mmc0".
 
 config FASTBOOT_GPT_NAME
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index b2f8932e1c..ab6674cac2 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -132,7 +132,8 @@ static void write_raw_image(struct blk_desc *dev_desc,
 	fastboot_okay(NULL, response);
 }
 
-#ifdef CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT
+#if defined(CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT) || \
+	defined(CONFIG_FASTBOOT_MMC_USER_SUPPORT)
 static int fb_mmc_erase_mmc_hwpart(struct blk_desc *dev_desc)
 {
 	lbaint_t blks;
@@ -151,7 +152,9 @@ static int fb_mmc_erase_mmc_hwpart(struct blk_desc *dev_desc)
 
 	return 0;
 }
+#endif
 
+#ifdef CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT
 static void fb_mmc_boot1_ops(struct blk_desc *dev_desc, void *buffer,
 			     u32 buff_sz, char *response)
 {
@@ -427,7 +430,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
 #endif
 
 #if CONFIG_IS_ENABLED(EFI_PARTITION)
-#ifndef CONFIG_FASTBOOT_MMC_USER_NAME
+#ifndef CONFIG_FASTBOOT_MMC_USER_SUPPORT
 	if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
 #else
 	if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0 ||
@@ -551,7 +554,7 @@ void fastboot_mmc_erase(const char *cmd, char *response)
 	}
 #endif
 
-#ifdef CONFIG_FASTBOOT_MMC_USER_NAME
+#ifdef CONFIG_FASTBOOT_MMC_USER_SUPPORT
 	if (strcmp(cmd, CONFIG_FASTBOOT_MMC_USER_NAME) == 0) {
 		/* erase EMMC userdata */
 		if (fb_mmc_erase_mmc_hwpart(dev_desc))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] fastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2
  2020-09-09 13:22 [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick Delaunay
@ 2020-09-09 13:22 ` Patrick Delaunay
  2020-09-09 13:22 ` [PATCH 3/4] fastboot: add command to select the default emmc hwpart for boot Patrick Delaunay
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2020-09-09 13:22 UTC (permalink / raw)
  To: u-boot

Update the code and the configs for eMMC boot and userdata
partitions acces
- FASTBOOT_MMC_BOOT_SUPPORT: boot partition 1 and 2 (erase/write)
- FASTBOOT_MMC_BOOT1_NAME: boot partition 1, default name="mmc0boot0"
- FASTBOOT_MMC_BOOT2_NAME: boot partition 2, default name="mmc0boot1"

This patch also removes the unnecessary dependency with
ARCH_MEDIATEK and EFI_PARTITION.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 configs/mt8518_ap1_emmc_defconfig |  2 +-
 drivers/fastboot/Kconfig          | 26 ++++++++++++-----
 drivers/fastboot/fb_mmc.c         | 47 ++++++++++++++++++++-----------
 3 files changed, 50 insertions(+), 25 deletions(-)

diff --git a/configs/mt8518_ap1_emmc_defconfig b/configs/mt8518_ap1_emmc_defconfig
index d5fb0ccd48..2c760c1591 100644
--- a/configs/mt8518_ap1_emmc_defconfig
+++ b/configs/mt8518_ap1_emmc_defconfig
@@ -24,7 +24,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x56000000
 CONFIG_FASTBOOT_BUF_SIZE=0x1E00000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
-CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT=y
+CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y
 CONFIG_FASTBOOT_MMC_USER_SUPPORT=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_HS200_SUPPORT=y
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 45e07d05e0..8a92e75007 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -104,18 +104,19 @@ config FASTBOOT_FLASH_NAND_TRIMFFS
 	  When flashing NAND enable the DROP_FFS flag to drop trailing all-0xff
 	  pages.
 
-config FASTBOOT_MMC_BOOT1_SUPPORT
-	bool "Enable EMMC_BOOT1 flash/erase"
-	depends on FASTBOOT_FLASH_MMC && EFI_PARTITION && ARCH_MEDIATEK
+config FASTBOOT_MMC_BOOT_SUPPORT
+	bool "Enable EMMC_BOOT flash/erase"
+	depends on FASTBOOT_FLASH_MMC
 	help
 	  The fastboot "flash" and "erase" commands normally does operations
-	  on EMMC userdata. Define this to enable the special commands to
-	  flash/erase EMMC_BOOT1.
-	  The default target name for updating EMMC_BOOT1 is "mmc0boot0".
+	  on eMMC userdata. Define this to enable the special commands to
+	  flash/erase eMMC boot partition.
+	  The default target name for updating eMMC boot partition 1/2 is
+	  CONFIG_FASTBOOT_MMC_BOOT1_NAME/CONFIG_FASTBOOT_MMC_BOOT2_NAME.
 
 config FASTBOOT_MMC_BOOT1_NAME
 	string "Target name for updating EMMC_BOOT1"
-	depends on FASTBOOT_MMC_BOOT1_SUPPORT
+	depends on FASTBOOT_MMC_BOOT_SUPPORT
 	default "mmc0boot0"
 	help
 	  The fastboot "flash" and "erase" commands support operations on
@@ -124,6 +125,17 @@ config FASTBOOT_MMC_BOOT1_NAME
 	  defined here.
 	  The default target name for updating EMMC_BOOT1 is "mmc0boot0".
 
+config FASTBOOT_MMC_BOOT2_NAME
+	string "Target name for updating EMMC_BOOT2"
+	depends on FASTBOOT_MMC_BOOT_SUPPORT
+	default "mmc0boot1"
+	help
+	  The fastboot "flash" and "erase" commands support operations on
+	  EMMC_BOOT2. This occurs when the specified "EMMC_BOOT2 name" on
+	  the "fastboot flash" and "fastboot erase" commands match the value
+	  defined here.
+	  The default target name for updating EMMC_BOOT2 is "mmc0boot1".
+
 config FASTBOOT_MMC_USER_SUPPORT
 	bool "Enable eMMC userdata partition flash/erase"
 	depends on FASTBOOT_FLASH_MMC
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index ab6674cac2..3dd02ee9a8 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -132,7 +132,7 @@ static void write_raw_image(struct blk_desc *dev_desc,
 	fastboot_okay(NULL, response);
 }
 
-#if defined(CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT) || \
+#if defined(CONFIG_FASTBOOT_MMC_BOOT_SUPPORT) || \
 	defined(CONFIG_FASTBOOT_MMC_USER_SUPPORT)
 static int fb_mmc_erase_mmc_hwpart(struct blk_desc *dev_desc)
 {
@@ -154,16 +154,16 @@ static int fb_mmc_erase_mmc_hwpart(struct blk_desc *dev_desc)
 }
 #endif
 
-#ifdef CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT
-static void fb_mmc_boot1_ops(struct blk_desc *dev_desc, void *buffer,
-			     u32 buff_sz, char *response)
+#ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
+static void fb_mmc_boot_ops(struct blk_desc *dev_desc, void *buffer,
+			    int hwpart, u32 buff_sz, char *response)
 {
 	lbaint_t blkcnt;
 	lbaint_t blks;
 	unsigned long blksz;
 
-	// To operate on EMMC_BOOT1 (mmc0boot0), we first change the hwpart
-	if (blk_dselect_hwpart(dev_desc, 1)) {
+	// To operate on EMMC_BOOT1/2 (mmc0boot0/1) we first change the hwpart
+	if (blk_dselect_hwpart(dev_desc, hwpart)) {
 		pr_err("Failed to select hwpart\n");
 		fastboot_fail("Failed to select hwpart", response);
 		return;
@@ -182,21 +182,24 @@ static void fb_mmc_boot1_ops(struct blk_desc *dev_desc, void *buffer,
 			return;
 		}
 
-		debug("Start Flashing Image to EMMC_BOOT1...\n");
+		debug("Start Flashing Image to EMMC_BOOT%d...\n", hwpart);
 
 		blks = fb_mmc_blk_write(dev_desc, 0, blkcnt, buffer);
 
 		if (blks != blkcnt) {
-			pr_err("Failed to write EMMC_BOOT1\n");
-			fastboot_fail("Failed to write EMMC_BOOT1", response);
+			pr_err("Failed to write EMMC_BOOT%d\n", hwpart);
+			fastboot_fail("Failed to write EMMC_BOOT part",
+				      response);
 			return;
 		}
 
-		printf("........ wrote %lu bytes to EMMC_BOOT1\n",
-		       blkcnt * blksz);
+		printf("........ wrote %lu bytes to EMMC_BOOT%d\n",
+		       blkcnt * blksz, hwpart);
 	} else { /* erase */
 		if (fb_mmc_erase_mmc_hwpart(dev_desc)) {
-			fastboot_fail("Failed to erase EMMC_BOOT1", response);
+			pr_err("Failed to erase EMMC_BOOT%d\n", hwpart);
+			fastboot_fail("Failed to erase EMMC_BOOT part",
+				      response);
 			return;
 		}
 	}
@@ -421,10 +424,15 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
 		return;
 	}
 
-#ifdef CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT
+#ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
 	if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
-		fb_mmc_boot1_ops(dev_desc, download_buffer,
-				 download_bytes, response);
+		fb_mmc_boot_ops(dev_desc, download_buffer, 1,
+				download_bytes, response);
+		return;
+	}
+	if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT2_NAME) == 0) {
+		fb_mmc_boot_ops(dev_desc, download_buffer, 2,
+				download_bytes, response);
 		return;
 	}
 #endif
@@ -546,10 +554,15 @@ void fastboot_mmc_erase(const char *cmd, char *response)
 		return;
 	}
 
-#ifdef CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT
+#ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
 	if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
 		/* erase EMMC boot1 */
-		fb_mmc_boot1_ops(dev_desc, NULL, 0, response);
+		fb_mmc_boot_ops(dev_desc, NULL, 1, 0, response);
+		return;
+	}
+	if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT2_NAME) == 0) {
+		/* erase EMMC boot2 */
+		fb_mmc_boot_ops(dev_desc, NULL, 2, 0, response);
 		return;
 	}
 #endif
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] fastboot: add command to select the default emmc hwpart for boot
  2020-09-09 13:22 [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick Delaunay
  2020-09-09 13:22 ` [PATCH 2/4] fastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2 Patrick Delaunay
@ 2020-09-09 13:22 ` Patrick Delaunay
  2020-09-09 13:22 ` [PATCH 4/4] fastboot: add command to select the eMMC boot configuration Patrick Delaunay
  2020-12-09 10:48 ` [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick DELAUNAY
  3 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2020-09-09 13:22 UTC (permalink / raw)
  To: u-boot

Add fastboot command oem partconf which executes the command
``mmc partconf <id> <arg> 0`` on the current <id> mmc device
to configure the eMMC boot partition with
<arg>: boot_ack boot_partition, so the command is:

$> fastboot oem partconf:<boot_ack> <boot_partition>

The partition_access argument is forced to 0 (userdata)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 doc/android/fastboot.rst      |  2 ++
 drivers/fastboot/Kconfig      |  7 +++++++
 drivers/fastboot/fb_command.c | 36 +++++++++++++++++++++++++++++++++++
 include/fastboot.h            |  3 +++
 4 files changed, 48 insertions(+)

diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst
index de3f6c37d7..7d69372753 100644
--- a/doc/android/fastboot.rst
+++ b/doc/android/fastboot.rst
@@ -23,6 +23,8 @@ The current implementation supports the following standard commands:
 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
 
 Support for both eMMC and NAND devices is included.
 
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 8a92e75007..1bcc8d4ab9 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -189,6 +189,13 @@ config FASTBOOT_CMD_OEM_FORMAT
 	  relies on the env variable partitions to contain the list of
 	  partitions as required by the gpt command.
 
+config FASTBOOT_CMD_OEM_PARTCONF
+	bool "Enable the 'oem partconf' command"
+	depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
+	help
+	  Add support for the "oem partconf" command from a client. This set
+	  the mmc boot-partition for the selecting eMMC device.
+
 endif # FASTBOOT
 
 endmenu
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 49f6a61c37..e42c018348 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -40,6 +40,9 @@ static void reboot_bootloader(char *, char *);
 #if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
 static void oem_format(char *, char *);
 #endif
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF)
+static void oem_partconf(char *, char *);
+#endif
 
 static const struct {
 	const char *command;
@@ -89,6 +92,12 @@ static const struct {
 		.dispatch = oem_format,
 	},
 #endif
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF)
+	[FASTBOOT_COMMAND_OEM_PARTCONF] = {
+		.command = "oem partconf",
+		.dispatch = oem_partconf,
+	},
+#endif
 };
 
 /**
@@ -336,3 +345,30 @@ static void oem_format(char *cmd_parameter, char *response)
 	}
 }
 #endif
+
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF)
+/**
+ * oem_partconf() - Execute the OEM partconf command
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void oem_partconf(char *cmd_parameter, char *response)
+{
+	char cmdbuf[32];
+
+	if (!cmd_parameter) {
+		fastboot_fail("Expected command parameter", response);
+		return;
+	}
+
+	/* execute 'mmc partconfg' command with cmd_parameter arguments*/
+	snprintf(cmdbuf, sizeof(cmdbuf), "mmc partconf %x %s 0",
+		 CONFIG_FASTBOOT_FLASH_MMC_DEV, cmd_parameter);
+	printf("Execute: %s\n", cmdbuf);
+	if (run_command(cmdbuf, 0))
+		fastboot_fail("Cannot set oem partconf", response);
+	else
+		fastboot_okay(NULL, response);
+}
+#endif
diff --git a/include/fastboot.h b/include/fastboot.h
index 1933b1d98e..3e68852e9a 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -36,6 +36,9 @@ enum {
 #if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
 	FASTBOOT_COMMAND_OEM_FORMAT,
 #endif
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF)
+	FASTBOOT_COMMAND_OEM_PARTCONF,
+#endif
 
 	FASTBOOT_COMMAND_COUNT
 };
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] fastboot: add command to select the eMMC boot configuration
  2020-09-09 13:22 [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick Delaunay
  2020-09-09 13:22 ` [PATCH 2/4] fastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2 Patrick Delaunay
  2020-09-09 13:22 ` [PATCH 3/4] fastboot: add command to select the default emmc hwpart for boot Patrick Delaunay
@ 2020-09-09 13:22 ` Patrick Delaunay
  2020-12-09 10:48 ` [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick DELAUNAY
  3 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2020-09-09 13:22 UTC (permalink / raw)
  To: u-boot

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@st.com>
---

 doc/android/fastboot.rst      |  1 +
 drivers/fastboot/Kconfig      |  7 +++++++
 drivers/fastboot/fb_command.c | 36 +++++++++++++++++++++++++++++++++++
 include/fastboot.h            |  3 +++
 4 files changed, 47 insertions(+)

diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst
index 7d69372753..6aa725fcd8 100644
--- a/doc/android/fastboot.rst
+++ b/doc/android/fastboot.rst
@@ -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.
 
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 e42c018348..00efd477db 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -43,6 +43,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;
@@ -98,6 +101,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
 };
 
 /**
@@ -372,3 +381,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
diff --git a/include/fastboot.h b/include/fastboot.h
index 3e68852e9a..966ffc6d94 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -39,6 +39,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
 };
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT
  2020-09-09 13:22 [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick Delaunay
                   ` (2 preceding siblings ...)
  2020-09-09 13:22 ` [PATCH 4/4] fastboot: add command to select the eMMC boot configuration Patrick Delaunay
@ 2020-12-09 10:48 ` Patrick DELAUNAY
  2021-01-23 12:15   ` Lukasz Majewski
  3 siblings, 1 reply; 7+ messages in thread
From: Patrick DELAUNAY @ 2020-12-09 10:48 UTC (permalink / raw)
  To: u-boot

Hi Lukasz,

> From: Patrick DELAUNAY <patrick.delaunay@st.com>
> Sent: mercredi 9 septembre 2020 15:23
> To: u-boot at lists.denx.de
> Cc: Patrick DELAUNAY <patrick.delaunay@st.com>; Jagan Teki
> <jagan@amarulasolutions.com>; Kever Yang <kever.yang@rock-chips.com>;
> Mingming lee <mingming.lee@mediatek.com>; Miquel Raynal
> <miquel.raynal@bootlin.com>; Peng Fan <peng.fan@nxp.com>; Simon Glass
> <sjg@chromium.org>; U-Boot STM32 <uboot-stm32@st-md-
> mailman.stormreply.com>
> Subject: [PATCH 1/4] fastboot: mmc: Add
> CONFIG_FASTBOOT_MMC_USER_SUPPORT
> Importance: High
> 
> Split userdata and boot partition support for eMMC update and correct the
> description (update is supported).
> 
> The new configuration CONFIG_FASTBOOT_MMC_USER_SUPPORT allows to
> activate support of userdata partition update, based on target
> name=CONFIG_FASTBOOT_MMC_USER_NAME
> 
> This patch also removes the unnecessary dependency with ARCH_MEDIATEK
> and EFI_PARTITION.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
> 
>  configs/mt8518_ap1_emmc_defconfig |  1 +
>  drivers/fastboot/Kconfig          | 22 +++++++++++++++++-----
>  drivers/fastboot/fb_mmc.c         |  9 ++++++---
>  3 files changed, 24 insertions(+), 8 deletions(-)
> 

Gentle reminder,

Any comments on this serie [1]

[1] http://patchwork.ozlabs.org/project/uboot/list/?series=200509

Patrick 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT
  2020-12-09 10:48 ` [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick DELAUNAY
@ 2021-01-23 12:15   ` Lukasz Majewski
       [not found]     ` <a8f9542dacb742afa96d2977df159d3f@SFHDAG2NODE3.st.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Majewski @ 2021-01-23 12:15 UTC (permalink / raw)
  To: u-boot

Hi Patrick,

> Hi Lukasz,
> 
> > From: Patrick DELAUNAY <patrick.delaunay@st.com>
> > Sent: mercredi 9 septembre 2020 15:23
> > To: u-boot at lists.denx.de
> > Cc: Patrick DELAUNAY <patrick.delaunay@st.com>; Jagan Teki
> > <jagan@amarulasolutions.com>; Kever Yang
> > <kever.yang@rock-chips.com>; Mingming lee
> > <mingming.lee@mediatek.com>; Miquel Raynal
> > <miquel.raynal@bootlin.com>; Peng Fan <peng.fan@nxp.com>; Simon
> > Glass <sjg@chromium.org>; U-Boot STM32 <uboot-stm32@st-md-
> > mailman.stormreply.com> Subject: [PATCH 1/4] fastboot: mmc: Add
> > CONFIG_FASTBOOT_MMC_USER_SUPPORT
> > Importance: High
> > 
> > Split userdata and boot partition support for eMMC update and
> > correct the description (update is supported).
> > 
> > The new configuration CONFIG_FASTBOOT_MMC_USER_SUPPORT allows to
> > activate support of userdata partition update, based on target
> > name=CONFIG_FASTBOOT_MMC_USER_NAME
> > 
> > This patch also removes the unnecessary dependency with
> > ARCH_MEDIATEK and EFI_PARTITION.
> > 
> > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> > ---
> > 
> >  configs/mt8518_ap1_emmc_defconfig |  1 +
> >  drivers/fastboot/Kconfig          | 22 +++++++++++++++++-----
> >  drivers/fastboot/fb_mmc.c         |  9 ++++++---
> >  3 files changed, 24 insertions(+), 8 deletions(-)
> >   
> 
> Gentle reminder,
> 
> Any comments on this serie [1]
> 
> [1] http://patchwork.ozlabs.org/project/uboot/list/?series=200509
> 
> Patrick 

Could you rebase this on top of current -master (after I do send the
PR) and resend. There are now build / application errors on this series.

Thanks in advance and please find my apologize for very late reply
(covid19 + personal matters).


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210123/03748a27/attachment.sig>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* FW: [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT
       [not found]     ` <a8f9542dacb742afa96d2977df159d3f@SFHDAG2NODE3.st.com>
@ 2021-01-27 10:27       ` Patrick DELAUNAY
  0 siblings, 0 replies; 7+ messages in thread
From: Patrick DELAUNAY @ 2021-01-27 10:27 UTC (permalink / raw)
  To: u-boot


On 1/26/21 4:48 PM, Patrick DELAUNAY wrote:
> From: Lukasz Majewski <lukma@denx.de>
> Sent: samedi 23 janvier 2021 13:16
>
> Hi Patrick,
>
>> Hi Lukasz,
>>
>>> From: Patrick DELAUNAY <patrick.delaunay@st.com>
>>> Sent: mercredi 9 septembre 2020 15:23
>>> To: u-boot at lists.denx.de
>>> Cc: Patrick DELAUNAY <patrick.delaunay@st.com>; Jagan Teki
>>> <jagan@amarulasolutions.com>; Kever Yang
>>> <kever.yang@rock-chips.com>; Mingming lee
>>> <mingming.lee@mediatek.com>; Miquel Raynal
>>> <miquel.raynal@bootlin.com>; Peng Fan <peng.fan@nxp.com>; Simon
>>> Glass <sjg@chromium.org>; U-Boot STM32 <uboot-stm32@st-md-
>>> mailman.stormreply.com> Subject: [PATCH 1/4] fastboot: mmc: Add
>>> CONFIG_FASTBOOT_MMC_USER_SUPPORT
>>> Importance: High
>>>
>>> Split userdata and boot partition support for eMMC update and
>>> correct the description (update is supported).
>>>
>>> The new configuration CONFIG_FASTBOOT_MMC_USER_SUPPORT allows to
>>> activate support of userdata partition update, based on target
>>> name=CONFIG_FASTBOOT_MMC_USER_NAME
>>>
>>> This patch also removes the unnecessary dependency with
>>> ARCH_MEDIATEK and EFI_PARTITION.
>>>
>>> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
>>> ---
>>>
>>>   configs/mt8518_ap1_emmc_defconfig |  1 +
>>>   drivers/fastboot/Kconfig          | 22 +++++++++++++++++-----
>>>   drivers/fastboot/fb_mmc.c         |  9 ++++++---
>>>   3 files changed, 24 insertions(+), 8 deletions(-)
>>>    
>> Gentle reminder,
>>
>> Any comments on this serie [1]
>>
>> [1] http://patchwork.ozlabs.org/project/uboot/list/?series=200509
>>
>> Patrick
> Could you rebase this on top of current -master (after I do send the
> PR) and resend. There are now build / application errors on this series.
>
> Thanks in advance and please find my apologize for very late reply
> (covid19 + personal matters).

I wil rebase the serie.

And I understand and accept your apologies;

anyway the serie wasn't blocking for me.


>
> Best regards,
>
> Lukasz Majewski
>
> --
>
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de

Regards

PAtrick

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-27 10:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 13:22 [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick Delaunay
2020-09-09 13:22 ` [PATCH 2/4] fastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2 Patrick Delaunay
2020-09-09 13:22 ` [PATCH 3/4] fastboot: add command to select the default emmc hwpart for boot Patrick Delaunay
2020-09-09 13:22 ` [PATCH 4/4] fastboot: add command to select the eMMC boot configuration Patrick Delaunay
2020-12-09 10:48 ` [PATCH 1/4] fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT Patrick DELAUNAY
2021-01-23 12:15   ` Lukasz Majewski
     [not found]     ` <a8f9542dacb742afa96d2977df159d3f@SFHDAG2NODE3.st.com>
2021-01-27 10:27       ` FW: " Patrick DELAUNAY

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.