From mboxrd@z Thu Jan 1 00:00:00 1970 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 1F603C433EF for ; Fri, 17 Dec 2021 15:42:25 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C4524830F5; Fri, 17 Dec 2021 16:42:22 +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="DwEPA2bQ"; dkim=pass (1024-bit key) header.d=akkea.ca header.i=@akkea.ca header.b="G+kkufql"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 038C5830C4; Fri, 17 Dec 2021 16:42:20 +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 CDED2830F0 for ; Fri, 17 Dec 2021 16:42:16 +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 337CB4E2010; Fri, 17 Dec 2021 15:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1639755735; bh=yGSaVPqYcv0Fpj9facN+kwfUguN+NcQ/WrVDZPmfbMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DwEPA2bQaOmoPQpYRqTTojPxH/lBXK0DCCs1jNrz1jFGZQ7SqAcFqILBQZiP8CNY8 7WjptsynD34Xl6eooRBcivM1ipQ7LfTsedUpvBN03DPORjFdJ/cqPqaxy6GQd/4/Z6 aNf3kuK7JPcZyCBo8FSZEyW/S7VgRwzsa5Nj9FYg= 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 uymIVMmB0lIO; Fri, 17 Dec 2021 15:42:15 +0000 (UTC) Received: from midas.localdomain (S0106788a2041785e.gv.shawcable.net [24.108.106.191]) by node.akkea.ca (Postfix) with ESMTPSA id 9FAA24E2006; Fri, 17 Dec 2021 15:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1639755734; bh=yGSaVPqYcv0Fpj9facN+kwfUguN+NcQ/WrVDZPmfbMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=G+kkufqlcGG5JaRzagZTkG2T1T+raYDch3VoIW46lXHN64GsBEYfF5ztoZek16WEs SgQWKH3gtZD9Dy7Fd1ZNn63U+1LsGqWoKN/zW4cAlhGqNZ6hOhP6FzGg7Kfo5UMCDR JlEs6P5gpzyJPPoC4hmemRiaXBnnpuBk/yDta5vY= From: Angus Ainslie To: u-boot@lists.denx.de Cc: Sean Anderson , Simon Glass , Oleh Kravchenko , Patrick Delaunay , Roman Stratiienko , Marek Szyprowski , Angus Ainslie Subject: [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool Date: Fri, 17 Dec 2021 07:41:59 -0800 Message-Id: <20211217154200.326443-2-angus@akkea.ca> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211217154200.326443-1-angus@akkea.ca> References: <20211217154200.326443-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 uuu uses the blocksize to determine the upload size 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); + + if (!dev_desc) { + printf("** Block device %s %d not supported\n", + "mmc", 0); + return 0; + } + 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); +} + static void getvar_serialno(char *var_parameter, char *response) { const char *tmp = env_get("serial#"); -- 2.25.1