Skip to content

Commit 7ccb7dc

Browse files
committed
Added support to reserve/enable a GPIO pin to be used from pps-gpio module (LinuxPPS).
Enable PPS modules in default config for RPi.
1 parent c1361d4 commit 7ccb7dc

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

arch/arm/configs/bcmrpi_defconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,9 @@ CONFIG_I2C_BCM2708=m
554554
CONFIG_SPI=y
555555
CONFIG_SPI_BCM2708=m
556556
CONFIG_SPI_SPIDEV=y
557+
CONFIG_PPS=m
558+
CONFIG_PPS_CLIENT_LDISC=m
559+
CONFIG_PPS_CLIENT_GPIO=m
557560
CONFIG_GPIO_SYSFS=y
558561
CONFIG_W1=m
559562
CONFIG_W1_MASTER_DS2490=m

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/module.h>
3434
#include <linux/spi/spi.h>
3535
#include <linux/w1-gpio.h>
36+
#include <linux/pps-gpio.h>
3637

3738
#include <linux/version.h>
3839
#include <linux/clkdev.h>
@@ -90,6 +91,7 @@ static unsigned disk_led_active_low = 1;
9091
static unsigned reboot_part = 0;
9192
static unsigned w1_gpio_pin = W1_GPIO;
9293
static unsigned w1_gpio_pullup = W1_PULLUP;
94+
static int pps_gpio_pin = -1;
9395
static unsigned bcm2835_mmc = 1;
9496
static bool vc_i2c_override = false;
9597

@@ -282,6 +284,19 @@ static struct platform_device w1_device = {
282284
};
283285
#endif
284286

287+
static struct pps_gpio_platform_data pps_gpio_info = {
288+
.assert_falling_edge = false,
289+
.capture_clear = false,
290+
.gpio_pin = -1,
291+
.gpio_label = "PPS",
292+
};
293+
294+
static struct platform_device pps_gpio_device = {
295+
.name = "pps-gpio",
296+
.id = PLATFORM_DEVID_NONE,
297+
.dev.platform_data = &pps_gpio_info,
298+
};
299+
285300
static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
286301

287302
static struct platform_device bcm2708_fb_device = {
@@ -851,6 +866,12 @@ void __init bcm2708_init(void)
851866
bcm_register_device(&bcm2708_vcio_device);
852867
#ifdef CONFIG_BCM2708_GPIO
853868
bcm_register_device(&bcm2708_gpio_device);
869+
if (pps_gpio_pin >= 0) {
870+
pr_info("bcm2708: GPIO %d setup as pps-gpio device\n", pps_gpio_pin);
871+
pps_gpio_info.gpio_pin = pps_gpio_pin;
872+
pps_gpio_device.id = pps_gpio_pin;
873+
bcm_register_device(&pps_gpio_device);
874+
}
854875
#endif
855876
#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
856877
w1_gpio_pdata.pin = w1_gpio_pin;
@@ -1111,6 +1132,8 @@ module_param(disk_led_active_low, uint, 0644);
11111132
module_param(reboot_part, uint, 0644);
11121133
module_param(w1_gpio_pin, uint, 0644);
11131134
module_param(w1_gpio_pullup, uint, 0644);
1135+
module_param(pps_gpio_pin, int, 0644);
1136+
MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS");
11141137
module_param(bcm2835_mmc, uint, 0644);
11151138
module_param(vc_i2c_override, bool, 0644);
11161139
MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral.");

0 commit comments

Comments
 (0)