* [PATCH] dfu: mmc: Add support for exposing whole mmc device
@ 2023-10-29 22:37 Marek Vasut
2023-10-30 8:53 ` Lukasz Majewski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Marek Vasut @ 2023-10-29 22:37 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Lukasz Majewski, Mattijs Korpershoek, Tom Rini
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 <marex@denx.de>
---
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Tom Rini <trini@konsulko.com>
---
doc/usage/dfu.rst | 5 +++++
drivers/dfu/dfu_mmc.c | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/doc/usage/dfu.rst b/doc/usage/dfu.rst
index 68cacbbef66..8845a71df36 100644
--- a/doc/usage/dfu.rst
+++ b/doc/usage/dfu.rst
@@ -121,6 +121,11 @@ mmc
with
+ offset
+ is the offset in the device (hexadecimal without "0x")
+ size
+ is the size of the access area (hexadecimal without "0x")
+ or 0 which means whole device
partid
being the GPT or DOS partition index,
num
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
@@ -386,6 +386,16 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char **argv, int a
dfu->data.mmc.lba_size = third_arg;
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
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] dfu: mmc: Add support for exposing whole mmc device
2023-10-29 22:37 [PATCH] dfu: mmc: Add support for exposing whole mmc device Marek Vasut
@ 2023-10-30 8:53 ` Lukasz Majewski
2023-10-31 9:34 ` Mattijs Korpershoek
2023-10-31 13:55 ` Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2023-10-30 8:53 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Mattijs Korpershoek, Tom Rini
[-- Attachment #1: Type: text/plain, Size: 2170 bytes --]
On Sun, 29 Oct 2023 23:37:22 +0100
Marek Vasut <marex@denx.de> wrote:
> 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 <marex@denx.de>
> ---
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> doc/usage/dfu.rst | 5 +++++
> drivers/dfu/dfu_mmc.c | 10 ++++++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/doc/usage/dfu.rst b/doc/usage/dfu.rst
> index 68cacbbef66..8845a71df36 100644
> --- a/doc/usage/dfu.rst
> +++ b/doc/usage/dfu.rst
> @@ -121,6 +121,11 @@ mmc
>
> with
>
> + offset
> + is the offset in the device (hexadecimal without "0x")
> + size
> + is the size of the access area (hexadecimal without "0x")
> + or 0 which means whole device
> partid
> being the GPT or DOS partition index,
> num
> 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
> @@ -386,6 +386,16 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu,
> char *devstr, char **argv, int a dfu->data.mmc.lba_size
> = third_arg; 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
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] dfu: mmc: Add support for exposing whole mmc device
2023-10-29 22:37 [PATCH] dfu: mmc: Add support for exposing whole mmc device Marek Vasut
2023-10-30 8:53 ` Lukasz Majewski
@ 2023-10-31 9:34 ` Mattijs Korpershoek
2023-10-31 13:55 ` Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2023-10-31 9:34 UTC (permalink / raw)
To: Marek Vasut, u-boot; +Cc: Marek Vasut, Lukasz Majewski, Tom Rini
On dim., oct. 29, 2023 at 23:37, Marek Vasut <marex@denx.de> wrote:
> 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 <marex@denx.de>
> ---
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> doc/usage/dfu.rst | 5 +++++
> drivers/dfu/dfu_mmc.c | 10 ++++++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/doc/usage/dfu.rst b/doc/usage/dfu.rst
> index 68cacbbef66..8845a71df36 100644
> --- a/doc/usage/dfu.rst
> +++ b/doc/usage/dfu.rst
> @@ -121,6 +121,11 @@ mmc
>
> with
>
> + offset
> + is the offset in the device (hexadecimal without "0x")
> + size
> + is the size of the access area (hexadecimal without "0x")
> + or 0 which means whole device
> partid
> being the GPT or DOS partition index,
> num
> 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
> @@ -386,6 +386,16 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char **argv, int a
> dfu->data.mmc.lba_size = third_arg;
> 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
> --
> 2.42.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] dfu: mmc: Add support for exposing whole mmc device
2023-10-29 22:37 [PATCH] dfu: mmc: Add support for exposing whole mmc device Marek Vasut
2023-10-30 8:53 ` Lukasz Majewski
2023-10-31 9:34 ` Mattijs Korpershoek
@ 2023-10-31 13:55 ` Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2023-10-31 13:55 UTC (permalink / raw)
To: u-boot, Marek Vasut; +Cc: Lukasz Majewski, Tom Rini
Hi,
On Sun, 29 Oct 2023 23:37:22 +0100, Marek Vasut wrote:
> 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.
>
>
Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)
[1/1] dfu: mmc: Add support for exposing whole mmc device
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/60d904a494c6e89c323bc13fa9348869e07e86d3
--
Mattijs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-31 13:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-29 22:37 [PATCH] dfu: mmc: Add support for exposing whole mmc device Marek Vasut
2023-10-30 8:53 ` Lukasz Majewski
2023-10-31 9:34 ` Mattijs Korpershoek
2023-10-31 13:55 ` Mattijs Korpershoek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox