[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230103174709.uzzxrvloei4diz2n@skbuf>
Date: Tue, 3 Jan 2023 19:47:09 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Arun Ramadoss <arun.ramadoss@...rochip.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
woojung.huh@...rochip.com, UNGLinuxDriver@...rochip.com,
andrew@...n.ch, vivien.didelot@...il.com, f.fainelli@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, linux@...linux.org.uk,
Tristram.Ha@...rochip.com, richardcochran@...il.com,
ceggers@...i.de, jacob.e.keller@...el.com
Subject: Re: [Patch net-next v6 12/13] net: dsa: microchip: ptp: lan937x: add
2 step timestamping
On Mon, Jan 02, 2023 at 10:34:58AM +0530, Arun Ramadoss wrote:
> ---
> drivers/net/dsa/microchip/ksz_ptp.c | 37 ++++++++++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c
> index 2d52a3d4771e..c2d156002ee5 100644
> --- a/drivers/net/dsa/microchip/ksz_ptp.c
> +++ b/drivers/net/dsa/microchip/ksz_ptp.c
> @@ -283,6 +283,9 @@ int ksz_get_ts_info(struct dsa_switch *ds, int port, struct ethtool_ts_info *ts)
>
> ts->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ONESTEP_P2P);
>
> + if (is_lan937x(dev))
> + ts->tx_types |= BIT(HWTSTAMP_TX_ON);
> +
> ts->rx_filters = BIT(HWTSTAMP_FILTER_NONE) |
> BIT(HWTSTAMP_FILTER_PTP_V2_L4_EVENT) |
> BIT(HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
> @@ -310,6 +313,8 @@ static int ksz_set_hwtstamp_config(struct ksz_device *dev,
> struct ksz_port *prt,
> struct hwtstamp_config *config)
> {
> + int ret;
> +
> if (config->flags)
> return -EINVAL;
>
> @@ -325,6 +330,25 @@ static int ksz_set_hwtstamp_config(struct ksz_device *dev,
> prt->ptpmsg_irq[KSZ_XDREQ_MSG].ts_en = 1;
> prt->ptpmsg_irq[KSZ_PDRES_MSG].ts_en = 0;
> prt->hwts_tx_en = true;
> +
> + ret = ksz_rmw16(dev, REG_PTP_MSG_CONF1, PTP_1STEP, PTP_1STEP);
> + if (ret)
> + return ret;
> +
> + break;
> + case HWTSTAMP_TX_ON:
> + if (!is_lan937x(dev))
> + return -ERANGE;
> +
> + prt->ptpmsg_irq[KSZ_SYNC_MSG].ts_en = 1;
> + prt->ptpmsg_irq[KSZ_XDREQ_MSG].ts_en = 1;
> + prt->ptpmsg_irq[KSZ_PDRES_MSG].ts_en = 1;
s/1/true/ please
> + prt->hwts_tx_en = true;
> +
> + ret = ksz_rmw16(dev, REG_PTP_MSG_CONF1, PTP_1STEP, 0);
> + if (ret)
> + return ret;
> +
> break;
> default:
> return -ERANGE;
Powered by blists - more mailing lists