summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/mv88e6xxx/hwtstamp.c
diff options
context:
space:
mode:
authorBrandon Streiff <brandon.streiff@ni.com>2018-02-14 01:07:51 +0100
committerDavid S. Miller <davem@davemloft.net>2018-02-14 14:33:37 -0500
commita2e47134e577713add97124afd812bc3f93627fb (patch)
treed779fcb16a984e9c1070269050d885c2d73ce120 /drivers/net/dsa/mv88e6xxx/hwtstamp.c
parentc6fe0ad2c3499cca7c7b3be83958e6f7e961f567 (diff)
net: dsa: mv88e6xxx: add workaround for 6341 timestamping
88E6341 devices default to timestamping at the PHY, but due to a hardware issue, timestamps via this component are unreliable. For this family, configure the PTP hardware to force the timestamping to occur at the MAC. Signed-off-by: Brandon Streiff <brandon.streiff@ni.com> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/hwtstamp.c')
-rw-r--r--drivers/net/dsa/mv88e6xxx/hwtstamp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/hwtstamp.c b/drivers/net/dsa/mv88e6xxx/hwtstamp.c
index 1b8f79b2c939..b251d534b70d 100644
--- a/drivers/net/dsa/mv88e6xxx/hwtstamp.c
+++ b/drivers/net/dsa/mv88e6xxx/hwtstamp.c
@@ -563,6 +563,19 @@ int mv88e6xxx_hwtstamp_setup(struct mv88e6xxx_chip *chip)
if (err)
return err;
+ /* 88E6341 devices default to timestamping at the PHY, but this has
+ * a hardware issue that results in unreliable timestamps. Force
+ * these devices to timestamp at the MAC.
+ */
+ if (chip->info->family == MV88E6XXX_FAMILY_6341) {
+ u16 val = MV88E6341_PTP_CFG_UPDATE |
+ MV88E6341_PTP_CFG_MODE_IDX |
+ MV88E6341_PTP_CFG_MODE_TS_AT_MAC;
+ err = mv88e6xxx_ptp_write(chip, MV88E6341_PTP_CFG, val);
+ if (err)
+ return err;
+ }
+
return 0;
}