Skip to content

Commit b88fdbb

Browse files
jlemonkuba-moo
authored andcommitted
ptp: ocp: fix PPS source selector debugfs reporting
The NTL timecard design has a PPS1 selector which selects the the PPS source automatically, according to Section 1.9 of the documentation. If there is a SMA PPS input detected: - send signal to MAC and PPS slave selector. If there is a MAC PPS input detected: - send GNSS1 to the MAC - send MAC to the PPS slave If there is a GNSS1 input detected: - send GNSS1 to the MAC - send GNSS1 to the PPS slave.MAC Change the debugfs summary so it reflects the correct mapping, for assistance in debugging. No functional change. Signed-off-by: Jonathan Lemon <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ee4cd72 commit b88fdbb

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

drivers/ptp/ptp_ocp.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,10 +3099,10 @@ ptp_ocp_summary_show(struct seq_file *s, void *data)
30993099
struct device *dev = s->private;
31003100
struct ptp_system_timestamp sts;
31013101
struct ts_reg __iomem *ts_reg;
3102+
char *buf, *src, *mac_src;
31023103
struct timespec64 ts;
31033104
struct ptp_ocp *bp;
31043105
u16 sma_val[4][2];
3105-
char *src, *buf;
31063106
u32 ctrl, val;
31073107
bool on, map;
31083108
int i;
@@ -3265,17 +3265,26 @@ ptp_ocp_summary_show(struct seq_file *s, void *data)
32653265
if (bp->pps_select) {
32663266
val = ioread32(&bp->pps_select->gpio1);
32673267
src = &buf[80];
3268-
if (val & 0x01)
3268+
mac_src = "GNSS1";
3269+
if (val & 0x01) {
32693270
gpio_input_map(src, bp, sma_val, 0, NULL);
3270-
else if (val & 0x02)
3271+
mac_src = src;
3272+
} else if (val & 0x02) {
32713273
src = "MAC";
3272-
else if (val & 0x04)
3274+
} else if (val & 0x04) {
32733275
src = "GNSS1";
3274-
else
3276+
} else {
32753277
src = "----";
3278+
mac_src = src;
3279+
}
32763280
} else {
32773281
src = "?";
3282+
mac_src = src;
32783283
}
3284+
seq_printf(s, "MAC PPS1 src: %s\n", mac_src);
3285+
3286+
gpio_input_map(buf, bp, sma_val, 1, "GNSS2");
3287+
seq_printf(s, "MAC PPS2 src: %s\n", buf);
32793288

32803289
/* assumes automatic switchover/selection */
32813290
val = ioread32(&bp->reg->select);
@@ -3300,12 +3309,6 @@ ptp_ocp_summary_show(struct seq_file *s, void *data)
33003309
seq_printf(s, "%7s: %s, state: %s\n", "PHC src", buf,
33013310
val & OCP_STATUS_IN_SYNC ? "sync" : "unsynced");
33023311

3303-
/* reuses PPS1 src from earlier */
3304-
seq_printf(s, "MAC PPS1 src: %s\n", src);
3305-
3306-
gpio_input_map(buf, bp, sma_val, 1, "GNSS2");
3307-
seq_printf(s, "MAC PPS2 src: %s\n", buf);
3308-
33093312
if (!ptp_ocp_gettimex(&bp->ptp_info, &ts, &sts)) {
33103313
struct timespec64 sys_ts;
33113314
s64 pre_ns, post_ns, ns;

0 commit comments

Comments
 (0)