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 3/5] hwrng: stm32 - allow disable clock error detection
Date: Thu, 15 Feb 2018 14:03:10 +0100 [thread overview]
Message-ID: <20180215130312.23612-4-lionel.debieve@st.com> (raw)
In-Reply-To: <20180215130312.23612-1-lionel.debieve@st.com>
Add a new property that allow to disable the clock error
detection which is required when the clock source selected
is out of specification (which is not mandatory).
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
---
drivers/char/hw_random/stm32-rng.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index 83c695938a2d..709a8d061be3 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -26,6 +26,7 @@
#define RNG_CR 0x00
#define RNG_CR_RNGEN BIT(2)
+#define RNG_CR_CED BIT(5)
#define RNG_SR 0x04
#define RNG_SR_SEIS BIT(6)
@@ -48,6 +49,7 @@ struct stm32_rng_private {
void __iomem *base;
struct clk *clk;
struct reset_control *rst;
+ bool ced;
};
static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
@@ -101,7 +103,11 @@ static int stm32_rng_init(struct hwrng *rng)
if (err)
return err;
- writel_relaxed(RNG_CR_RNGEN, priv->base + RNG_CR);
+ if (priv->ced)
+ writel_relaxed(RNG_CR_RNGEN, priv->base + RNG_CR);
+ else
+ writel_relaxed(RNG_CR_RNGEN | RNG_CR_CED,
+ priv->base + RNG_CR);
/* clear error indicators */
writel_relaxed(0, priv->base + RNG_SR);
@@ -149,6 +155,8 @@ static int stm32_rng_probe(struct platform_device *ofdev)
reset_control_deassert(priv->rst);
}
+ priv->ced = of_property_read_bool(np, "clock-error-detect");
+
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 ` [PATCH Resend 1/5] hwrng: stm32 - add reset during probe Lionel Debieve
2018-02-15 13:03 ` [PATCH Resend 2/5] dt-bindings: rng: add reset node for stm32 Lionel Debieve
2018-02-15 13:03 ` Lionel Debieve [this message]
2018-02-15 13:03 ` [PATCH Resend 4/5] dt-bindings: rng: add clock detection error " 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-4-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®