Skip to content

Commit f2e761a

Browse files
committed
Fix flash_version() leaving SPI mux unlocked, turning LED pink
flash_version() sent EC_CMD_FLASH_NOTIFIED with AccessSpi (0x00) to unlock the SPI flash but never sent AccessSpiDone (0x03) to restore it. On hx30 (12th Gen), GPIO_0056 is shared between the SPI flash clock (function 2) and the right-side green charging LED PWM (function 1). When AccessSpi is sent, the EC switches GPIO_0056 to SPI mode and disables the LED driver (GPIO_TYPEC_G_DRV2_EN). Without the matching AccessSpiDone, the green channel stays dead while red and blue continue normally, turning the white charging LED pink (R+B without G). Send AccessSpiDone after reading the version to restore the mux, matching the pattern used by test_ec_flash_read() and get_entire_ec_flash(). Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent f9cb1c2 commit f2e761a

File tree

1 file changed

+11
-2
lines changed
  • framework_lib/src/chromium_ec

1 file changed

+11
-2
lines changed

framework_lib/src/chromium_ec/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,20 @@ impl CrosEc {
335335

336336
pub fn flash_version(&self) -> Option<(String, String, EcCurrentImage)> {
337337
// Unlock SPI
338-
// TODO: Lock flash again again
339-
let _data = EcRequestFlashNotify { flags: 0 }.send_command(self).ok()?;
338+
let _data = EcRequestFlashNotify {
339+
flags: MecFlashNotify::AccessSpi as u8,
340+
}
341+
.send_command(self)
342+
.ok()?;
340343

341344
let v = EcRequestGetVersion {}.send_command(self).ok()?;
342345

346+
// Lock SPI
347+
let _ = EcRequestFlashNotify {
348+
flags: MecFlashNotify::AccessSpiDone as u8,
349+
}
350+
.send_command(self);
351+
343352
let curr = match v.current_image {
344353
1 => EcCurrentImage::RO,
345354
2 => EcCurrentImage::RW,

0 commit comments

Comments
 (0)