[brcm63xx] refresh patches
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.3 / 104-MIPS-BCM63XX-add-RNG-driver-platform_device-stub.patch
1 From cfcc8526e97bdcbfcbf945246b878262389b8842 Mon Sep 17 00:00:00 2001
2 From: Florian Fainelli <florian@openwrt.org>
3 Date: Wed, 25 Jan 2012 17:39:59 +0100
4 Subject: [PATCH 17/63] MIPS: BCM63XX: add RNG driver platform_device stub
5
6 Signed-off-by: Florian Fainelli <florian@openwrt.org>
7 ---
8 arch/mips/bcm63xx/Makefile | 4 ++--
9 arch/mips/bcm63xx/dev-trng.c | 40 ++++++++++++++++++++++++++++++++++++++++
10 2 files changed, 42 insertions(+), 2 deletions(-)
11 create mode 100644 arch/mips/bcm63xx/dev-trng.c
12
13 --- a/arch/mips/bcm63xx/Makefile
14 +++ b/arch/mips/bcm63xx/Makefile
15 @@ -1,6 +1,6 @@
16 obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
17 - dev-dsp.o dev-enet.o dev-pcmcia.o dev-spi.o dev-uart.o \
18 - dev-wdt.o
19 + dev-dsp.o dev-enet.o dev-pcmcia.o dev-spi.o dev-trng.o \
20 + dev-uart.o dev-wdt.o
21 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
22
23 obj-y += boards/
24 --- /dev/null
25 +++ b/arch/mips/bcm63xx/dev-trng.c
26 @@ -0,0 +1,40 @@
27 +/*
28 + * This file is subject to the terms and conditions of the GNU General Public
29 + * License. See the file "COPYING" in the main directory of this archive
30 + * for more details.
31 + *
32 + * Copyright (C) 2011 Florian Fainelli <florian@openwrt.org>
33 + */
34 +
35 +#include <linux/init.h>
36 +#include <linux/kernel.h>
37 +#include <linux/platform_device.h>
38 +#include <bcm63xx_cpu.h>
39 +
40 +static struct resource trng_resources[] = {
41 + {
42 + .start = -1, /* filled at runtime */
43 + .end = -1, /* filled at runtime */
44 + .flags = IORESOURCE_MEM,
45 + },
46 +};
47 +
48 +static struct platform_device bcm63xx_trng_device = {
49 + .name = "bcm63xx-trng",
50 + .id = -1,
51 + .num_resources = ARRAY_SIZE(trng_resources),
52 + .resource = trng_resources,
53 +};
54 +
55 +int __init bcm63xx_trng_register(void)
56 +{
57 + if (!BCMCPU_IS_6368())
58 + return -ENODEV;
59 +
60 + trng_resources[0].start = bcm63xx_regset_address(RSET_TRNG);
61 + trng_resources[0].end = trng_resources[0].start;
62 + trng_resources[0].end += RSET_TRNG_SIZE - 1;
63 +
64 + return platform_device_register(&bcm63xx_trng_device);
65 +}
66 +arch_initcall(bcm63xx_trng_register);