2014-11-20 09:43:31

by Nicolas Ferre

[permalink] [raw]
Subject: [PATCH RESEND v2 0/4] hwrng: atmel: add DT support

This is the patch series that Boris sent yesterday. I've just collected
"Acked-by" tags and resend it with updated cover letter.

This series adds DT support for the TRNG (True Random Generator) block and adds
missing trng nodes to at91sam9g45 dtsi files.

Herbert,
As you said that you can take this series, here is the latest vertion ready for you to
pick it up. Thanks for your help.

Bye,

Boris Brezillon (4):
hwrng: atmel: use clk_prepapre_enable/_disable_unprepare
hwrng: atmel: add DT support
hwrng: atmel: Add TRNG DT binding doc
ARM: at91/dt: add trng node to at91sam9g45

Documentation/devicetree/bindings/hwrng/atmel-trng.txt | 16 ++++++++++++++++
arch/arm/boot/dts/at91sam9g45.dtsi | 7 +++++++
drivers/char/hw_random/Kconfig | 2 +-
drivers/char/hw_random/atmel-rng.c | 15 +++++++++++----
4 files changed, 35 insertions(+), 5 deletions(-)
create mode 100644 Documentation/devicetree/bindings/hwrng/atmel-trng.txt

--
2.1.3


2014-11-20 09:43:52

by Nicolas Ferre

[permalink] [raw]
Subject: [PATCH RESEND v2 1/4] hwrng: atmel: use clk_prepapre_enable/_disable_unprepare

From: Boris Brezillon <[email protected]>

Use clk_prepare_enable/_disable_unprepare instead of clk_enable/disable
to work properly with the CCF.

Signed-off-by: Boris Brezillon <[email protected]>
Acked-by: Peter Korsgaard <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
---
drivers/char/hw_random/atmel-rng.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index 851bc7e20ad2..644ec4882206 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -67,7 +67,7 @@ static int atmel_trng_probe(struct platform_device *pdev)
if (IS_ERR(trng->clk))
return PTR_ERR(trng->clk);

- ret = clk_enable(trng->clk);
+ ret = clk_prepare_enable(trng->clk);
if (ret)
return ret;

@@ -95,7 +95,7 @@ static int atmel_trng_remove(struct platform_device *pdev)
hwrng_unregister(&trng->rng);

writel(TRNG_KEY, trng->base + TRNG_CR);
- clk_disable(trng->clk);
+ clk_disable_unprepare(trng->clk);

return 0;
}
@@ -105,7 +105,7 @@ static int atmel_trng_suspend(struct device *dev)
{
struct atmel_trng *trng = dev_get_drvdata(dev);

- clk_disable(trng->clk);
+ clk_disable_unprepare(trng->clk);

return 0;
}
@@ -114,7 +114,7 @@ static int atmel_trng_resume(struct device *dev)
{
struct atmel_trng *trng = dev_get_drvdata(dev);

- return clk_enable(trng->clk);
+ return clk_prepare_enable(trng->clk);
}

static const struct dev_pm_ops atmel_trng_pm_ops = {
--
2.1.3

2014-11-20 09:43:56

by Nicolas Ferre

[permalink] [raw]
Subject: [PATCH RESEND v2 2/4] hwrng: atmel: add DT support

From: Boris Brezillon <[email protected]>

Add DT support.

Make the driver depend on CONFIG_OF as at91sam9g45 was the only SoC making
use of the TRNG block and this SoC is now fully migrated to DT.

Signed-off-by: Boris Brezillon <[email protected]>
Acked-by: Peter Korsgaard <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
---
drivers/char/hw_random/Kconfig | 2 +-
drivers/char/hw_random/atmel-rng.c | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index 91a04ae8003c..de57b38809c7 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -64,7 +64,7 @@ config HW_RANDOM_AMD

config HW_RANDOM_ATMEL
tristate "Atmel Random Number Generator support"
- depends on ARCH_AT91 && HAVE_CLK
+ depends on ARCH_AT91 && HAVE_CLK && OF
default HW_RANDOM
---help---
This driver provides kernel-side support for the Random Number
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index 644ec4882206..0bb0b2120a63 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -123,6 +123,12 @@ static const struct dev_pm_ops atmel_trng_pm_ops = {
};
#endif /* CONFIG_PM */

+static const struct of_device_id atmel_trng_dt_ids[] = {
+ { .compatible = "atmel,at91sam9g45-trng" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, atmel_trng_dt_ids);
+
static struct platform_driver atmel_trng_driver = {
.probe = atmel_trng_probe,
.remove = atmel_trng_remove,
@@ -132,6 +138,7 @@ static struct platform_driver atmel_trng_driver = {
#ifdef CONFIG_PM
.pm = &atmel_trng_pm_ops,
#endif /* CONFIG_PM */
+ .of_match_table = atmel_trng_dt_ids,
},
};

--
2.1.3

2014-11-20 09:44:18

by Nicolas Ferre

[permalink] [raw]
Subject: [PATCH RESEND v2 3/4] hwrng: atmel: Add TRNG DT binding doc

From: Boris Brezillon <[email protected]>

Document DT bindings of Atmel's TRNG (True Random Number Generator) IP.

Signed-off-by: Boris Brezillon <[email protected]>
Acked-by: Peter Korsgaard <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
---
Documentation/devicetree/bindings/hwrng/atmel-trng.txt | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwrng/atmel-trng.txt

diff --git a/Documentation/devicetree/bindings/hwrng/atmel-trng.txt b/Documentation/devicetree/bindings/hwrng/atmel-trng.txt
new file mode 100644
index 000000000000..4ac5aaa2d024
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwrng/atmel-trng.txt
@@ -0,0 +1,16 @@
+Atmel TRNG (True Random Number Generator) block
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g45-trng"
+- reg : Offset and length of the register set of this block
+- interrupts : the interrupt number for the TRNG block
+- clocks: should contain the TRNG clk source
+
+Example:
+
+trng@fffcc000 {
+ compatible = "atmel,at91sam9g45-trng";
+ reg = <0xfffcc000 0x4000>;
+ interrupts = <6 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&trng_clk>;
+};
--
2.1.3

2014-11-20 09:44:25

by Nicolas Ferre

[permalink] [raw]
Subject: [PATCH RESEND v2 4/4] ARM: at91/dt: add trng node to at91sam9g45

From: Boris Brezillon <[email protected]>

Add a DT node for the TRNG (True Random Number Generator) block.

Keep this block enabled as it does not depend on any external connection,
and thus should be available on all boards.

Signed-off-by: Boris Brezillon <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
---
arch/arm/boot/dts/at91sam9g45.dtsi | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index d3f65130a1f8..6c0637a4bda5 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -940,6 +940,13 @@
status = "disabled";
};

+ trng@fffcc000 {
+ compatible = "atmel,at91sam9g45-trng";
+ reg = <0xfffcc000 0x4000>;
+ interrupts = <6 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&trng_clk>;
+ };
+
i2c0: i2c@fff84000 {
compatible = "atmel,at91sam9g10-i2c";
reg = <0xfff84000 0x100>;
--
2.1.3

2014-11-20 14:44:25

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH RESEND v2 0/4] hwrng: atmel: add DT support

On Thu, Nov 20, 2014 at 10:43:21AM +0100, Nicolas Ferre wrote:
> This is the patch series that Boris sent yesterday. I've just collected
> "Acked-by" tags and resend it with updated cover letter.
>
> This series adds DT support for the TRNG (True Random Generator) block and adds
> missing trng nodes to at91sam9g45 dtsi files.
>
> Herbert,
> As you said that you can take this series, here is the latest vertion ready for you to
> pick it up. Thanks for your help.
>
> Bye,
>
> Boris Brezillon (4):
> hwrng: atmel: use clk_prepapre_enable/_disable_unprepare
> hwrng: atmel: add DT support
> hwrng: atmel: Add TRNG DT binding doc
> ARM: at91/dt: add trng node to at91sam9g45

All applied. Thanks!
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt