Hello Julius Werner, Philip Chen,
I'd like you to do a code review. Please visit
https://review.coreboot.org/19558
to review the following change.
Change subject: google/gru: support 800M/928M frequency for bob ......................................................................
google/gru: support 800M/928M frequency for bob
In order to support the 800M/928M frequency for bob. 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 --- M src/mainboard/google/gru/Kconfig M src/mainboard/google/gru/Makefile.inc M src/mainboard/google/gru/sdram_configs.c M src/mainboard/google/gru/sdram_params_800/Makefile.inc M src/mainboard/google/gru/sdram_params_933/Makefile.inc 5 files changed, 32 insertions(+), 18 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/58/19558/1
diff --git a/src/mainboard/google/gru/Kconfig b/src/mainboard/google/gru/Kconfig index 0fce7cc..1bae084 100644 --- a/src/mainboard/google/gru/Kconfig +++ b/src/mainboard/google/gru/Kconfig @@ -94,13 +94,6 @@ default "Gru" if BOARD_GOOGLE_GRU 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 string depends on CHROMEOS diff --git a/src/mainboard/google/gru/Makefile.inc b/src/mainboard/google/gru/Makefile.inc index d54ce2f..9972c5b 100644 --- a/src/mainboard/google/gru/Makefile.inc +++ b/src/mainboard/google/gru/Makefile.inc @@ -13,7 +13,7 @@ ## GNU General Public License for more details. ##
-subdirs-y += sdram_params_$(CONFIG_MAX_SDRAM_FREQ)/ +subdirs-y += sdram_params_800/ sdram_params_933/
bootblock-y += bootblock.c bootblock-y += chromeos.c diff --git a/src/mainboard/google/gru/sdram_configs.c b/src/mainboard/google/gru/sdram_configs.c index b9f77d0..a9264d5 100644 --- a/src/mainboard/google/gru/sdram_configs.c +++ b/src/mainboard/google/gru/sdram_configs.c @@ -22,22 +22,37 @@ #include <string.h> #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", +#define MAX_SDRAM_CONFIGS 10 + +static const char *sdram_configs_800[MAX_SDRAM_CONFIGS] = { + [3] = "sdram-lpddr3-samsung-2GB-24EB-800", + [4] = "sdram-lpddr3-micron-2GB-800", + [5] = "sdram-lpddr3-samsung-4GB-04EB-800", + [6] = "sdram-lpddr3-micron-4GB-800", +}; + +static const char *sdram_configs_933[MAX_SDRAM_CONFIGS] = { + [0] = "sdram-lpddr3-hynix-4GB-933", + [3] = "sdram-lpddr3-samsung-2GB-24EB-933", + [4] = "sdram-lpddr3-micron-2GB-933", + [5] = "sdram-lpddr3-samsung-4GB-04EB-933", + [6] = "sdram-lpddr3-micron-4GB-933", };
static struct rk3399_sdram_params params;
const struct rk3399_sdram_params *get_sdram_config() { + const char **sdram_configs; uint32_t ramcode;
+ if (IS_ENABLED(CONFIG_BOARD_GOOGLE_BOB) && board_id() < 4) + sdram_configs = sdram_configs_800; + else + sdram_configs = sdram_configs_933; + ramcode = ram_code(); - if (ramcode >= ARRAY_SIZE(sdram_configs) || !sdram_configs[ramcode] || + if (ramcode >= MAX_SDRAM_CONFIGS || !sdram_configs[ramcode] || (cbfs_boot_load_struct(sdram_configs[ramcode], ¶ms, sizeof(params)) != sizeof(params))) die("Cannot load SDRAM parameter file!"); diff --git a/src/mainboard/google/gru/sdram_params_800/Makefile.inc b/src/mainboard/google/gru/sdram_params_800/Makefile.inc index ca7b52b..56dd390 100644 --- a/src/mainboard/google/gru/sdram_params_800/Makefile.inc +++ b/src/mainboard/google/gru/sdram_params_800/Makefile.inc @@ -13,15 +13,18 @@ ## GNU General Public License for more details. ##
+freq := 800 + sdram-params := 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 +sdram-params := $(addsuffix -$(freq), $(sdram-params))
$(foreach params,$(sdram-params), \ $(eval cbfs-files-y += $(params)) \ - $(eval $(params)-file := $(params).c:struct) \ + $(eval $(params)-file := $(patsubst %-$(freq),%.c:struct, $(params))) \ $(eval $(params)-type := struct) \ $(eval $(params)-compression := $(CBFS_COMPRESS_FLAG)) \ ) diff --git a/src/mainboard/google/gru/sdram_params_933/Makefile.inc b/src/mainboard/google/gru/sdram_params_933/Makefile.inc index 8751e53..ce3ae60 100644 --- a/src/mainboard/google/gru/sdram_params_933/Makefile.inc +++ b/src/mainboard/google/gru/sdram_params_933/Makefile.inc @@ -1,7 +1,7 @@ ## ## This file is part of the coreboot project. ## -## Copyright 2016 Rockchip Inc. +## Copyright 2017 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 @@ -13,16 +13,19 @@ ## GNU General Public License for more details. ##
+freq := 933 + 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 +sdram-params := $(addsuffix -$(freq), $(sdram-params))
$(foreach params,$(sdram-params), \ $(eval cbfs-files-y += $(params)) \ - $(eval $(params)-file := $(params).c:struct) \ + $(eval $(params)-file := $(patsubst %-$(freq),%.c:struct, $(params))) \ $(eval $(params)-type := struct) \ $(eval $(params)-compression := $(CBFS_COMPRESS_FLAG)) \ )