From: Lionel Debieve <lionel.debieve@st.com>
To: Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
Rob Herring <rob.herring@linaro.org>,
<linux-crypto@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Cc: Benjamin Gaignard <benjamin.gaignard@st.com>,
Ludovic Barre <ludovic.barre@st.com>
Subject: [PATCH Resend 1/5] hwrng: stm32 - add reset during probe
Date: Thu, 15 Feb 2018 14:03:08 +0100 [thread overview]
Message-ID: <20180215130312.23612-2-lionel.debieve@st.com> (raw)
In-Reply-To: <20180215130312.23612-1-lionel.debieve@st.com>
Avoid issue when probing the RNG without
reset if bad status has been detected previously
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
---
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 <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#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
next prev parent reply other threads:[~2018-02-15 13:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 13:03 [PATCH Resend 0/5] hwrng: stm32 - Improvement for stm32-rng Lionel Debieve
2018-02-15 13:03 ` Lionel Debieve [this message]
2018-02-15 13:03 ` [PATCH Resend 2/5] dt-bindings: rng: add reset node for stm32 Lionel Debieve
2018-02-15 13:03 ` [PATCH Resend 3/5] hwrng: stm32 - allow disable clock error detection Lionel Debieve
2018-02-15 13:03 ` [PATCH Resend 4/5] dt-bindings: rng: add clock detection error for stm32 Lionel Debieve
2018-02-15 13:03 ` [PATCH Resend 5/5] hwrng: stm32 - rework read timeout calculation Lionel Debieve
2018-02-22 14:03 ` [PATCH Resend 0/5] hwrng: stm32 - Improvement for stm32-rng Herbert Xu
2018-02-22 15:25 ` Alexandre Torgue
2018-03-02 16:34 ` Herbert Xu
2018-03-02 16:33 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180215130312.23612-2-lionel.debieve@st.com \
--to=lionel.debieve@st.com \
--cc=alexandre.torgue@st.com \
--cc=arnd@arndb.de \
--cc=benjamin.gaignard@st.com \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.barre@st.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mpm@selenic.com \
--cc=rob.herring@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®