Permalink
Browse files

enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (a…

…s a module)
  • Loading branch information...
1 parent 091073b commit a915a4f6e8969a599627ca6b3e2cd7714608d222 @FrankBuss FrankBuss committed Aug 23, 2012
Showing with 22 additions and 0 deletions.
  1. +2 −0 arch/arm/configs/bcmrpi_defconfig
  2. +20 −0 arch/arm/mach-bcm2708/bcm2708.c
View
2 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
View
20 arch/arm/mach-bcm2708/bcm2708.c
@@ -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>
@@ -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 = {
@@ -592,6 +609,9 @@ void __init bcm2708_init(void)
#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
bcm_register_device(&bcm2708_mci_device);

0 comments on commit a915a4f

Please sign in to comment.