Skip to content

Commit 71d7e08

Browse files
jlemondavem330
authored andcommitted
ptp: ocp: Add second GNSS device
Upcoming boards may have a second GNSS receiver, getting information from a different constellation than the first receiver, which provides some measure of anti-spoofing. Expose the sysfs attribute for this device, if detected. Signed-off-by: Jonathan Lemon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e3516bb commit 71d7e08

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

drivers/ptp/ptp_ocp.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ struct ptp_ocp {
232232
int id;
233233
int n_irqs;
234234
int gnss_port;
235+
int gnss2_port;
235236
int mac_port; /* miniature atomic clock */
236237
int nmea_port;
237238
u8 serial[6];
@@ -286,8 +287,8 @@ static int ptp_ocp_ts_enable(void *priv, bool enable);
286287
* 0: N/C
287288
* 1: TS0
288289
* 2: TS1
289-
* 3: GPS
290-
* 4: GPS2 (n/c)
290+
* 3: GNSS
291+
* 4: GNSS2
291292
* 5: MAC
292293
* 6: TS2
293294
* 7: I2C controller
@@ -384,6 +385,10 @@ static struct ocp_resource ocp_fb_resource[] = {
384385
OCP_SERIAL_RESOURCE(gnss_port),
385386
.offset = 0x00160000 + 0x1000, .irq_vec = 3,
386387
},
388+
{
389+
OCP_SERIAL_RESOURCE(gnss2_port),
390+
.offset = 0x00170000 + 0x1000, .irq_vec = 4,
391+
},
387392
{
388393
OCP_SERIAL_RESOURCE(mac_port),
389394
.offset = 0x00180000 + 0x1000, .irq_vec = 5,
@@ -2100,6 +2105,7 @@ ptp_ocp_device_init(struct ptp_ocp *bp, struct pci_dev *pdev)
21002105
bp->ptp_info = ptp_ocp_clock_info;
21012106
spin_lock_init(&bp->lock);
21022107
bp->gnss_port = -1;
2108+
bp->gnss2_port = -1;
21032109
bp->mac_port = -1;
21042110
bp->nmea_port = -1;
21052111
bp->pdev = pdev;
@@ -2163,6 +2169,10 @@ ptp_ocp_complete(struct ptp_ocp *bp)
21632169
sprintf(buf, "ttyS%d", bp->gnss_port);
21642170
ptp_ocp_link_child(bp, buf, "ttyGNSS");
21652171
}
2172+
if (bp->gnss2_port != -1) {
2173+
sprintf(buf, "ttyS%d", bp->gnss2_port);
2174+
ptp_ocp_link_child(bp, buf, "ttyGNSS2");
2175+
}
21662176
if (bp->mac_port != -1) {
21672177
sprintf(buf, "ttyS%d", bp->mac_port);
21682178
ptp_ocp_link_child(bp, buf, "ttyMAC");
@@ -2241,6 +2251,7 @@ ptp_ocp_info(struct ptp_ocp *bp)
22412251
ver >> 16);
22422252
}
22432253
ptp_ocp_serial_info(dev, "GNSS", bp->gnss_port, 115200);
2254+
ptp_ocp_serial_info(dev, "GNSS2", bp->gnss2_port, 115200);
22442255
ptp_ocp_serial_info(dev, "MAC", bp->mac_port, 57600);
22452256
if (bp->nmea_out && bp->nmea_port != -1) {
22462257
int baud = -1;
@@ -2281,6 +2292,8 @@ ptp_ocp_detach(struct ptp_ocp *bp)
22812292
ptp_ocp_unregister_ext(bp->pps);
22822293
if (bp->gnss_port != -1)
22832294
serial8250_unregister_port(bp->gnss_port);
2295+
if (bp->gnss2_port != -1)
2296+
serial8250_unregister_port(bp->gnss2_port);
22842297
if (bp->mac_port != -1)
22852298
serial8250_unregister_port(bp->mac_port);
22862299
if (bp->nmea_port != -1)

0 commit comments

Comments
 (0)