Advertisement
Guest User

asuswrt-merlin-380.57-usbtimepps-arm.patch

a guest
Jan 4th, 2016
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.97 KB | None | 0 0
  1. diff -u -r -B -X ./excludes.txt ./asuswrt-merlin-380.57_original/release/src-rt-6.x.4708/linux/linux-2.6.36/config_base.6a ./asuswrt-merlin-380.57/release/src-rt-6.x.4708/linux/linux-2.6.36/config_base.6a
  2. --- ./asuswrt-merlin-380.57_original/release/src-rt-6.x.4708/linux/linux-2.6.36/config_base.6a 2015-12-24 16:18:19.000000000 -0500
  3. +++ ./asuswrt-merlin-380.57/release/src-rt-6.x.4708/linux/linux-2.6.36/config_base.6a 2015-12-26 15:24:34.523705421 -0500
  4. @@ -1222,7 +1222,10 @@
  5. #
  6. # PPS support
  7. #
  8. -# CONFIG_PPS is not set
  9. +CONFIG_PPS=m
  10. +# CONFIG_PPS_DEBUG is not set
  11. +CONFIG_PPS_CLIENT_KTIMER=m
  12. +CONFIG_PPS_CLIENT_LDISC=m
  13. # CONFIG_W1 is not set
  14. # CONFIG_POWER_SUPPLY is not set
  15. # CONFIG_HWMON is not set
  16. @@ -1409,13 +1412,13 @@
  17. # CONFIG_USB_SERIAL_AIRCABLE is not set
  18. # CONFIG_USB_SERIAL_ARK3116 is not set
  19. # CONFIG_USB_SERIAL_BELKIN is not set
  20. -# CONFIG_USB_SERIAL_CH341 is not set
  21. +CONFIG_USB_SERIAL_CH341=m
  22. # CONFIG_USB_SERIAL_WHITEHEAT is not set
  23. # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
  24. # CONFIG_USB_SERIAL_CP210X is not set
  25. # CONFIG_USB_SERIAL_CYPRESS_M8 is not set
  26. # CONFIG_USB_SERIAL_EMPEG is not set
  27. -# CONFIG_USB_SERIAL_FTDI_SIO is not set
  28. +CONFIG_USB_SERIAL_FTDI_SIO=m
  29. # CONFIG_USB_SERIAL_FUNSOFT is not set
  30. # CONFIG_USB_SERIAL_VISOR is not set
  31. # CONFIG_USB_SERIAL_IPAQ is not set
  32. @@ -1434,7 +1437,7 @@
  33. # CONFIG_USB_SERIAL_MOS7840 is not set
  34. # CONFIG_USB_SERIAL_MOTOROLA is not set
  35. # CONFIG_USB_SERIAL_NAVMAN is not set
  36. -# CONFIG_USB_SERIAL_PL2303 is not set
  37. +CONFIG_USB_SERIAL_PL2303=m
  38. # CONFIG_USB_SERIAL_OTI6858 is not set
  39. # CONFIG_USB_SERIAL_QCAUX is not set
  40. # CONFIG_USB_SERIAL_QUALCOMM is not set
  41. @@ -1442,13 +1445,13 @@
  42. # CONFIG_USB_SERIAL_HP4X is not set
  43. # CONFIG_USB_SERIAL_SAFE is not set
  44. # CONFIG_USB_SERIAL_SIEMENS_MPI is not set
  45. -CONFIG_USB_SERIAL_SIERRAWIRELESS=m
  46. +CONFIG_USB_SERIAL_SIERRAWIRELESS=n
  47. # CONFIG_USB_SERIAL_SYMBOL is not set
  48. # CONFIG_USB_SERIAL_TI is not set
  49. # CONFIG_USB_SERIAL_CYBERJACK is not set
  50. # CONFIG_USB_SERIAL_XIRCOM is not set
  51. -CONFIG_USB_SERIAL_WWAN=m
  52. -CONFIG_USB_SERIAL_OPTION=m
  53. +CONFIG_USB_SERIAL_WWAN=n
  54. +CONFIG_USB_SERIAL_OPTION=n
  55. # CONFIG_USB_SERIAL_OMNINET is not set
  56. # CONFIG_USB_SERIAL_OPTICON is not set
  57. # CONFIG_USB_SERIAL_VIVOPAY_SERIAL is not set
  58. diff -u -r -B -X ./excludes.txt ./asuswrt-merlin-380.57_original/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/serial/ftdi_sio.c ./asuswrt-merlin-380.57/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/serial/ftdi_sio.c
  59. --- ./asuswrt-merlin-380.57_original/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/serial/ftdi_sio.c 2015-12-24 16:18:19.000000000 -0500
  60. +++ ./asuswrt-merlin-380.57/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/serial/ftdi_sio.c 2015-12-26 15:24:34.523705421 -0500
  61. @@ -1868,8 +1868,20 @@
  62. are only processed once. */
  63. status = packet[0] & FTDI_STATUS_B0_MASK;
  64. if (status != priv->prev_status) {
  65. - priv->diff_status |= status ^ priv->prev_status;
  66. - wake_up_interruptible(&priv->delta_msr_wait);
  67. + char diff_status = status ^ priv->prev_status;
  68. + priv->diff_status |= diff_status;
  69. +
  70. + if (diff_status & FTDI_RS0_RLSD) {
  71. + struct tty_struct *tty;
  72. +
  73. + tty = tty_port_tty_get(&port->port);
  74. + if (tty)
  75. + usb_serial_handle_dcd_change(port, tty,
  76. + status & FTDI_RS0_RLSD);
  77. + tty_kref_put(tty);
  78. + }
  79. +
  80. + wake_up_interruptible(&priv->delta_msr_wait);
  81. priv->prev_status = status;
  82. }
  83.  
  84. diff -u -r -B -X ./excludes.txt ./asuswrt-merlin-380.57_original/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/serial/generic.c ./asuswrt-merlin-380.57/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/serial/generic.c
  85. --- ./asuswrt-merlin-380.57_original/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/serial/generic.c 2015-12-24 16:18:19.000000000 -0500
  86. +++ ./asuswrt-merlin-380.57/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/serial/generic.c 2015-12-26 15:24:34.739705269 -0500
  87. @@ -491,6 +491,15 @@
  88. struct tty_port *port = &usb_port->port;
  89.  
  90. dbg("%s - port %d, status %d", __func__, usb_port->number, status);
  91. + if (tty) {
  92. + struct tty_ldisc *ld = tty_ldisc_ref(tty);
  93. +
  94. + if (ld) {
  95. + if (ld->ops->dcd_change)
  96. + ld->ops->dcd_change(tty, status, NULL);
  97. + tty_ldisc_deref(ld);
  98. + }
  99. + }
  100.  
  101. if (status)
  102. wake_up_interruptible(&port->open_wait);
  103. --- ./asuswrt-merlin-380.57_original/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/arm-brcm-linux-uclibcgnueabi/sysroot/usr/include/timepps.h 1969-12-31 19:00:00.000000000 -0500
  104. +++ ./asuswrt-merlin-380.57/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/arm-brcm-linux-uclibcgnueabi/sysroot/usr/include/timepps.h 2015-12-26 15:24:34.751705113 -0500
  105. @@ -0,0 +1,198 @@
  106. +/*
  107. + * timepps.h -- PPS API main header
  108. + *
  109. + * Copyright (C) 2005-2007 Rodolfo Giometti <giometti@linux.it>
  110. + *
  111. + * This program is free software; you can redistribute it and/or modify
  112. + * it under the terms of the GNU General Public License as published by
  113. + * the Free Software Foundation; either version 2 of the License, or
  114. + * (at your option) any later version.
  115. + *
  116. + * This program is distributed in the hope that it will be useful,
  117. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  118. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  119. + * GNU General Public License for more details.
  120. + *
  121. + * You should have received a copy of the GNU General Public License
  122. + * along with this program; if not, write to the Free Software
  123. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  124. + */
  125. +
  126. +#ifndef _SYS_TIMEPPS_H_
  127. +#define _SYS_TIMEPPS_H_
  128. +
  129. +#include <errno.h>
  130. +#include <sys/time.h>
  131. +#include <sys/ioctl.h>
  132. +#include <linux/types.h>
  133. +#include <linux/pps.h>
  134. +
  135. +#define LINUXPPS 1 /* signal we are using LinuxPPS */
  136. +
  137. +/*
  138. + * New data structures
  139. + */
  140. +
  141. +struct ntp_fp {
  142. + unsigned int integral;
  143. + unsigned int fractional;
  144. +};
  145. +
  146. +union pps_timeu {
  147. + struct timespec tspec;
  148. + struct ntp_fp ntpfp;
  149. + unsigned long longpad[3];
  150. +};
  151. +
  152. +struct pps_info {
  153. + unsigned long assert_sequence; /* seq. num. of assert event */
  154. + unsigned long clear_sequence; /* seq. num. of clear event */
  155. + union pps_timeu assert_tu; /* time of assert event */
  156. + union pps_timeu clear_tu; /* time of clear event */
  157. + int current_mode; /* current mode bits */
  158. +};
  159. +
  160. +struct pps_params {
  161. + int api_version; /* API version # */
  162. + int mode; /* mode bits */
  163. + union pps_timeu assert_off_tu; /* offset compensation for assert */
  164. + union pps_timeu clear_off_tu; /* offset compensation for clear */
  165. +};
  166. +
  167. +typedef int pps_handle_t; /* represents a PPS source */
  168. +typedef unsigned long pps_seq_t; /* sequence number */
  169. +typedef struct ntp_fp ntp_fp_t; /* NTP-compatible time stamp */
  170. +typedef union pps_timeu pps_timeu_t; /* generic data type for time stamps */
  171. +typedef struct pps_info pps_info_t;
  172. +typedef struct pps_params pps_params_t;
  173. +
  174. +#define assert_timestamp assert_tu.tspec
  175. +#define clear_timestamp clear_tu.tspec
  176. +
  177. +#define assert_timestamp_ntpfp assert_tu.ntpfp
  178. +#define clear_timestamp_ntpfp clear_tu.ntpfp
  179. +
  180. +#define assert_offset assert_off_tu.tspec
  181. +#define clear_offset clear_off_tu.tspec
  182. +
  183. +#define assert_offset_ntpfp assert_off_tu.ntpfp
  184. +#define clear_offset_ntpfp clear_off_tu.ntpfp
  185. +
  186. +/*
  187. + * The PPS API
  188. + */
  189. +
  190. +static __inline int time_pps_create(int source, pps_handle_t *handle)
  191. +{
  192. + int ret;
  193. + struct pps_kparams dummy;
  194. +
  195. + if (!handle) {
  196. + errno = EINVAL;
  197. + return -1;
  198. + }
  199. +
  200. + /* First we check if current device is a valid PPS one by
  201. + * doing a dummy PPS_GETPARAMS...
  202. + */
  203. + ret = ioctl(source, PPS_GETPARAMS, &dummy);
  204. + if (ret) {
  205. + errno = EOPNOTSUPP;
  206. + return -1;
  207. + }
  208. +
  209. + /* ... then since in LinuxPPS there are no differences between a
  210. + * "PPS source" and a "PPS handle", we simply return the same value.
  211. + */
  212. + *handle = source;
  213. +
  214. + return 0;
  215. +}
  216. +
  217. +static __inline int time_pps_destroy(pps_handle_t handle)
  218. +{
  219. + return close(handle);
  220. +}
  221. +
  222. +static __inline int time_pps_getparams(pps_handle_t handle,
  223. + pps_params_t *ppsparams)
  224. +{
  225. + int ret;
  226. + struct pps_kparams __ppsparams;
  227. +
  228. + ret = ioctl(handle, PPS_GETPARAMS, &__ppsparams);
  229. +
  230. + ppsparams->api_version = __ppsparams.api_version;
  231. + ppsparams->mode = __ppsparams.mode;
  232. + ppsparams->assert_off_tu.tspec.tv_sec = __ppsparams.assert_off_tu.sec;
  233. + ppsparams->assert_off_tu.tspec.tv_nsec = __ppsparams.assert_off_tu.nsec;
  234. + ppsparams->clear_off_tu.tspec.tv_sec = __ppsparams.clear_off_tu.sec;
  235. + ppsparams->clear_off_tu.tspec.tv_nsec = __ppsparams.clear_off_tu.nsec;
  236. +
  237. + return ret;
  238. +}
  239. +
  240. +static __inline int time_pps_setparams(pps_handle_t handle,
  241. + const pps_params_t *ppsparams)
  242. +{
  243. + struct pps_kparams __ppsparams;
  244. +
  245. + __ppsparams.api_version = ppsparams->api_version;
  246. + __ppsparams.mode = ppsparams->mode;
  247. + __ppsparams.assert_off_tu.sec = ppsparams->assert_off_tu.tspec.tv_sec;
  248. + __ppsparams.assert_off_tu.nsec = ppsparams->assert_off_tu.tspec.tv_nsec;
  249. + __ppsparams.clear_off_tu.sec = ppsparams->clear_off_tu.tspec.tv_sec;
  250. + __ppsparams.clear_off_tu.nsec = ppsparams->clear_off_tu.tspec.tv_nsec;
  251. +
  252. + return ioctl(handle, PPS_SETPARAMS, &__ppsparams);
  253. +}
  254. +
  255. +/* Get capabilities for handle */
  256. +static __inline int time_pps_getcap(pps_handle_t handle, int *mode)
  257. +{
  258. + return ioctl(handle, PPS_GETCAP, mode);
  259. +}
  260. +
  261. +static __inline int time_pps_fetch(pps_handle_t handle, const int tsformat,
  262. + pps_info_t *ppsinfobuf,
  263. + const struct timespec *timeout)
  264. +{
  265. + struct pps_fdata __fdata;
  266. + int ret;
  267. +
  268. + /* Sanity checks */
  269. + if (tsformat != PPS_TSFMT_TSPEC) {
  270. + errno = EINVAL;
  271. + return -1;
  272. + }
  273. +
  274. + if (timeout) {
  275. + __fdata.timeout.sec = timeout->tv_sec;
  276. + __fdata.timeout.nsec = timeout->tv_nsec;
  277. + __fdata.timeout.flags = ~PPS_TIME_INVALID;
  278. + } else
  279. + __fdata.timeout.flags = PPS_TIME_INVALID;
  280. +
  281. + ret = ioctl(handle, PPS_FETCH, &__fdata);
  282. +
  283. + ppsinfobuf->assert_sequence = __fdata.info.assert_sequence;
  284. + ppsinfobuf->clear_sequence = __fdata.info.clear_sequence;
  285. + ppsinfobuf->assert_tu.tspec.tv_sec = __fdata.info.assert_tu.sec;
  286. + ppsinfobuf->assert_tu.tspec.tv_nsec = __fdata.info.assert_tu.nsec;
  287. + ppsinfobuf->clear_tu.tspec.tv_sec = __fdata.info.clear_tu.sec;
  288. + ppsinfobuf->clear_tu.tspec.tv_nsec = __fdata.info.clear_tu.nsec;
  289. + ppsinfobuf->current_mode = __fdata.info.current_mode;
  290. +
  291. + return ret;
  292. +}
  293. +
  294. +static __inline int time_pps_kcbind(pps_handle_t handle,
  295. + const int kernel_consumer,
  296. + const int edge, const int tsformat)
  297. +{
  298. + /* LinuxPPS doesn't implement kernel consumer feature */
  299. + errno = EOPNOTSUPP;
  300. + return -1;
  301. +}
  302. +
  303. +#endif /* _SYS_TIMEPPS_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement