public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Angus Ainslie <angus@akkea.ca>, Stefan Roese <sr@denx.de>,
	Simon Glass <sjg@chromium.org>
Cc: kernel@puri.sm, u-boot@lists.denx.de
Subject: [PATCH u-boot] mmc: Use EXT_CSD_EXTRACT_BOOT_PART() macro for extracting boot part
Date: Sat, 11 Mar 2023 11:44:27 +0100	[thread overview]
Message-ID: <20230311104427.18421-1-pali@kernel.org> (raw)

Mask macro PART_ACCESS_MASK filter out access bits of emmc register and
macro EXT_CSD_EXTRACT_BOOT_PART() extracts boot part bits of emmc register.
So use EXT_CSD_EXTRACT_BOOT_PART() when extracting boot partition.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 board/purism/librem5/librem5.c | 2 +-
 cmd/mvebu/bubt.c               | 3 +--
 common/spl/spl_mmc.c           | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/board/purism/librem5/librem5.c b/board/purism/librem5/librem5.c
index caa02655fc49..386ed1b4fb22 100644
--- a/board/purism/librem5/librem5.c
+++ b/board/purism/librem5/librem5.c
@@ -41,7 +41,7 @@ int board_early_init_f(void)
 #if IS_ENABLED(CONFIG_LOAD_ENV_FROM_MMC_BOOT_PARTITION)
 uint board_mmc_get_env_part(struct mmc *mmc)
 {
-	uint part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+	uint part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 
 	if (part == 7)
 		part = 0;
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 49797b23144b..37ff9c455228 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -223,8 +223,7 @@ static int mmc_burn_image(size_t image_size)
 	orig_part = mmc->block_dev.hwpart;
 #endif
 
-	part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
-
+	part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 	if (part == 7)
 		part = 0;
 
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index bd5e6adf1ea6..a0722167044f 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -378,7 +378,7 @@ int default_spl_mmc_emmc_boot_partition(struct mmc *mmc)
 	 * 1 and 2 match up to boot0 / boot1 and 7 is user data
 	 * which is the first physical partition (0).
 	 */
-	part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+	part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 	if (part == 7)
 		part = 0;
 #endif
-- 
2.20.1


             reply	other threads:[~2023-03-11 10:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11 10:44 Pali Rohár [this message]
2023-03-30 16:47 ` [PATCH u-boot] mmc: Use EXT_CSD_EXTRACT_BOOT_PART() macro for extracting boot part Pali Rohár
2023-03-30 20:13 ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230311104427.18421-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=angus@akkea.ca \
    --cc=kernel@puri.sm \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox