diff options
author | Sam Day <me@samcday.com> | 2025-02-12 07:01:39 +0000 |
---|---|---|
committer | Caleb Connolly <caleb.connolly@linaro.org> | 2025-03-17 13:38:18 +0000 |
commit | 6e933cd69ad9eadcc26d6db01b066e524b8894c2 (patch) | |
tree | 92e722a0442b129d59b3e24ea34570e77dc154bb /drivers/rng/msm_rng.c | |
parent | d146a8771f8769e392f5f12316cbc1cfe64ede3a (diff) |
rng: msm: don't enable PRNG if it's already enabled
msm_rng_enable is supposed to skip writing to LFSR_CFG + CONFIG
registers in the PRNG_ block if PRNG_CONFIG_HW_ENABLE is already set.
The logic to test for this was inverted.
Without this fix, the driver was causing SError aborts on my MSM8916
device. Stephan Gerhold suggested this was probably because TZ has
marked this as a protected register, since it would also be using it for
RNG.
Fixes: 033ec636fcb ("rng: Add Qualcomm MSM PRNG driver")
Suggested-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Sam Day <me@samcday.com>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/r/20250212-msm-rng-fixes-v2-3-645cf8d3fd3c@samcday.com
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Diffstat (limited to 'drivers/rng/msm_rng.c')
-rw-r--r-- | drivers/rng/msm_rng.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rng/msm_rng.c b/drivers/rng/msm_rng.c index f790d3b60f9..01505509103 100644 --- a/drivers/rng/msm_rng.c +++ b/drivers/rng/msm_rng.c @@ -76,7 +76,7 @@ static int msm_rng_enable(struct msm_rng_priv *priv, int enable) if (enable) { /* Enable PRNG only if it is not already enabled */ val = readl_relaxed(priv->base + PRNG_CONFIG); - if (val & PRNG_CONFIG_HW_ENABLE) { + if (!(val & PRNG_CONFIG_HW_ENABLE)) { val = readl_relaxed(priv->base + PRNG_LFSR_CFG); val &= ~PRNG_LFSR_CFG_MASK; val |= PRNG_LFSR_CFG_CLOCKS; |