NXP's mfgtool queies the mmc blocksize and splits a sparse image into
blocksize size pieces for the upload.

Signed-off-by: Angus Ainslie <an...@akkea.ca>
---
 drivers/fastboot/fb_getvar.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index d43f2cfee6..3cb72b8a54 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -26,6 +26,7 @@ static void getvar_has_slot(char *var_parameter, char 
*response);
 #endif
 #if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
 static void getvar_partition_type(char *part_name, char *response);
+static void getvar_logical_blocksize(char *var_parameter, char *response);
 #endif
 #if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
 static void getvar_partition_size(char *part_name, char *response);
@@ -72,6 +73,9 @@ static const struct {
        }, {
                .variable = "partition-type",
                .dispatch = getvar_partition_type
+       }, {
+               .variable = "logical-block-size",
+               .dispatch = getvar_logical_blocksize
 #endif
 #if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
        }, {
@@ -232,6 +236,23 @@ static void getvar_partition_type(char *part_name, char 
*response)
                        fastboot_okay(fs_get_type_name(), response);
        }
 }
+
+static void getvar_logical_blocksize(char *var_parameter, char *response)
+{
+       u32 blksz;
+       struct blk_desc *dev_desc;
+
+       dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+
+       if (!dev_desc) {
+               pr_err("** Block device mmc %d not supported\n",
+                      CONFIG_FASTBOOT_FLASH_MMC_DEV);
+               fastboot_fail("Get logical_blocksize failed", response);
+               return;
+       }
+
+       fastboot_response("OKAY", response, "0x%08x", dev_desc->blksz);
+}
 #endif
 
 #if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
-- 
2.25.1

Reply via email to