summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-06-26 15:24:25 -0600
committerCommit Bot <commit-bot@chromium.org>2020-07-02 00:04:58 +0000
commita047383e6902ad7f0f417ff4be6a25345194b951 (patch)
treefc1ff5b5ef77330e7383a058f1c2d5faeaa52b6c
parentdc3e8d69dbffc330a0725eacf00da14f54ac86fc (diff)
downloadchrome-ec-a047383e6902ad7f0f417ff4be6a25345194b951.tar.gz
Dedede: Set up baseboard FW_CONFIG parsing
Set up basic files to use for parsing FW_CONFIG. Currently, this just has a function to return the DB enum value. BRANCH=None BUG=b:159246161 TEST=on waddledoo, FW_CONFIG print appears during boot with current value (tested 0, 3, and 4) Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id9ef2ea5ed297bb662d8455123452b1aeb06ae39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2274992 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--baseboard/dedede/build.mk2
-rw-r--r--baseboard/dedede/cbi_fw_config.c34
-rw-r--r--baseboard/dedede/cbi_fw_config.h28
3 files changed, 63 insertions, 1 deletions
diff --git a/baseboard/dedede/build.mk b/baseboard/dedede/build.mk
index f30c6d04f2..e86d1976ed 100644
--- a/baseboard/dedede/build.mk
+++ b/baseboard/dedede/build.mk
@@ -6,6 +6,6 @@
# Baseboard specific files build
#
-baseboard-y=baseboard.o
+baseboard-y=baseboard.o cbi_fw_config.o
baseboard-$(VARIANT_DEDEDE_EC_NPCX796FC)+=variant_ec_npcx796fc.o
baseboard-$(VARIANT_DEDEDE_EC_IT8320)+=variant_ec_it8320.o
diff --git a/baseboard/dedede/cbi_fw_config.c b/baseboard/dedede/cbi_fw_config.c
new file mode 100644
index 0000000000..c483e5dbb7
--- /dev/null
+++ b/baseboard/dedede/cbi_fw_config.c
@@ -0,0 +1,34 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "cbi_fw_config.h"
+#include "common.h"
+#include "console.h"
+#include "cros_board_info.h"
+#include "hooks.h"
+
+/****************************************************************************
+ * Dedede CBI FW Configuration
+ */
+
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+
+/* Cache FW_CONFIG on init since we don't expect it to change in runtime */
+static uint32_t cached_fw_config;
+
+static void cbi_fw_config_init(void)
+{
+ if (cbi_get_fw_config(&cached_fw_config) != EC_SUCCESS)
+ /* Default to 0 when CBI isn't populated */
+ cached_fw_config = 0;
+
+ CPRINTS("FW_CONFIG: 0x%04X", cached_fw_config);
+}
+DECLARE_HOOK(HOOK_INIT, cbi_fw_config_init, HOOK_PRIO_INIT_I2C + 1);
+
+enum fw_config_db get_cbi_fw_config_db(void)
+{
+ return ((cached_fw_config & FW_CONFIG_DB_MASK) >> FW_CONFIG_DB_OFFSET);
+}
diff --git a/baseboard/dedede/cbi_fw_config.h b/baseboard/dedede/cbi_fw_config.h
new file mode 100644
index 0000000000..cca9af68b4
--- /dev/null
+++ b/baseboard/dedede/cbi_fw_config.h
@@ -0,0 +1,28 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef _DEDEDE_CBI_FW_CONFIG__H_
+#define _DEDEDE_CBI_FW_CONFIG__H_
+
+/****************************************************************************
+ * Dedede CBI FW Configuration
+ */
+
+/*
+ * Daughter Board (Bits 0-3)
+ */
+enum fw_config_db {
+ DB_NONE,
+ DB_2C,
+ DB_1C_LTE,
+ DB_1A_HDMI,
+ DB_1C,
+};
+#define FW_CONFIG_DB_OFFSET 0
+#define FW_CONFIG_DB_MASK GENMASK(3, 0)
+
+enum fw_config_db get_cbi_fw_config_db(void);
+
+#endif /* _DEDEDE_CBI_FW_CONFIG__H_ */