Hook the UFS flash backend into the fastboot command dispatcher
(flash, erase) and the getvar partition-size/has-slot lookup path.

This follows the same IS_ENABLED() pattern used by the existing
MMC, NAND, and SPI flash backends in fb_command.c and fb_getvar.c.

Signed-off-by: Ruitong Su <[email protected]>
---
 drivers/fastboot/fb_command.c | 8 ++++++++
 drivers/fastboot/fb_getvar.c  | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 18d86988f4c..aaf5b1eaf6a 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -12,6 +12,7 @@
 #include <fb_mmc.h>
 #include <fb_nand.h>
 #include <fb_spi_flash.h>
+#include <fb_ufs.h>
 #include <part.h>
 #include <stdlib.h>
 #include <vsprintf.h>
@@ -354,6 +355,10 @@ static void __maybe_unused flash(char *cmd_parameter, char 
*response)
        if (IS_ENABLED(CONFIG_FASTBOOT_FLASH_SPI))
                fastboot_spi_flash_write(cmd_parameter, fastboot_buf_addr,
                                         image_size, response);
+
+       if (IS_ENABLED(CONFIG_FASTBOOT_FLASH_UFS))
+               fastboot_ufs_flash_write(cmd_parameter, fastboot_buf_addr,
+                                        image_size, response);
 }
 
 /**
@@ -378,6 +383,9 @@ static void __maybe_unused erase(char *cmd_parameter, char 
*response)
 
        if (IS_ENABLED(CONFIG_FASTBOOT_FLASH_SPI))
                fastboot_spi_flash_erase(cmd_parameter, response);
+
+       if (IS_ENABLED(CONFIG_FASTBOOT_FLASH_UFS))
+               fastboot_ufs_erase(cmd_parameter, response);
 }
 
 /**
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index e8aa0e09aa6..d761592eb57 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -10,6 +10,7 @@
 #include <fb_block.h>
 #include <fb_nand.h>
 #include <fb_spi_flash.h>
+#include <fb_ufs.h>
 #include <fs.h>
 #include <part.h>
 #include <version.h>
@@ -135,6 +136,11 @@ static int getvar_get_part_info(const char *part_name, 
char *response,
                                                     response);
                if (r >= 0 && size)
                        *size = disk_part.size * disk_part.blksz;
+       } else if (IS_ENABLED(CONFIG_FASTBOOT_FLASH_UFS)) {
+               r = fastboot_ufs_get_part_info(part_name, &dev_desc,
+                                              &disk_part, response);
+               if (r >= 0 && size)
+                       *size = disk_part.size * disk_part.blksz;
        } else {
                fastboot_fail("this storage is not supported in bootloader", 
response);
                r = -ENODEV;
-- 
2.50.1

声明:这封邮件只允许文件接收者阅读,有很高的机密性要求。禁止其他人使用、打开、复制或转发里面的任何内容。如果本邮件错误地发给了你,请联系邮件发出者并删除这个文件。机密及法律的特权并不因为误发邮件而放弃或丧失。任何提出的观点或意见只属于作者的个人见解,并不一定代表本公司。
Disclaimer: This email is intended to be read only by the designated recipient 
of the document and has high confidentiality requirements. Anyone else is 
prohibited from using, opening, copying or forwarding any of the contents 
inside. If this email was sent to you by mistake, please contact the sender of 
the email and delete this file immediately. Confidentiality and legal 
privileges are not waived or lost by misdirected emails. Any views or opinions 
expressed in the email are those of the author and do not necessarily represent 
those of the Company.

Reply via email to