ec/starlabs/merlin: Add retry to get_ec_version()
Occasionally when reading the EC version from ECRAM, the major version fails to read and returns zero. To avoid having an incorrect version reported, retry up to 10x with a 10ms delay between retries. TEST=build/boot various Starlabs hardware, update the EC firmware, verify the EC version is reported correctly every time. Change-Id: I78d921e7230e8e180041097672661e744f70dde2 Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/90834 Reviewed-by: Sean Rhodes <sean@starlabs.systems> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
b2c24afcf5
commit
60c8496afe
1 changed files with 4 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <console/console.h>
|
||||
#include <delay.h>
|
||||
#include <device/device.h>
|
||||
#include <device/pnp.h>
|
||||
#include <ec/acpi/ec.h>
|
||||
|
|
@ -17,6 +18,9 @@
|
|||
|
||||
uint16_t ec_get_version(void)
|
||||
{
|
||||
for (int i = 0; i < 10 && ec_read(ECRAM_MAJOR_VERSION) == 0; i++)
|
||||
mdelay(10);
|
||||
|
||||
return (ec_read(ECRAM_MAJOR_VERSION) << 8) | ec_read(ECRAM_MINOR_VERSION);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue