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 7994EC433EF for ; Wed, 29 Dec 2021 13:35:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B78D5830BE; Wed, 29 Dec 2021 14:35:53 +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="I2Ms646j"; dkim=pass (1024-bit key) header.d=akkea.ca header.i=@akkea.ca header.b="I2Ms646j"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C157830C0; Wed, 29 Dec 2021 14:35:51 +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 A9F0183084 for ; Wed, 29 Dec 2021 14:35:47 +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 D30354E2006; Wed, 29 Dec 2021 13:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1640784945; bh=oeU22ibJySTblnYa28g0p+Oew4Y4SY+JVSwCqFSAdLI=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=I2Ms646jkqR+AoF/ypnW0nqINasodx+2Hd0PYfxdNooWfWBJ6g0asui1yaO74hRec OSRdrF79tMTQZR6ZTfu02mq60VojJ7ns40ZmPBJPzZ0yyb0in2smGMLlVhbz7AUbRB iMIp3YxC8ToGrRqRhmHZpxlzBVPmugQ0m0GTMT2Y= 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 BDba5awv8fm9; Wed, 29 Dec 2021 13:35:45 +0000 (UTC) Received: from www.akkea.ca (li1434-30.members.linode.com [45.33.107.30]) by node.akkea.ca (Postfix) with ESMTPSA id 0D92F4E2003; Wed, 29 Dec 2021 13:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1640784945; bh=oeU22ibJySTblnYa28g0p+Oew4Y4SY+JVSwCqFSAdLI=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=I2Ms646jkqR+AoF/ypnW0nqINasodx+2Hd0PYfxdNooWfWBJ6g0asui1yaO74hRec OSRdrF79tMTQZR6ZTfu02mq60VojJ7ns40ZmPBJPzZ0yyb0in2smGMLlVhbz7AUbRB iMIp3YxC8ToGrRqRhmHZpxlzBVPmugQ0m0GTMT2Y= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 29 Dec 2021 05:35:45 -0800 From: Angus Ainslie To: Sean Anderson Cc: Oleh Kravchenko , u-boot@lists.denx.de, Simon Glass , Patrick Delaunay , Roman Stratiienko , Marek Szyprowski , kernel@puri.sm Subject: Re: [PATCH v2 1/1] fastboot: fb_getvar: Add getvar_logical_blocksize for NXP mfgtool In-Reply-To: <906fabbf-4297-8b03-ea39-6ea0109723aa@seco.com> References: <20211219161516.118636-1-angus@akkea.ca> <20211219161516.118636-2-angus@akkea.ca> <906fabbf-4297-8b03-ea39-6ea0109723aa@seco.com> Message-ID: <5f4413d03f81d7d7ba113d34b76a6749@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-28 08:59, Sean Anderson wrote: > Hi Angus, > >> NXP's mfgtool queies the mmc blocksize and splits a sparse image into >> blocksize size pieces for the upload. > > It's still not clear to me why this is necessary. fastboot (for > example) > transfers in blocks of max-download-size. Using the actual block size > seems like it would result in unnecessary overhead. > The version of uuu that we are using requires the block-size for the sparse upload https://source.puri.sm/Librem5/mfgtools/-/blob/pureos/amber/libuuu/fastboot.cpp#L501 It looks like the upstream version will default to 4096 if the block-size is not provided https://github.com/NXPmicro/mfgtools/blob/5397913ad97db422c1d70f314dedff4cb7d976b9/libuuu/fastboot.cpp#L642 Instead of making assumptions about the block size wouldn't it be better to provide one if requested ? We could also remove that being a required parameter from the uuu that we are using but that still leaves versions out there that won't work with a mainline u-boot. Thanks Angus > --Sean > >> Signed-off-by: Angus Ainslie >> --- >> drivers/fastboot/fb_getvar.c | 21 +++++++++++++++++++++ >> 1 file changed, 21 insertions(+) >> >> diff --git a/drivers/fastboot/fb_getvar.c >> b/drivers/fastboot/fb_getvar.c >> index d43f2cfee6..3cb72b8a54 100644 >> --- a/drivers/fastboot/fb_getvar.c >> +++ b/drivers/fastboot/fb_getvar.c >> @@ -26,6 +26,7 @@ static void getvar_has_slot(char *var_parameter, >> char *response); >> #endif >> #if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC) >> static void getvar_partition_type(char *part_name, char *response); >> +static void getvar_logical_blocksize(char *var_parameter, char >> *response); >> #endif >> #if CONFIG_IS_ENABLED(FASTBOOT_FLASH) >> static void getvar_partition_size(char *part_name, char *response); >> @@ -72,6 +73,9 @@ static const struct { >> }, { >> .variable = "partition-type", >> .dispatch = getvar_partition_type >> + }, { >> + .variable = "logical-block-size", >> + .dispatch = getvar_logical_blocksize >> #endif >> #if CONFIG_IS_ENABLED(FASTBOOT_FLASH) >> }, { >> @@ -232,6 +236,23 @@ static void getvar_partition_type(char >> *part_name, char *response) >> fastboot_okay(fs_get_type_name(), response); >> } >> } >> + >> +static void getvar_logical_blocksize(char *var_parameter, char >> *response) >> +{ >> + u32 blksz; >> + struct blk_desc *dev_desc; >> + >> + dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); >> + >> + if (!dev_desc) { >> + pr_err("** Block device mmc %d not supported\n", >> + CONFIG_FASTBOOT_FLASH_MMC_DEV); >> + fastboot_fail("Get logical_blocksize failed", response); >> + return; >> + } >> + >> + fastboot_response("OKAY", response, "0x%08x", dev_desc->blksz); >> +} >> #endif >> >> #if CONFIG_IS_ENABLED(FASTBOOT_FLASH) >>