|
16 | 16 |
|
17 | 17 | /* PTPSYNCTS has no interrupt or update mechanism, because the intended
|
18 | 18 | * hardware use case is for the timestamp to be collected synchronously,
|
19 |
| - * immediately after the CAS_MASTER SJA1105 switch has triggered a CASSYNC |
20 |
| - * pulse on the PTP_CLK pin. When used as a generic extts source, it needs |
21 |
| - * polling and a comparison with the old value. The polling interval is just |
22 |
| - * the Nyquist rate of a canonical PPS input (e.g. from a GPS module). |
23 |
| - * Anything of higher frequency than 1 Hz will be lost, since there is no |
24 |
| - * timestamp FIFO. |
| 19 | + * immediately after the CAS_MASTER SJA1105 switch has performed a CASSYNC |
| 20 | + * one-shot toggle (no return to level) on the PTP_CLK pin. When used as a |
| 21 | + * generic extts source, the PTPSYNCTS register needs polling and a comparison |
| 22 | + * with the old value. The polling interval is configured as the Nyquist rate |
| 23 | + * of a signal with 50% duty cycle and 1Hz frequency, which is sadly all that |
| 24 | + * this hardware can do (but may be enough for some setups). Anything of higher |
| 25 | + * frequency than 1 Hz will be lost, since there is no timestamp FIFO. |
25 | 26 | */
|
26 |
| -#define SJA1105_EXTTS_INTERVAL (HZ / 2) |
| 27 | +#define SJA1105_EXTTS_INTERVAL (HZ / 4) |
27 | 28 |
|
28 | 29 | /* This range is actually +/- SJA1105_MAX_ADJ_PPB
|
29 | 30 | * divided by 1000 (ppb -> ppm) and with a 16-bit
|
@@ -754,7 +755,16 @@ static int sja1105_extts_enable(struct sja1105_private *priv,
|
754 | 755 | return -EOPNOTSUPP;
|
755 | 756 |
|
756 | 757 | /* Reject requests with unsupported flags */
|
757 |
| - if (extts->flags) |
| 758 | + if (extts->flags & ~(PTP_ENABLE_FEATURE | |
| 759 | + PTP_RISING_EDGE | |
| 760 | + PTP_FALLING_EDGE | |
| 761 | + PTP_STRICT_FLAGS)) |
| 762 | + return -EOPNOTSUPP; |
| 763 | + |
| 764 | + /* We can only enable time stamping on both edges, sadly. */ |
| 765 | + if ((extts->flags & PTP_STRICT_FLAGS) && |
| 766 | + (extts->flags & PTP_ENABLE_FEATURE) && |
| 767 | + (extts->flags & PTP_EXTTS_EDGES) != PTP_EXTTS_EDGES) |
758 | 768 | return -EOPNOTSUPP;
|
759 | 769 |
|
760 | 770 | rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_EXTTS);
|
|
0 commit comments