dt-bindings: timeriomem_rng: Add entropy quality property
PATCH 1/2 dt-bindings: timeriomem_rng: Add entropy quality property
---
Documentation/devicetree/bindings/rng/timeriomem_rng.txt | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/rng/timeriomem_rng.txt +7 -0
@@ -5,6 +5,13 @@ Required properties: - reg : base address to sample from - period : wait time in microseconds to use between samples +Optional properties: +- quality : estimated number of bits of true entropy per 1024 bits read from the + rng. Defaults to zero which causes the kernel's default quality to + be used instead. Note that the default quality is usually zero + which disables using this rng to automatically fill the kernel's + entropy pool. + N.B. currently 'reg' must be four bytes wide and aligned Example:
Signature · 6 lines
2.13.0.303.g4ebf302169-goog -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/2 hw_random: timeriomem_rng: Allow setting RNG quality from platform data
When a hw_random device's quality is non-zero, it will automatically be used to fill the kernel's entropy pool. Since timeriomem_rng is used by many different devices, the quality needs to be provided by platform data or device tree.
---
drivers/char/hw_random/timeriomem-rng.c | 7 +++++++ include/linux/timeriomem-rng.h | 3 +++ 2 files changed, 10 insertions(+)
drivers/char/hw_random/timeriomem-rng.c +7 -0
@@ -151,8 +151,15 @@ static int timeriomem_rng_probe(struct platform_device *pdev)dev_err (&pdev->dev,"missing period\n" );return -EINVAL ; } + +if (!of_property_read_u32 (pdev->dev.of_node, +"quality" , &i)) + priv->rng_ops.quality = i; +else + priv->rng_ops.quality =0 ; }else { period = pdata->period; + priv->rng_ops.quality = pdata->quality; } priv->period =ns_to_ktime (period *NSEC_PER_USEC );
include/linux/timeriomem-rng.h +3 -0
@@ -13,4 +13,7 @@ struct timeriomem_rng_data {/* measures in usecs */ unsigned int period; + +/* bits of entropy per 1000 bits read */ +unsigned int quality; };
Signature · 1 line
2.13.0.303.g4ebf302169-goog
Re: [PATCH v1 2/2] hw_random: timeriomem_rng: Allow setting RNG quality from platform data
Hi Rick,
Minor comment below.
Quoted 37 lines · Rick Altherr
When a
hw_randomdevice's quality is non-zero, it will automatically be used to fill the kernel's entropy pool. Sincetimeriomem_rngis used by many different devices, the quality needs to be provided by platform data or device tree.Signed-off-by Rick Altherr <[email protected]>---
drivers/char/hw_random/timeriomem-rng.c | 7 +++++++ include/linux/timeriomem-rng.h | 3 +++ 2 files changed, 10 insertions(+)drivers/char/hw_random/timeriomem-rng.c +7
-0@@ -151,8 +151,15 @@ static int timeriomem_rng_probe(struct platform_device *pdev)dev_err (&pdev->dev,"missing period\n" );return -EINVAL ; } + +if (!of_property_read_u32 (pdev->dev.of_node, +"quality" , &i)) + priv->rng_ops.quality = i; +else + priv->rng_ops.quality =0 ; }else { period = pdata->period; + priv->rng_ops.quality = pdata->quality; } priv->period =ns_to_ktime (period *NSEC_PER_USEC );include/linux/timeriomem-rng.h +0
-0
include/linux/timeriomem-rng.h struct timeriomem_rng_data { · line 17
Quoted 5 lines
include/linux/timeriomem-rng.h +2
-0@@ -13,4 +13,7 @@ struct timeriomem_rng_data {/* measures in usecs */ unsigned int period; + +/* bits of entropy per 1000 bits read */
Your dt-bindings patch says 'entropy per 1024 bits'. Please be consistent.
Quoted 5 lines
include/linux/timeriomem-rng.h +1
-1+unsigned int quality; }; --2.13.0.303.g4ebf302169-goog
Regards,
PrasannaKumar
Quoted 5 lines · Rick Altherr
Signed-off-by Rick Altherr <[email protected]>---
Documentation/devicetree/bindings/rng/timeriomem_rng.txt | 7 +++++++ 1 file changed, 7 insertions(+)