0081-Added-support-to-reserve-enable-a-GPIO-pin-to-be-use.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. arch/arm/mach-bcm2708/bcm2708.c | 27 +++++++++++++++++++++++++++
  9. 1 file changed, 27 insertions(+)
  10. --- a/arch/arm/mach-bcm2708/bcm2708.c
  11. +++ b/arch/arm/mach-bcm2708/bcm2708.c
  12. @@ -37,6 +37,7 @@
  13. #include <linux/spi/spi.h>
  14. #include <linux/gpio/machine.h>
  15. #include <linux/w1-gpio.h>
  16. +#include <linux/pps-gpio.h>
  17. #include <linux/version.h>
  18. #include <linux/clkdev.h>
  19. @@ -93,6 +94,7 @@ static unsigned disk_led_active_low = 1;
  20. static unsigned reboot_part = 0;
  21. static unsigned w1_gpio_pin = W1_GPIO;
  22. static unsigned w1_gpio_pullup = W1_PULLUP;
  23. +static int pps_gpio_pin = -1;
  24. static bool vc_i2c_override = false;
  25. static unsigned use_dt = 0;
  26. @@ -274,6 +276,19 @@ static struct platform_device w1_device
  27. };
  28. #endif
  29. +static struct pps_gpio_platform_data pps_gpio_info = {
  30. + .assert_falling_edge = false,
  31. + .capture_clear = false,
  32. + .gpio_pin = -1,
  33. + .gpio_label = "PPS",
  34. +};
  35. +
  36. +static struct platform_device pps_gpio_device = {
  37. + .name = "pps-gpio",
  38. + .id = PLATFORM_DEVID_NONE,
  39. + .dev.platform_data = &pps_gpio_info,
  40. +};
  41. +
  42. static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
  43. static struct platform_device bcm2708_fb_device = {
  44. @@ -841,6 +856,16 @@ void __init bcm2708_init(void)
  45. #ifdef CONFIG_BCM2708_GPIO
  46. bcm_register_device_dt(&bcm2708_gpio_device);
  47. #endif
  48. +
  49. +#if defined(CONFIG_PPS_CLIENT_GPIO) || defined(CONFIG_PPS_CLIENT_GPIO_MODULE)
  50. + if (!use_dt && (pps_gpio_pin >= 0)) {
  51. + pr_info("bcm2708: GPIO %d setup as pps-gpio device\n", pps_gpio_pin);
  52. + pps_gpio_info.gpio_pin = pps_gpio_pin;
  53. + pps_gpio_device.id = pps_gpio_pin;
  54. + bcm_register_device(&pps_gpio_device);
  55. + }
  56. +#endif
  57. +
  58. #if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
  59. w1_gpio_pdata.pin = w1_gpio_pin;
  60. w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup;
  61. @@ -1101,5 +1126,7 @@ module_param(disk_led_active_low, uint,
  62. module_param(reboot_part, uint, 0644);
  63. module_param(w1_gpio_pin, uint, 0644);
  64. module_param(w1_gpio_pullup, uint, 0644);
  65. +module_param(pps_gpio_pin, int, 0644);
  66. +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS");
  67. module_param(vc_i2c_override, bool, 0644);
  68. MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral.");