From 123b191b47b3502eb326c2c229da6d5d1d15259e Mon Sep 17 00:00:00 2001 From: Eric Lai Date: Sat, 25 Jan 2020 22:14:04 +0800 Subject: ec/google/wilco: Set cpu id and cores to EC Set CPU ID and cores to EC then EC will adapt power table according to the CPU ID and number of cores. BUG=b:148126144 BRANCH=None TEST=check EC can get correct CPU id and cores. Signed-off-by: Eric Lai Change-Id: I23f5580b15a20a01e03a5f4c798e73574f874c9a Reviewed-on: https://review.coreboot.org/c/coreboot/+/38566 Reviewed-by: Duncan Laurie Reviewed-by: Mathew King Tested-by: build bot (Jenkins) --- src/ec/google/wilco/chip.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/ec/google') diff --git a/src/ec/google/wilco/chip.c b/src/ec/google/wilco/chip.c index b44cbd6c64..5729b4aa27 100644 --- a/src/ec/google/wilco/chip.c +++ b/src/ec/google/wilco/chip.c @@ -16,10 +16,13 @@ #include #include #include +#include #include #include +#include #include #include +#include #include #include @@ -124,6 +127,14 @@ static void wilco_ec_resume(void *unused) } BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, wilco_ec_resume, NULL); +static int wilco_set_cpu_id(void) +{ + uint32_t cpu_phy_cores, cpu_virtual_cores; + + cpu_read_topology(&cpu_phy_cores, &cpu_virtual_cores); + return wilco_ec_set_cpuid(cpu_get_cpuid(), cpu_phy_cores, 0); +} + static void wilco_ec_init(struct device *dev) { if (!dev->enabled) @@ -153,6 +164,10 @@ static void wilco_ec_init(struct device *dev) /* Turn on camera power */ wilco_ec_send(KB_CAMERA, CAMERA_ON); + + /* Set cpu id and phy cores */ + if (wilco_set_cpu_id()) + printk(BIOS_ERR, "EC: use default cpu power table\n"); } static void wilco_ec_resource(struct device *dev, int index, -- cgit v1.2.3