Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Vadim Fedorenko and committed by
Jakub Kicinski
dadc5187 d51de60b

+23
+23
drivers/ptp/ptp_ines.c
··· 328 328 return ns; 329 329 } 330 330 331 + static int ines_hwtstamp_get(struct mii_timestamper *mii_ts, 332 + struct kernel_hwtstamp_config *cfg) 333 + { 334 + struct ines_port *port = container_of(mii_ts, struct ines_port, mii_ts); 335 + unsigned long flags; 336 + u32 port_conf; 337 + 338 + cfg->rx_filter = port->rxts_enabled ? HWTSTAMP_FILTER_PTP_V2_EVENT 339 + : HWTSTAMP_FILTER_NONE; 340 + if (port->txts_enabled) { 341 + spin_lock_irqsave(&port->lock, flags); 342 + port_conf = ines_read32(port, port_conf); 343 + spin_unlock_irqrestore(&port->lock, flags); 344 + cfg->tx_type = (port_conf & CM_ONE_STEP) ? HWTSTAMP_TX_ONESTEP_P2P 345 + : HWTSTAMP_TX_OFF; 346 + } else { 347 + cfg->tx_type = HWTSTAMP_TX_OFF; 348 + } 349 + 350 + return 0; 351 + } 352 + 331 353 static int ines_hwtstamp_set(struct mii_timestamper *mii_ts, 332 354 struct kernel_hwtstamp_config *cfg, 333 355 struct netlink_ext_ack *extack) ··· 732 710 port->mii_ts.rxtstamp = ines_rxtstamp; 733 711 port->mii_ts.txtstamp = ines_txtstamp; 734 712 port->mii_ts.hwtstamp_set = ines_hwtstamp_set; 713 + port->mii_ts.hwtstamp_get = ines_hwtstamp_get; 735 714 port->mii_ts.link_state = ines_link_state; 736 715 port->mii_ts.ts_info = ines_ts_info; 737 716