device/dram: Add function to convert freq to MT/s for (LP)DDR5

As the frequency field in the SMBIOS type 17 table is deprecated,
we need to provide the maximum and configured speed in MT/s. Add
a method to convert from frequency to MT/s using a lookup table.

BUG=b:239000826
TEST=Build and verify with other patches in train

Change-Id: I0402b33a667f7d72918365a6a79b13c5b1719c0d
Signed-off-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66953
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
Matt DeVillier
2022-08-22 17:27:11 -05:00
committed by Martin L Roth
parent 65fe21f1c9
commit bb9d106eab
3 changed files with 150 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef DEVICE_DRAM_DDR5_H
#define DEVICE_DRAM_DDR5_H
/**
* @file ddr5.h
*
* \brief Utilities for decoding (LP)DDR5 info
*/
#include <device/dram/common.h>
#include <types.h>
/**
* Converts DDR5 clock speed in MHz to the standard reported speed in MT/s
*/
uint16_t ddr5_speed_mhz_to_reported_mts(uint16_t speed_mhz);
#endif /* DEVICE_DRAM_DDR5_H */