public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: Angus Ainslie <angus@akkea.ca>, u-boot@lists.denx.de
Cc: Sean Anderson <seanga2@gmail.com>, Simon Glass <sjg@chromium.org>,
	Oleh Kravchenko <oleg@kaa.org.ua>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Roman Stratiienko <r.stratiienko@gmail.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool
Date: Fri, 17 Dec 2021 18:10:08 -0500	[thread overview]
Message-ID: <eba2d777-c96c-e4f2-80c8-cd930c61111c@seco.com> (raw)
In-Reply-To: <20211217154200.326443-2-angus@akkea.ca>

Hi Angus,

On 12/17/21 10:41 AM, Angus Ainslie wrote:
> uuu uses the blocksize to determine the upload size

Can you please elaborate on this more?

> 
> Signed-off-by: Angus Ainslie <angus@akkea.ca>
> ---
>   drivers/fastboot/fb_getvar.c | 27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
> index d43f2cfee6..ff5f0d3d40 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_blocksize(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_blocksize
>   	}
>   };
>   
> @@ -140,6 +144,29 @@ static void getvar_downloadsize(char *var_parameter, char *response)
>   	fastboot_response("OKAY", response, "0x%08x", fastboot_buf_size);
>   }
>   
> +static int fb_get_block_size(void)
> +{
> +	int dev_no = 0;
> +	struct blk_desc *dev_desc;
> +
> +	dev_desc = blk_get_dev("mmc", 0);

And what if your block device is not mmc 0? This code is not specific to fastboot mmc. What about nand?

> +
> +	if (!dev_desc) {
> +		printf("** Block device %s %d not supported\n",
> +		       "mmc", 0);
> +		return 0;

Why return 0? This should result in an error fastboot_response.

> +	}
> +	return dev_desc->blksz;
> +}
> +
> +static void getvar_logical_blocksize(char *var_parameter, char *response)
> +{
> +	u32 blksz;
> +
> +	blksz = fb_get_block_size();
> +	fastboot_response("OKAY", response, "0x%08x", blksz);

Can we combine these functions?

--Sean

> +}
> +
>   static void getvar_serialno(char *var_parameter, char *response)
>   {
>   	const char *tmp = env_get("serial#");
> 

  reply	other threads:[~2021-12-17 23:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 15:41 [PATCH 0/2] Add more support for NXP's mfgtool Angus Ainslie
2021-12-17 15:41 ` [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool Angus Ainslie
2021-12-17 23:10   ` Sean Anderson [this message]
2021-12-19 15:25     ` Angus Ainslie
2021-12-17 15:42 ` [PATCH 2/2] fastboot: fb_mmc: Add mfgtool all partition size Angus Ainslie
2021-12-17 23:02   ` Sean Anderson
2021-12-18  8:44 ` [PATCH 0/2] Add more support for NXP's mfgtool Oleh Kravchenko
2021-12-18 14:34   ` Angus Ainslie
2021-12-18 21:52     ` Oleh Kravchenko

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=eba2d777-c96c-e4f2-80c8-cd930c61111c@seco.com \
    --to=sean.anderson@seco.com \
    --cc=angus@akkea.ca \
    --cc=m.szyprowski@samsung.com \
    --cc=oleg@kaa.org.ua \
    --cc=patrick.delaunay@foss.st.com \
    --cc=r.stratiienko@gmail.com \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox