-
-
Save Ttech/64fc688a5fd27116d39e92fab98993ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/arch/mips/ath79/mach-gl-inet.c b/arch/mips/ath79/mach-gl-inet.c | |
index 0713f14..0374d70 100644 | |
--- a/arch/mips/ath79/mach-gl-inet.c | |
+++ b/arch/mips/ath79/mach-gl-inet.c | |
@@ -14,6 +14,23 @@ | |
#include <linux/gpio.h> | |
#include <asm/mach-ath79/ath79.h> | |
+#include <linux/pps-gpio.h> | |
+#include <linux/platform_device.h> | |
+#include <linux/syscore_ops.h> | |
+#include <linux/interrupt.h> | |
+#include <linux/amba/bus.h> | |
+#include <linux/amba/clcd.h> | |
+#include <linux/clk-provider.h> | |
+#include <linux/clkdev.h> | |
+#include <linux/clockchips.h> | |
+#include <linux/cnt32_to_63.h> | |
+#include <linux/io.h> | |
+#include <linux/module.h> | |
+#include <linux/of_platform.h> | |
+#include <linux/spi/spi.h> | |
+#include <linux/w1-gpio.h> | |
+#include <linux/pps-gpio.h> | |
+ | |
#include "dev-eth.h" | |
#include "dev-gpio-buttons.h" | |
@@ -30,6 +47,8 @@ | |
#define GL_INET_KEYS_POLL_INTERVAL 20 /* msecs */ | |
#define GL_INET_KEYS_DEBOUNCE_INTERVAL (3 * GL_INET_KEYS_POLL_INTERVAL) | |
+static int pps_gpio_pin = 17; | |
+ | |
static const char * gl_inet_part_probes[] = { | |
"tp-link", /* dont change, this will use tplink parser */ | |
NULL , | |
@@ -64,6 +83,32 @@ static struct gpio_keys_button gl_inet_gpio_keys[] __initdata = { | |
} | |
}; | |
+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, | |
+}; | |
+ | |
+ | |
+int __init gl_register_device(struct platform_device *pdev) | |
+{ | |
+ int ret; | |
+ | |
+ ret = platform_device_register(pdev); | |
+ if (ret) | |
+ pr_debug("Unable to register platform device '%s': %d\n", | |
+ pdev->name, ret); | |
+ | |
+ return ret; | |
+} | |
+ | |
static void __init gl_inet_setup(void) | |
{ | |
/* get the mac address which is stored in the 1st 64k uboot MTD */ | |
@@ -96,6 +141,11 @@ static void __init gl_inet_setup(void) | |
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); | |
ath79_register_eth(1); | |
+ pr_info("bcm2709: 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; | |
+ gl_register_device(&pps_gpio_device); | |
+ | |
/* register wireless mac with cal data */ | |
ath79_register_wmac(ee, mac); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment