All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Marek Vasut <marex@denx.de>, u-boot@lists.denx.de
Cc: Marek Vasut <marex@denx.de>, Lukasz Majewski <lukma@denx.de>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] dfu: mmc: Add support for exposing whole mmc device
Date: Tue, 31 Oct 2023 10:34:05 +0100	[thread overview]
Message-ID: <8734xrcf02.fsf@baylibre.com> (raw)
In-Reply-To: <20231029223740.284149-1-marex@denx.de>

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

  parent reply	other threads:[~2023-10-31  9:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-10-31 13:55 ` Mattijs Korpershoek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734xrcf02.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.