[PATCH] m68knommu: add DMA timer counter to entropy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Greg Ungerer <gerg@xxxxxxxxxxx>

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 <gerg@xxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux