Skip to content

Added support to reserve/enable a GPIO pin to be used from pps-gpio module #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions arch/arm/configs/bcmrpi_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,9 @@ CONFIG_I2C_BCM2708=m
CONFIG_SPI=y
CONFIG_SPI_BCM2708=m
CONFIG_SPI_SPIDEV=y
CONFIG_PPS=m
CONFIG_PPS_CLIENT_LDISC=m
CONFIG_PPS_CLIENT_GPIO=m
CONFIG_GPIO_SYSFS=y
CONFIG_W1=m
CONFIG_W1_MASTER_DS2490=m
Expand Down
23 changes: 23 additions & 0 deletions arch/arm/mach-bcm2708/bcm2708.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/w1-gpio.h>
#include <linux/pps-gpio.h>

#include <linux/version.h>
#include <linux/clkdev.h>
Expand Down Expand Up @@ -90,6 +91,7 @@ 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 int pps_gpio_pin = -1;
static unsigned bcm2835_mmc = 1;
static bool vc_i2c_override = false;

Expand Down Expand Up @@ -282,6 +284,19 @@ static struct platform_device w1_device = {
};
#endif

static struct pps_gpio_platform_data pps_gpio_info = {
.assert_falling_edge = false,
.capture_clear = false,
.gpio_pin = -1,
.gpio_label = "PPS",
};

static struct platform_device pps_gpio_device = {
.name = "pps-gpio",
.id = PLATFORM_DEVID_NONE,
.dev.platform_data = &pps_gpio_info,
};

static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);

static struct platform_device bcm2708_fb_device = {
Expand Down Expand Up @@ -851,6 +866,12 @@ void __init bcm2708_init(void)
bcm_register_device(&bcm2708_vcio_device);
#ifdef CONFIG_BCM2708_GPIO
bcm_register_device(&bcm2708_gpio_device);
if (pps_gpio_pin >= 0) {
pr_info("bcm2708: GPIO %d setup as pps-gpio device\n", pps_gpio_pin);
pps_gpio_info.gpio_pin = pps_gpio_pin;
pps_gpio_device.id = pps_gpio_pin;
bcm_register_device(&pps_gpio_device);
}
#endif
#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
w1_gpio_pdata.pin = w1_gpio_pin;
Expand Down Expand Up @@ -1111,6 +1132,8 @@ 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);
module_param(pps_gpio_pin, int, 0644);
MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS");
module_param(bcm2835_mmc, uint, 0644);
module_param(vc_i2c_override, bool, 0644);
MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral.");