summaryrefslogtreecommitdiff
path: root/drivers/dfu
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2023-10-29 23:37:22 +0100
committerMattijs Korpershoek <[email protected]>2023-10-31 14:53:05 +0100
commit60d904a494c6e89c323bc13fa9348869e07e86d3 (patch)
tree46cc4140fc6b86f68ae3e678a4381be21331d206 /drivers/dfu
parent355aab94d1f675ec1118906e1f88dfdf6a3582eb (diff)
dfu: mmc: Add support for exposing whole mmc device
Add support for exposing the whole mmc device by setting the 'size' parameter to 0. This can be useful in case it is not clear what the total device size is up front. Update the documentation accordingly. Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Lukasz Majewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
Diffstat (limited to 'drivers/dfu')
-rw-r--r--drivers/dfu/dfu_mmc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index cdb3c18b01d..12c54e90ef7 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -387,6 +387,16 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char **argv, int a
dfu->data.mmc.lba_blk_size = mmc->read_bl_len;
/*
+ * In case the size is zero (i.e. mmc raw 0x10 0),
+ * assume the user intends to use whole device.
+ */
+ if (third_arg == 0) {
+ struct blk_desc *blk_dev = mmc_get_blk_desc(mmc);
+
+ dfu->data.mmc.lba_size = blk_dev->lba;
+ }
+
+ /*
* Check for an extra entry at dfu_alt_info env variable
* specifying the mmc HW defined partition number
*/