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/it83xx | |
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/it83xx')
-rw-r--r-- | chip/it83xx/registers.h | 6 | ||||
-rw-r--r-- | chip/it83xx/system.c | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/chip/it83xx/registers.h b/chip/it83xx/registers.h index 47f06991d3..4d5aec7131 100644 --- a/chip/it83xx/registers.h +++ b/chip/it83xx/registers.h @@ -1078,7 +1078,11 @@ enum bram_indices { BRAM_IDX_RESET_FLAGS2 = 2, BRAM_IDX_RESET_FLAGS3 = 3, - /* index 4 ~ 7 are reserved */ + /* PD state data for CONFIG_USB_PD_DUAL_ROLE uses 2 bytes */ + BRAM_IDX_PD0 = 4, + BRAM_IDX_PD1 = 5, + + /* index 6 ~ 7 are reserved */ BRAM_IDX_SCRATCHPAD = 8, BRAM_IDX_SCRATCHPAD1 = 9, diff --git a/chip/it83xx/system.c b/chip/it83xx/system.c index 055c586cd8..8ba3a970c1 100644 --- a/chip/it83xx/system.c +++ b/chip/it83xx/system.c @@ -232,6 +232,12 @@ static int bram_idx_lookup(enum system_bbram_idx idx) idx <= SYSTEM_BBRAM_IDX_VBNVBLOCK15) return BRAM_IDX_NVCONTEXT + idx - SYSTEM_BBRAM_IDX_VBNVBLOCK0; +#ifdef CONFIG_USB_PD_DUAL_ROLE + if (idx == SYSTEM_BBRAM_IDX_PD0) + return BRAM_IDX_PD0; + if (idx == SYSTEM_BBRAM_IDX_PD1) + return BRAM_IDX_PD1; +#endif return -1; } |