Received: by 10.223.185.116 with SMTP id b49csp1998153wrg; Thu, 15 Feb 2018 05:05:19 -0800 (PST) X-Google-Smtp-Source: AH8x224CYyuXrK2CAgcVxELvzH6i1O0fD6g17FnSwXOrBsbu8X4tuRLeFVNxryeC0XoMULHBNZZV X-Received: by 10.98.14.70 with SMTP id w67mr2609423pfi.1.1518699919401; Thu, 15 Feb 2018 05:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518699919; cv=none; d=google.com; s=arc-20160816; b=jTmNi7FbBjD+9lhkYzGtQnVEqK24tjrYWmIGlboN2cIYncC5AVy7Dtg5WPRQIknl7r SshzHcuKkV1cJsR/zrMcaaBC+j3z3DZ47EL66FRtWP2Jc7HH0OaGiDFg57Sh0Z082tsS VX7qy63UcEzSvTJZGX/mydCghrGFZaS7yh4/aB9d7EA6nev28gOcD876UZyhvrq8E1ZH et1fQjPF7UNCUz3EZmbX2CslZxyndRzsZMWkauA/BYhK5vcShWRVkcSfRXLP7ghZ+T/P KunwXHC0SZJePpf0n8BGaXNL3gyoMCSoIRTGxWUrgfr7VAs4ay4cy1Z4UpsShuPilqT+ R4yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=Q+avL/3/Ae/cJ2cfnXYHRi6MCDDRA5D23aYHii/qYPM=; b=R91ih5x4XaRC5XLQy1jkaghQTiLSeMpQtkKLVmAWpaje7YAouzr/+mzeqmtV/FMaSj tBbM06n9h9z3J22R3yOrpiyR4lUwITbXMVr04pXOucDLPmAlrljwhPPDDSbt48+8Hljy T6apA1HtB+q6LpZi8RDuc826puTMz/j3myzP6MfXnAtQKi2RtMn7/IvjlsjLyY0kywDg r4A87z2JZi1BxOpx9hPzKPAkS44neFIVO+NrhvGUkRQUZYsbg0yoXJ3EzEol/h+sgCC5 +7zw4X1BmLEyVpLaWAfGQaA59zs09Z7rhDq4PlG4DQ3JDCp8KpudvylvoyXZ4AXRHoGA abtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 79si1205940pfn.282.2018.02.15.05.05.04; Thu, 15 Feb 2018 05:05:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032372AbeBONED (ORCPT + 99 others); Thu, 15 Feb 2018 08:04:03 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:28407 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031104AbeBOND5 (ORCPT ); Thu, 15 Feb 2018 08:03:57 -0500 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w1FCxBqE008490; Thu, 15 Feb 2018 14:03:25 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2g1q329252-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 15 Feb 2018 14:03:25 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BEAC931; Thu, 15 Feb 2018 13:03:24 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas24.st.com [10.75.90.94]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9B6AC4DFA; Thu, 15 Feb 2018 13:03:24 +0000 (GMT) Received: from SAFEX1HUBCAS23.st.com (10.75.90.47) by Safex1hubcas24.st.com (10.75.90.94) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 15 Feb 2018 14:03:24 +0100 Received: from localhost (10.201.23.65) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 15 Feb 2018 14:03:24 +0100 From: Lionel Debieve To: Matt Mackall , Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , Rob Herring , , , CC: Benjamin Gaignard , Ludovic Barre Subject: [PATCH Resend 1/5] hwrng: stm32 - add reset during probe Date: Thu, 15 Feb 2018 14:03:08 +0100 Message-ID: <20180215130312.23612-2-lionel.debieve@st.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180215130312.23612-1-lionel.debieve@st.com> References: <20180215130312.23612-1-lionel.debieve@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.65] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-15_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoid issue when probing the RNG without reset if bad status has been detected previously Signed-off-by: Lionel Debieve --- drivers/char/hw_random/stm32-rng.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c index 63d84e6f1891..83c695938a2d 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #define RNG_CR 0x00 @@ -46,6 +47,7 @@ struct stm32_rng_private { struct hwrng rng; void __iomem *base; struct clk *clk; + struct reset_control *rst; }; static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) @@ -140,6 +142,13 @@ static int stm32_rng_probe(struct platform_device *ofdev) if (IS_ERR(priv->clk)) return PTR_ERR(priv->clk); + priv->rst = devm_reset_control_get(&ofdev->dev, NULL); + if (!IS_ERR(priv->rst)) { + reset_control_assert(priv->rst); + udelay(2); + reset_control_deassert(priv->rst); + } + dev_set_drvdata(dev, priv); priv->rng.name = dev_driver_string(dev), -- 2.15.1