diff options
author | Jonathan Lemon <jonathan.lemon@gmail.com> | 2021-09-14 19:16:32 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-09-15 11:10:01 +0100 |
commit | 71d7e0850476918b2932ac1dca5a135a5584f742 (patch) | |
tree | e86c77392c913f8d3e5f0edfa00c341d4965e4c4 /drivers/ptp | |
parent | e3516bb45078fbcafeefe20a990080b9c838ac72 (diff) | |
download | linux-71d7e0850476918b2932ac1dca5a135a5584f742.tar.bz2 |
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 <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp')
-rw-r--r-- | drivers/ptp/ptp_ocp.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 74b5561fbdae..d0e3096f53f6 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -232,6 +232,7 @@ struct ptp_ocp { int id; int n_irqs; int gnss_port; + int gnss2_port; int mac_port; /* miniature atomic clock */ int nmea_port; u8 serial[6]; @@ -286,8 +287,8 @@ static int ptp_ocp_ts_enable(void *priv, bool enable); * 0: N/C * 1: TS0 * 2: TS1 - * 3: GPS - * 4: GPS2 (n/c) + * 3: GNSS + * 4: GNSS2 * 5: MAC * 6: TS2 * 7: I2C controller @@ -385,6 +386,10 @@ static struct ocp_resource ocp_fb_resource[] = { .offset = 0x00160000 + 0x1000, .irq_vec = 3, }, { + OCP_SERIAL_RESOURCE(gnss2_port), + .offset = 0x00170000 + 0x1000, .irq_vec = 4, + }, + { OCP_SERIAL_RESOURCE(mac_port), .offset = 0x00180000 + 0x1000, .irq_vec = 5, }, @@ -2100,6 +2105,7 @@ ptp_ocp_device_init(struct ptp_ocp *bp, struct pci_dev *pdev) bp->ptp_info = ptp_ocp_clock_info; spin_lock_init(&bp->lock); bp->gnss_port = -1; + bp->gnss2_port = -1; bp->mac_port = -1; bp->nmea_port = -1; bp->pdev = pdev; @@ -2163,6 +2169,10 @@ ptp_ocp_complete(struct ptp_ocp *bp) sprintf(buf, "ttyS%d", bp->gnss_port); ptp_ocp_link_child(bp, buf, "ttyGNSS"); } + if (bp->gnss2_port != -1) { + sprintf(buf, "ttyS%d", bp->gnss2_port); + ptp_ocp_link_child(bp, buf, "ttyGNSS2"); + } if (bp->mac_port != -1) { sprintf(buf, "ttyS%d", bp->mac_port); ptp_ocp_link_child(bp, buf, "ttyMAC"); @@ -2241,6 +2251,7 @@ ptp_ocp_info(struct ptp_ocp *bp) ver >> 16); } ptp_ocp_serial_info(dev, "GNSS", bp->gnss_port, 115200); + ptp_ocp_serial_info(dev, "GNSS2", bp->gnss2_port, 115200); ptp_ocp_serial_info(dev, "MAC", bp->mac_port, 57600); if (bp->nmea_out && bp->nmea_port != -1) { int baud = -1; @@ -2281,6 +2292,8 @@ ptp_ocp_detach(struct ptp_ocp *bp) ptp_ocp_unregister_ext(bp->pps); if (bp->gnss_port != -1) serial8250_unregister_port(bp->gnss_port); + if (bp->gnss2_port != -1) + serial8250_unregister_port(bp->gnss2_port); if (bp->mac_port != -1) serial8250_unregister_port(bp->mac_port); if (bp->nmea_port != -1) |