aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/reef/romstage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/google/reef/romstage.c')
-rw-r--r--src/mainboard/google/reef/romstage.c66
1 files changed, 58 insertions, 8 deletions
diff --git a/src/mainboard/google/reef/romstage.c b/src/mainboard/google/reef/romstage.c
index ecf6fa502d..2c68b60d46 100644
--- a/src/mainboard/google/reef/romstage.c
+++ b/src/mainboard/google/reef/romstage.c
@@ -13,8 +13,10 @@
* GNU General Public License for more details.
*/
+#include <gpio.h>
#include <soc/meminit.h>
#include <soc/romstage.h>
+#include "gpio.h"
static const struct lpddr4_swizzle_cfg board_swizzle = {
/* CH0_DQA[0:31] SoC pins -> U22 LPDDR4 module pins */
@@ -60,15 +62,63 @@ static const struct lpddr4_swizzle_cfg board_swizzle = {
},
};
+/*
+ * Proto boards didn't have a memory SKU id. The configuration pins use
+ * an internal weak pullup with stronger pulldowns for the 0 bits. As
+ * proto boards didn't use the memory SKU pins the SKU id reads as 4'b1111,
+ * i.e. 15.
+ */
+#define PROTO_SKU 15
+
+static const struct lpddr4_sku skus[] = {
+ /* K4F6E304HB-MGCJ - both logical channels */
+ [0] = {
+ .speed = LP4_SPEED_2400,
+ .ch0_density = LP4_16Gb_DENSITY,
+ .ch1_density = LP4_16Gb_DENSITY,
+ },
+ /* K4F8E304HB-MGCJ - both logical channels */
+ [1] = {
+ .speed = LP4_SPEED_2400,
+ .ch0_density = LP4_8Gb_DENSITY,
+ .ch1_density = LP4_8Gb_DENSITY,
+ },
+ /* MT53B512M32D2NP-062WT:C - both logical channels */
+ [2] = {
+ .speed = LP4_SPEED_2400,
+ .ch0_density = LP4_16Gb_DENSITY,
+ .ch1_density = LP4_16Gb_DENSITY,
+ /* MT53B256M32D1NP-062 WT:C - both logical channels */
+ },
+ [3] = {
+ .speed = LP4_SPEED_2400,
+ .ch0_density = LP4_8Gb_DENSITY,
+ .ch1_density = LP4_8Gb_DENSITY,
+ },
+ /* K4F8E304HB-MGCH - both logical channels */
+ [PROTO_SKU] = {
+ .speed = LP4_SPEED_2400,
+ .ch0_density = LP4_8Gb_DENSITY,
+ .ch1_density = LP4_8Gb_DENSITY,
+ },
+};
+
+static const struct lpddr4_cfg lp4cfg = {
+ .skus = skus,
+ .num_skus = ARRAY_SIZE(skus),
+ .swizzle_config = &board_swizzle,
+};
+
void mainboard_memory_init_params(struct FSPM_UPD *memupd)
{
- struct FSP_M_CONFIG *cfg = &memupd->FspmConfig;
+ int mem_sku;
+ gpio_t pads[] = { MEM_CONFIG3, MEM_CONFIG2, MEM_CONFIG1, MEM_CONFIG0 };
+
+ /*
+ * Read memory SKU id with internal pullups enabled to handle
+ * proto boards with no SKU id pins.
+ */
+ mem_sku = gpio_pullup_base2_value(pads, ARRAY_SIZE(pads));
- /* Use a default 2400 speed. */
- meminit_lpddr4(cfg, LP4_SPEED_2400);
- /* Enable both logical channels with a 8Gb density. */
- meminit_lpddr4_enable_channel(cfg, LP4_LCH0, LP4_8Gb_DENSITY,
- &board_swizzle);
- meminit_lpddr4_enable_channel(cfg, LP4_LCH1, LP4_8Gb_DENSITY,
- &board_swizzle);
+ meminit_lpddr4_by_sku(&memupd->FspmConfig, &lp4cfg, mem_sku);
}