summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Adolfsson <sadolfsson@google.com>2018-04-24 10:33:24 +0200
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-06-19 19:58:31 +0000
commitfa0eb37679207bb4b7257c642e8f2b8458600a2d (patch)
treecb795503de675f6310b9e90968f0561f6e9f13a3
parentf3d3fc6f8b25932391934dbee701b63d5919373b (diff)
downloadchrome-ec-fa0eb37679207bb4b7257c642e8f2b8458600a2d.tar.gz
npcx: CEC: Add stub implementation of CEC
Add CEC stub implementation and enable it for Fizz. All it does is print a message when the driver is initialized. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Check that "CEC initialized" is printed on the console when the EC boots. CQ-DEPEND=CL:1030219 Reviewed-on: https://chromium-review.googlesource.com/1030220 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Conflicts: chip/npcx/registers.h Change-Id: I1cf674e664e091354e344e0c08a69bd09f415904 Reviewed-on: https://chromium-review.googlesource.com/1055519 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
-rw-r--r--board/fizz/board.h1
-rw-r--r--chip/npcx/build.mk1
-rw-r--r--chip/npcx/cec.c22
-rw-r--r--chip/npcx/registers.h1
4 files changed, 25 insertions, 0 deletions
diff --git a/board/fizz/board.h b/board/fizz/board.h
index f0983f11fe..ef7bbb0c65 100644
--- a/board/fizz/board.h
+++ b/board/fizz/board.h
@@ -21,6 +21,7 @@
#define CONFIG_BOARD_VERSION
#define CONFIG_BOARD_SPECIFIC_VERSION
#define CONFIG_CRC8
+#define CONFIG_CEC
#define CONFIG_CROS_BOARD_INFO
#define CONFIG_DEDICATED_RECOVERY_BUTTON
#define CONFIG_EMULATED_SYSRQ
diff --git a/chip/npcx/build.mk b/chip/npcx/build.mk
index 2cd4d087c2..da5f7cbd2f 100644
--- a/chip/npcx/build.mk
+++ b/chip/npcx/build.mk
@@ -29,6 +29,7 @@ chip-$(CONFIG_LPC)+=lpc.o
chip-$(CONFIG_ESPI)+=espi.o
chip-$(CONFIG_PECI)+=peci.o
chip-$(CONFIG_HOSTCMD_SPS)+=shi.o
+chip-$(CONFIG_CEC)+=cec.o
# pwm functions are implemented with the fan functions
chip-$(CONFIG_PWM)+=pwm.o
chip-$(CONFIG_SPI)+=spi.o
diff --git a/chip/npcx/cec.c b/chip/npcx/cec.c
new file mode 100644
index 0000000000..f21789781f
--- /dev/null
+++ b/chip/npcx/cec.c
@@ -0,0 +1,22 @@
+/* Copyright 2018 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 "console.h"
+#include "hooks.h"
+#include "registers.h"
+
+#if !(DEBUG_CEC)
+#define CPRINTF(...)
+#define CPRINTS(...)
+#else
+#define CPRINTF(format, args...) cprintf(CC_CEC, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CEC, format, ## args)
+#endif
+
+static void cec_init(void)
+{
+ CPRINTS("CEC initialized");
+}
+DECLARE_HOOK(HOOK_INIT, cec_init, HOOK_PRIO_LAST);
diff --git a/chip/npcx/registers.h b/chip/npcx/registers.h
index 9bca32e82f..b204d96085 100644
--- a/chip/npcx/registers.h
+++ b/chip/npcx/registers.h
@@ -64,6 +64,7 @@
#define DEBUG_CLK 0
#define DEBUG_LPC 0
#define DEBUG_ESPI 0
+#define DEBUG_CEC 0
/* Modules Map */
#define NPCX_ESPI_BASE_ADDR 0x4000A000