Skip to content

Commit ce4095c

Browse files
author
Lady Ada
committed
added support for the w1-gpio module on #4
1 parent 4ab5fbd commit ce4095c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <linux/io.h>
3333
#include <linux/module.h>
3434
#include <linux/spi/spi.h>
35+
#include <linux/w1-gpio.h>
3536

3637
#include <linux/version.h>
3738
#include <linux/clkdev.h>
@@ -69,6 +70,9 @@
6970
*/
7071
#define DMA_MASK_BITS_COMMON 32
7172

73+
// use GPIO 4 for the one-wire GPIO pin, if enabled
74+
#define W1_GPIO 4
75+
7276
static DEFINE_CLOCK_DATA(cd);
7377

7478
/* command line parameters */
@@ -395,6 +399,21 @@ static struct platform_device bcm2708_gpio_device = {
395399
.coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
396400
},
397401
};
402+
403+
#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
404+
static struct w1_gpio_platform_data w1_gpio_pdata = {
405+
/* If you choose to use a pin other than PB16 it needs to be 3.3V */
406+
.pin = W1_GPIO,
407+
.is_open_drain = 0,
408+
};
409+
410+
static struct platform_device w1_device = {
411+
.name = "w1-gpio",
412+
.id = -1,
413+
.dev.platform_data = &w1_gpio_pdata,
414+
};
415+
416+
#endif // W1 GPIO mod
398417
#endif
399418

400419
static struct resource bcm2708_systemtimer_resources[] = {
@@ -591,6 +610,9 @@ void __init bcm2708_init(void)
591610
bcm_register_device(&bcm2708_vcio_device);
592611
#ifdef CONFIG_BCM2708_GPIO
593612
bcm_register_device(&bcm2708_gpio_device);
613+
#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
614+
platform_device_register(&w1_device);
615+
#endif
594616
#endif
595617
bcm_register_device(&bcm2708_systemtimer_device);
596618
#ifdef CONFIG_MMC_BCM2708

0 commit comments

Comments
 (0)