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