diff options
Diffstat (limited to 'src/mainboard/google/gru/sdram_configs.c')
-rw-r--r-- | src/mainboard/google/gru/sdram_configs.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/mainboard/google/gru/sdram_configs.c b/src/mainboard/google/gru/sdram_configs.c index b9f77d0f1f..eec8a0d3c0 100644 --- a/src/mainboard/google/gru/sdram_configs.c +++ b/src/mainboard/google/gru/sdram_configs.c @@ -23,23 +23,40 @@ #include <types.h> static const char *sdram_configs[] = { - [0] = "sdram-lpddr3-hynix-4GB", - [3] = "sdram-lpddr3-samsung-2GB-24EB", - [4] = "sdram-lpddr3-micron-2GB", - [5] = "sdram-lpddr3-samsung-4GB-04EB", - [6] = "sdram-lpddr3-micron-4GB", + [0] = "sdram-lpddr3-hynix-4GB", + [3] = "sdram-lpddr3-samsung-2GB-24EB", + [4] = "sdram-lpddr3-micron-2GB", + [5] = "sdram-lpddr3-samsung-4GB-04EB", + [6] = "sdram-lpddr3-micron-4GB", }; static struct rk3399_sdram_params params; +enum dram_speeds { + dram_800MHz = 800, + dram_928MHz = 928, +}; + +static enum dram_speeds get_sdram_target_mhz(void) +{ + if (IS_ENABLED(CONFIG_BOARD_GOOGLE_BOB) && board_id() < 4) + return dram_800MHz; + + return dram_928MHz; +} + const struct rk3399_sdram_params *get_sdram_config() { + char config_file[64]; uint32_t ramcode; ramcode = ram_code(); - if (ramcode >= ARRAY_SIZE(sdram_configs) || !sdram_configs[ramcode] || - (cbfs_boot_load_struct(sdram_configs[ramcode], - ¶ms, sizeof(params)) != sizeof(params))) + if (ramcode >= ARRAY_SIZE(sdram_configs) || + !snprintf(config_file, sizeof(config_file), "%s-%d", + sdram_configs[ramcode], get_sdram_target_mhz()) || + (cbfs_boot_load_struct(config_file, ¶ms, + sizeof(params)) != sizeof(params))) die("Cannot load SDRAM parameter file!"); + return ¶ms; } |