mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
9f59c3df7599d9ecaf4a335556141769c65fee9e
After entering prepare_to_sleep() and doing interrupt_disable(), if an interrupt happens, it will stay pending (as the handler is masked). Then, when calling 'wfi' in __idle(), we will go through the instruction rather than entering deep-sleep (if requested) as we have a pending interrupt. The downside of this corner case is that we never undo the actions done to prepare for deep-sleep in the IDLE_DEEP_SLEEP clause of prepare_to_sleep(). For USB suspend, this means that on the subsequent deep-sleep entry, we are going to try to save GR_USB_CFG/the USB device address while the USB controller is already in reset/power-down, recording a null value in SCRATCH18. Then, at resume time, we will restore 0 in USB_CFG and the USB device will no longer work. As the USB configuration is difficult to restore in case of deep-sleep abortion, simply skip writing a bogus value in SCRATCH18 on the real deep-sleep entry happening afterwards. This is good enough to resume properly on USB. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=cr50 BUG=b:38160821 TEST=manual: add a (long) panic_printf trace in prepare_to_sleep() in order to dramatically increase the probability of getting an interruption pending after entering the function. On cr52, trigger USB suspends by suspending the host, and see we no longer regularly get a null USB device address at USB resume. Change-Id: Ied3fc003eefe7fc164a320b15b5f9d400551198e Reviewed-on: https://chromium-review.googlesource.com/559332 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
For an overview of the Embedded Controller firmware, refer to http://www.chromium.org/chromium-os/2014-firmware-summit For instructions on building from source, refer to http://www.chromium.org/chromium-os/ec-development/getting-started-building-ec-images-quickly
Description
Languages
C
64.7%
Lasso
20.7%
ASL
3.6%
JavaScript
3.2%
C#
2.9%
Other
4.6%