brcm2708: update against latest rpi-3.10.y branch
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.10 / 0025-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch
1 From d3ea04a7506cca51d1e154cde5bcc7063595c98c Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Wed, 8 May 2013 11:46:50 +0100
4 Subject: [PATCH 025/174] enabling the realtime clock 1-wire chip DS1307 and
5 1-wire on GPIO4 (as a module)
6
7 ---
8 arch/arm/mach-bcm2708/bcm2708.c | 20 ++++++++++++++++++++
9 1 file changed, 20 insertions(+)
10
11 --- a/arch/arm/mach-bcm2708/bcm2708.c
12 +++ b/arch/arm/mach-bcm2708/bcm2708.c
13 @@ -32,6 +32,7 @@
14 #include <linux/io.h>
15 #include <linux/module.h>
16 #include <linux/spi/spi.h>
17 +#include <linux/w1-gpio.h>
18
19 #include <linux/version.h>
20 #include <linux/clkdev.h>
21 @@ -71,6 +72,9 @@
22 */
23 #define DMA_MASK_BITS_COMMON 32
24
25 +// use GPIO 4 for the one-wire GPIO pin, if enabled
26 +#define W1_GPIO 4
27 +
28 /* command line parameters */
29 static unsigned boardrev, serial;
30 static unsigned uart_clock;
31 @@ -251,6 +255,19 @@ static struct platform_device bcm2708_dm
32 .num_resources = ARRAY_SIZE(bcm2708_dmaman_resources),
33 };
34
35 +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
36 +static struct w1_gpio_platform_data w1_gpio_pdata = {
37 + .pin = W1_GPIO,
38 + .is_open_drain = 0,
39 +};
40 +
41 +static struct platform_device w1_device = {
42 + .name = "w1-gpio",
43 + .id = -1,
44 + .dev.platform_data = &w1_gpio_pdata,
45 +};
46 +#endif
47 +
48 static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
49
50 static struct platform_device bcm2708_fb_device = {
51 @@ -620,6 +637,9 @@ void __init bcm2708_init(void)
52 #ifdef CONFIG_BCM2708_GPIO
53 bcm_register_device(&bcm2708_gpio_device);
54 #endif
55 +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
56 + platform_device_register(&w1_device);
57 +#endif
58 bcm_register_device(&bcm2708_systemtimer_device);
59 bcm_register_device(&bcm2708_fb_device);
60 bcm_register_device(&bcm2708_usb_device);