Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1250322 > unrolled thread

[PATCH 0/4] hwrng: exynos - Add Device Tree support

Started byKrzysztof Kozlowski <k.kozlowski@samsung.com>
First post2015-10-19 06:40 +0200
Last post2015-10-20 16:30 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] hwrng: exynos - Add Device Tree support Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-10-19 06:40 +0200
    [PATCH 1/4] dt-bindings: rng: Describe Exynos4 PRNG bindings Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-10-19 06:40 +0200
    [PATCH 4/4] hwrng: exynos - Add Device Tree support Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-10-19 06:40 +0200
    [PATCH 2/4] hwrng: exynos - Add timeout for waiting on init done Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-10-19 06:50 +0200
    Re: [PATCH 0/4] hwrng: exynos - Add Device Tree support Herbert Xu <herbert@gondor.apana.org.au> - 2015-10-20 16:30 +0200

#1250322 — [PATCH 0/4] hwrng: exynos - Add Device Tree support

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2015-10-19 06:40 +0200
Subject[PATCH 0/4] hwrng: exynos - Add Device Tree support
Message-ID<qlaoO-20i-5@gated-at.bofh.it>
Hi,

The patchset fixes known issues in Exynos hardware random number
generator and adds Device Tree support for it.

The device was tested on Trats2 board (Exynos4412). It should work
on other Exynos4 and Exynos5 as well... altough it seems that
on some of Exynos542x boards the SSS module is secured.

Best regards,
Krzysztof

Krzysztof Kozlowski (4):
  dt-bindings: rng: Describe Exynos4 PRNG bindings
  hwrng: exynos - Add timeout for waiting on init done
  hwrng: exynos - Fix missing configuration after suspend to RAM
  hwrng: exynos - Add Device Tree support

 .../bindings/rng/samsung,exynos-rng4.txt           | 17 +++++++
 drivers/char/hw_random/exynos-rng.c                | 56 ++++++++++++++++++----
 2 files changed, 65 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1250324 — [PATCH 1/4] dt-bindings: rng: Describe Exynos4 PRNG bindings

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2015-10-19 06:40 +0200
Subject[PATCH 1/4] dt-bindings: rng: Describe Exynos4 PRNG bindings
Message-ID<qlaoO-20i-11@gated-at.bofh.it>
In reply to#1250322
Document the bindings used by exynos-rng Pseudo Random Number Generator
driver.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 .../devicetree/bindings/rng/samsung,exynos-rng4.txt     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt

diff --git a/Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt b/Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt
new file mode 100644
index 000000000000..4ca8dd4d7e66
--- /dev/null
+++ b/Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt
@@ -0,0 +1,17 @@
+Exynos Pseudo Random Number Generator
+
+Required properties:
+
+- compatible  : Should be "samsung,exynos4-rng".
+- reg         : Specifies base physical address and size of the registers map.
+- clocks      : Phandle to clock-controller plus clock-specifier pair.
+- clock-names : "secss" as a clock name.
+
+Example:
+
+	rng@10830400 {
+		compatible = "samsung,exynos4-rng";
+		reg = <0x10830400 0x200>;
+		clocks = <&clock CLK_SSS>;
+		clock-names = "secss";
+	};
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1250325 — [PATCH 4/4] hwrng: exynos - Add Device Tree support

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2015-10-19 06:40 +0200
Subject[PATCH 4/4] hwrng: exynos - Add Device Tree support
Message-ID<qlaoO-20i-13@gated-at.bofh.it>
In reply to#1250322
Add Device Tree support for the driver. The Pseudo Random Number
Generator module is the same in almost all of Exynos SoCs, since
Exynos4210 (however the tests were done only on Trats2 board with
Exynos4412). There are some differences on newer Exynos Octa
(Exynos542x) SoCs.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/char/hw_random/exynos-rng.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c
index 162adbda1b70..7077c7741dae 100644
--- a/drivers/char/hw_random/exynos-rng.c
+++ b/drivers/char/hw_random/exynos-rng.c
@@ -188,10 +188,19 @@ static const struct dev_pm_ops exynos_rng_pm_ops = {
 			   exynos_rng_runtime_resume, NULL)
 };
 
+static const struct of_device_id exynos_rng_dt_match[] = {
+	{
+		.compatible = "samsung,exynos4-rng",
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(of, exynos_rng_dt_match);
+
 static struct platform_driver exynos_rng_driver = {
 	.driver		= {
 		.name	= "exynos-rng",
 		.pm	= &exynos_rng_pm_ops,
+		.of_match_table = exynos_rng_dt_match,
 	},
 	.probe		= exynos_rng_probe,
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1250327 — [PATCH 2/4] hwrng: exynos - Add timeout for waiting on init done

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2015-10-19 06:50 +0200
Subject[PATCH 2/4] hwrng: exynos - Add timeout for waiting on init done
Message-ID<qlayt-2bl-1@gated-at.bofh.it>
In reply to#1250322
Driver may hang waiting indefinitely for PRNG to finish its
initialization stage. Instead of stalling return -ETIMEDOUT error.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/char/hw_random/exynos-rng.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c
index dc4701fd814f..dfaaaafb8ddd 100644
--- a/drivers/char/hw_random/exynos-rng.c
+++ b/drivers/char/hw_random/exynos-rng.c
@@ -81,14 +81,17 @@ static int exynos_read(struct hwrng *rng, void *buf,
 	struct exynos_rng *exynos_rng = container_of(rng,
 						struct exynos_rng, rng);
 	u32 *data = buf;
+	int retry = 100;
 
 	pm_runtime_get_sync(exynos_rng->dev);
 
 	exynos_rng_writel(exynos_rng, PRNG_START, 0);
 
 	while (!(exynos_rng_readl(exynos_rng,
-			EXYNOS_PRNG_STATUS_OFFSET) & PRNG_DONE))
+			EXYNOS_PRNG_STATUS_OFFSET) & PRNG_DONE) && --retry)
 		cpu_relax();
+	if (!retry)
+		return -ETIMEDOUT;
 
 	exynos_rng_writel(exynos_rng, PRNG_DONE, EXYNOS_PRNG_STATUS_OFFSET);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1251747

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2015-10-20 16:30 +0200
Message-ID<qlG5k-6l5-23@gated-at.bofh.it>
In reply to#1250322
On Mon, Oct 19, 2015 at 01:37:38PM +0900, Krzysztof Kozlowski wrote:
> Hi,
> 
> The patchset fixes known issues in Exynos hardware random number
> generator and adds Device Tree support for it.
> 
> The device was tested on Trats2 board (Exynos4412). It should work
> on other Exynos4 and Exynos5 as well... altough it seems that
> on some of Exynos542x boards the SSS module is secured.

All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web