]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: dragonboard410c: Drop UNSTUFF_BITS() macro
authorStephan Gerhold <stephan.gerhold@linaro.org>
Mon, 7 Apr 2025 16:59:25 +0000 (18:59 +0200)
committerCaleb Connolly <caleb.connolly@linaro.org>
Fri, 11 Apr 2025 13:32:21 +0000 (15:32 +0200)
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>
board/qualcomm/dragonboard410c/dragonboard410c.c

index 744ac4fda8e228c1a5b6bce26d66a31741863d13..b3f9a097e783fd684bdb96163c7ed7fc304eb0f3 100644 (file)
 
 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)