gerg
2014-05-29 00:58:48 UTC
From: Greg Ungerer <gerg at uclinux.org>
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 at uclinux.org>
---
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);
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 at uclinux.org>
---
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
1.8.1.4