|
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>
|
|
69 | 70 | */
|
70 | 71 | #define DMA_MASK_BITS_COMMON 32
|
71 | 72 |
|
| 73 | +// use GPIO 4 for the one-wire GPIO pin, if enabled |
| 74 | +#define W1_GPIO 4 |
| 75 | + |
72 | 76 | static DEFINE_CLOCK_DATA(cd);
|
73 | 77 |
|
74 | 78 | /* command line parameters */
|
@@ -395,6 +399,21 @@ static struct platform_device bcm2708_gpio_device = {
|
395 | 399 | .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
|
396 | 400 | },
|
397 | 401 | };
|
| 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 |
398 | 417 | #endif
|
399 | 418 |
|
400 | 419 | static struct resource bcm2708_systemtimer_resources[] = {
|
@@ -591,6 +610,9 @@ void __init bcm2708_init(void)
|
591 | 610 | bcm_register_device(&bcm2708_vcio_device);
|
592 | 611 | #ifdef CONFIG_BCM2708_GPIO
|
593 | 612 | 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 |
594 | 616 | #endif
|
595 | 617 | bcm_register_device(&bcm2708_systemtimer_device);
|
596 | 618 | #ifdef CONFIG_MMC_BCM2708
|
|
0 commit comments