Skip to content

Commit

Permalink
Dallas one wire interface with the Linux w1 GPIO bitbanging implement…
Browse files Browse the repository at this point in the history
…ation on GPIO 4
  • Loading branch information
Frank-Buss committed May 26, 2012
1 parent 48bcd88 commit 7187150
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions arch/arm/mach-bcm2708/bcm2708.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/w1-gpio.h>

#include <linux/version.h>
#include <linux/clkdev.h>
Expand Down Expand Up @@ -68,6 +69,9 @@
*/
#define DMA_MASK_BITS_COMMON 32

// use GPIO 4 for the one-wire GPIO pin, if enabled
#define W1_GPIO 4

static DEFINE_CLOCK_DATA(cd);

/* command line parameters */
Expand Down Expand Up @@ -388,6 +392,22 @@ static struct platform_device bcm2708_gpio_device = {
.coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
},
};

#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
static struct w1_gpio_platform_data w1_gpio_pdata = {
/* If you choose to use a pin other than PB16 it needs to be 3.3V */
.pin = W1_GPIO,
.is_open_drain = 0,
};

static struct platform_device w1_device = {
.name = "w1-gpio",
.id = -1,
.dev.platform_data = &w1_gpio_pdata,
};

#endif

#endif

static struct resource bcm2708_systemtimer_resources[] = {
Expand Down Expand Up @@ -571,6 +591,9 @@ void __init bcm2708_init(void)
bcm_register_device(&bcm2708_vcio_device);
#ifdef CONFIG_BCM2708_GPIO
bcm_register_device(&bcm2708_gpio_device);
#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
platform_device_register(&w1_device);
#endif
#endif
bcm_register_device(&bcm2708_systemtimer_device);
#ifdef CONFIG_MMC_BCM2708
Expand Down

0 comments on commit 7187150

Please sign in to comment.