google/gru: support 800M/928M frequency for bob

The coreboot had no supported the different frequency for gru yet.
e.g:
we can't support the bob to run ddr 800M for rev3 board and
run 928M for rev4 board.

So, in order to support the 800M and 928M ddr frequency for bob different
boards. We will use the ram_id and board_id to select the board on bob.

Change-Id: I613050292a09ff56f4636d7af285075e32259ef4
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Reviewed-on: https://review.coreboot.org/19558
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Caesar Wang 2017-05-05 17:37:42 +08:00 committed by Julius Werner
parent e085a8a359
commit 6c4e574872
14 changed files with 37 additions and 48 deletions

View File

@ -95,13 +95,6 @@ config MAINBOARD_PART_NUMBER
default "Gru" if BOARD_GOOGLE_GRU default "Gru" if BOARD_GOOGLE_GRU
default "Kevin" if BOARD_GOOGLE_KEVIN default "Kevin" if BOARD_GOOGLE_KEVIN
# The default max sdram freq is 933M(actually 928M dpll), and
# 800M is another choice.
config MAX_SDRAM_FREQ
int
default 800 if BOARD_GOOGLE_BOB
default 933
config GBB_HWID config GBB_HWID
string string
depends on CHROMEOS depends on CHROMEOS

View File

@ -13,7 +13,7 @@
## GNU General Public License for more details. ## GNU General Public License for more details.
## ##
subdirs-y += sdram_params_$(CONFIG_MAX_SDRAM_FREQ)/ subdirs-y += sdram_params/
bootblock-y += bootblock.c bootblock-y += bootblock.c
bootblock-y += chromeos.c bootblock-y += chromeos.c

View File

@ -23,23 +23,40 @@
#include <types.h> #include <types.h>
static const char *sdram_configs[] = { static const char *sdram_configs[] = {
[0] = "sdram-lpddr3-hynix-4GB", [0] = "sdram-lpddr3-hynix-4GB",
[3] = "sdram-lpddr3-samsung-2GB-24EB", [3] = "sdram-lpddr3-samsung-2GB-24EB",
[4] = "sdram-lpddr3-micron-2GB", [4] = "sdram-lpddr3-micron-2GB",
[5] = "sdram-lpddr3-samsung-4GB-04EB", [5] = "sdram-lpddr3-samsung-4GB-04EB",
[6] = "sdram-lpddr3-micron-4GB", [6] = "sdram-lpddr3-micron-4GB",
}; };
static struct rk3399_sdram_params params; 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() const struct rk3399_sdram_params *get_sdram_config()
{ {
char config_file[64];
uint32_t ramcode; uint32_t ramcode;
ramcode = ram_code(); ramcode = ram_code();
if (ramcode >= ARRAY_SIZE(sdram_configs) || !sdram_configs[ramcode] || if (ramcode >= ARRAY_SIZE(sdram_configs) ||
(cbfs_boot_load_struct(sdram_configs[ramcode], !snprintf(config_file, sizeof(config_file), "%s-%d",
&params, sizeof(params)) != sizeof(params))) sdram_configs[ramcode], get_sdram_target_mhz()) ||
(cbfs_boot_load_struct(config_file, &params,
sizeof(params)) != sizeof(params)))
die("Cannot load SDRAM parameter file!"); die("Cannot load SDRAM parameter file!");
return &params; return &params;
} }

View File

@ -14,10 +14,17 @@
## ##
sdram-params := sdram-params :=
sdram-params += sdram-lpddr3-samsung-2GB-24EB sdram-params += sdram-lpddr3-hynix-4GB-928
sdram-params += sdram-lpddr3-micron-2GB
sdram-params += sdram-lpddr3-samsung-4GB-04EB sdram-params += sdram-lpddr3-micron-2GB-800
sdram-params += sdram-lpddr3-micron-4GB sdram-params += sdram-lpddr3-micron-2GB-928
sdram-params += sdram-lpddr3-micron-4GB-800
sdram-params += sdram-lpddr3-micron-4GB-928
sdram-params += sdram-lpddr3-samsung-2GB-24EB-800
sdram-params += sdram-lpddr3-samsung-2GB-24EB-928
sdram-params += sdram-lpddr3-samsung-4GB-04EB-800
sdram-params += sdram-lpddr3-samsung-4GB-04EB-928
$(foreach params,$(sdram-params), \ $(foreach params,$(sdram-params), \
$(eval cbfs-files-y += $(params)) \ $(eval cbfs-files-y += $(params)) \

View File

@ -1,28 +0,0 @@
##
## This file is part of the coreboot project.
##
## Copyright 2016 Rockchip Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
sdram-params :=
sdram-params += sdram-lpddr3-hynix-4GB
sdram-params += sdram-lpddr3-samsung-2GB-24EB
sdram-params += sdram-lpddr3-micron-2GB
sdram-params += sdram-lpddr3-samsung-4GB-04EB
sdram-params += sdram-lpddr3-micron-4GB
$(foreach params,$(sdram-params), \
$(eval cbfs-files-y += $(params)) \
$(eval $(params)-file := $(params).c:struct) \
$(eval $(params)-type := struct) \
$(eval $(params)-compression := $(CBFS_COMPRESS_FLAG)) \
)