Skip to content

Commit 2663f76

Browse files
committed
Merge pull request #92 from FrankBuss/rpi-3.2.27
enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4
2 parents 091073b + a915a4f commit 2663f76

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

arch/arm/configs/bcmrpi_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ CONFIG_LEDS_GPIO=y
738738
CONFIG_LEDS_TRIGGER_TIMER=m
739739
CONFIG_LEDS_TRIGGER_HEARTBEAT=m
740740
CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
741+
CONFIG_RTC_CLASS=y
742+
CONFIG_RTC_DRV_DS1307=m
741743
CONFIG_UIO=m
742744
CONFIG_UIO_PDRV=m
743745
CONFIG_UIO_PDRV_GENIRQ=m

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 20 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 */
@@ -291,6 +295,19 @@ static struct platform_device bcm2708_mci_device = {
291295
};
292296
#endif /* CONFIG_MMC_BCM2708 */
293297

298+
#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
299+
static struct w1_gpio_platform_data w1_gpio_pdata = {
300+
.pin = W1_GPIO,
301+
.is_open_drain = 0,
302+
};
303+
304+
static struct platform_device w1_device = {
305+
.name = "w1-gpio",
306+
.id = -1,
307+
.dev.platform_data = &w1_gpio_pdata,
308+
};
309+
#endif
310+
294311
static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
295312

296313
static struct platform_device bcm2708_fb_device = {
@@ -591,6 +608,9 @@ void __init bcm2708_init(void)
591608
bcm_register_device(&bcm2708_vcio_device);
592609
#ifdef CONFIG_BCM2708_GPIO
593610
bcm_register_device(&bcm2708_gpio_device);
611+
#endif
612+
#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
613+
platform_device_register(&w1_device);
594614
#endif
595615
bcm_register_device(&bcm2708_systemtimer_device);
596616
#ifdef CONFIG_MMC_BCM2708

0 commit comments

Comments
 (0)