Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/68938 )
Change subject: ec/starlabs/merlin: Add support for enabling the mirror flag ......................................................................
ec/starlabs/merlin: Add support for enabling the mirror flag
When enabled, the EC will mirror the firmware contained inside the coreboot ROM. This allows it to be updated at the same time as coreboot.
Signed-off-by: Sean Rhodes sean@starlabs.systems Change-Id: Ief088e012b65be32648f581fc3190e1000bca241 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68938 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Angel Pons th3fanbus@gmail.com --- M src/ec/starlabs/merlin/Kconfig M src/ec/starlabs/merlin/ec.h M src/ec/starlabs/merlin/ite.c M src/ec/starlabs/merlin/variants/adl/ecdefs.h M src/ec/starlabs/merlin/variants/apl/ecdefs.h M src/ec/starlabs/merlin/variants/cezanne/ecdefs.h M src/ec/starlabs/merlin/variants/cml/ecdefs.h M src/ec/starlabs/merlin/variants/glk/ecdefs.h M src/ec/starlabs/merlin/variants/glkr/ecdefs.h M src/ec/starlabs/merlin/variants/kbl/ecdefs.h M src/ec/starlabs/merlin/variants/merlin/ecdefs.h M src/ec/starlabs/merlin/variants/tgl/ecdefs.h 12 files changed, 57 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
diff --git a/src/ec/starlabs/merlin/Kconfig b/src/ec/starlabs/merlin/Kconfig index 6ccd217..203fd48 100644 --- a/src/ec/starlabs/merlin/Kconfig +++ b/src/ec/starlabs/merlin/Kconfig @@ -64,6 +64,13 @@ help Select if the mainboard supports limiting the maximum charge of the battery.
+config EC_STARLABS_MIRROR_FLAG + bool + default n + depends on EC_STARLABS_ITE + help + Select if the EC should mirror the EC firmware contained in the coreboot ROM. + config EC_STARLABS_MERLIN bool "Use open-source Merlin EC Firmware" default n diff --git a/src/ec/starlabs/merlin/ec.h b/src/ec/starlabs/merlin/ec.h index ca1d081..ff01c89 100644 --- a/src/ec/starlabs/merlin/ec.h +++ b/src/ec/starlabs/merlin/ec.h @@ -98,6 +98,10 @@ #define KBL_DISABLED 0x00 #define KBL_ENABLED 0xdd
+/* Mirror Flag */ +#define MIRROR_DISABLED 0x00 +#define MIRROR_ENABLED 0x01 + uint16_t ec_get_version(void);
#endif diff --git a/src/ec/starlabs/merlin/ite.c b/src/ec/starlabs/merlin/ite.c index 357c67c..d2d7c45 100644 --- a/src/ec/starlabs/merlin/ite.c +++ b/src/ec/starlabs/merlin/ite.c @@ -70,6 +70,7 @@ * trackpad_state * kbl_brightness * kbl_state + * mirror_flag */
/* @@ -247,6 +248,25 @@ 1, kbl_state, ARRAY_SIZE(kbl_state))); + + /* + * Mirror Flag + * + * Setting: mirror_flag + * + * Values: Off, On + * Default: On + */ + const uint8_t mirror_flag[] = { + MIRROR_DISABLED, + MIRROR_ENABLED + }; + if (CONFIG(EC_STARLABS_MIRROR_FLAG)) + ec_write(ECRAM_MIRROR_FLAG, + get_ec_value_from_option("mirror_flag", + 1, + mirror_flag, + ARRAY_SIZE(mirror_flag))); }
static struct device_operations ops = { diff --git a/src/ec/starlabs/merlin/variants/adl/ecdefs.h b/src/ec/starlabs/merlin/variants/adl/ecdefs.h index 28f7e4b..18480e2 100644 --- a/src/ec/starlabs/merlin/variants/adl/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/adl/ecdefs.h @@ -23,5 +23,5 @@ #define ECRAM_MAX_CHARGE 0x1a #define ECRAM_FAN_MODE 0x1b #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) - +#define ECRAM_MIRROR_FLAG 0x05 #endif diff --git a/src/ec/starlabs/merlin/variants/apl/ecdefs.h b/src/ec/starlabs/merlin/variants/apl/ecdefs.h index fa7e79b..5cbe14e 100644 --- a/src/ec/starlabs/merlin/variants/apl/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/apl/ecdefs.h @@ -23,5 +23,6 @@ #define ECRAM_MAX_CHARGE dead_code_t(uint8_t) #define ECRAM_FAN_MODE dead_code_t(uint8_t) #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) +#define ECRAM_MIRROR_FLAG 0x04
#endif diff --git a/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h b/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h index 6a3bad9..0826456 100644 --- a/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h @@ -23,5 +23,6 @@ #define ECRAM_MAX_CHARGE 0x23 #define ECRAM_FAN_MODE 0x24 #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) +#define ECRAM_MIRROR_FLAG 0x05
#endif diff --git a/src/ec/starlabs/merlin/variants/cml/ecdefs.h b/src/ec/starlabs/merlin/variants/cml/ecdefs.h index 6a24bc4..0a2654b 100644 --- a/src/ec/starlabs/merlin/variants/cml/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/cml/ecdefs.h @@ -23,5 +23,6 @@ #define ECRAM_KBL_BRIGHTNESS 0x19 #define ECRAM_FN_LOCK_STATE 0x2c #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) +#define ECRAM_MIRROR_FLAG 0x04
#endif diff --git a/src/ec/starlabs/merlin/variants/glk/ecdefs.h b/src/ec/starlabs/merlin/variants/glk/ecdefs.h index fefdd14..b2e2f2f 100644 --- a/src/ec/starlabs/merlin/variants/glk/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/glk/ecdefs.h @@ -23,5 +23,6 @@ #define ECRAM_MAX_CHARGE dead_code_t(uint8_t) #define ECRAM_FAN_MODE dead_code_t(uint8_t) #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) +#define ECRAM_MIRROR_FLAG 0x04
#endif diff --git a/src/ec/starlabs/merlin/variants/glkr/ecdefs.h b/src/ec/starlabs/merlin/variants/glkr/ecdefs.h index 038c378..ecc117c 100644 --- a/src/ec/starlabs/merlin/variants/glkr/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/glkr/ecdefs.h @@ -23,5 +23,6 @@ #define ECRAM_MAX_CHARGE dead_code_t(uint8_t) #define ECRAM_FAN_MODE dead_code_t(uint8_t) #define ECRAM_FAST_CHARGE 0x18 +#define ECRAM_MIRROR_FLAG dead_code_t(uint8_t)
#endif diff --git a/src/ec/starlabs/merlin/variants/kbl/ecdefs.h b/src/ec/starlabs/merlin/variants/kbl/ecdefs.h index 3b69317..8f3355d 100644 --- a/src/ec/starlabs/merlin/variants/kbl/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/kbl/ecdefs.h @@ -23,5 +23,6 @@ #define ECRAM_FN_CTRL_REVERSE 0x43 #define ECRAM_MAX_CHARGE dead_code_t(uint8_t) #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) +#define ECRAM_MIRROR_FLAG 0x04
#endif diff --git a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h index f02c73a..08f80cb 100644 --- a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h @@ -20,5 +20,6 @@ #define ECRAM_FAN_MODE 0x50 #define ECRAM_MAX_CHARGE 0x51 #define ECRAM_FAST_CHARGE 0x52 +#define ECRAM_MIRROR_FLAG 0x05
#endif diff --git a/src/ec/starlabs/merlin/variants/tgl/ecdefs.h b/src/ec/starlabs/merlin/variants/tgl/ecdefs.h index cbc7b86e..c17b025 100644 --- a/src/ec/starlabs/merlin/variants/tgl/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/tgl/ecdefs.h @@ -23,5 +23,6 @@ #define ECRAM_MAX_CHARGE 0x1a #define ECRAM_FAN_MODE 0x1b #define ECRAM_FAST_CHARGE dead_code_t(uint8_t) +#define ECRAM_MIRROR_FLAG 0x05
#endif