TCPMv2: Do not perform hard reset when battery is low
TCPMv2: Do not perform hard reset when battery is low

This change adds checking for enough battery level before sending
hard reset in PE_SNK_Hard_Reset state.
There are a lot of reasons causing Policy Engine to send hard reset.
One of them is timeout in PE_SNK_Wait_For_Capabilities, which can cause
brown out if battery doesn't have enough charge

New flag PE_FLAGS_SNK_WAITING_BATT was added. This flag is set on
PE_SNK_Hard_Reset entry, and can be cleared when battery
reaches minimal charge (see pe_update_waiting_batt_flag()).

Original fix implemented for TCPMv1 stack:
https://chromium-review.googlesource.com/1565147
https://chromium-review.googlesource.com/1980406

BUG=b:160243307, b:161775827
BRANCH=none
TEST=Get board with bad battery (eg. bobba). Flash ToT EC.
     Discharge battery to cutoff. Plug charger. Make sure that
     PD goes to PE_SRC_Disabled after PE_SNK_Wait_For_Capabilities
     tries to send hard reset (switches to PE_SNK_Hard_Reset).
     PD should remain in PE_SRC_Disabled state until battery
     reaches minimal charge.
     It might be necessary to limit PD_CAPS_COUNT (in my case to 10)
     in ServoV4 (used as charger) to actually trigger timeout.
     During test EC RO have to report that PD comm is disabled, in
     other words system must be locked.
     When battery charges quickly, it is allowed to do 'sysjump RW'.

Signed-off-by: Patryk Duda <6aed17a362577cf10cb5675888c1635d522769c1@semihalf.com>
Change-Id: I63ac93a093d921f41bea2af93de8325783056962
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600985
Reviewed-by: Diana Z <cb2016afc7183e5356c690dc63b4ba817470501a@chromium.org>

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