ptp: ptp_ines: add HW timestamp configuration reporting
The driver partially stores HW timestamping configuration, but missing pieces can be read from HW. Add callback to report configuration. Reviewed-by: Kory Maincent <kory.maincent@bootlin.com> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Link: https://patch.msgid.link/20251124181151.277256-8-vadim.fedorenko@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>pull/1354/merge
parent
d51de60b8e
commit
dadc51871d
|
|
@ -328,6 +328,28 @@ static u64 ines_find_txts(struct ines_port *port, struct sk_buff *skb)
|
|||
return ns;
|
||||
}
|
||||
|
||||
static int ines_hwtstamp_get(struct mii_timestamper *mii_ts,
|
||||
struct kernel_hwtstamp_config *cfg)
|
||||
{
|
||||
struct ines_port *port = container_of(mii_ts, struct ines_port, mii_ts);
|
||||
unsigned long flags;
|
||||
u32 port_conf;
|
||||
|
||||
cfg->rx_filter = port->rxts_enabled ? HWTSTAMP_FILTER_PTP_V2_EVENT
|
||||
: HWTSTAMP_FILTER_NONE;
|
||||
if (port->txts_enabled) {
|
||||
spin_lock_irqsave(&port->lock, flags);
|
||||
port_conf = ines_read32(port, port_conf);
|
||||
spin_unlock_irqrestore(&port->lock, flags);
|
||||
cfg->tx_type = (port_conf & CM_ONE_STEP) ? HWTSTAMP_TX_ONESTEP_P2P
|
||||
: HWTSTAMP_TX_OFF;
|
||||
} else {
|
||||
cfg->tx_type = HWTSTAMP_TX_OFF;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ines_hwtstamp_set(struct mii_timestamper *mii_ts,
|
||||
struct kernel_hwtstamp_config *cfg,
|
||||
struct netlink_ext_ack *extack)
|
||||
|
|
@ -710,6 +732,7 @@ static struct mii_timestamper *ines_ptp_probe_channel(struct device *device,
|
|||
port->mii_ts.rxtstamp = ines_rxtstamp;
|
||||
port->mii_ts.txtstamp = ines_txtstamp;
|
||||
port->mii_ts.hwtstamp_set = ines_hwtstamp_set;
|
||||
port->mii_ts.hwtstamp_get = ines_hwtstamp_get;
|
||||
port->mii_ts.link_state = ines_link_state;
|
||||
port->mii_ts.ts_info = ines_ts_info;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue