The msm-rng driver is currently broken on MSM8916.

The first issue is that the core clock isn't defined and thus not being
enabled before registers in the PRNG block are accessed.

The second issue is that the enable method is only initializing the PRNG
registers if the block is *already* initialized. This would have likely
caused issues elsewhere once the driver was in more active use, but the
problems on MSM8916 are immediate: trying to modify the state of LFSR_CFG
causes SErrors, presumably because this register is protected by TZ.

I also included a couple of extra patches while I'm in the neighborhood.
One is to improve the logging in apq8016 clk_enable (which would have
better surfaced the first issue). The other changes msm-rng driver slightly
to only enable its core clock when it's needed (similar to how the kernel
does it).

Signed-off-by: Sam Day <m...@samcday.com>
---
Changes in v2:
- split hunk changing clk_ens of existing clocks into separate patch
- Link to v1: 
https://lore.kernel.org/r/20250127-msm-rng-fixes-v1-0-00f5d2284...@samcday.com

---
Sam Day (5):
      clk/qcom: apq8016: use BIT macro for clk en_vals
      clk/qcom: apq8016: add PRNG_AHB_CLK
      rng: msm: don't enable PRNG if it's already enabled
      clk/qcom: apq8016: improve clk_enable logging
      rng: msm: keep core clock disabled when PRNG not in use

 drivers/clk/qcom/clock-apq8016.c |  9 +++++----
 drivers/rng/msm_rng.c            | 13 +++++++++++--
 2 files changed, 16 insertions(+), 6 deletions(-)
---
base-commit: 636fcc96c3d7e2b00c843e6da78ed3e9e3bdf4de
change-id: 20250126-msm-rng-fixes-f5a722a9492c

Best regards,
-- 
Sam Day <m...@samcday.com>


Reply via email to