Received: by 10.223.176.5 with SMTP id f5csp3125271wra; Mon, 29 Jan 2018 09:08:45 -0800 (PST) X-Google-Smtp-Source: AH8x224OVUyF6QhbLOQstqR8Bbo9mHxNOSaJfj/48+nMyg8sBhNm3fAgxbIHIcWdks4qnEMaDduW X-Received: by 10.98.170.24 with SMTP id e24mr27495126pff.177.1517245724910; Mon, 29 Jan 2018 09:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517245724; cv=none; d=google.com; s=arc-20160816; b=U8EDUUaMQVjJA+LfqBZjnan7/LeUjwAfY8dkj1qOwu87qaw+vUWwEM9uTYiCN4opJ2 ZMEqS8ck2uoYmrx1i7xf/o7Ggyt8ihpzz8R+gEOP/tJ2FhkVq46wgpwuZG1Gos0kiwLf 8lGDbU/hAxZdvjcyCPR+70Cmb5ft7C+KZpdFIoQJghQupLgDH8qU/jh7vLfhjmAKxhQ/ 3ARPTkVAVnxeGI0pn+xl6vjonWd12ezxTGlXwpD5pCbJjTws+gWWDUEXopMKyCtErtQr 5wa4+vRes+9Hy75phJA7oIJxbGFSJkgF5lbyWLJ7Cn1VcdRfZfHBlFG1ceX+gmZYArWc oIaw== 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=NMrLUUREvIrWjCp2EjxQg+YWh3iIJxJehWBkIhOW9M2x/fvGn1RnisBHX5rp72bJg7 dCZV2qojhtciD56Sijjkb+KSiLJ2AxreKx6Lc6IEU1kf6d+dnqfse2YQGgtby9vso3EA +4ROG1RCqpit/Bcbtb/C+x1oDc0oExvpth7q+Q45QAKX3PCRsCQwEncPihQ6lMDoElXE uMiKjQ5Xc8EJeXZrbPAWbhCF7fe9yCBi+H8BiA4QnKdzlGjkymDEZa+lCim5vyT+/hAP 5y4IKcV6cEqr8tKYxS4FNLOHTazRk668foe0TpvAUzG0AbUmh5iRILh0hjBKFZVkl7EZ cCZw== 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 a70si7744800pge.448.2018.01.29.09.08.30; Mon, 29 Jan 2018 09:08:44 -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 S1751594AbeA2RGs (ORCPT + 99 others); Mon, 29 Jan 2018 12:06:48 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:60310 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751219AbeA2RGo (ORCPT ); Mon, 29 Jan 2018 12:06:44 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w0TH4E2H027972; Mon, 29 Jan 2018 18:06:19 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2frh6j4skd-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 29 Jan 2018 18:06:19 +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 235EE31; Mon, 29 Jan 2018 17:06:19 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag7node2.st.com [10.75.127.20]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 04DC32D4E; Mon, 29 Jan 2018 17:06:19 +0000 (GMT) Received: from lmecxl0602.lme.st.com (10.75.127.48) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 29 Jan 2018 18:06:18 +0100 From: Lionel Debieve To: Matt Mackall , Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , , , CC: Benjamin Gaignard , Ludovic Barre Subject: [PATCH 1/5] hwrng: stm32 - add reset during probe Date: Mon, 29 Jan 2018 18:05:17 +0100 Message-ID: <20180129170521.1862-2-lionel.debieve@st.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180129170521.1862-1-lionel.debieve@st.com> References: <20180129170521.1862-1-lionel.debieve@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG8NODE3.st.com (10.75.127.24) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-29_08:,, 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