diff options
Diffstat (limited to 'drivers/ptp/ptp_ines.c')
| -rw-r--r-- | drivers/ptp/ptp_ines.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/drivers/ptp/ptp_ines.c b/drivers/ptp/ptp_ines.c index 385643f3f8fe..790eb42b78db 100644 --- a/drivers/ptp/ptp_ines.c +++ b/drivers/ptp/ptp_ines.c @@ -328,9 +328,31 @@ static u64 ines_find_txts(struct ines_port *port, struct sk_buff *skb) return ns; } -static int ines_hwtstamp(struct mii_timestamper *mii_ts, - struct kernel_hwtstamp_config *cfg, - struct netlink_ext_ack *extack) +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) { struct ines_port *port = container_of(mii_ts, struct ines_port, mii_ts); u32 cm_one_step = 0, port_conf, ts_stat_rx, ts_stat_tx; @@ -556,18 +578,14 @@ static bool ines_timestamp_expired(struct ines_timestamp *ts) } static int ines_ts_info(struct mii_timestamper *mii_ts, - struct ethtool_ts_info *info) + struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_HARDWARE | - SOF_TIMESTAMPING_RX_SOFTWARE | - SOF_TIMESTAMPING_SOFTWARE | SOF_TIMESTAMPING_RAW_HARDWARE; - info->phc_index = -1; - info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON) | @@ -713,7 +731,8 @@ 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 = ines_hwtstamp; + 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; @@ -786,7 +805,7 @@ MODULE_DEVICE_TABLE(of, ines_ptp_ctrl_of_match); static struct platform_driver ines_ptp_ctrl_driver = { .probe = ines_ptp_ctrl_probe, - .remove_new = ines_ptp_ctrl_remove, + .remove = ines_ptp_ctrl_remove, .driver = { .name = "ines_ptp_ctrl", .of_match_table = ines_ptp_ctrl_of_match, |
