summaryrefslogtreecommitdiff
path: root/chip/g/jitter.c
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2016-11-01 11:05:42 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-11-04 18:31:44 -0700
commitf16d6e43d36ae7cda38b64e2c1ea94b56e292442 (patch)
tree4493588c438bd23f0e45021e51bd069289a89100 /chip/g/jitter.c
parent1f6600fd344bb5eb5476206a05c2bc773252d788 (diff)
downloadchrome-ec-f16d6e43d36ae7cda38b64e2c1ea94b56e292442.tar.gz
g: add permission level checks
The jittery clock and trng security features require high permissions to be initialized. In the future these initializations and the permission level drop may be moved to RO. This change adds permission level checks before trying to access any registers that require high permission, so when we update RO to change the permission RW can still function fine. BUG=chrome-os-partner:59107 BRANCH=none TEST=Move the permission drop to the beginning of main and verify the system still boots. Change-Id: I5b7cb856decd0640288ad3476f875ec9edc42635 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/405840
Diffstat (limited to 'chip/g/jitter.c')
-rw-r--r--chip/g/jitter.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/chip/g/jitter.c b/chip/g/jitter.c
index 3a485d3d84..a7601487a9 100644
--- a/chip/g/jitter.c
+++ b/chip/g/jitter.c
@@ -35,7 +35,8 @@ void init_jittery_clock(int highsec)
/* saturate at 0xff */
bankval = (setting > 0xfff) ? 0xff : (setting >> 4);
- GR_XO_JTR_JITTERY_TRIM_BANK(bank) = bankval;
+ if (runlevel_is_high())
+ GR_XO_JTR_JITTERY_TRIM_BANK(bank) = bankval;
setting += stepx16;
if ((setting > skiplow) && (setting < skiphigh))