Skip to content

Commit ba67f9d

Browse files
committed
Add EC_CMD_KBD_FLASH_STM32
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 758de92 commit ba67f9d

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

‎framework_lib/src/chromium_ec/command.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ pub enum EcCommands {
127127
GetPdPortState = 0x3E23,
128128
/// Read board ID of specific ADC channel
129129
ReadBoardId = 0x3E26,
130+
/// Move the STM32 keyboard controller into its ROM bootloader and back
131+
KbdFlashStm32 = 0x3E2C,
130132
}
131133

132134
pub trait EcRequest<R> {

‎framework_lib/src/chromium_ec/commands.rs‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,3 +1999,32 @@ impl EcRequest<EcResponseGetApThrottleStatus> for EcRequestGetApThrottleStatus {
19991999
EcCommands::GetApThrottleStatus
20002000
}
20012001
}
2002+
2003+
/// Sub-commands of `EcCommands::KbdFlashStm32`.
2004+
///
2005+
/// The EC only drives BOOT0 and the power rail and keeps its own I2C-HID
2006+
/// driver off the bus. The bootloader protocol itself runs on the host over
2007+
/// I2C passthrough.
2008+
/// 1-3 were erase/write/read on the EC and have been removed.
2009+
#[repr(u8)]
2010+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2011+
pub enum KbdFlashStm32Subcmd {
2012+
/// Reset the STM32 into its ROM bootloader
2013+
Enter = 0,
2014+
/// Reset the STM32 into its application
2015+
Exit = 4,
2016+
}
2017+
2018+
#[repr(C, packed)]
2019+
pub struct EcRequestKbdFlashStm32 {
2020+
/// See KbdFlashStm32Subcmd
2021+
pub subcmd: u8,
2022+
}
2023+
2024+
/// No response on current EC firmware. EC firmware that still had the
2025+
/// flashing code returns 5 bytes for Enter, use send_command_vec and ignore them.
2026+
impl EcRequest<()> for EcRequestKbdFlashStm32 {
2027+
fn command_id() -> EcCommands {
2028+
EcCommands::KbdFlashStm32
2029+
}
2030+
}

0 commit comments

Comments
 (0)