Wayby Zhai has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84350?usp=email )
Change subject: Pujjoteen: CBI override ......................................................................
Pujjoteen: CBI override
For test
BUG=b:361519672 TEST= FW_NAME=pujjo emerge-nissa chromeos-bootimage coreboot
Change-Id: I1943e51f0733f9d4ee2b2db9afe16db74a47bfc3 Signed-off-by: Wayby Zhai wayby.zhai@lcfc.corp-partner.google.com --- M src/mainboard/google/brya/variants/pujjo/variant.c 1 file changed, 56 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/84350/1
diff --git a/src/mainboard/google/brya/variants/pujjo/variant.c b/src/mainboard/google/brya/variants/pujjo/variant.c index 695f043..cd0b3c6 100644 --- a/src/mainboard/google/brya/variants/pujjo/variant.c +++ b/src/mainboard/google/brya/variants/pujjo/variant.c @@ -7,10 +7,20 @@ #include <drivers/intel/gma/opregion.h> #include <sar.h> #include <delay.h> +#include <cpu/x86/name.h> +#include <ec/google/chromeec/ec.h> +#include <inttypes.h> +#include <string.h>
#define FM350_RST_DEALY_MS 20 #define FM350_PERST_DEALY_MS 30
+#define EC_CMD_CBI_BIN_OVERRIDE 0x0506 +#define FAN_FW_CONFIG_MASK 0x00000004UL + +int ec_cbi_override(void); +void fix_cbi(void); + static const struct pad_config fm350_rst_pad[] = { /* F12 : WWAN_RST_L */ PAD_CFG_GPO_LOCK(GPP_F12, 1, LOCK_CONFIG), @@ -54,8 +64,54 @@ return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI_SAR_ID)); }
+int ec_cbi_override(void) +{ + struct chromeec_command cmd = { + .cmd_code = EC_CMD_CBI_BIN_OVERRIDE, + .cmd_version = 0, + .cmd_data_in = NULL, + .cmd_data_out = NULL, + .cmd_size_in = 0, + .cmd_size_out = 0, + .cmd_dev_index = 0, + }; + int rv; + + rv = google_chromeec_command(&cmd); + if (rv != 0) + return rv; + return 0; +} + +void fix_cbi(void) +{ + + char processor_name[49]; + + fill_processor_name(processor_name); + /* Only i3-N305 need to fix cbi.*/ + if (strcmp(processor_name, "Intel(R) Core(TM) i3-N305") != 0) + return; + + uint64_t fw_config_value; + + if (google_chromeec_cbi_get_fw_config(&fw_config_value)) + printk(BIOS_WARNING, "%s: Could not get FW_CONFIG from CBI\n", + __func__); + else + printk(BIOS_INFO, "FW_CONFIG value from CBI is 0x%" PRIx64 "\n", + fw_config_value); + + if ((fw_config_value & FAN_FW_CONFIG_MASK) == 0) { + ec_cbi_override(); + printk(BIOS_INFO, "CBI override.\n"); + } + +} + void variant_init(void) { + fix_cbi(); if (fw_config_probe(FW_CONFIG(WWAN_5G, WWAN_5G_PRESENT))) { /* * FM350 power on seuqence: