mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
make sure that the power states get set correctly early in the resume process
This commit is contained in:
parent
d417ef560a
commit
e2ce3cad2c
3 changed files with 12 additions and 0 deletions
|
|
@ -1228,6 +1228,11 @@ fn boot_sequence(args: KernelArguments, _signature: u32) -> ! {
|
|||
} else {
|
||||
// resume path
|
||||
use utralib::generated::*;
|
||||
// flip my self-power-on switch: otherwise, I might turn off before the whole sequence is finished.
|
||||
let mut power_csr = CSR::new(utra::power::HW_POWER_BASE as *mut u32);
|
||||
power_csr.rmwf(utra::power::POWER_STATE, 1);
|
||||
power_csr.rmwf(utra::power::POWER_SELF, 1);
|
||||
|
||||
// TRNG virtual memory mapping already set up, but we pump values out just to make sure
|
||||
// the pipeline is fresh. Simulations show this isn't necessary, but I feel paranoid;
|
||||
// I worry a subtle bug in the reset logic could leave deterministic values in the pipeline.
|
||||
|
|
|
|||
|
|
@ -242,6 +242,9 @@ mod implementation {
|
|||
}
|
||||
pub fn resume(&mut self) {
|
||||
self.power_susres.resume();
|
||||
// reset these to "on" in case the "off" value was captured and stored on suspend
|
||||
self.power_csr.rmwf(utra::power::POWER_SELF, 1);
|
||||
self.power_csr.rmwf(utra::power::POWER_STATE, 1);
|
||||
self.event_susres.resume();
|
||||
self.gpio_susres.resume();
|
||||
// restore the UART mux setting after resume
|
||||
|
|
|
|||
|
|
@ -87,8 +87,12 @@ mod implementation {
|
|||
}
|
||||
}
|
||||
|
||||
// prevent re-ordering
|
||||
core::sync::atomic::compiler_fence(core::sync::atomic::Ordering::Acquire);
|
||||
// power the system down - this should result in an almost immediate loss of power
|
||||
sr.csr.wfo(utra::susres::POWERDOWN_POWERDOWN, 1);
|
||||
// prevent re-ordering
|
||||
core::sync::atomic::compiler_fence(core::sync::atomic::Ordering::Acquire);
|
||||
|
||||
loop {} // block forever here
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue