diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-02-15 17:06:37 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-02-25 14:23:20 -0800 |
commit | 23bc38414ade30fb3e72ae8beefb657b47ca8288 (patch) | |
tree | a3bd50f2e039cee14e71a453190b4daaa5fc61c2 /chip/npcx/system.c | |
parent | b7f8d9df654945827d6a21332e140ddecb8bdd1b (diff) | |
download | chrome-ec-23bc38414ade30fb3e72ae8beefb657b47ca8288.tar.gz |
pd: Store PD active state in battery-backed memory
Our previous idea to cut Rd for many reset cases cannot work if cr50
consistently resets the EC by asserting the reset pin shortly after
power-on. Therefore, make a decision based upon whether battery-backed
memory indicates we previously negotiated a PD power contract as a sink.
If we previously did not negotiate a contract, or if power was removed
from the device (causing battery-backed memory to wipe) then we can
assume that we don't have an active power contract.
BUG=chrome-os-partner:62952
BRANCH=reef
TEST=On reef, run "cutoff" on the console, reattach AC, and verify
device successfully wakes. Also verify Rp is dropped on console 'reboot'
and F3 + power from RW.
Change-Id: Ie300b9589cac6be7a69b77678bea6b1b6b25578c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/443356
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/npcx/system.c')
-rw-r--r-- | chip/npcx/system.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c index bec553be53..335cb9a44a 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -87,7 +87,12 @@ void system_watchdog_reset(void) static int bbram_is_byte_access(enum bbram_data_index index) { return (index >= BBRM_DATA_INDEX_VBNVCNTXT && - index < BBRM_DATA_INDEX_RAMLOG); + index < BBRM_DATA_INDEX_RAMLOG) +#ifdef CONFIG_USB_PD_DUAL_ROLE + || index == BBRM_DATA_INDEX_PD0 + || index == BBRM_DATA_INDEX_PD1 +#endif + ; } /** @@ -158,6 +163,12 @@ static int bbram_idx_lookup(enum system_bbram_idx idx) idx <= SYSTEM_BBRAM_IDX_VBNVBLOCK15) return BBRM_DATA_INDEX_VBNVCNTXT + idx - SYSTEM_BBRAM_IDX_VBNVBLOCK0; +#ifdef CONFIG_USB_PD_DUAL_ROLE + if (idx == SYSTEM_BBRAM_IDX_PD0) + return BBRM_DATA_INDEX_PD0; + if (idx == SYSTEM_BBRAM_IDX_PD1) + return BBRM_DATA_INDEX_PD1; +#endif return -1; } |