Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8EAACC433F5 for ; Sun, 19 Dec 2021 15:26:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F0AC88307B; Sun, 19 Dec 2021 16:26:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=akkea.ca Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=akkea.ca header.i=@akkea.ca header.b="OOyGbIcH"; dkim=pass (1024-bit key) header.d=akkea.ca header.i=@akkea.ca header.b="OOyGbIcH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1391383090; Sun, 19 Dec 2021 16:26:00 +0100 (CET) Received: from node.akkea.ca (li1434-30.members.linode.com [45.33.107.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 93CB982F95 for ; Sun, 19 Dec 2021 16:25:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=akkea.ca Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=angus@akkea.ca Received: from localhost (localhost [127.0.0.1]) by node.akkea.ca (Postfix) with ESMTP id CE2ED4E2006; Sun, 19 Dec 2021 15:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1639927553; bh=klGb8OSAx/G7Vktv+Kj10bWImU8X7kAbYsnwBNcxSgs=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=OOyGbIcHHVmAYnTA0P9AWiJQ+hr0kpKRIsV6F7xIeA55Y9LYCOfefHeXXdOzx8L1Y oRdvfDVAFqIiLGodNKX1kjq0htaOG+MT6bvR4g4wPzvubIbAa8s4rJ+L6YS99YdyZF J9gNoF0iVPgGie2KGc4zeT4O93cir1hUS9pQifmY= Received: from node.akkea.ca ([127.0.0.1]) by localhost (mail.akkea.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c4Az7zwKM8Ft; Sun, 19 Dec 2021 15:25:53 +0000 (UTC) Received: from www.akkea.ca (li1434-30.members.linode.com [45.33.107.30]) by node.akkea.ca (Postfix) with ESMTPSA id 23A704E2003; Sun, 19 Dec 2021 15:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1639927553; bh=klGb8OSAx/G7Vktv+Kj10bWImU8X7kAbYsnwBNcxSgs=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=OOyGbIcHHVmAYnTA0P9AWiJQ+hr0kpKRIsV6F7xIeA55Y9LYCOfefHeXXdOzx8L1Y oRdvfDVAFqIiLGodNKX1kjq0htaOG+MT6bvR4g4wPzvubIbAa8s4rJ+L6YS99YdyZF J9gNoF0iVPgGie2KGc4zeT4O93cir1hUS9pQifmY= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 19 Dec 2021 07:25:53 -0800 From: Angus Ainslie To: Sean Anderson Cc: u-boot@lists.denx.de, Sean Anderson , Simon Glass , Oleh Kravchenko , Patrick Delaunay , Roman Stratiienko , Marek Szyprowski Subject: Re: [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool In-Reply-To: References: <20211217154200.326443-1-angus@akkea.ca> <20211217154200.326443-2-angus@akkea.ca> Message-ID: <8662dc480a0988e882f257662e4f2697@akkea.ca> X-Sender: angus@akkea.ca User-Agent: Roundcube Webmail/1.3.6 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Sean, On 2021-12-17 15:10, Sean Anderson wrote: > 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 >> --- >> 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 Thanks for the comments. I'll fix them up for v2. Angus > >> +} >> + >> static void getvar_serialno(char *var_parameter, char *response) >> { >> const char *tmp = env_get("serial#"); >>