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.9 required=3.0 tests=BAYES_00,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 409BCC433EF for ; Wed, 15 Sep 2021 09:40:55 +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 13C4461247 for ; Wed, 15 Sep 2021 09:40:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 13C4461247 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de 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 684F582039; Wed, 15 Sep 2021 11:40:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1631698852; bh=XlE46y8HaacXNhCARaWFkSTwU5+gB+KHgXHpkegckD4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=xxf1T3JxHiyvGfUK5MntIJLnAJQt9SckJEx43TdAR9p4UDcyMEyQXrHh3N6oNGmb3 Te3z1nUdWspyr2dJCbAcnPqaK+DgZHSudL5f50Brw2kQcTqkEdMJRGwEbjT/3rvB3W 692YZCjljkdpmMeZhqDE0tOCb4BAyWLCrGaE43YgiZVC9pNTB/uHQtsXWhNgvJo4Ph kt1iuVm4N2qA1is8FXSEFKae9Z6vr1n4sc1J9BmLY8UFl9lutn7gqoBYiR55FhVXuc hDx6PSrsAyaEOBvgbj6vKopvVtlx5JIrXPN1+bWhRvh026e4FkUr1TtvD+GIwBPzOE tTHypbCG3GpCw== Received: from [IPv6:::1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 1101780098; Wed, 15 Sep 2021 11:40:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1631698849; bh=XlE46y8HaacXNhCARaWFkSTwU5+gB+KHgXHpkegckD4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=nJNUUDzUwhhRKAcSwHLx7AZI7gTa8MamSZ9bmPkIcv6EANrfokJpVDrY0zG2cPlzp aixIqzEkY9FN9qnyb51og4o4T/IyHQn4D5iOoKqsaHN10EPTvEnOY2YBZfvMUe9xP0 nwgKYxwaEBjFgoLN208ESU14dl/T65c5SkoFkkaMkqosQAaPMmHLyHaEgE449ZXCQx O1yXs7rc91sjVkpwyM+zvgdeR7uAgYWZrh4rIxGNy3NykndGeDMg8SENnoI/79yIMZ U6zVfDexMH6nfe8kYxbWNfNlGrF0FTKMwNvOqKcicxJdM3tPg4j3Oaj/GfMM08Zk/h wsmKj4msjEZXg== Subject: Re: [PATCH] cmd: mmc: Support mmc hwpartition user enh start - To: "Peng Fan (OSS)" , "u-boot@lists.denx.de" Cc: Fabio Estevam , Jaehoon Chung , Peng Fan , Stefano Babic References: <20210911211416.32390-1-marex@denx.de> <3d074004-5dee-2093-59ec-5e64e7177b17@oss.nxp.com> From: Marek Vasut Message-ID: <6d7f7bd5-ab4c-494e-c510-8948bfa94d97@denx.de> Date: Wed, 15 Sep 2021 11:40:48 +0200 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: <3d074004-5dee-2093-59ec-5e64e7177b17@oss.nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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/15/21 4:30 AM, Peng Fan (OSS) wrote: > > On 2021/9/12 5:14, Marek Vasut wrote: >> Add option to extend the hardware partition to the maximum size by >> using the '-' dash sign instead of $cnt parameter. This is useful >> in case we want to switch the entire eMMC user area into pSLC mode, >> especially in case the device may be populated with different size >> eMMCs. With this change, we do not have to calculate the number of >> blocks of the user area manually. >> >> To switch the pSLC mode for user area, use e.g. the following. >> WARNING: This is a one-time irreversible change. >> => mmc hwpartition user enh 0 - wrrel on complete >> >> Signed-off-by: Marek Vasut >> Cc: Fabio Estevam >> Cc: Jaehoon Chung >> Cc: Peng Fan >> Cc: Stefano Babic >> --- >>   cmd/mmc.c | 32 ++++++++++++++++++++++++++++---- >>   1 file changed, 28 insertions(+), 4 deletions(-) >> >> diff --git a/cmd/mmc.c b/cmd/mmc.c >> index c67ad762422..b6bb951347d 100644 >> --- a/cmd/mmc.c >> +++ b/cmd/mmc.c >> @@ -560,7 +560,32 @@ static int do_mmc_list(struct cmd_tbl *cmdtp, int >> flag, >>   } >>   #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) >> -static int parse_hwpart_user(struct mmc_hwpart_conf *pconf, >> +static void parse_hwpart_user_enh_size(struct mmc *mmc, >> +                       struct mmc_hwpart_conf *pconf, >> +                       char *argv) >> +{ >> +    int ret; >> + >> +    pconf->user.enh_size = 0; >> + >> +    if (!strcmp(argv, "-"))    { /* The rest of eMMC */ >> +        ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN); >> +        ret = mmc_send_ext_csd(mmc, ext_csd); >> +        if (ret) >> +            return; >> +        pconf->user.enh_size = >> +            ((ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT+2] << 16) + > > space before/after "+" > >> +            (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT+1] << 8) + > > Ditto > >> +            ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT]) * 1024 * > > Hardcode HC_WP_GRP_SIZE to 1024? > Per spec: > > (GP_SIZE_MULT_X_2 * 2^16 + GP_SIZE_MULT_X_1 * 2^8 + GP_SIZE_MULT_X_0 * > 2^0) * HC_WP_GRP_SIZE * HC_ERASE_GRP_SIZE * 512kBytes That "1024" above is that "* 512kBytes" part, in 512 Byte block units.