Skip to content

Commit aaf632f

Browse files
HoratiuVulturdavem330
authored andcommitted
net: micrel: Fix PTP frame parsing for lan8814
The HW has the capability to check each frame if it is a PTP frame, which domain it is, which ptp frame type it is, different ip address in the frame. And if one of these checks fail then the frame is not timestamp. Most of these checks were disabled except checking the field minorVersionPTP inside the PTP header. Meaning that once a partner sends a frame compliant to 8021AS which has minorVersionPTP set to 1, then the frame was not timestamp because the HW expected by default a value of 0 in minorVersionPTP. This is exactly the same issue as on lan8841. Fix this issue by removing this check so the userspace can decide on this. Fixes: ece1950 ("net: phy: micrel: 1588 support for LAN8814 phy") Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Divya Koppera <divya.koppera@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 94fa82b commit aaf632f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/net/phy/micrel.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@
120120
*/
121121
#define LAN8814_1PPM_FORMAT 17179
122122

123+
#define PTP_RX_VERSION 0x0248
124+
#define PTP_TX_VERSION 0x0288
125+
#define PTP_MAX_VERSION(x) (((x) & GENMASK(7, 0)) << 8)
126+
#define PTP_MIN_VERSION(x) ((x) & GENMASK(7, 0))
127+
123128
#define PTP_RX_MOD 0x024F
124129
#define PTP_RX_MOD_BAD_UDPV4_CHKSUM_FORCE_FCS_DIS_ BIT(3)
125130
#define PTP_RX_TIMESTAMP_EN 0x024D
@@ -3150,6 +3155,12 @@ static void lan8814_ptp_init(struct phy_device *phydev)
31503155
lanphy_write_page_reg(phydev, 5, PTP_TX_PARSE_IP_ADDR_EN, 0);
31513156
lanphy_write_page_reg(phydev, 5, PTP_RX_PARSE_IP_ADDR_EN, 0);
31523157

3158+
/* Disable checking for minorVersionPTP field */
3159+
lanphy_write_page_reg(phydev, 5, PTP_RX_VERSION,
3160+
PTP_MAX_VERSION(0xff) | PTP_MIN_VERSION(0x0));
3161+
lanphy_write_page_reg(phydev, 5, PTP_TX_VERSION,
3162+
PTP_MAX_VERSION(0xff) | PTP_MIN_VERSION(0x0));
3163+
31533164
skb_queue_head_init(&ptp_priv->tx_queue);
31543165
skb_queue_head_init(&ptp_priv->rx_queue);
31553166
INIT_LIST_HEAD(&ptp_priv->rx_ts_list);

0 commit comments

Comments
 (0)