1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/dram/common.h>
7 * \brief Calculate the CRC of a DDR SPD data
9 * @param spd pointer to raw SPD data
10 * @param len length of data in SPD
12 * @return the CRC of the SPD data
14 u16
ddr_crc16(const u8
*ptr
, int n_crc
)
19 while (--n_crc
>= 0) {
20 crc
= crc
^ ((int)*ptr
++ << 8);
21 for (i
= 0; i
< 8; ++i
)
23 crc
= (crc
<< 1) ^ 0x1021;