[PATCH] m68knommu: add DMA timer counter to entropy

[email protected]
Newsgroups gmane.linux.ports.m68k,gmane.linux.uclinux.devel
Message-ID <[email protected]>
From: Greg Ungerer <[email protected]>

The ColdFire DMA timer hardware module is a free running counter that is
derived from the master system clock. It is effectively a cycle counter,
so lets add it to the entropy pool.

Signed-off-by: Greg Ungerer <[email protected]>
---
 arch/m68k/platform/coldfire/dma_timer.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/m68k/platform/coldfire/dma_timer.c b/arch/m68k/platform/coldfire/dma_timer.c
index 1f8d967..850463c 100644
--- a/arch/m68k/platform/coldfire/dma_timer.c
+++ b/arch/m68k/platform/coldfire/dma_timer.c
@@ -9,6 +9,7 @@
 #include <linux/clocksource.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/timex.h>
 
 #include <asm/machdep.h>
 #include <asm/coldfire.h>
@@ -30,6 +31,11 @@
 #define DMA_DTMR_CLK_DIV_16	(2 << 1)
 #define DMA_DTMR_ENABLE		(1 << 0)
 
+static unsigned long cf_dt_random_get_entropy(void)
+{
+	return __raw_readl(DTCN0);
+}
+
 static cycle_t cf_dt_get_cycles(struct clocksource *cs)
 {
 	return __raw_readl(DTCN0);
@@ -56,6 +62,7 @@ static int __init  init_cf_dt_clocksource(void)
 	clk = clk_get(NULL, "mcftmr.0");
 	if (clk)
 		clk_enable(clk);
+	mach_random_get_entropy = cf_dt_random_get_entropy;
 
 	__raw_writeb(0x00, DTXMR0);
 	__raw_writeb(0x00, DTER0);
-- 
1.8.1.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.