summaryrefslogtreecommitdiff
path: root/arch/arm/mach-bcm2708
diff options
context:
space:
mode:
authorpopcornmix <popcornmix@gmail.com>2013-05-08 11:46:50 +0100
committerpopcornmix <popcornmix@gmail.com>2015-05-18 14:10:48 +0100
commitefa97087b154ee2c307bb8df2d47dfcb9bef1562 (patch)
tree9732c64883be5c9d7ce32dfdc8ebcbe5cd617a2b /arch/arm/mach-bcm2708
parentdf82c206722eaca7ccfb3b1640dcb297b2365584 (diff)
downloadlinux-efa97087b154ee2c307bb8df2d47dfcb9bef1562.tar.gz
enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module)
1-wire: Add support for configuring pin for w1-gpio kernel module See: https://github.com/raspberrypi/linux/pull/457 Add bitbanging pullups, use them for w1-gpio Allows parasite power to work, uses module option pullup=1 bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk> w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
Diffstat (limited to 'arch/arm/mach-bcm2708')
-rw-r--r--arch/arm/mach-bcm2708/bcm2708.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 496cbcd55c8b..5873f8b1a666 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -36,6 +36,7 @@
#include <linux/of_platform.h>
#include <linux/spi/spi.h>
#include <linux/gpio/machine.h>
+#include <linux/w1-gpio.h>
#include <linux/version.h>
#include <linux/clkdev.h>
@@ -79,12 +80,19 @@
*/
#define DMA_MASK_BITS_COMMON 32
+// use GPIO 4 for the one-wire GPIO pin, if enabled
+#define W1_GPIO 4
+// ensure one-wire GPIO pullup is disabled by default
+#define W1_PULLUP -1
+
/* command line parameters */
static unsigned boardrev, serial;
static unsigned uart_clock = UART0_CLOCK;
static unsigned disk_led_gpio = 16;
static unsigned disk_led_active_low = 1;
static unsigned reboot_part = 0;
+static unsigned w1_gpio_pin = W1_GPIO;
+static unsigned w1_gpio_pullup = W1_PULLUP;
static unsigned use_dt = 0;
@@ -256,6 +264,20 @@ static struct platform_device bcm2708_dmaengine_device = {
.id = -1,
};
+#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
+static struct w1_gpio_platform_data w1_gpio_pdata = {
+ .pin = W1_GPIO,
+ .ext_pullup_enable_pin = W1_PULLUP,
+ .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 = {
@@ -715,6 +737,11 @@ 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)
+ w1_gpio_pdata.pin = w1_gpio_pin;
+ w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup;
+ bcm_register_device_dt(&w1_device);
+#endif
bcm_register_device(&bcm2708_systemtimer_device);
bcm_register_device(&bcm2708_fb_device);
bcm_register_device(&bcm2708_usb_device);
@@ -925,3 +952,5 @@ module_param(uart_clock, uint, 0644);
module_param(disk_led_gpio, uint, 0644);
module_param(disk_led_active_low, uint, 0644);
module_param(reboot_part, uint, 0644);
+module_param(w1_gpio_pin, uint, 0644);
+module_param(w1_gpio_pullup, uint, 0644);