|
32 | 32 | #include <linux/io.h> |
33 | 33 | #include <linux/module.h> |
34 | 34 | #include <linux/spi/spi.h> |
| 35 | +#include <linux/w1-gpio.h> |
35 | 36 |
|
36 | 37 | #include <linux/version.h> |
37 | 38 | #include <linux/clkdev.h> |
|
68 | 69 | */ |
69 | 70 | #define DMA_MASK_BITS_COMMON 32 |
70 | 71 |
|
| 72 | +// use GPIO 4 for the one-wire GPIO pin, if enabled |
| 73 | +#define W1_GPIO 4 |
| 74 | + |
71 | 75 | static DEFINE_CLOCK_DATA(cd); |
72 | 76 |
|
73 | 77 | /* command line parameters */ |
@@ -388,6 +392,22 @@ static struct platform_device bcm2708_gpio_device = { |
388 | 392 | .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), |
389 | 393 | }, |
390 | 394 | }; |
| 395 | + |
| 396 | +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) |
| 397 | +static struct w1_gpio_platform_data w1_gpio_pdata = { |
| 398 | + /* If you choose to use a pin other than PB16 it needs to be 3.3V */ |
| 399 | + .pin = W1_GPIO, |
| 400 | + .is_open_drain = 0, |
| 401 | +}; |
| 402 | + |
| 403 | +static struct platform_device w1_device = { |
| 404 | + .name = "w1-gpio", |
| 405 | + .id = -1, |
| 406 | + .dev.platform_data = &w1_gpio_pdata, |
| 407 | +}; |
| 408 | + |
| 409 | +#endif |
| 410 | + |
391 | 411 | #endif |
392 | 412 |
|
393 | 413 | static struct resource bcm2708_systemtimer_resources[] = { |
@@ -571,6 +591,9 @@ void __init bcm2708_init(void) |
571 | 591 | bcm_register_device(&bcm2708_vcio_device); |
572 | 592 | #ifdef CONFIG_BCM2708_GPIO |
573 | 593 | bcm_register_device(&bcm2708_gpio_device); |
| 594 | +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) |
| 595 | + platform_device_register(&w1_device); |
| 596 | +#endif |
574 | 597 | #endif |
575 | 598 | bcm_register_device(&bcm2708_systemtimer_device); |
576 | 599 | #ifdef CONFIG_MMC_BCM2708 |
|
0 commit comments