diff --git a/common/aboot.c b/common/aboot.c
index 6c35d8226903251b221ad3e0ac27ca42d1c6c856..7f412ac0ad4f6620f6e150ba5a25248b6bc408e8 100644
--- a/common/aboot.c
+++ b/common/aboot.c
@@ -264,8 +264,8 @@ static void sparse_put_data_buffer(sparse_buffer_t *buffer)
 	free(buffer);
 }
 
-int store_sparse_image(sparse_storage_t *storage,
-		       void *storage_priv, void *data)
+int store_sparse_image(sparse_storage_t *storage, void *storage_priv,
+		       unsigned int session_id, void *data)
 {
 	unsigned int chunk, offset;
 	sparse_header_t *sparse_header;
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index c9f2ed6b58635aa7d9e73ca64770c08c392a32a5..c6989668ae5b914bdec8913654441b108ee02195 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -96,8 +96,9 @@ static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
 	fastboot_okay(response_str, "");
 }
 
-void fb_mmc_flash_write(const char *cmd, void *download_buffer,
-			unsigned int download_bytes, char *response)
+void fb_mmc_flash_write(const char *cmd, unsigned int session_id,
+			void *download_buffer, unsigned int download_bytes,
+			char *response)
 {
 	block_dev_desc_t *dev_desc;
 	disk_partition_t info;
@@ -151,7 +152,8 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,
 		printf("Flashing sparse image at offset " LBAFU "\n",
 		       info.start);
 
-		store_sparse_image(&sparse, &sparse_priv, download_buffer);
+		store_sparse_image(&sparse, &sparse_priv, session_id,
+				   download_buffer);
 	} else {
 		write_raw_image(dev_desc, &info, cmd, download_buffer,
 				download_bytes);
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 05fb77302b3e10b04aa06082747f32d44708369f..a70463db33987a47e3a0398139dec60cefa0c40a 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -51,6 +51,7 @@ static inline struct f_fastboot *func_to_fastboot(struct usb_function *f)
 }
 
 static struct f_fastboot *fastboot_func;
+static unsigned int fastboot_flash_session_id;
 static unsigned int download_size;
 static unsigned int download_bytes;
 static bool is_high_speed;
@@ -393,6 +394,15 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
 
 		sprintf(str_num, "0x%08x", CONFIG_FASTBOOT_BUF_SIZE);
 		strncat(response, str_num, chars_left);
+
+		/*
+		 * This also indicates the start of a new flashing
+		 * "session", in which we could have 1-N buffers to
+		 * write to a partition.
+		 *
+		 * Reset our session counter.
+		 */
+		fastboot_flash_session_id = 0;
 	} else if (!strcmp_l1("serialno", cmd)) {
 		s = getenv("serial#");
 		if (s)
@@ -555,9 +565,11 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
 
 	strcpy(response, "FAILno flash device defined");
 #ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-	fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
+	fb_mmc_flash_write(cmd, fastboot_flash_session_id,
+			   (void *)CONFIG_FASTBOOT_BUF_ADDR,
 			   download_bytes, response);
 #endif
+	fastboot_flash_session_id++;
 	fastboot_tx_write_str(response);
 }
 #endif
diff --git a/include/aboot.h b/include/aboot.h
index a2b0694190d99ed8235f98c622a581e589f347e3..0382f5bd2639fecd498b7a2635ed5035381ee58d 100644
--- a/include/aboot.h
+++ b/include/aboot.h
@@ -32,4 +32,4 @@ static inline int is_sparse_image(void *buf)
 }
 
 int store_sparse_image(sparse_storage_t *storage, void *storage_priv,
-		       void *data);
+		       unsigned int session_id, void *data);
diff --git a/include/fb_mmc.h b/include/fb_mmc.h
index 402ba9b1b47079864a6d97d1863435380b84ae52..978a1395a185a31b5be5646f6d3042b8ac3d22fa 100644
--- a/include/fb_mmc.h
+++ b/include/fb_mmc.h
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-void fb_mmc_flash_write(const char *cmd, void *download_buffer,
-			unsigned int download_bytes, char *response);
+void fb_mmc_flash_write(const char *cmd, unsigned int session_id,
+			void *download_buffer, unsigned int download_bytes,
+			char *response);
 void fb_mmc_erase(const char *cmd, char *response);