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 20BFAC433F5 for ; Sun, 19 Dec 2021 16:15:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AFEF7830AF; Sun, 19 Dec 2021 17:15:45 +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="e6pl8Dur"; dkim=pass (1024-bit key) header.d=akkea.ca header.i=@akkea.ca header.b="e6pl8Dur"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC2CB80D1C; Sun, 19 Dec 2021 17:15:39 +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 5A6E182FE0 for ; Sun, 19 Dec 2021 17:15:36 +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 D5CDC4E200C; Sun, 19 Dec 2021 16:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1639930534; bh=ZjX1yrFbXlFz2OsKEdidgE5YnAhoEFoBOohQndMGsGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=e6pl8DurWyX3+5yoFsgBSqLNQZYck8Me17gToqg03/yMhuFCsPvCeRrMAWWoeNCvs hHtDeMjRIRfIfc2UN7VjhUV8EoWyZhTWtHtfHiy1R+CM6LXolBoFgKkXDJQElOtF6p lo6gSz1yJ6WPej4duEwrAK8U/Hkk8L6wfd8ZfgMY= 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 2ol7-eMMpHsS; Sun, 19 Dec 2021 16:15:34 +0000 (UTC) Received: from midas.localdomain (S0106788a2041785e.gv.shawcable.net [24.108.106.191]) by node.akkea.ca (Postfix) with ESMTPSA id 37F934E2006; Sun, 19 Dec 2021 16:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1639930534; bh=ZjX1yrFbXlFz2OsKEdidgE5YnAhoEFoBOohQndMGsGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=e6pl8DurWyX3+5yoFsgBSqLNQZYck8Me17gToqg03/yMhuFCsPvCeRrMAWWoeNCvs hHtDeMjRIRfIfc2UN7VjhUV8EoWyZhTWtHtfHiy1R+CM6LXolBoFgKkXDJQElOtF6p lo6gSz1yJ6WPej4duEwrAK8U/Hkk8L6wfd8ZfgMY= From: Angus Ainslie To: sean.anderson@seco.com, Oleh Kravchenko , u-boot@lists.denx.de Cc: Simon Glass , Patrick Delaunay , Roman Stratiienko , Marek Szyprowski , kernel@puri.sm, Angus Ainslie Subject: [PATCH v2 1/1] fastboot: fb_getvar: Add getvar_logical_blocksize for NXP mfgtool Date: Sun, 19 Dec 2021 08:15:16 -0800 Message-Id: <20211219161516.118636-2-angus@akkea.ca> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211219161516.118636-1-angus@akkea.ca> References: <20211219161516.118636-1-angus@akkea.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 NXP's mfgtool queies the mmc blocksize and splits a sparse image into blocksize size pieces for the upload. 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) -- 2.25.1