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 X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31BC7C433F5 for ; Thu, 23 Sep 2021 12:03:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8BE1360EE7 for ; Thu, 23 Sep 2021 12:03:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8BE1360EE7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E67BD833B4; Thu, 23 Sep 2021 14:03:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com 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=samsung.com header.i=@samsung.com header.b="WoqDE/+1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DFCD482D5B; Thu, 23 Sep 2021 14:03:13 +0200 (CEST) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E440B82D5B for ; Thu, 23 Sep 2021 14:03:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jh80.chung@samsung.com Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210923120253epoutp04d903762a4d1abed5f4554ebf902bf23b~ncdqARqPz1261712617epoutp04N for ; Thu, 23 Sep 2021 12:02:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210923120253epoutp04d903762a4d1abed5f4554ebf902bf23b~ncdqARqPz1261712617epoutp04N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1632398573; bh=81HycoZB8Ltlu+OIasWopuv+QY8YBjs4luOr+3cvD/E=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=WoqDE/+1w50xlEO8uTnQ5rSaX50EB1Sr0T+CVfoKhLbYAGhbz2LaORI694OWoZ70U 4XJkxo500vXX/UN1gFn9ynunUpSK5Lk5kmJvEvWhwv5elw0STHXOySLJpT45Z+SRjA +hJDNUgMYq2I16+JF4MyvJgK5mOnHG5WTK/gQtJA= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20210923120252epcas1p40108c1218a31093d694df6a77516ee20~ncdpxSv4T0521705217epcas1p4d; Thu, 23 Sep 2021 12:02:52 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.38.237]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4HFYh73NXPz4x9Pt; Thu, 23 Sep 2021 12:02:47 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 69.1B.13696.7EC6C416; Thu, 23 Sep 2021 21:02:47 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20210923120246epcas1p307cfbcaf495646d2166b35c3dd83fd09~ncdj-DMvd0401104011epcas1p34; Thu, 23 Sep 2021 12:02:46 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210923120246epsmtrp28b7b6deb6ba62dba4004aa4f1ad81dcf~ncdj_Yki50209402094epsmtrp2T; Thu, 23 Sep 2021 12:02:46 +0000 (GMT) X-AuditID: b6c32a37-297ff70000023580-c0-614c6ce7ffdd Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 75.99.09091.6EC6C416; Thu, 23 Sep 2021 21:02:46 +0900 (KST) Received: from [10.113.113.235] (unknown [10.113.113.235]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210923120246epsmtip274e782f7a8ccf26a5662b2e8e18e5ec7~ncdjs65II0567805678epsmtip2c; Thu, 23 Sep 2021 12:02:46 +0000 (GMT) Subject: Re: [PATCH 2/2] cmd/mmc: add subcommand to query max enhanced partition size To: Matthias Schiffer , u-boot@lists.denx.de Cc: Peng Fan , Markus Niebel From: Jaehoon Chung Message-ID: <1369dd62-fda1-fa2a-7535-3afc23ca924c@samsung.com> Date: Thu, 23 Sep 2021 21:03:24 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <5bfd7e81fd5ed77e049d3fc3892c9175aa80e5cd.1632313515.git.matthias.schiffer@ew.tq-group.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvr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2/siP+tXRvCOlQMuJ1sNuoxFKckWioxVxUnAgAywuyJO4C AAA= X-CMS-MailID: 20210923120246epcas1p307cfbcaf495646d2166b35c3dd83fd09 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210922123106epcas1p159c23271eb3096b2438119e2ec733848 References: <1d862733e0d4ae632eb036de13aaf048b31b8bdb.1632313515.git.matthias.schiffer@ew.tq-group.com> <5bfd7e81fd5ed77e049d3fc3892c9175aa80e5cd.1632313515.git.matthias.schiffer@ew.tq-group.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 On 9/22/21 9:30 PM, Matthias Schiffer wrote: > From: Markus Niebel > > The new command prints the sector count and size in a human-readable > format and sets an environment variable for scripted handling. The > variable value is set in decimal to match what the 'mmc hwpartition' > command expects. > > The environment variable can be used for automated partitioning scripts, > for example the following would convert a whole eMMC to pSLC mode: > > mmc maxhwpartsectors > mmc hwpartition user enh 0 ${maxhwpartsectors} wrrel on complete I don't have any objection about this patch. If we can use more simpler variable name than maxhwpartsectors, I think that it's more useful. But it's not important. :) And Could you update doc/usage/mmc.rst about this command? Best Regards, Jaehoon Chung > > Signed-off-by: Markus Niebel > Signed-off-by: Matthias Schiffer > --- > > The human-readable output of the command could also be added to `mmc info`, > but it would still be great to have a separate command that sets an > environment variable for scripting, like this patch adds. > > > cmd/mmc.c | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/cmd/mmc.c b/cmd/mmc.c > index f1e30d0cf64..d0b33cc0494 100644 > --- a/cmd/mmc.c > +++ b/cmd/mmc.c > @@ -593,6 +593,33 @@ static int do_mmc_list(struct cmd_tbl *cmdtp, int flag, > } > > #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) > +static int do_mmc_maxhwpartsectors(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) > +{ > + struct mmc *mmc; > + u64 sectors; > + > + mmc = init_mmc_device(curr_device, false); > + if (!mmc) > + return CMD_RET_FAILURE; > + > + if (mmc_max_enhanced_size_sectors(mmc, §ors)) > + return CMD_RET_FAILURE; > + > + /* Ensure that the value fits in mmc_hwpart_conf::user.enh_size */ > + if (sectors > UINT_MAX) { > + puts("ERROR: sector count larger than UINT_MAX\n"); > + return CMD_RET_FAILURE; > + } > + > + env_set_ulong("maxhwpartsectors", sectors); > + > + printf("Maximum size of hardware partition: %u sectors (", > + (uint)sectors); > + print_size(sectors * 512, ")\n"); > + > + return 0; > +} > + > static int parse_hwpart_user(struct mmc_hwpart_conf *pconf, > int argc, char *const argv[]) > { > @@ -1021,6 +1048,7 @@ static struct cmd_tbl cmd_mmc[] = { > U_BOOT_CMD_MKENT(dev, 4, 0, do_mmc_dev, "", ""), > U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""), > #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) > + U_BOOT_CMD_MKENT(maxhwpartsectors, 1, 0, do_mmc_maxhwpartsectors, "", ""), > U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""), > #endif > #ifdef CONFIG_SUPPORT_EMMC_BOOT > @@ -1084,6 +1112,8 @@ U_BOOT_CMD( > "mmc list - lists available devices\n" > "mmc wp - power on write protect boot partitions\n" > #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) > + "mmc maxhwpartsectors - shows the maximum number of 512-byte blocks usable for hardware partitioning\n" > + " Sets env var maxhwpartsectors on success.\n" > "mmc hwpartition - does hardware partitioning\n" > " arguments (sizes in 512-byte blocks):\n" > " USER - <{on|off}>\n" >