b61af35ec225244515ae2d13312d04fed18a5d6e
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.10 / 0025-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch
1 From b0ffe239799004245e53a998216d361f6ab67f96 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/196] 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 diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
12 index 03b8ec5..18f7ede 100644
13 --- a/arch/arm/mach-bcm2708/bcm2708.c
14 +++ b/arch/arm/mach-bcm2708/bcm2708.c
15 @@ -32,6 +32,7 @@
16 #include <linux/io.h>
17 #include <linux/module.h>
18 #include <linux/spi/spi.h>
19 +#include <linux/w1-gpio.h>
20
21 #include <linux/version.h>
22 #include <linux/clkdev.h>
23 @@ -71,6 +72,9 @@
24 */
25 #define DMA_MASK_BITS_COMMON 32
26
27 +// use GPIO 4 for the one-wire GPIO pin, if enabled
28 +#define W1_GPIO 4
29 +
30 /* command line parameters */
31 static unsigned boardrev, serial;
32 static unsigned uart_clock;
33 @@ -251,6 +255,19 @@ static struct platform_device bcm2708_dmaman_device = {
34 .num_resources = ARRAY_SIZE(bcm2708_dmaman_resources),
35 };
36
37 +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
38 +static struct w1_gpio_platform_data w1_gpio_pdata = {
39 + .pin = W1_GPIO,
40 + .is_open_drain = 0,
41 +};
42 +
43 +static struct platform_device w1_device = {
44 + .name = "w1-gpio",
45 + .id = -1,
46 + .dev.platform_data = &w1_gpio_pdata,
47 +};
48 +#endif
49 +
50 static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
51
52 static struct platform_device bcm2708_fb_device = {
53 @@ -620,6 +637,9 @@ void __init bcm2708_init(void)
54 #ifdef CONFIG_BCM2708_GPIO
55 bcm_register_device(&bcm2708_gpio_device);
56 #endif
57 +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
58 + platform_device_register(&w1_device);
59 +#endif
60 bcm_register_device(&bcm2708_systemtimer_device);
61 bcm_register_device(&bcm2708_fb_device);
62 bcm_register_device(&bcm2708_usb_device);
63 --
64 1.9.1
65