diff options
author | Tom Rini <trini@konsulko.com> | 2021-09-02 18:39:28 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-09-02 18:39:28 -0400 |
commit | b35be5ed42c8453ac95432b6fbc0d42b1e91c758 (patch) | |
tree | c3f4646963db0c7010ca32b024b6947f4f144d9f /arch/arm/mach-snapdragon/misc.c | |
parent | 4bb7de1b3c09ada52ec42249221f745a6cbd3360 (diff) | |
parent | 6628813f9d400c49da4926f01833063a30151cdb (diff) |
Merge branch '2021-09-02-assorted-platform-and-bugfixes' into next
- Add position independent execution support for ARMv7
- Snapdragon, synquacer, vexpress64 fixes / improvements
- Prevent NEON register use on ARMv8
- Other assorted fixes
Diffstat (limited to 'arch/arm/mach-snapdragon/misc.c')
-rw-r--r-- | arch/arm/mach-snapdragon/misc.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/arch/arm/mach-snapdragon/misc.c b/arch/arm/mach-snapdragon/misc.c index 985625a548e..7d452f4529b 100644 --- a/arch/arm/mach-snapdragon/misc.c +++ b/arch/arm/mach-snapdragon/misc.c @@ -9,6 +9,7 @@ #include <common.h> #include <mmc.h> #include <asm/arch/misc.h> +#include <asm/unaligned.h> /* UNSTUFF_BITS macro taken from Linux Kernel: drivers/mmc/core/sd.c */ #define UNSTUFF_BITS(resp, start, size) \ @@ -33,21 +34,22 @@ u32 msm_board_serial(void) if (!mmc_dev) return 0; + if (mmc_init(mmc_dev)) + return 0; + return UNSTUFF_BITS(mmc_dev->cid, 16, 32); } void msm_generate_mac_addr(u8 *mac) { - int i; - char sn[9]; - - snprintf(sn, 9, "%08x", msm_board_serial()); - - /* fill in the mac with serialno, use locally adminstrated pool */ + /* use locally adminstrated pool */ mac[0] = 0x02; - mac[1] = 00; - for (i = 3; i >= 0; i--) { - mac[i + 2] = hextoul(&sn[2 * i], NULL); - sn[2 * i] = 0; - } + mac[1] = 0x00; + + /* + * Put the 32-bit serial number in the last 32-bit of the MAC address. + * Use big endian order so it is consistent with the serial number + * written as a hexadecimal string, e.g. 0x1234abcd -> 02:00:12:34:ab:cd + */ + put_unaligned_be32(msm_board_serial(), &mac[2]); } |