EFS2: Reset after shutdown if EC is still in RO
EFS2: Reset after shutdown if EC is still in RO

When the system boots in recovery mode, EC stays in RO. When a power
button is pressed in recovery screen, currently the system shuts down
and EC continues to stay in RO.

For a battery-less system, when a power button is pressed again, the
system can't boot because there is no PD power (unless the system is
powered otherwise). So, EC needs to be in RW so that it can boot the
AP on the next power button press.

This patch makes EC reset itself when the AP shuts down and EC is still
in RO.

For a chromebook, when a power button is pressed for power-on, the
system may be able to boot using the battery power. However, with this
patch, EC will be able to negotiate PD power while waiting for another
power button press.

The timelines below show the difference between the system without
and with this patch:

    PB (for shutdown)   PB (for boot)
    v                   v
1)  -------------- ... -----+++++++++
2)  -|-+++++++++++ ... ++++++++++++++

where:
  PB = power button press
  -: EC in RO
  +: EC in RW
  |: Reset

Tests are executed on a reworked Helios.

Signed-off-by: dnojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>

BUG=chromium:1045209
BRANCH=none
TEST=Boot to recovery screen. Press power button to shutdown.
     Verify (after reset) EC jumps to RW and stays in S5.
TEST=Boot to developer screen. Press power button to shutdown.
     Verify EC stays in RW.
TEST=Run reboot from OS. Verify system reboots back to S0.
TEST=Run shutdown -H now. Verify system shuts down and stays in S5.
TEST=Hold L_Shift+ESC+F3+Power to trigger HW_REINIT.
TEST=ectool batterycutoff at-shutdown
TEST=test_that firmware_SoftwareSync firmware_DevMode

Change-Id: I6a04a9741351fa06cbadf6725ff71452574db68c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2095754
Tested-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Tested-by: George Engelbrecht <c828e237e346dc3df684bcfc0b60e48b180f6a3d@google.com>
Reviewed-by: Peter Marheine <ef0b2c492edde94778d7465bfbaeed52c5be6858@chromium.org>
Auto-Submit: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Commit-Queue: George Engelbrecht <c828e237e346dc3df684bcfc0b60e48b180f6a3d@google.com>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec