soc/intel/ptl: Update ME specification version to 21
[coreboot.git] / src / mainboard / google / gru / sdram_configs.c
blob02790b0762a34b13d4682826f09f71e83f88a8ef
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <boardid.h>
4 #include <cbfs.h>
5 #include <console/console.h>
6 #include <gpio.h>
7 #include <soc/sdram.h>
8 #include <stdio.h>
9 #include <types.h>
11 static const char *sdram_configs[] = {
12 /* Samsung K4E6E304EB-EGCE */
13 [0] = "sdram-lpddr3-generic-4GB",
15 /* Hynix H9CCNNNBJTALAR */
16 [1] = "sdram-lpddr3-generic-4GB",
18 /* Samsung K4E8E324EB-EGCF */
19 [3] = "sdram-lpddr3-generic-2GB",
21 /* Micron MT52L256M32D1PF */
22 [4] = "sdram-lpddr3-generic-2GB",
24 /* Samsung K4E6E304EB-EGCE, duplicate to 0 */
25 [5] = "sdram-lpddr3-generic-4GB",
27 /* Micron MT52L512M32D2PF */
28 [6] = "sdram-lpddr3-generic-4GB",
31 static struct rk3399_sdram_params params;
33 enum dram_speeds {
34 dram_800MHz = 800,
35 dram_928MHz = 928,
38 static enum dram_speeds get_sdram_target_mhz(void)
40 if (CONFIG(BOARD_GOOGLE_BOB) && board_id() < 4)
41 return dram_800MHz;
43 return dram_928MHz;
46 const struct rk3399_sdram_params *get_sdram_config(void)
48 char config_file[64];
49 uint32_t ramcode;
51 ramcode = ram_code();
52 if (ramcode >= ARRAY_SIZE(sdram_configs) ||
53 !snprintf(config_file, sizeof(config_file), "%s-%d",
54 sdram_configs[ramcode], get_sdram_target_mhz()) ||
55 (cbfs_load(config_file, &params, sizeof(params)) != sizeof(params)))
56 die("Cannot load SDRAM parameter file!");
58 return &params;