Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2576815rwb; Sat, 8 Oct 2022 10:09:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fSNLg8D0VudAeh4A+BOrh0WAUKkejAxztHRMA95FqOZMffXu71CiuXG+m+VXktgVyUTab X-Received: by 2002:a17:906:cc59:b0:779:f094:af3d with SMTP id mm25-20020a170906cc5900b00779f094af3dmr8115373ejb.239.1665248989094; Sat, 08 Oct 2022 10:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665248989; cv=none; d=google.com; s=arc-20160816; b=roPkNnKcq2ZOC0a+4A6qY907JbFXjdO1rgctFS7IyDmhKzRz3ZAnkllH/8Cz8u89Z0 a/QOl3Pdf4pAiHtQVj4AdQ5QLmHzHjDTPUoX2iuAmrG/K1FzohYzvYp42qDLe6kvKpdV Dm7AWD1dKI/FXYjB4kaW2Tb7BU8W+dXzY+1lJYAwG5/ZdnAANeTKrQwa/XKDAum/Xqkf 4DDGXIwedFPYPuqheQmvier6pvAvu5fcS/sDFJBf3Qmx6DneuO4ERpWD0STNLGXcWvCK Vuk19dnaVFPoj3ACBt97J+bTewHC9VZKS7767Bae7HMOs+/cf2/R7cF4IU2BSnAeV+a8 aKaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ukf4dE615x0DESNVVTZIQKgBm7oCRLwwO/K4NDp2D4U=; b=SfG90SrLSDRCqxxOnbXhrWGG0nGmGqTAQ+6KbPMvzbEtdx6ZzRAzEQg9sxN1f4Vukg xtFkHup44lfB6PIbUH5zIXOjPvz2crS3d6C5ZYvMg72Id3IOYW0gxpEVTbk3r5+DPxwr 6EbmTv4nfAfXNhytQzVcBmekmIYUYmYpra6dliGDdU4P+C060c0CcsQWD9W3p/zjvykY XhlDnlEcs9yaamKXRoWU1BNydBhsC+tPaJH0/yu/6ZS5DQ91L2k/p+AnkICWiRrjDxqF Kxpn0pTabzamL9rFzd65a22xLCWlEpTM926ZczvZOq7uKqsCwNK3F+NwYtSW+Qz5nKLw XBOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b="RGW/fnkV"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a12-20020a17090640cc00b007825337afeesi4803369ejk.273.2022.10.08.10.09.07; Sat, 08 Oct 2022 10:09:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b="RGW/fnkV"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229886AbiJHQyA (ORCPT + 99 others); Sat, 8 Oct 2022 12:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbiJHQx7 (ORCPT ); Sat, 8 Oct 2022 12:53:59 -0400 X-Greylist: delayed 479 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 08 Oct 2022 09:53:58 PDT Received: from mxout4.routing.net (mxout4.routing.net [IPv6:2a03:2900:1:a::9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8826C4316A for ; Sat, 8 Oct 2022 09:53:58 -0700 (PDT) Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout4.routing.net (Postfix) with ESMTP id CDE6E1008F7; Sat, 8 Oct 2022 16:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1665247557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ukf4dE615x0DESNVVTZIQKgBm7oCRLwwO/K4NDp2D4U=; b=RGW/fnkVu099eEytt5RqUWDS3UiEsoxLt9uwoxVrN+7FkATC4gQCslUR3Hyiwhv+FNxbSc 0H9+ektC1+w/udzgxvx9wZJlGN4HOe1SG1ml5kjdU132rGAaf1evJ4Th8sgibOJL4aT1Wx UfQBUZvuro6h4BYmiN6jTCsYsIS9U0I= Received: from frank-G5.. (fttx-pool-217.61.149.60.bambit.de [217.61.149.60]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id 1421710042C; Sat, 8 Oct 2022 16:45:57 +0000 (UTC) From: Frank Wunderlich To: linux-mediatek@lists.infradead.org Cc: "Mingming.Su" , Sean Wang , Olivia Mackall , Herbert Xu , Matthias Brugger , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Frank Wunderlich Subject: [PATCH] hwrng: mediatek: add mt7986 support Date: Sat, 8 Oct 2022 18:45:53 +0200 Message-Id: <20221008164553.113260-1-linux@fw-web.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mail-ID: 955c1372-43fb-49a3-a48a-2ecb07b1de5f X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: "Mingming.Su" 1. Add trng compatible name for MT7986 2. Fix mtk_rng_wait_ready() function Signed-off-by: Mingming.Su Signed-off-by: Frank Wunderlich --- 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