summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/fastboot/fb_getvar.c18
-rw-r--r--include/fastboot.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index d43f2cfee6..4e5536d611 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -31,6 +31,7 @@ static void getvar_partition_type(char *part_name, char *response);
static void getvar_partition_size(char *part_name, char *response);
#endif
static void getvar_is_userspace(char *var_parameter, char *response);
+static void getvar_logical_block_size(char *var_parameter, char *response);
static const struct {
const char *variable;
@@ -81,6 +82,9 @@ static const struct {
}, {
.variable = "is-userspace",
.dispatch = getvar_is_userspace
+ }, {
+ .variable = "logical-block-size",
+ .dispatch = getvar_logical_block_size
}
};
@@ -251,6 +255,20 @@ static void getvar_is_userspace(char *var_parameter, char *response)
fastboot_okay("no", response);
}
+static void getvar_logical_block_size(char *var_parameter, char *response)
+{
+ struct blk_desc *dev_desc;
+
+ dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+ if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
+ pr_err("invalid mmc device\n");
+ fastboot_fail("invalid mmc device", response);
+ return;
+ }
+
+ fastboot_response("OKAY", response, "0x%08lx", dev_desc->blksz);
+}
+
/**
* fastboot_getvar() - Writes variable indicated by cmd_parameter to response.
*
diff --git a/include/fastboot.h b/include/fastboot.h
index 57daaf1298..816c01b8fd 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -48,6 +48,7 @@ enum {
FASTBOOT_COMMAND_ACMD,
FASTBOOT_COMMAND_UCMD,
#endif
+ FASTBOOT_COMMAND_BLOCK_SIZE,
FASTBOOT_COMMAND_COUNT
};