lantiq: Use the BAR0 base address in the ath PCI fixup code
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.18 / 0081-Added-support-to-reserve-enable-a-GPIO-pin-to-be-use.patch
1 From 47a2d8098a9523435aec2fff1389ae92fd8791a9 Mon Sep 17 00:00:00 2001
2 From: Timo Kokkonen <tjko@iki.fi>
3 Date: Wed, 29 Oct 2014 23:30:30 -0700
4 Subject: [PATCH 081/114] Added support to reserve/enable a GPIO pin to be used
5 from pps-gpio module (LinuxPPS). Enable PPS modules in default config for
6 RPi.
7
8 ---
9 arch/arm/mach-bcm2708/bcm2708.c | 27 +++++++++++++++++++++++++++
10 1 file changed, 27 insertions(+)
11
12 --- a/arch/arm/mach-bcm2708/bcm2708.c
13 +++ b/arch/arm/mach-bcm2708/bcm2708.c
14 @@ -37,6 +37,7 @@
15 #include <linux/spi/spi.h>
16 #include <linux/gpio/machine.h>
17 #include <linux/w1-gpio.h>
18 +#include <linux/pps-gpio.h>
19
20 #include <linux/version.h>
21 #include <linux/clkdev.h>
22 @@ -93,6 +94,7 @@ static unsigned disk_led_active_low = 1;
23 static unsigned reboot_part = 0;
24 static unsigned w1_gpio_pin = W1_GPIO;
25 static unsigned w1_gpio_pullup = W1_PULLUP;
26 +static int pps_gpio_pin = -1;
27 static bool vc_i2c_override = false;
28
29 static unsigned use_dt = 0;
30 @@ -274,6 +276,19 @@ static struct platform_device w1_device
31 };
32 #endif
33
34 +static struct pps_gpio_platform_data pps_gpio_info = {
35 + .assert_falling_edge = false,
36 + .capture_clear = false,
37 + .gpio_pin = -1,
38 + .gpio_label = "PPS",
39 +};
40 +
41 +static struct platform_device pps_gpio_device = {
42 + .name = "pps-gpio",
43 + .id = PLATFORM_DEVID_NONE,
44 + .dev.platform_data = &pps_gpio_info,
45 +};
46 +
47 static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
48
49 static struct platform_device bcm2708_fb_device = {
50 @@ -841,6 +856,16 @@ void __init bcm2708_init(void)
51 #ifdef CONFIG_BCM2708_GPIO
52 bcm_register_device_dt(&bcm2708_gpio_device);
53 #endif
54 +
55 +#if defined(CONFIG_PPS_CLIENT_GPIO) || defined(CONFIG_PPS_CLIENT_GPIO_MODULE)
56 + if (!use_dt && (pps_gpio_pin >= 0)) {
57 + pr_info("bcm2708: GPIO %d setup as pps-gpio device\n", pps_gpio_pin);
58 + pps_gpio_info.gpio_pin = pps_gpio_pin;
59 + pps_gpio_device.id = pps_gpio_pin;
60 + bcm_register_device(&pps_gpio_device);
61 + }
62 +#endif
63 +
64 #if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
65 w1_gpio_pdata.pin = w1_gpio_pin;
66 w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup;
67 @@ -1101,5 +1126,7 @@ module_param(disk_led_active_low, uint,
68 module_param(reboot_part, uint, 0644);
69 module_param(w1_gpio_pin, uint, 0644);
70 module_param(w1_gpio_pullup, uint, 0644);
71 +module_param(pps_gpio_pin, int, 0644);
72 +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS");
73 module_param(vc_i2c_override, bool, 0644);
74 MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral.");