[coreboot-gerrit] Change in coreboot[master]: bdk: Use Kconfig options instead of getenv()
Patrick Rudolph (Code Review)
gerrit at coreboot.org
Thu Jul 12 16:01:36 CEST 2018
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/27448
Change subject: bdk: Use Kconfig options instead of getenv()
......................................................................
bdk: Use Kconfig options instead of getenv()
* Use Kconfig options instead of unusable getenv
* Select CAVIUM_BDK_DDR_TUNE_HW_OFFSETS on CN81XX
* Fix Coverity CID 1393976 (DEADCODE)
Tested on Cavium's cn8100_sff_evb.
Change-Id: Ia16c0161b0e9cf5d06418e46556c0fb45532a5b1
Signed-off-by: Patrick Rudolph <patrick.rudolph at 9elements.com>
---
M src/soc/cavium/cn81xx/Kconfig
M src/vendorcode/cavium/Kconfig
M src/vendorcode/cavium/bdk/libdram/libdram.c
3 files changed, 26 insertions(+), 18 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/27448/1
diff --git a/src/soc/cavium/cn81xx/Kconfig b/src/soc/cavium/cn81xx/Kconfig
index ca8fbd0..9cc7b48 100644
--- a/src/soc/cavium/cn81xx/Kconfig
+++ b/src/soc/cavium/cn81xx/Kconfig
@@ -11,6 +11,7 @@
select HAVE_MONOTONIC_TIMER
select UART_OVERRIDE_REFCLK
select SOC_CAVIUM_COMMON
+ select CAVIUM_BDK_DDR_TUNE_HW_OFFSETS
if SOC_CAVIUM_CN81XX
diff --git a/src/vendorcode/cavium/Kconfig b/src/vendorcode/cavium/Kconfig
index 8037762..37d22c3 100644
--- a/src/vendorcode/cavium/Kconfig
+++ b/src/vendorcode/cavium/Kconfig
@@ -65,6 +65,27 @@
depends on CAVIUM_BDK
help
Build Cavium's BDK with verbose PHY code.
+
+config CAVIUM_BDK_DDR_TUNE_HW_OFFSETS
+ bool "Hardware assisted DLL read offset tuning"
+ default n
+ depends on CAVIUM_BDK
+
+ help
+ Automatically tune the data byte DLL read offsets.
+ Always done by default, but allow use of HW-assist.
+ NOTE: HW-assist will also tune the ECC byte
+
+config CAVIUM_BDK_DDR_TUNE_WRITE_OFFSETS
+ bool "Automatically tune thw data byte DLL write offsets"
+ default n
+ depends on CAVIUM_BDK
+
+config CAVIUM_BDK_DDR_TUNE_ECC_ENABLE
+ bool "Automatically tune the ECC byte DLL read offsets"
+ default n
+ depends on CAVIUM_BDK
+
endmenu
endif
diff --git a/src/vendorcode/cavium/bdk/libdram/libdram.c b/src/vendorcode/cavium/bdk/libdram/libdram.c
index 551ba24..bebd520 100644
--- a/src/vendorcode/cavium/bdk/libdram/libdram.c
+++ b/src/vendorcode/cavium/bdk/libdram/libdram.c
@@ -149,23 +149,16 @@
static int bdk_libdram_tune_node(int node)
{
int errs, tot_errs;
- int do_dllro_hw = 0; // default to NO
- int do_dllwo = 0; // default to NO
- int do_eccdll = 0; // default to NO
- const char *str;
+ int do_dllro_hw = IS_ENABLED(CONFIG_CAVIUM_BDK_DDR_TUNE_HW_OFFSETS);
+ int do_dllwo = IS_ENABLED(CONFIG_CAVIUM_BDK_DDR_TUNE_WRITE_OFFSETS);
+ int do_eccdll = IS_ENABLED(CONFIG_CAVIUM_BDK_DDR_TUNE_ECC_ENABLE);
BDK_CSR_INIT(lmc_config, node, BDK_LMCX_CONFIG(0)); // FIXME: probe LMC0
do_eccdll = (lmc_config.s.ecc_ena != 0); // change to ON if ECC enabled
- // FIXME!!! make 81xx always use HW-assist tuning
- if (CAVIUM_IS_MODEL(CAVIUM_CN81XX))
- do_dllro_hw = 1;
-
// Automatically tune the data byte DLL read offsets
// always done by default, but allow use of HW-assist
// NOTE: HW-assist will also tune the ECC byte
- str = getenv("ddr_tune_hw_offsets");
- if (str)
- do_dllro_hw = !!strtoul(str, NULL, 0);
+
BDK_TRACE(DRAM, "N%d: Starting DLL Read Offset Tuning for LMCs\n", node);
if (!do_dllro_hw || (lmc_config.s.mode32b != 0)) {
errs = perform_dll_offset_tuning(node, 2, /* tune */1);
@@ -179,10 +172,6 @@
// disabled by default for now, does not seem to be needed?
// Automatically tune the data byte DLL write offsets
// allow override of default setting
- str = getenv("ddr_tune_write_offsets");
- str = NULL;
- if (str)
- do_dllwo = !!strtoul(str, NULL, 0);
if (do_dllwo) {
BDK_TRACE(DRAM, "N%d: Starting DLL Write Offset Tuning for LMCs\n", node);
errs = perform_dll_offset_tuning(node, /* write */1, /* tune */1);
@@ -195,9 +184,6 @@
// Automatically tune the ECC byte DLL read offsets
// FIXME? allow override of the filtering
// FIXME? allow programmatic override, not via envvar?
- str = getenv("ddr_tune_ecc_enable");
- if (str)
- do_eccdll = !!strtoul(str, NULL, 10);
if (do_eccdll && !do_dllro_hw && (lmc_config.s.mode32b == 0)) { // do not do HW-assist twice for ECC
BDK_TRACE(DRAM, "N%d: Starting ECC DLL Read Offset Tuning for LMCs\n", node);
errs = perform_HW_dll_offset_tuning(node, 2, 8/* ECC bytelane */);
--
To view, visit https://review.coreboot.org/27448
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia16c0161b0e9cf5d06418e46556c0fb45532a5b1
Gerrit-Change-Number: 27448
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180712/801f4317/attachment-0001.html>
More information about the coreboot-gerrit
mailing list