[5/5] hw_random: ixp4xx: Add OF support

Message ID 20210511132928.814697-5-linus.walleij@linaro.org
State Accepted
Commit b80e60eb8ecc77e479ed19a70d1b9e86f0fcc2ca
Headers show
Series
  • [1/5] hw_random: ixp4xx: enable compile-testing
Related show

Commit Message

Linus Walleij May 11, 2021, 1:29 p.m.
This makes the hardware random number generator found in
the IXP46x SoCs probe from the device tree.

Cc: Deepak Saxena <dsaxena@plexity.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
The idea is to apply this through the ARM SoC tree along
with other IXP4xx refactorings.
Please tell me if you prefer another solution.
---
 drivers/char/hw_random/ixp4xx-rng.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

-- 
2.30.2

Comments

Herbert Xu May 21, 2021, 7:11 a.m. | #1
On Tue, May 11, 2021 at 03:29:28PM +0200, Linus Walleij wrote:
> This makes the hardware random number generator found in

> the IXP46x SoCs probe from the device tree.

> 

> Cc: Deepak Saxena <dsaxena@plexity.net>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> ---

> The idea is to apply this through the ARM SoC tree along

> with other IXP4xx refactorings.

> Please tell me if you prefer another solution.

> ---

>  drivers/char/hw_random/ixp4xx-rng.c | 10 ++++++++++

>  1 file changed, 10 insertions(+)


Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

-- 
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

Patch

diff --git a/drivers/char/hw_random/ixp4xx-rng.c b/drivers/char/hw_random/ixp4xx-rng.c
index 8b59aeefd4a4..188854dd16a9 100644
--- a/drivers/char/hw_random/ixp4xx-rng.c
+++ b/drivers/char/hw_random/ixp4xx-rng.c
@@ -19,6 +19,7 @@ 
 #include <linux/init.h>
 #include <linux/bitops.h>
 #include <linux/hw_random.h>
+#include <linux/of.h>
 #include <linux/soc/ixp4xx/cpu.h>
 
 #include <asm/io.h>
@@ -55,9 +56,18 @@  static int ixp4xx_rng_probe(struct platform_device *pdev)
 	return devm_hwrng_register(dev, &ixp4xx_rng_ops);
 }
 
+static const struct of_device_id ixp4xx_rng_of_match[] = {
+	{
+		.compatible = "intel,ixp46x-rng",
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, ixp4xx_rng_of_match);
+
 static struct platform_driver ixp4xx_rng_driver = {
 	.driver = {
 		.name = "ixp4xx-hwrandom",
+		.of_match_table = ixp4xx_rng_of_match,
 	},
 	.probe = ixp4xx_rng_probe,
 };