From a915a4f6e8969a599627ca6b3e2cd7714608d222 Mon Sep 17 00:00:00 2001 From: Frank Buss Date: Thu, 23 Aug 2012 02:42:34 +0200 Subject: [PATCH] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) --- arch/arm/configs/bcmrpi_defconfig | 2 ++ arch/arm/mach-bcm2708/bcm2708.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig index 13c8bbd1d0b9f1..20cb4ce307c969 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -738,6 +738,8 @@ CONFIG_LEDS_GPIO=y CONFIG_LEDS_TRIGGER_TIMER=m CONFIG_LEDS_TRIGGER_HEARTBEAT=m CONFIG_LEDS_TRIGGER_DEFAULT_ON=m +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_DS1307=m CONFIG_UIO=m CONFIG_UIO_PDRV=m CONFIG_UIO_PDRV_GENIRQ=m diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c index 0efa4d9b16badd..c9ef82a2f2b365 100644 --- a/arch/arm/mach-bcm2708/bcm2708.c +++ b/arch/arm/mach-bcm2708/bcm2708.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -69,6 +70,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 */ @@ -291,6 +295,19 @@ static struct platform_device bcm2708_mci_device = { }; #endif /* CONFIG_MMC_BCM2708 */ +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) +static struct w1_gpio_platform_data w1_gpio_pdata = { + .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 + static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); static struct platform_device bcm2708_fb_device = { @@ -591,6 +608,9 @@ void __init bcm2708_init(void) bcm_register_device(&bcm2708_vcio_device); #ifdef CONFIG_BCM2708_GPIO bcm_register_device(&bcm2708_gpio_device); +#endif +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) + platform_device_register(&w1_device); #endif bcm_register_device(&bcm2708_systemtimer_device); #ifdef CONFIG_MMC_BCM2708