From 802337c26daaa07b42127bdf6de62f9b0afd306a Mon Sep 17 00:00:00 2001 From: Stefan Adolfsson Date: Tue, 24 Apr 2018 10:33:24 +0200 Subject: 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 BUG=b:76467407 BRANCH=none TEST=Check that "CEC initialized" is printed on the console when the EC boots. CQ-DEPEND=CL:1030219 Change-Id: I1cf674e664e091354e344e0c08a69bd09f415904 Reviewed-on: https://chromium-review.googlesource.com/1030220 Commit-Ready: Stefan Adolfsson Tested-by: Stefan Adolfsson Reviewed-by: Daisuke Nojiri --- board/fizz/board.h | 1 + chip/npcx/build.mk | 1 + chip/npcx/cec.c | 22 ++++++++++++++++++++++ chip/npcx/registers.h | 1 + 4 files changed, 25 insertions(+) create mode 100644 chip/npcx/cec.c diff --git a/board/fizz/board.h b/board/fizz/board.h index 69b61ce641..5224b22d67 100644 --- a/board/fizz/board.h +++ b/board/fizz/board.h @@ -19,6 +19,7 @@ #define CONFIG_ADC #define CONFIG_BOARD_VERSION_CBI #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 13c4a60015..215edf58fb 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 c30ada4207..32ad827833 100644 --- a/chip/npcx/registers.h +++ b/chip/npcx/registers.h @@ -65,6 +65,7 @@ #define DEBUG_LPC 0 #define DEBUG_ESPI 0 #define DEBUG_WOV 0 +#define DEBUG_CEC 0 /* Modules Map */ #define NPCX_ESPI_BASE_ADDR 0x4000A000 -- cgit v1.2.1