blob: bef2e1c5c974e4c922ca0f263d234ce5d60acd44 [file] [log] [blame]
developer5d148cb2023-06-02 13:08:11 +08001From 28b23dd56546943c99dc4e884576e629b417fb6d Mon Sep 17 00:00:00 2001
2From: Sam Shih <sam.shih@mediatek.com>
3Date: Fri, 2 Jun 2023 13:06:05 +0800
4Subject: [PATCH] [slow-speed-io][999-2100-mt7986-trng-add-rng-support.patch]
developer870b85a2021-07-02 10:54:11 +08005
developer870b85a2021-07-02 10:54:11 +08006---
7 drivers/char/hw_random/mtk-rng.c | 5 +++--
8 1 file changed, 3 insertions(+), 2 deletions(-)
9
10diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c
developer5d148cb2023-06-02 13:08:11 +080011index 6670516fa..a8bd06da7 100644
developer870b85a2021-07-02 10:54:11 +080012--- a/drivers/char/hw_random/mtk-rng.c
13+++ b/drivers/char/hw_random/mtk-rng.c
14@@ -22,7 +22,7 @@
15 #define RNG_AUTOSUSPEND_TIMEOUT 100
16
17 #define USEC_POLL 2
18-#define TIMEOUT_POLL 20
19+#define TIMEOUT_POLL 60
20
21 #define RNG_CTRL 0x00
22 #define RNG_EN BIT(0)
23@@ -77,7 +77,7 @@ static bool mtk_rng_wait_ready(struct hwrng *rng, bool wait)
24 readl_poll_timeout_atomic(priv->base + RNG_CTRL, ready,
25 ready & RNG_READY, USEC_POLL,
26 TIMEOUT_POLL);
27- return !!ready;
28+ return !!(ready & RNG_READY);
29 }
30
31 static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
developer5d148cb2023-06-02 13:08:11 +080032@@ -186,6 +186,7 @@ static const struct dev_pm_ops mtk_rng_pm_ops = {
developer870b85a2021-07-02 10:54:11 +080033 #endif /* CONFIG_PM */
34
35 static const struct of_device_id mtk_rng_match[] = {
36+ { .compatible = "mediatek,mt7986-rng" },
37 { .compatible = "mediatek,mt7623-rng" },
38 {},
39 };
40--
developer5d148cb2023-06-02 13:08:11 +0800412.34.1
developer870b85a2021-07-02 10:54:11 +080042