summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorCaesar Wang <wxt@rock-chips.com>2017-05-05 17:37:42 +0800
committerJulius Werner <jwerner@chromium.org>2017-05-11 04:55:17 +0200
commit6c4e57487239e773f6135bb9cda4fba7f35059d0 (patch)
tree2b251fac2832895276215903d0fde83891c58fdb /src/mainboard
parente085a8a359a82bce204fe15325e1aead53aa3edd (diff)
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>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/google/gru/Kconfig7
-rw-r--r--src/mainboard/google/gru/Makefile.inc2
-rw-r--r--src/mainboard/google/gru/sdram_configs.c33
-rw-r--r--src/mainboard/google/gru/sdram_params/Makefile.inc (renamed from src/mainboard/google/gru/sdram_params_800/Makefile.inc)15
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-hynix-4GB-928.c (renamed from src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-hynix-4GB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-2GB-800.c (renamed from src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-micron-2GB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-2GB-928.c (renamed from src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-micron-2GB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-4GB-800.c (renamed from src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-micron-4GB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-4GB-928.c (renamed from src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-micron-4GB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-2GB-24EB-800.c (renamed from src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-samsung-2GB-24EB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-2GB-24EB-928.c (renamed from src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-samsung-2GB-24EB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-4GB-04EB-800.c (renamed from src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-samsung-4GB-04EB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-4GB-04EB-928.c (renamed from src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-samsung-4GB-04EB.c)0
-rw-r--r--src/mainboard/google/gru/sdram_params_933/Makefile.inc28
14 files changed, 37 insertions, 48 deletions
diff --git a/src/mainboard/google/gru/Kconfig b/src/mainboard/google/gru/Kconfig
index 0dba3e9bda..3a30013de9 100644
--- a/src/mainboard/google/gru/Kconfig
+++ b/src/mainboard/google/gru/Kconfig
@@ -95,13 +95,6 @@ config MAINBOARD_PART_NUMBER
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 d54ce2f0f6..122139dd15 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/
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 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],
- &params, 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, &params,
+ sizeof(params)) != sizeof(params)))
die("Cannot load SDRAM parameter file!");
+
return &params;
}
diff --git a/src/mainboard/google/gru/sdram_params_800/Makefile.inc b/src/mainboard/google/gru/sdram_params/Makefile.inc
index ca7b52b0ec..6720c0c493 100644
--- a/src/mainboard/google/gru/sdram_params_800/Makefile.inc
+++ b/src/mainboard/google/gru/sdram_params/Makefile.inc
@@ -14,10 +14,17 @@
##
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 += sdram-lpddr3-hynix-4GB-928
+
+sdram-params += sdram-lpddr3-micron-2GB-800
+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), \
$(eval cbfs-files-y += $(params)) \
diff --git a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-hynix-4GB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-hynix-4GB-928.c
index d2828da6da..d2828da6da 100644
--- a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-hynix-4GB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-hynix-4GB-928.c
diff --git a/src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-micron-2GB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-2GB-800.c
index 062df3a418..062df3a418 100644
--- a/src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-micron-2GB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-2GB-800.c
diff --git a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-micron-2GB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-2GB-928.c
index f14200c804..f14200c804 100644
--- a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-micron-2GB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-2GB-928.c
diff --git a/src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-micron-4GB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-4GB-800.c
index 0b00462d6b..0b00462d6b 100644
--- a/src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-micron-4GB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-4GB-800.c
diff --git a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-micron-4GB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-4GB-928.c
index dc7efd9c41..dc7efd9c41 100644
--- a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-micron-4GB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-micron-4GB-928.c
diff --git a/src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-samsung-2GB-24EB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-2GB-24EB-800.c
index ac995a82e2..ac995a82e2 100644
--- a/src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-samsung-2GB-24EB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-2GB-24EB-800.c
diff --git a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-samsung-2GB-24EB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-2GB-24EB-928.c
index 62c3392dcd..62c3392dcd 100644
--- a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-samsung-2GB-24EB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-2GB-24EB-928.c
diff --git a/src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-samsung-4GB-04EB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-4GB-04EB-800.c
index b4eb49484f..b4eb49484f 100644
--- a/src/mainboard/google/gru/sdram_params_800/sdram-lpddr3-samsung-4GB-04EB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-4GB-04EB-800.c
diff --git a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-samsung-4GB-04EB.c b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-4GB-04EB-928.c
index 54b7397921..54b7397921 100644
--- a/src/mainboard/google/gru/sdram_params_933/sdram-lpddr3-samsung-4GB-04EB.c
+++ b/src/mainboard/google/gru/sdram_params/sdram-lpddr3-samsung-4GB-04EB-928.c
diff --git a/src/mainboard/google/gru/sdram_params_933/Makefile.inc b/src/mainboard/google/gru/sdram_params_933/Makefile.inc
deleted file mode 100644
index 8751e53667..0000000000
--- a/src/mainboard/google/gru/sdram_params_933/Makefile.inc
+++ /dev/null
@@ -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)) \
-)