summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2017-05-09 18:23:49 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-05-12 13:09:56 -0700
commit70f2088b41cb540f29fef24acf149746b39822af (patch)
tree17fbb60141e3ccbe2783bc9bf5f165cdb1c2d594 /chip
parent4ecdf787938fc8d0124c07a05e34c59cd2fcc79e (diff)
downloadchrome-ec-70f2088b41cb540f29fef24acf149746b39822af.tar.gz
CR50: enable dcrypto random stalls
Clean up a lingering TODO; enable random stalls (NOPs) at ~6% for crypto operations. BRANCH=none BUG=none TEST=TCG tests pass Change-Id: I46b2755d9f501eb4ec98c3184d1e14fbf118c718 Signed-off-by: nagendra modadugu <ngm@google.com> Reviewed-on: https://chromium-review.googlesource.com/501349 Commit-Ready: Nagendra Modadugu <ngm@google.com> Tested-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Paul Scheidt <pscheidt@google.com>
Diffstat (limited to 'chip')
-rw-r--r--chip/g/dcrypto/dcrypto_runtime.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/chip/g/dcrypto/dcrypto_runtime.c b/chip/g/dcrypto/dcrypto_runtime.c
index 9f4b849a82..12e0832aa7 100644
--- a/chip/g/dcrypto/dcrypto_runtime.c
+++ b/chip/g/dcrypto/dcrypto_runtime.c
@@ -30,9 +30,12 @@ void dcrypto_init(void)
REG_WRITE_MLV(GR_PMU_RST0, GC_PMU_RST0_DCRYPTO0_MASK,
GC_PMU_RST0_DCRYPTO0_LSB, 0);
- /* Turn off random nops (for accurate measuring here). */
- /* TODO(ngm): enable for production. */
- GREG32(CRYPTO, RAND_STALL_CTL) = 0;
+ /* Turn off random nops (which are enabled by default). */
+ GWRITE_FIELD(CRYPTO, RAND_STALL_CTL, STALL_EN, 0);
+ /* Configure random nop percentage at 6%. */
+ GWRITE_FIELD(CRYPTO, RAND_STALL_CTL, FREQ, 3);
+ /* Now turn on random nops. */
+ GWRITE_FIELD(CRYPTO, RAND_STALL_CTL, STALL_EN, 1);
/* Initialize DMEM. */
ptr = GREG32_ADDR(CRYPTO, DMEM_DUMMY);