]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: phy: broadcom: add HW timestamp configuration reporting
authorVadim Fedorenko <vadim.fedorenko@linux.dev>
Mon, 24 Nov 2025 18:11:47 +0000 (18:11 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 27 Nov 2025 00:56:34 +0000 (16:56 -0800)
The driver stores configuration information and can technically report
it. Implement hwtstamp_get callback to report the configuration.

Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20251124181151.277256-4-vadim.fedorenko@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/bcm-phy-ptp.c

index 6815e844a62e868f9ecb09062a2f12192091655c..65d609ed69fb4e06f3e1c32dfd3ac33abc4eab87 100644 (file)
@@ -780,6 +780,18 @@ out:
        kfree_skb(skb);
 }
 
+static int bcm_ptp_hwtstamp_get(struct mii_timestamper *mii_ts,
+                               struct kernel_hwtstamp_config *cfg)
+{
+       struct bcm_ptp_private *priv = mii2priv(mii_ts);
+
+       cfg->rx_filter = priv->hwts_rx ? HWTSTAMP_FILTER_PTP_V2_EVENT
+                                      : HWTSTAMP_FILTER_NONE;
+       cfg->tx_type = priv->tx_type;
+
+       return 0;
+}
+
 static int bcm_ptp_hwtstamp_set(struct mii_timestamper *mii_ts,
                                struct kernel_hwtstamp_config *cfg,
                                struct netlink_ext_ack *extack)
@@ -899,6 +911,7 @@ static void bcm_ptp_init(struct bcm_ptp_private *priv)
        priv->mii_ts.rxtstamp = bcm_ptp_rxtstamp;
        priv->mii_ts.txtstamp = bcm_ptp_txtstamp;
        priv->mii_ts.hwtstamp_set = bcm_ptp_hwtstamp_set;
+       priv->mii_ts.hwtstamp_get = bcm_ptp_hwtstamp_get;
        priv->mii_ts.ts_info = bcm_ptp_ts_info;
 
        priv->phydev->mii_ts = &priv->mii_ts;