2022-10-08 17:09:49

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH] hwrng: mediatek: add mt7986 support

From: "Mingming.Su" <[email protected]>

1. Add trng compatible name for MT7986
2. Fix mtk_rng_wait_ready() function

Signed-off-by: Mingming.Su <[email protected]>
Signed-off-by: Frank Wunderlich <[email protected]>
---
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 6c00ea008555..aa993753ab12 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)
@@ -179,6 +179,7 @@ static const struct dev_pm_ops mtk_rng_pm_ops = {
#endif /* CONFIG_PM */

static const struct of_device_id mtk_rng_match[] = {
+ { .compatible = "mediatek,mt7986-rng" },
{ .compatible = "mediatek,mt7623-rng" },
{},
};
--
2.34.1


2022-10-21 11:45:19

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] hwrng: mediatek: add mt7986 support

On Sat, Oct 08, 2022 at 06:45:53PM +0200, Frank Wunderlich wrote:
> From: "Mingming.Su" <[email protected]>
>
> 1. Add trng compatible name for MT7986
> 2. Fix mtk_rng_wait_ready() function
>
> Signed-off-by: Mingming.Su <[email protected]>
> Signed-off-by: Frank Wunderlich <[email protected]>
> ---
> drivers/char/hw_random/mtk-rng.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt