summaryrefslogtreecommitdiff
path: root/src/ec/starlabs/merlin/ec.h
diff options
context:
space:
mode:
authorSean Rhodes <sean@starlabs.systems>2021-10-14 20:58:15 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-11-22 14:46:20 +0000
commit296994bec80d27c0dc1f155530fd495fa00bda6c (patch)
tree94049a26b84e3c92e32ece723f0291f21fc29542 /src/ec/starlabs/merlin/ec.h
parent6973a3e7c481efc89845ecc3c78d7994a3e48b3c (diff)
ec/starlabs: Add standardised ITE EC support
Add EC support that supports different Q Events and EC memory. Created from the ITE IT5570E and IT8987E datasheets, all using data port 0x4e. Tested with Ubuntu 20.04.3 and Windows 10 on: * StarBook Mk V (TGL + IT5570E): * ITE Firmware 1.00 * Merlin Firmware 1.00 * LabTop Mk IV (CML + IT8987E): * ITE Firmware 1.04 * LabTop Mk III (KBL + IT8987E): * ITE Firmware 3.12 Signed-off-by: Sean Rhodes <sean@starlabs.systems> Change-Id: I8023c26de23c874c84106fda96e64dcfa0c5ba32 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58343 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Andy Pont <andy.pont@sdcsystems.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/ec/starlabs/merlin/ec.h')
-rw-r--r--src/ec/starlabs/merlin/ec.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/ec/starlabs/merlin/ec.h b/src/ec/starlabs/merlin/ec.h
new file mode 100644
index 0000000000..0f564caa2f
--- /dev/null
+++ b/src/ec/starlabs/merlin/ec.h
@@ -0,0 +1,86 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * EC communication interface for ITE Embedded Controller.
+ */
+
+#ifndef _EC_STARLABS_ITE_H
+#define _EC_STARLABS_ITE_H
+
+/*
+ * Define the expected value of the PNP base address that is fixed through
+ * the BADRSEL register controlled within the EC domain by the EC Firmware.
+ */
+#define ITE_FIXED_ADDR 0x4e
+
+/* Logical device number (LDN) assignments. */
+#define ITE_SP1 0x01 /* Serial Port 1 (UART) */
+#define ITE_SP2 0x02 /* Serial Port 2 (UART) */
+#define ITE_SWUC 0x04 /* System Wake-Up Control (SWUC) */
+#define ITE_KBCM 0x05 /* KBC / Mouse Interface */
+#define ITE_KBCK 0x06 /* KBC / Keyboard Interface */
+#define ITE_IR 0x0a /* Consumer IR (CIR) */
+#define ITE_SMFI 0x0f /* Shared Memory / Flash Interface (SMFI) */
+#define ITE_RTCT 0x10 /* RTC-like Timer (RCTC) */
+#define ITE_PMC1 0x11 /* Power Management I/F Channel 1 (PMC1) */
+#define ITE_PMC2 0x12 /* Power Management I/F Channel 2 (PMC2) */
+#define ITE_SSPI 0x13 /* Serial Peripheral Interface (SSPI) */
+#define ITE_PECI 0x14 /* Platform Environment Control Interface (PECI) */
+#define ITE_PMC3 0x17 /* Power Management I/F Channel 3 (PMC3) */
+#define ITE_PMC4 0x18 /* Power Management I/F Channel 4 (PMC4) */
+#define ITE_PMC5 0x19 /* Power Management I/F Channel 5 (PMC5) */
+
+/* Host domain registers. */
+#define ITE_CHIPID1 0x20 /* Device ID register 1 */
+#define ITE_CHIPID2 0x21 /* Device ID register 2 */
+
+/* EC RAM common offsets */
+#define ECRAM_MAJOR_VERSION 0x00
+#define ECRAM_MINOR_VERSION 0x01
+
+/*
+ * CMOS Settings
+ */
+
+/* Keyboard Backlight Timeout */
+#define SEC_30 0x00
+#define MIN_1 0x01
+#define MIN_3 0x02
+#define MIN_5 0x03
+#define NEVER 0x04
+
+/* Fn Ctrl Swap */
+#define FN_CTRL 0x00
+#define CTRL_FN 0x01
+
+/* Max Charge Setting */
+#define CHARGE_100 0x00
+#define CHARGE_80 0xbb
+#define CHARGE_60 0xaa
+
+/* Fan Mode Setting */
+#define FAN_NORMAL 0x00
+#define FAN_AGGRESSIVE 0xbb
+#define FAN_QUIET 0xaa
+
+/* Fn Lock State */
+#define UNLOCKED 0x00
+#define LOCKED 0x01
+
+/* Trackpad State */
+#define TRACKPAD_ENABLED 0x00
+#define TRACKPAD_DISABLED 0x22
+
+/* Keyboard Brightness Levels */
+#define KBL_ON 0xdd
+#define KBL_OFF 0xcc
+#define KBL_LOW 0xbb
+#define KBL_HIGH 0xaa
+
+/* Keyboard Backlight State */
+#define KBL_DISABLED 0x00
+#define KBL_ENABLED 0xaa
+
+uint16_t it_get_version(void);
+
+#endif