summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Gerhold <stephan.gerhold@linaro.org>2025-04-07 18:59:25 +0200
committerCaleb Connolly <caleb.connolly@linaro.org>2025-04-11 15:32:21 +0200
commitf7d3009b39d4f0ba0300e9312f51387d3ed343e2 (patch)
tree03310b69b2b1c93a8aa7a74ad70d0d1e2f48fb64
parent2cc2dc23360144129ab2f5e39356fae93c479dcc (diff)
board: dragonboard410c: Drop UNSTUFF_BITS() macro
This was originally taken from Linux, but at this point it's an inline function upstream and no longer a macro. Given that we just want to extract the serial number from the MMC CID, let's just inline that specifically. This is also the style used in the MMC core code within U-Boot. Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Link: https://lore.kernel.org/r/20250407-db410c-fixes-v1-4-524aefbc8bb4@linaro.org Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
-rw-r--r--board/qualcomm/dragonboard410c/dragonboard410c.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 744ac4fda8e..b3f9a097e78 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -22,21 +22,6 @@
DECLARE_GLOBAL_DATA_PTR;
-/* UNSTUFF_BITS macro taken from Linux Kernel: drivers/mmc/core/sd.c */
-#define UNSTUFF_BITS(resp, start, size) \
- ({ \
- const int __size = size; \
- const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
- const int __off = 3 - ((start) / 32); \
- const int __shft = (start) & 31; \
- u32 __res; \
- \
- __res = resp[__off] >> __shft; \
- if (__size + __shft > 32) \
- __res |= resp[__off - 1] << ((32 - __shft) % 32); \
- __res & __mask; \
- })
-
static u32 msm_board_serial(void)
{
struct mmc *mmc_dev;
@@ -48,7 +33,8 @@ static u32 msm_board_serial(void)
if (mmc_init(mmc_dev))
return 0;
- return UNSTUFF_BITS(mmc_dev->cid, 16, 32);
+ /* MMC serial number */
+ return mmc_dev->cid[2] << 16 | mmc_dev->cid[3] >> 16;
}
static void msm_generate_mac_addr(u8 *mac)