Files
immortalwrt-mt798x/target/linux/mediatek/patches-5.4/0111-mt7986-trng-add-rng-support.patch
yangxu52 81a41bfe22 kernel: bump to 5.4.302
- update the 5.4 kernel baseline from 5.4.284 to 5.4.302
- rebase the affected generic patches, including the MikroTik build bits and codel backport, to the 5.4.302 source context
- rebase the affected MediaTek TRNG and PWM patches to the new source context
- adjust 993-usb-serial-option-add-u9300.patch so the LONGSUNG U9300 modem patch still applies after the qmi_wwan changes
2026-04-14 11:20:54 +08:00

47 lines
1.4 KiB
Diff

From 6d4a858d6f7db2a86f6513a543feb8f7b8a8b4c1 Mon Sep 17 00:00:00 2001
From: "Mingming.Su" <Mingming.Su@mediatek.com>
Date: Wed, 30 Jun 2021 16:59:32 +0800
Subject: [PATCH] mt7986: trng: add rng support
1. Add trng compatible name for MT7986
2. Fix mtk_rng_wait_ready() function
Signed-off-by: Mingming.Su <Mingming.Su@mediatek.com>
---
drivers/char/hw_random/mtk-rng.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c
index e649be5a5..496adb0a0 100644
--- a/drivers/char/hw_random/mtk-rng.c
+++ b/drivers/char/hw_random/mtk-rng.c
@@ -22,7 +22,7 @@
#define RNG_AUTOSUSPEND_TIMEOUT 100
#define USEC_POLL 2
-#define TIMEOUT_POLL 20
+#define TIMEOUT_POLL 60
#define RNG_CTRL 0x00
#define RNG_EN BIT(0)
@@ -77,7 +77,7 @@ static bool mtk_rng_wait_ready(struct hwrng *rng, bool wait)
readl_poll_timeout_atomic(priv->base + RNG_CTRL, ready,
ready & RNG_READY, USEC_POLL,
TIMEOUT_POLL);
- return !!ready;
+ return !!(ready & RNG_READY);
}
static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
@@ -186,6 +186,7 @@ static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend,
#endif /* CONFIG_PM */
static const struct of_device_id mtk_rng_match[] = {
+ { .compatible = "mediatek,mt7986-rng" },
{ .compatible = "mediatek,mt7623-rng" },
{},
};
--
2.18.0