[{"id":3063005,"web_url":"http://patchwork.ozlabs.org/comment/3063005/","msgid":"<48c07c08-5b73-1586-ee51-1969bffb5e92@denx.de>","list_archive_url":null,"date":"2023-02-22T09:55:54","subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","submitter":{"id":13,"url":"http://patchwork.ozlabs.org/api/people/13/","name":"Stefan Roese","email":"sr@denx.de"},"content":"Hi Pali,\n\nOn 2/21/23 21:18, Pali Rohár wrote:\n> Support for burning into the correct eMMC HW boot partition was broken and\n> removed in commit 96be2f072768 (\"mvebu: bubt: Drop dead code\"). Reimplement\n> this functionality and bring it back again.\n> \n> Fixes: 96be2f072768 (\"mvebu: bubt: Drop dead code\")\n> Signed-off-by: Pali Rohár <pali@kernel.org>\n> ---\n>   cmd/mvebu/bubt.c       | 53 ++++++++++++++++++++++++++++++++++++++----\n>   doc/mvebu/cmd/bubt.txt | 21 ++++++++++++-----\n>   2 files changed, 63 insertions(+), 11 deletions(-)\n> \n> diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c\n> index 2bcdf145f64a..4bad9a69527c 100644\n> --- a/cmd/mvebu/bubt.c\n> +++ b/cmd/mvebu/bubt.c\n> @@ -189,6 +189,11 @@ static int mmc_burn_image(size_t image_size)\n>   #ifdef CONFIG_BLK\n>   \tstruct blk_desc *blk_desc;\n>   #endif\n> +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> +\tu8\t\tpart;\n> +\tu8\t\torig_part;\n> +#endif\n> +\n>   \tmmc = find_mmc_device(mmc_dev_num);\n>   \tif (!mmc) {\n>   \t\tprintf(\"No SD/MMC/eMMC card found\\n\");\n> @@ -202,6 +207,38 @@ static int mmc_burn_image(size_t image_size)\n>   \t\treturn err;\n>   \t}\n>   \n> +#ifdef CONFIG_BLK\n> +\tblk_desc = mmc_get_blk_desc(mmc);\n> +\tif (!blk_desc) {\n> +\t\tprintf(\"Error - failed to obtain block descriptor\\n\");\n> +\t\treturn -ENODEV;\n> +\t}\n> +#endif\n\nThis #ifdef usage really gets out of hand IMHO. Yes I know, you did not\nintroduce it here. Still, perhaps some of this can be moved to using\nIS_ENABLED or CONFIG_IS_ENABLED instead?\n\nAnd I just checked that \"bubt\" is not compiled for CONFIG_BLK not\ndefined. So please depend this file on CONFIG_BLK in Kconfig and remove\nthe non CONFIG_BLK code here.\n\nThanks,\nStefan\n\n> +\n> +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> +#ifdef CONFIG_BLK\n> +\torig_part = blk_desc->hwpart;\n> +#else\n> +\torig_part = mmc->block_dev.hwpart;\n> +#endif\n> +\n> +\tpart = (mmc->part_config >> 3) & PART_ACCESS_MASK;\n> +\n> +\tif (part == 7)\n> +\t\tpart = 0;\n> +\n> +#ifdef CONFIG_BLK\n> +\terr = blk_dselect_hwpart(blk_desc, part);\n> +#else\n> +\terr = mmc_switch_part(mmc, part);\n> +#endif\n> +\n> +\tif (err) {\n> +\t\tprintf(\"Error - MMC partition switch failed\\n\");\n> +\t\treturn err;\n> +\t}\n> +#endif\n> +\n>   \t/* SD reserves LBA-0 for MBR and boots from LBA-1,\n>   \t * MMC/eMMC boots from LBA-0\n>   \t */\n> @@ -211,11 +248,6 @@ static int mmc_burn_image(size_t image_size)\n>   \tif (image_size % mmc->write_bl_len)\n>   \t\tblk_count += 1;\n>   \n> -\tblk_desc = mmc_get_blk_desc(mmc);\n> -\tif (!blk_desc) {\n> -\t\tprintf(\"Error - failed to obtain block descriptor\\n\");\n> -\t\treturn -ENODEV;\n> -\t}\n>   \tblk_written = blk_dwrite(blk_desc, start_lba, blk_count,\n>   \t\t\t\t (void *)get_load_addr());\n>   #else\n> @@ -227,6 +259,17 @@ static int mmc_burn_image(size_t image_size)\n>   \t\t\t\t\t\t start_lba, blk_count,\n>   \t\t\t\t\t\t (void *)get_load_addr());\n>   #endif /* CONFIG_BLK */\n> +\n> +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> +#ifdef CONFIG_BLK\n> +\terr = blk_dselect_hwpart(blk_desc, orig_part);\n> +#else\n> +\terr = mmc_switch_part(mmc, orig_part);\n> +#endif\n> +\tif (err)\n> +\t\tprintf(\"Error - MMC failed to switch back to original partition\\n\");\n> +#endif\n> +\n>   \tif (blk_written != blk_count) {\n>   \t\tprintf(\"Error - written %#lx blocks\\n\", blk_written);\n>   \t\treturn -ENOSPC;\n> diff --git a/doc/mvebu/cmd/bubt.txt b/doc/mvebu/cmd/bubt.txt\n> index 6051243f1165..1fe1f07dd187 100644\n> --- a/doc/mvebu/cmd/bubt.txt\n> +++ b/doc/mvebu/cmd/bubt.txt\n> @@ -14,8 +14,7 @@ Examples:\n>   \n>   Notes:\n>   - For the TFTP interface set serverip and ipaddr.\n> -- To burn image to SD/eMMC device, the target is defined\n> -  by parameters CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART.\n> +- To burn image to SD/eMMC device, the target is defined by HW partition.\n>   \n>   Bubt command details (burn image step by-step)\n>   ----------------------------------------------\n> @@ -40,10 +39,20 @@ Notes:\n>     Number 0 is used for user data partition and should not be utilized for storing\n>     boot images and U-Boot environment in RAW mode since it will break file system\n>     structures usually located here.\n> -  The default boot partition is BOOT0. It is selected by the following parameter:\n> -  CONFIG_SYS_MMC_ENV_PART=1\n> -  Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1.\n> -  Please never use partition number 0 here!\n> +\n> +  Currently configured boot partition can be printed by command:\n> +  # mmc partconf 0\n> +  (search for BOOT_PARTITION_ACCESS output, number 7 is user data)\n> +\n> +  Change it to BOOT0:\n> +  # mmc partconf 0 0 1 1\n> +\n> +  Change it to BOOT1:\n> +  # mmc partconf 0 0 2 2\n> +\n> +  Change it to user data:\n> +  # mmc partconf 0 0 7 0\n> +\n>   - The partition number is ignored if the target device is SD card.\n>   - The boot image offset starts at block 0 for eMMC and block 1 for SD devices.\n>     The block 0 on SD devices is left for MBR storage.\n\nViele Grüße,\nStefan Roese","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)","legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256\n header.s=phobos-20191101 header.b=aGdLIH5B;\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=denx.de","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=denx.de","phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4PMBPR5qW2z23yZ\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Feb 2023 20:56:10 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 71E85858D6;\n\tWed, 22 Feb 2023 10:56:01 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id 68FBE8590C; Wed, 22 Feb 2023 10:56:00 +0100 (CET)","from mout-u-107.mailbox.org (mout-u-107.mailbox.org\n [IPv6:2001:67c:2050:101:465::107])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id CF36A8572F\n for <u-boot@lists.denx.de>; Wed, 22 Feb 2023 10:55:57 +0100 (CET)","from smtp102.mailbox.org (smtp102.mailbox.org\n [IPv6:2001:67c:2050:b231:465::102])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest\n SHA256) (No client certificate requested)\n by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4PMBP74Klrz9sWd;\n Wed, 22 Feb 2023 10:55:55 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de;\n\ts=phobos-20191101; t=1677059761;\n\tbh=oeBXMGlC1hOqwq/LNHf5vh8s2bT4S8zDDnnlwnjitiw=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=aGdLIH5BQp/JcsT9WFgFM7EsXvCBV7RzaLFpain5+T8cwX7vbUpmeo8SiPsaA3Lpr\n\t ONfdJ5UhmEoDFrw/tc3Z6WPLxImxyIQaJXChH5PqM+eXHqj1BynvhuhZstnhjjsuKp\n\t xUjfFl3KJ8gKgOXhg62lVb+sIPvERG0a2/QSULorycQNmlxFfKU8POrCRe+Lyt8dep\n\t 6bqmkO2W32q1PyMEQ6xFunF8FujNS9J4hJd0zkxHmPdBHx91ym3+MGRF7aD8EPxSax\n\t fi5Zy3PjoQKHvdjNQl3zKRy7m7ojtjaC3nhZ5sQzQMuKN/iDcQbXK96RC32r3PcG3g\n\t xryf79Hxe/LGg==","X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_NONE,\n SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.2","Message-ID":"<48c07c08-5b73-1586-ee51-1969bffb5e92@denx.de>","Date":"Wed, 22 Feb 2023 10:55:54 +0100","MIME-Version":"1.0","Subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","Content-Language":"en-US","To":"=?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>, u-boot@lists.denx.de","Cc":"Tony Dinh <mibodhi@gmail.com>, Josua Mayer <josua@solid-run.com>","References":"<20230221201925.9644-1-pali@kernel.org>\n <20230221201925.9644-21-pali@kernel.org>","From":"Stefan Roese <sr@denx.de>","In-Reply-To":"<20230221201925.9644-21-pali@kernel.org>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-Rspamd-Queue-Id":"4PMBP74Klrz9sWd","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.6 at phobos.denx.de","X-Virus-Status":"Clean"}},{"id":3063430,"web_url":"http://patchwork.ozlabs.org/comment/3063430/","msgid":"<20230222180627.fzk5yu4awuya75dz@pali>","list_archive_url":null,"date":"2023-02-22T18:06:27","subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","submitter":{"id":78810,"url":"http://patchwork.ozlabs.org/api/people/78810/","name":"Pali Rohár","email":"pali@kernel.org"},"content":"On Wednesday 22 February 2023 10:55:54 Stefan Roese wrote:\n> Hi Pali,\n> \n> On 2/21/23 21:18, Pali Rohár wrote:\n> > Support for burning into the correct eMMC HW boot partition was broken and\n> > removed in commit 96be2f072768 (\"mvebu: bubt: Drop dead code\"). Reimplement\n> > this functionality and bring it back again.\n> > \n> > Fixes: 96be2f072768 (\"mvebu: bubt: Drop dead code\")\n> > Signed-off-by: Pali Rohár <pali@kernel.org>\n> > ---\n> >   cmd/mvebu/bubt.c       | 53 ++++++++++++++++++++++++++++++++++++++----\n> >   doc/mvebu/cmd/bubt.txt | 21 ++++++++++++-----\n> >   2 files changed, 63 insertions(+), 11 deletions(-)\n> > \n> > diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c\n> > index 2bcdf145f64a..4bad9a69527c 100644\n> > --- a/cmd/mvebu/bubt.c\n> > +++ b/cmd/mvebu/bubt.c\n> > @@ -189,6 +189,11 @@ static int mmc_burn_image(size_t image_size)\n> >   #ifdef CONFIG_BLK\n> >   \tstruct blk_desc *blk_desc;\n> >   #endif\n> > +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> > +\tu8\t\tpart;\n> > +\tu8\t\torig_part;\n> > +#endif\n> > +\n> >   \tmmc = find_mmc_device(mmc_dev_num);\n> >   \tif (!mmc) {\n> >   \t\tprintf(\"No SD/MMC/eMMC card found\\n\");\n> > @@ -202,6 +207,38 @@ static int mmc_burn_image(size_t image_size)\n> >   \t\treturn err;\n> >   \t}\n> > +#ifdef CONFIG_BLK\n> > +\tblk_desc = mmc_get_blk_desc(mmc);\n> > +\tif (!blk_desc) {\n> > +\t\tprintf(\"Error - failed to obtain block descriptor\\n\");\n> > +\t\treturn -ENODEV;\n> > +\t}\n> > +#endif\n> \n> This #ifdef usage really gets out of hand IMHO. Yes I know, you did not\n> introduce it here. Still, perhaps some of this can be moved to using\n> IS_ENABLED or CONFIG_IS_ENABLED instead?\n> \n> And I just checked that \"bubt\" is not compiled for CONFIG_BLK not\n> defined. So please depend this file on CONFIG_BLK in Kconfig and remove\n> the non CONFIG_BLK code here.\n\nbubt is used for at least 4 different mvebu platforms (AXP, A38x, A3720,\nA7K) and every one has slightly different code and configuration.\n\nI really do not know if all those configurations support CONFIG_BLK, so\nI decided to let it as it was before to eliminate possible issues.\n\n> Thanks,\n> Stefan\n> \n> > +\n> > +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> > +#ifdef CONFIG_BLK\n> > +\torig_part = blk_desc->hwpart;\n> > +#else\n> > +\torig_part = mmc->block_dev.hwpart;\n> > +#endif\n> > +\n> > +\tpart = (mmc->part_config >> 3) & PART_ACCESS_MASK;\n> > +\n> > +\tif (part == 7)\n> > +\t\tpart = 0;\n> > +\n> > +#ifdef CONFIG_BLK\n> > +\terr = blk_dselect_hwpart(blk_desc, part);\n> > +#else\n> > +\terr = mmc_switch_part(mmc, part);\n> > +#endif\n> > +\n> > +\tif (err) {\n> > +\t\tprintf(\"Error - MMC partition switch failed\\n\");\n> > +\t\treturn err;\n> > +\t}\n> > +#endif\n> > +\n> >   \t/* SD reserves LBA-0 for MBR and boots from LBA-1,\n> >   \t * MMC/eMMC boots from LBA-0\n> >   \t */\n> > @@ -211,11 +248,6 @@ static int mmc_burn_image(size_t image_size)\n> >   \tif (image_size % mmc->write_bl_len)\n> >   \t\tblk_count += 1;\n> > -\tblk_desc = mmc_get_blk_desc(mmc);\n> > -\tif (!blk_desc) {\n> > -\t\tprintf(\"Error - failed to obtain block descriptor\\n\");\n> > -\t\treturn -ENODEV;\n> > -\t}\n> >   \tblk_written = blk_dwrite(blk_desc, start_lba, blk_count,\n> >   \t\t\t\t (void *)get_load_addr());\n> >   #else\n> > @@ -227,6 +259,17 @@ static int mmc_burn_image(size_t image_size)\n> >   \t\t\t\t\t\t start_lba, blk_count,\n> >   \t\t\t\t\t\t (void *)get_load_addr());\n> >   #endif /* CONFIG_BLK */\n> > +\n> > +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> > +#ifdef CONFIG_BLK\n> > +\terr = blk_dselect_hwpart(blk_desc, orig_part);\n> > +#else\n> > +\terr = mmc_switch_part(mmc, orig_part);\n> > +#endif\n> > +\tif (err)\n> > +\t\tprintf(\"Error - MMC failed to switch back to original partition\\n\");\n> > +#endif\n> > +\n> >   \tif (blk_written != blk_count) {\n> >   \t\tprintf(\"Error - written %#lx blocks\\n\", blk_written);\n> >   \t\treturn -ENOSPC;\n> > diff --git a/doc/mvebu/cmd/bubt.txt b/doc/mvebu/cmd/bubt.txt\n> > index 6051243f1165..1fe1f07dd187 100644\n> > --- a/doc/mvebu/cmd/bubt.txt\n> > +++ b/doc/mvebu/cmd/bubt.txt\n> > @@ -14,8 +14,7 @@ Examples:\n> >   Notes:\n> >   - For the TFTP interface set serverip and ipaddr.\n> > -- To burn image to SD/eMMC device, the target is defined\n> > -  by parameters CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART.\n> > +- To burn image to SD/eMMC device, the target is defined by HW partition.\n> >   Bubt command details (burn image step by-step)\n> >   ----------------------------------------------\n> > @@ -40,10 +39,20 @@ Notes:\n> >     Number 0 is used for user data partition and should not be utilized for storing\n> >     boot images and U-Boot environment in RAW mode since it will break file system\n> >     structures usually located here.\n> > -  The default boot partition is BOOT0. It is selected by the following parameter:\n> > -  CONFIG_SYS_MMC_ENV_PART=1\n> > -  Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1.\n> > -  Please never use partition number 0 here!\n> > +\n> > +  Currently configured boot partition can be printed by command:\n> > +  # mmc partconf 0\n> > +  (search for BOOT_PARTITION_ACCESS output, number 7 is user data)\n> > +\n> > +  Change it to BOOT0:\n> > +  # mmc partconf 0 0 1 1\n> > +\n> > +  Change it to BOOT1:\n> > +  # mmc partconf 0 0 2 2\n> > +\n> > +  Change it to user data:\n> > +  # mmc partconf 0 0 7 0\n> > +\n> >   - The partition number is ignored if the target device is SD card.\n> >   - The boot image offset starts at block 0 for eMMC and block 1 for SD devices.\n> >     The block 0 on SD devices is left for MBR storage.\n> \n> Viele Grüße,\n> Stefan Roese\n> \n> -- \n> DENX Software Engineering GmbH,      Managing Director: Erika Unter\n> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany\n> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)","legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=h5A2kM4b;\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.b=\"h5A2kM4b\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org","phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4PMPHb1FB0z23yZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Feb 2023 05:06:51 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 6AC3985B1B;\n\tWed, 22 Feb 2023 19:06:46 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id BD46E85AEF; Wed, 22 Feb 2023 19:06:44 +0100 (CET)","from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 4B9FA85B25\n for <u-boot@lists.denx.de>; Wed, 22 Feb 2023 19:06:42 +0100 (CET)","from smtp.kernel.org (relay.kernel.org [52.25.139.140])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by ams.source.kernel.org (Postfix) with ESMTPS id F3F2FB81649;\n Wed, 22 Feb 2023 18:06:31 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 6ED1DC433A7;\n Wed, 22 Feb 2023 18:06:30 +0000 (UTC)","by pali.im (Postfix)\n id 93B2172C; Wed, 22 Feb 2023 19:06:27 +0100 (CET)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,\n SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1677089190;\n bh=+N1c7ZJWSW9pjtq1dJ6/xeX1tkN78k5cw9A/yAANKxU=;\n h=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n b=h5A2kM4b3VOV9NfNsJS5vKFGenR6Jg/HRJTt+zD8OrA9xgLUI6pv+OgKtOOE4KfO7\n muGnYjZaNJFxvNVYVgy3Qfygdj5OYMSOh6U+Wm7EK2rHNbI0/+iKd78xZZ5E8tHo5x\n 1rqQeyNOlcxEBdTblzHOsSkbnh2yN7veWFs3soflWf5JVhhWoXMkiYdVJn0ID83gGG\n K67yt5+T+vT5ol0fbJ37y/h/VpPQZi4mF9FDVSyxUp36WNAtpw6GcjTl+Eob5/yjbN\n ngY1hri8kZ5LzS9NSPXCfhu+WijAefRNImkHUZzAB6FYDVRfc4IIDLcXdcnM9xNy1Q\n 3Sw2Ez19CBH/Q==","Date":"Wed, 22 Feb 2023 19:06:27 +0100","From":"Pali =?utf-8?b?Um9ow6Fy?= <pali@kernel.org>","To":"Stefan Roese <sr@denx.de>","Cc":"u-boot@lists.denx.de, Tony Dinh <mibodhi@gmail.com>,\n Josua Mayer <josua@solid-run.com>","Subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","Message-ID":"<20230222180627.fzk5yu4awuya75dz@pali>","References":"<20230221201925.9644-1-pali@kernel.org>\n <20230221201925.9644-21-pali@kernel.org>\n <48c07c08-5b73-1586-ee51-1969bffb5e92@denx.de>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<48c07c08-5b73-1586-ee51-1969bffb5e92@denx.de>","User-Agent":"NeoMutt/20180716","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.6 at phobos.denx.de","X-Virus-Status":"Clean"}},{"id":3063734,"web_url":"http://patchwork.ozlabs.org/comment/3063734/","msgid":"<5ce408ca-b33b-f8ee-bbf9-6cc40ed65c83@denx.de>","list_archive_url":null,"date":"2023-02-23T06:17:26","subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","submitter":{"id":13,"url":"http://patchwork.ozlabs.org/api/people/13/","name":"Stefan Roese","email":"sr@denx.de"},"content":"Hi Pali,\n\nOn 2/22/23 19:06, Pali Rohár wrote:\n> On Wednesday 22 February 2023 10:55:54 Stefan Roese wrote:\n>> Hi Pali,\n>>\n>> On 2/21/23 21:18, Pali Rohár wrote:\n>>> Support for burning into the correct eMMC HW boot partition was broken and\n>>> removed in commit 96be2f072768 (\"mvebu: bubt: Drop dead code\"). Reimplement\n>>> this functionality and bring it back again.\n>>>\n>>> Fixes: 96be2f072768 (\"mvebu: bubt: Drop dead code\")\n>>> Signed-off-by: Pali Rohár <pali@kernel.org>\n>>> ---\n>>>    cmd/mvebu/bubt.c       | 53 ++++++++++++++++++++++++++++++++++++++----\n>>>    doc/mvebu/cmd/bubt.txt | 21 ++++++++++++-----\n>>>    2 files changed, 63 insertions(+), 11 deletions(-)\n>>>\n>>> diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c\n>>> index 2bcdf145f64a..4bad9a69527c 100644\n>>> --- a/cmd/mvebu/bubt.c\n>>> +++ b/cmd/mvebu/bubt.c\n>>> @@ -189,6 +189,11 @@ static int mmc_burn_image(size_t image_size)\n>>>    #ifdef CONFIG_BLK\n>>>    \tstruct blk_desc *blk_desc;\n>>>    #endif\n>>> +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n>>> +\tu8\t\tpart;\n>>> +\tu8\t\torig_part;\n>>> +#endif\n>>> +\n>>>    \tmmc = find_mmc_device(mmc_dev_num);\n>>>    \tif (!mmc) {\n>>>    \t\tprintf(\"No SD/MMC/eMMC card found\\n\");\n>>> @@ -202,6 +207,38 @@ static int mmc_burn_image(size_t image_size)\n>>>    \t\treturn err;\n>>>    \t}\n>>> +#ifdef CONFIG_BLK\n>>> +\tblk_desc = mmc_get_blk_desc(mmc);\n>>> +\tif (!blk_desc) {\n>>> +\t\tprintf(\"Error - failed to obtain block descriptor\\n\");\n>>> +\t\treturn -ENODEV;\n>>> +\t}\n>>> +#endif\n>>\n>> This #ifdef usage really gets out of hand IMHO. Yes I know, you did not\n>> introduce it here. Still, perhaps some of this can be moved to using\n>> IS_ENABLED or CONFIG_IS_ENABLED instead?\n>>\n>> And I just checked that \"bubt\" is not compiled for CONFIG_BLK not\n>> defined. So please depend this file on CONFIG_BLK in Kconfig and remove\n>> the non CONFIG_BLK code here.\n> \n> bubt is used for at least 4 different mvebu platforms (AXP, A38x, A3720,\n> A7K) and every one has slightly different code and configuration.\n> \n> I really do not know if all those configurations support CONFIG_BLK, so\n> I decided to let it as it was before to eliminate possible issues.\n\nAs mentioned above, I've checked this myself before sending the\nsuggestion yesterday. No platform compiling this cmd has CONFIG_BLK\ndisabled.\n\nMy understanding is that CONFIG_BLK will be required at some time and\nall non CONFIG_BLK code will get dropped.\n\nStill, if you feel you don't want to make this change, as it's not\nreally related to your current patchset, then this is no showstopper.\n\nThanks,\nStefan\n\n>> Thanks,\n>> Stefan\n>>\n>>> +\n>>> +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n>>> +#ifdef CONFIG_BLK\n>>> +\torig_part = blk_desc->hwpart;\n>>> +#else\n>>> +\torig_part = mmc->block_dev.hwpart;\n>>> +#endif\n>>> +\n>>> +\tpart = (mmc->part_config >> 3) & PART_ACCESS_MASK;\n>>> +\n>>> +\tif (part == 7)\n>>> +\t\tpart = 0;\n>>> +\n>>> +#ifdef CONFIG_BLK\n>>> +\terr = blk_dselect_hwpart(blk_desc, part);\n>>> +#else\n>>> +\terr = mmc_switch_part(mmc, part);\n>>> +#endif\n>>> +\n>>> +\tif (err) {\n>>> +\t\tprintf(\"Error - MMC partition switch failed\\n\");\n>>> +\t\treturn err;\n>>> +\t}\n>>> +#endif\n>>> +\n>>>    \t/* SD reserves LBA-0 for MBR and boots from LBA-1,\n>>>    \t * MMC/eMMC boots from LBA-0\n>>>    \t */\n>>> @@ -211,11 +248,6 @@ static int mmc_burn_image(size_t image_size)\n>>>    \tif (image_size % mmc->write_bl_len)\n>>>    \t\tblk_count += 1;\n>>> -\tblk_desc = mmc_get_blk_desc(mmc);\n>>> -\tif (!blk_desc) {\n>>> -\t\tprintf(\"Error - failed to obtain block descriptor\\n\");\n>>> -\t\treturn -ENODEV;\n>>> -\t}\n>>>    \tblk_written = blk_dwrite(blk_desc, start_lba, blk_count,\n>>>    \t\t\t\t (void *)get_load_addr());\n>>>    #else\n>>> @@ -227,6 +259,17 @@ static int mmc_burn_image(size_t image_size)\n>>>    \t\t\t\t\t\t start_lba, blk_count,\n>>>    \t\t\t\t\t\t (void *)get_load_addr());\n>>>    #endif /* CONFIG_BLK */\n>>> +\n>>> +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n>>> +#ifdef CONFIG_BLK\n>>> +\terr = blk_dselect_hwpart(blk_desc, orig_part);\n>>> +#else\n>>> +\terr = mmc_switch_part(mmc, orig_part);\n>>> +#endif\n>>> +\tif (err)\n>>> +\t\tprintf(\"Error - MMC failed to switch back to original partition\\n\");\n>>> +#endif\n>>> +\n>>>    \tif (blk_written != blk_count) {\n>>>    \t\tprintf(\"Error - written %#lx blocks\\n\", blk_written);\n>>>    \t\treturn -ENOSPC;\n>>> diff --git a/doc/mvebu/cmd/bubt.txt b/doc/mvebu/cmd/bubt.txt\n>>> index 6051243f1165..1fe1f07dd187 100644\n>>> --- a/doc/mvebu/cmd/bubt.txt\n>>> +++ b/doc/mvebu/cmd/bubt.txt\n>>> @@ -14,8 +14,7 @@ Examples:\n>>>    Notes:\n>>>    - For the TFTP interface set serverip and ipaddr.\n>>> -- To burn image to SD/eMMC device, the target is defined\n>>> -  by parameters CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART.\n>>> +- To burn image to SD/eMMC device, the target is defined by HW partition.\n>>>    Bubt command details (burn image step by-step)\n>>>    ----------------------------------------------\n>>> @@ -40,10 +39,20 @@ Notes:\n>>>      Number 0 is used for user data partition and should not be utilized for storing\n>>>      boot images and U-Boot environment in RAW mode since it will break file system\n>>>      structures usually located here.\n>>> -  The default boot partition is BOOT0. It is selected by the following parameter:\n>>> -  CONFIG_SYS_MMC_ENV_PART=1\n>>> -  Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1.\n>>> -  Please never use partition number 0 here!\n>>> +\n>>> +  Currently configured boot partition can be printed by command:\n>>> +  # mmc partconf 0\n>>> +  (search for BOOT_PARTITION_ACCESS output, number 7 is user data)\n>>> +\n>>> +  Change it to BOOT0:\n>>> +  # mmc partconf 0 0 1 1\n>>> +\n>>> +  Change it to BOOT1:\n>>> +  # mmc partconf 0 0 2 2\n>>> +\n>>> +  Change it to user data:\n>>> +  # mmc partconf 0 0 7 0\n>>> +\n>>>    - The partition number is ignored if the target device is SD card.\n>>>    - The boot image offset starts at block 0 for eMMC and block 1 for SD devices.\n>>>      The block 0 on SD devices is left for MBR storage.\n>>\n>> Viele Grüße,\n>> Stefan Roese\n>>\n>> -- \n>> DENX Software Engineering GmbH,      Managing Director: Erika Unter\n>> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany\n>> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de\n\nViele Grüße,\nStefan Roese","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)","legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256\n header.s=phobos-20191101 header.b=ljWkkxPo;\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=denx.de","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=denx.de","phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4PMjVr4Nz2z240V\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Feb 2023 17:17:40 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 4854285ADC;\n\tThu, 23 Feb 2023 07:17:35 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id 64CC38551B; Thu, 23 Feb 2023 07:17:33 +0100 (CET)","from mout-u-107.mailbox.org (mout-u-107.mailbox.org\n [IPv6:2001:67c:2050:101:465::107])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 3150085AFC\n for <u-boot@lists.denx.de>; Thu, 23 Feb 2023 07:17:30 +0100 (CET)","from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest\n SHA256) (No client certificate requested)\n by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4PMjVb712nz9sR4;\n Thu, 23 Feb 2023 07:17:27 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de;\n\ts=phobos-20191101; t=1677133055;\n\tbh=/1zUCn9MEM/91Id7qdny10iiTYzoREdVftoY8mCaqgk=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=ljWkkxPo7gKb6QK2A46JMKpBGJXv9vWvKCys9/ckfRdoIJXNJVGE/O9xKkXP2zrY0\n\t 28kRq+NE4ffsVnzbwBTqxk1GDjm7JjLs1ibouIf0dYC81kdzHF5pxww3AESWGBXVsG\n\t 6Z+Ir0OuvcmNjHv6wxqhMlM+gEUr1gSi/OB/jC7twGV5zmXajVRVLg4eSOlUVamERB\n\t nyuzd0EAgFvaAj/8PvGx2hM/3Q26hKeps695VxzQZsQkqrlV3xrzK5IoPoemQmRWqZ\n\t n6FDB3N45iHwJzDleisSwrf3/nlDX94NpiPSq6Yt8XT7m1ZNs+pHMY3/clxZfSGTR8\n\t KqGws0OExh1cw==","X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_NONE,\n SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.2","Message-ID":"<5ce408ca-b33b-f8ee-bbf9-6cc40ed65c83@denx.de>","Date":"Thu, 23 Feb 2023 07:17:26 +0100","MIME-Version":"1.0","Subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","Content-Language":"en-US","To":"=?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>","Cc":"u-boot@lists.denx.de, Tony Dinh <mibodhi@gmail.com>,\n Josua Mayer <josua@solid-run.com>","References":"<20230221201925.9644-1-pali@kernel.org>\n <20230221201925.9644-21-pali@kernel.org>\n <48c07c08-5b73-1586-ee51-1969bffb5e92@denx.de>\n <20230222180627.fzk5yu4awuya75dz@pali>","From":"Stefan Roese <sr@denx.de>","In-Reply-To":"<20230222180627.fzk5yu4awuya75dz@pali>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.6 at phobos.denx.de","X-Virus-Status":"Clean"}},{"id":3063757,"web_url":"http://patchwork.ozlabs.org/comment/3063757/","msgid":"<20230223075525.p74636ezb5phwlpu@pali>","list_archive_url":null,"date":"2023-02-23T07:55:25","subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","submitter":{"id":78810,"url":"http://patchwork.ozlabs.org/api/people/78810/","name":"Pali Rohár","email":"pali@kernel.org"},"content":"On Thursday 23 February 2023 07:17:26 Stefan Roese wrote:\n> Hi Pali,\n> \n> On 2/22/23 19:06, Pali Rohár wrote:\n> > On Wednesday 22 February 2023 10:55:54 Stefan Roese wrote:\n> > > Hi Pali,\n> > > \n> > > On 2/21/23 21:18, Pali Rohár wrote:\n> > > > Support for burning into the correct eMMC HW boot partition was broken and\n> > > > removed in commit 96be2f072768 (\"mvebu: bubt: Drop dead code\"). Reimplement\n> > > > this functionality and bring it back again.\n> > > > \n> > > > Fixes: 96be2f072768 (\"mvebu: bubt: Drop dead code\")\n> > > > Signed-off-by: Pali Rohár <pali@kernel.org>\n> > > > ---\n> > > >    cmd/mvebu/bubt.c       | 53 ++++++++++++++++++++++++++++++++++++++----\n> > > >    doc/mvebu/cmd/bubt.txt | 21 ++++++++++++-----\n> > > >    2 files changed, 63 insertions(+), 11 deletions(-)\n> > > > \n> > > > diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c\n> > > > index 2bcdf145f64a..4bad9a69527c 100644\n> > > > --- a/cmd/mvebu/bubt.c\n> > > > +++ b/cmd/mvebu/bubt.c\n> > > > @@ -189,6 +189,11 @@ static int mmc_burn_image(size_t image_size)\n> > > >    #ifdef CONFIG_BLK\n> > > >    \tstruct blk_desc *blk_desc;\n> > > >    #endif\n> > > > +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> > > > +\tu8\t\tpart;\n> > > > +\tu8\t\torig_part;\n> > > > +#endif\n> > > > +\n> > > >    \tmmc = find_mmc_device(mmc_dev_num);\n> > > >    \tif (!mmc) {\n> > > >    \t\tprintf(\"No SD/MMC/eMMC card found\\n\");\n> > > > @@ -202,6 +207,38 @@ static int mmc_burn_image(size_t image_size)\n> > > >    \t\treturn err;\n> > > >    \t}\n> > > > +#ifdef CONFIG_BLK\n> > > > +\tblk_desc = mmc_get_blk_desc(mmc);\n> > > > +\tif (!blk_desc) {\n> > > > +\t\tprintf(\"Error - failed to obtain block descriptor\\n\");\n> > > > +\t\treturn -ENODEV;\n> > > > +\t}\n> > > > +#endif\n> > > \n> > > This #ifdef usage really gets out of hand IMHO. Yes I know, you did not\n> > > introduce it here. Still, perhaps some of this can be moved to using\n> > > IS_ENABLED or CONFIG_IS_ENABLED instead?\n> > > \n> > > And I just checked that \"bubt\" is not compiled for CONFIG_BLK not\n> > > defined. So please depend this file on CONFIG_BLK in Kconfig and remove\n> > > the non CONFIG_BLK code here.\n> > \n> > bubt is used for at least 4 different mvebu platforms (AXP, A38x, A3720,\n> > A7K) and every one has slightly different code and configuration.\n> > \n> > I really do not know if all those configurations support CONFIG_BLK, so\n> > I decided to let it as it was before to eliminate possible issues.\n> \n> As mentioned above, I've checked this myself before sending the\n> suggestion yesterday. No platform compiling this cmd has CONFIG_BLK\n> disabled.\n\nOK! In this case I would rather send an additional cleanup patch which\nremoves usage of non-CONFIG_BLK code from the whole command. As it does\nnot make sense to not-have it in MMC and have it in SATA.\n\n> My understanding is that CONFIG_BLK will be required at some time and\n> all non CONFIG_BLK code will get dropped.\n> \n> Still, if you feel you don't want to make this change, as it's not\n> really related to your current patchset, then this is no showstopper.\n> \n> Thanks,\n> Stefan\n> \n> > > Thanks,\n> > > Stefan\n> > > \n> > > > +\n> > > > +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> > > > +#ifdef CONFIG_BLK\n> > > > +\torig_part = blk_desc->hwpart;\n> > > > +#else\n> > > > +\torig_part = mmc->block_dev.hwpart;\n> > > > +#endif\n> > > > +\n> > > > +\tpart = (mmc->part_config >> 3) & PART_ACCESS_MASK;\n> > > > +\n> > > > +\tif (part == 7)\n> > > > +\t\tpart = 0;\n> > > > +\n> > > > +#ifdef CONFIG_BLK\n> > > > +\terr = blk_dselect_hwpart(blk_desc, part);\n> > > > +#else\n> > > > +\terr = mmc_switch_part(mmc, part);\n> > > > +#endif\n> > > > +\n> > > > +\tif (err) {\n> > > > +\t\tprintf(\"Error - MMC partition switch failed\\n\");\n> > > > +\t\treturn err;\n> > > > +\t}\n> > > > +#endif\n> > > > +\n> > > >    \t/* SD reserves LBA-0 for MBR and boots from LBA-1,\n> > > >    \t * MMC/eMMC boots from LBA-0\n> > > >    \t */\n> > > > @@ -211,11 +248,6 @@ static int mmc_burn_image(size_t image_size)\n> > > >    \tif (image_size % mmc->write_bl_len)\n> > > >    \t\tblk_count += 1;\n> > > > -\tblk_desc = mmc_get_blk_desc(mmc);\n> > > > -\tif (!blk_desc) {\n> > > > -\t\tprintf(\"Error - failed to obtain block descriptor\\n\");\n> > > > -\t\treturn -ENODEV;\n> > > > -\t}\n> > > >    \tblk_written = blk_dwrite(blk_desc, start_lba, blk_count,\n> > > >    \t\t\t\t (void *)get_load_addr());\n> > > >    #else\n> > > > @@ -227,6 +259,17 @@ static int mmc_burn_image(size_t image_size)\n> > > >    \t\t\t\t\t\t start_lba, blk_count,\n> > > >    \t\t\t\t\t\t (void *)get_load_addr());\n> > > >    #endif /* CONFIG_BLK */\n> > > > +\n> > > > +#ifdef CONFIG_SUPPORT_EMMC_BOOT\n> > > > +#ifdef CONFIG_BLK\n> > > > +\terr = blk_dselect_hwpart(blk_desc, orig_part);\n> > > > +#else\n> > > > +\terr = mmc_switch_part(mmc, orig_part);\n> > > > +#endif\n> > > > +\tif (err)\n> > > > +\t\tprintf(\"Error - MMC failed to switch back to original partition\\n\");\n> > > > +#endif\n> > > > +\n> > > >    \tif (blk_written != blk_count) {\n> > > >    \t\tprintf(\"Error - written %#lx blocks\\n\", blk_written);\n> > > >    \t\treturn -ENOSPC;\n> > > > diff --git a/doc/mvebu/cmd/bubt.txt b/doc/mvebu/cmd/bubt.txt\n> > > > index 6051243f1165..1fe1f07dd187 100644\n> > > > --- a/doc/mvebu/cmd/bubt.txt\n> > > > +++ b/doc/mvebu/cmd/bubt.txt\n> > > > @@ -14,8 +14,7 @@ Examples:\n> > > >    Notes:\n> > > >    - For the TFTP interface set serverip and ipaddr.\n> > > > -- To burn image to SD/eMMC device, the target is defined\n> > > > -  by parameters CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART.\n> > > > +- To burn image to SD/eMMC device, the target is defined by HW partition.\n> > > >    Bubt command details (burn image step by-step)\n> > > >    ----------------------------------------------\n> > > > @@ -40,10 +39,20 @@ Notes:\n> > > >      Number 0 is used for user data partition and should not be utilized for storing\n> > > >      boot images and U-Boot environment in RAW mode since it will break file system\n> > > >      structures usually located here.\n> > > > -  The default boot partition is BOOT0. It is selected by the following parameter:\n> > > > -  CONFIG_SYS_MMC_ENV_PART=1\n> > > > -  Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1.\n> > > > -  Please never use partition number 0 here!\n> > > > +\n> > > > +  Currently configured boot partition can be printed by command:\n> > > > +  # mmc partconf 0\n> > > > +  (search for BOOT_PARTITION_ACCESS output, number 7 is user data)\n> > > > +\n> > > > +  Change it to BOOT0:\n> > > > +  # mmc partconf 0 0 1 1\n> > > > +\n> > > > +  Change it to BOOT1:\n> > > > +  # mmc partconf 0 0 2 2\n> > > > +\n> > > > +  Change it to user data:\n> > > > +  # mmc partconf 0 0 7 0\n> > > > +\n> > > >    - The partition number is ignored if the target device is SD card.\n> > > >    - The boot image offset starts at block 0 for eMMC and block 1 for SD devices.\n> > > >      The block 0 on SD devices is left for MBR storage.\n> > > \n> > > Viele Grüße,\n> > > Stefan Roese\n> > > \n> > > -- \n> > > DENX Software Engineering GmbH,      Managing Director: Erika Unter\n> > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany\n> > > Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de\n> \n> Viele Grüße,\n> Stefan Roese\n> \n> -- \n> DENX Software Engineering GmbH,      Managing Director: Erika Unter\n> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany\n> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)","legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=npbYC3gF;\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.b=\"npbYC3gF\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org","phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4PMlgx5mv4z2461\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Feb 2023 18:55:41 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id F3DFE8574F;\n\tThu, 23 Feb 2023 08:55:34 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id 9407D8574F; Thu, 23 Feb 2023 08:55:33 +0100 (CET)","from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 50F1185738\n for <u-boot@lists.denx.de>; Thu, 23 Feb 2023 08:55:30 +0100 (CET)","from smtp.kernel.org (relay.kernel.org [52.25.139.140])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by ams.source.kernel.org (Postfix) with ESMTPS id BF88AB80EF9;\n Thu, 23 Feb 2023 07:55:29 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 1E0A0C433EF;\n Thu, 23 Feb 2023 07:55:28 +0000 (UTC)","by pali.im (Postfix)\n id 857F13AD; Thu, 23 Feb 2023 08:55:25 +0100 (CET)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,\n SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1677138928;\n bh=L6pOsqv01ghJF7H+oP38N5F5D/ZxL/sk6jaWBQkwH0g=;\n h=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n b=npbYC3gFFL/KtDadsbO/rOPDfzLArpleOd+2LeU3BTMt1IMlFUX2iefW78d5CU1PM\n 7N4naHnZb4cj+6ehprBwbU/pC69MAJZhaX9Ff5enN7Z4Vn+ICqXKh07r0Z9oJbeqaj\n /9gKKs2DM1jQIsZFxL9++Ww8kgByZorf/NR7p2jW5uCQFOs2Vswdr1IzBQD4hnhSt9\n r9m9v+TYvAVb2AGQvQ8fMGOyC3MkmXPe1lIUzbone34y6zlC+3NIo23aG7dkiADoAy\n XMW1h07/sh/10SW8ZY9RCLxh0CbjkOnmAIHW5B/7HqSAiEuhqnL54AHXd2LzWl6v5+\n PV8m7GuuFVJWw==","Date":"Thu, 23 Feb 2023 08:55:25 +0100","From":"Pali =?utf-8?b?Um9ow6Fy?= <pali@kernel.org>","To":"Stefan Roese <sr@denx.de>","Cc":"u-boot@lists.denx.de, Tony Dinh <mibodhi@gmail.com>,\n Josua Mayer <josua@solid-run.com>","Subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","Message-ID":"<20230223075525.p74636ezb5phwlpu@pali>","References":"<20230221201925.9644-1-pali@kernel.org>\n <20230221201925.9644-21-pali@kernel.org>\n <48c07c08-5b73-1586-ee51-1969bffb5e92@denx.de>\n <20230222180627.fzk5yu4awuya75dz@pali>\n <5ce408ca-b33b-f8ee-bbf9-6cc40ed65c83@denx.de>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<5ce408ca-b33b-f8ee-bbf9-6cc40ed65c83@denx.de>","User-Agent":"NeoMutt/20180716","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.6 at phobos.denx.de","X-Virus-Status":"Clean"}},{"id":3063761,"web_url":"http://patchwork.ozlabs.org/comment/3063761/","msgid":"<bf75ca0e-2795-01e4-7e82-f5a89950eae8@denx.de>","list_archive_url":null,"date":"2023-02-23T08:15:27","subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","submitter":{"id":13,"url":"http://patchwork.ozlabs.org/api/people/13/","name":"Stefan Roese","email":"sr@denx.de"},"content":"Hi Pali,\n\nOn 2/23/23 08:55, Pali Rohár wrote:\n\n<snip>\n\n>>>> This #ifdef usage really gets out of hand IMHO. Yes I know, you did not\n>>>> introduce it here. Still, perhaps some of this can be moved to using\n>>>> IS_ENABLED or CONFIG_IS_ENABLED instead?\n>>>>\n>>>> And I just checked that \"bubt\" is not compiled for CONFIG_BLK not\n>>>> defined. So please depend this file on CONFIG_BLK in Kconfig and remove\n>>>> the non CONFIG_BLK code here.\n>>>\n>>> bubt is used for at least 4 different mvebu platforms (AXP, A38x, A3720,\n>>> A7K) and every one has slightly different code and configuration.\n>>>\n>>> I really do not know if all those configurations support CONFIG_BLK, so\n>>> I decided to let it as it was before to eliminate possible issues.\n>>\n>> As mentioned above, I've checked this myself before sending the\n>> suggestion yesterday. No platform compiling this cmd has CONFIG_BLK\n>> disabled.\n> \n> OK! In this case I would rather send an additional cleanup patch which\n> removes usage of non-CONFIG_BLK code from the whole command. As it does\n> not make sense to not-have it in MMC and have it in SATA.\n\nHandling this via a follow-up patch is even better. Thanks for working\non this.\n\nThanks,\nStefan","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)","legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256\n header.s=phobos-20191101 header.b=tRDt74EA;\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=denx.de","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=denx.de","phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4PMm751dSKz240V\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Feb 2023 19:15:45 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id BBA2085ADF;\n\tThu, 23 Feb 2023 09:15:35 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id BE40985AEB; Thu, 23 Feb 2023 09:15:32 +0100 (CET)","from mout-u-204.mailbox.org (mout-u-204.mailbox.org\n [IPv6:2001:67c:2050:101:465::204])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 6DC15859F8\n for <u-boot@lists.denx.de>; Thu, 23 Feb 2023 09:15:30 +0100 (CET)","from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest\n SHA256) (No client certificate requested)\n by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4PMm6m1Xr9z9sWR;\n Thu, 23 Feb 2023 09:15:28 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de;\n\ts=phobos-20191101; t=1677140136;\n\tbh=1kIVbSkW6mTCecF5szIYVzvDKVNy6UmaR54MBVcWMQE=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=tRDt74EAQzuMlN2o5jqXo2y+2Ezft8P1ONu+CAJzkT1QW83AbpsC5MnPU/gQ2EvMc\n\t 5uTmEaHFYPXL3WtIqMjWlxpOpDnzSKVZ2o/4t7uAte4r6qgr+JXsfblbUvlgG1RCbX\n\t 2cUjK9zbAG7gdne6syG8jN5qYnrfxt/u1nsTd7RNdCWJ+ZTP8kxd5+VZihNl3Hfdsv\n\t n9IUPVq2KPYtN4yqa537VTU9O7MlLpxZq+lMQcSTmEfZQOaNzvFFxM+pP9lbU/U6Q5\n\t WVrVLZsL+eOq4GOn+IEWGOl22hRBM4l72Ph4GuVWevNA5Yr/NaAUUdOxUiyFTa9da3\n\t cIFldRbWpCz8w==","X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_NONE,\n SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.2","Message-ID":"<bf75ca0e-2795-01e4-7e82-f5a89950eae8@denx.de>","Date":"Thu, 23 Feb 2023 09:15:27 +0100","MIME-Version":"1.0","Subject":"Re: [PATCH RFC u-boot-mvebu 20/59] cmd: mvebu/bubt: Add support for\n selecting eMMC HW partition","Content-Language":"en-US","To":"=?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>","Cc":"u-boot@lists.denx.de, Tony Dinh <mibodhi@gmail.com>,\n Josua Mayer <josua@solid-run.com>","References":"<20230221201925.9644-1-pali@kernel.org>\n <20230221201925.9644-21-pali@kernel.org>\n <48c07c08-5b73-1586-ee51-1969bffb5e92@denx.de>\n <20230222180627.fzk5yu4awuya75dz@pali>\n <5ce408ca-b33b-f8ee-bbf9-6cc40ed65c83@denx.de>\n <20230223075525.p74636ezb5phwlpu@pali>","From":"Stefan Roese <sr@denx.de>","In-Reply-To":"<20230223075525.p74636ezb5phwlpu@pali>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.6 at phobos.denx.de","X-Virus-Status":"Clean"}}]