From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: "Radu Pirea (NXP OSS)" <radu-nicolae.pirea@oss.nxp.com>
Cc: <andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <richardcochran@gmail.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<sebastian.tobuschat@nxp.com>
Subject: Re: [PATCH net-next v1 14/14] net: phy: nxp-c45-tja11xx: timestamp reading workaround for TJA1120
Date: Mon, 19 Jun 2023 10:58:31 +0200 [thread overview]
Message-ID: <20230619085831.dnzg2i5mqysc6r3r@soft-dev3-1> (raw)
In-Reply-To: <20230616135323.98215-15-radu-nicolae.pirea@oss.nxp.com>
The 06/16/2023 16:53, Radu Pirea (NXP OSS) wrote:
Hi Radu,
>
> On TJA1120 engineering samples, the new timestamp is stuck in the FIFO.
> If the MORE_TS bit is set and the VALID bit is not set, we know that we
> have a timestamp in the FIFO but not in the buffer.
>
> To move the new timestamp in the buffer registers, the current
> timestamp(which is invalid) is unlocked by writing any of the buffer
> registers.
Shouldn't this be split and merged in patch 9 and patch 10?
As those two patches introduced this functions with issues.
>
> Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
> ---
> drivers/net/phy/nxp-c45-tja11xx.c | 31 ++++++++++++++++++++++++++++---
> 1 file changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
> index 0d22eb7534dc..3543c8fe099c 100644
> --- a/drivers/net/phy/nxp-c45-tja11xx.c
> +++ b/drivers/net/phy/nxp-c45-tja11xx.c
> @@ -532,15 +532,30 @@ static bool nxp_c45_get_extts(struct nxp_c45_phy *priv,
> static bool tja1120_get_extts(struct nxp_c45_phy *priv,
> struct timespec64 *extts)
> {
> + const struct nxp_c45_regmap *regmap = nxp_c45_get_regmap(priv->phydev);
> + bool more_ts;
> bool valid;
> u16 reg;
>
> + reg = phy_read_mmd(priv->phydev, MDIO_MMD_VEND1,
> + regmap->vend1_ext_trg_ctrl);
> + more_ts = !!(reg & TJA1120_MORE_TS);
> +
> reg = phy_read_mmd(priv->phydev, MDIO_MMD_VEND1,
> TJA1120_VEND1_PTP_TRIG_DATA_S);
> valid = !!(reg & TJA1120_TS_VALID);
> if (valid)
> return nxp_c45_get_extts(priv, extts);
>
> + /* Bug workaround for TJA1120 enegineering samples: move the new
> + * timestamp from the FIFO to the buffer.
> + */
> + if (more_ts) {
> + phy_write_mmd(priv->phydev, MDIO_MMD_VEND1,
> + regmap->vend1_ext_trg_ctrl, RING_DONE);
> + return nxp_c45_get_extts(priv, extts);
> + }
> +
> return valid;
> }
>
> @@ -588,15 +603,25 @@ static bool tja1120_get_hwtxts(struct nxp_c45_phy *priv,
> struct nxp_c45_hwts *hwts)
> {
> struct phy_device *phydev = priv->phydev;
> + bool more_ts;
> bool valid;
> u16 reg;
>
> mutex_lock(&priv->ptp_lock);
> + reg = phy_read_mmd(phydev, MDIO_MMD_VEND1, TJA1120_EGRESS_TS_END);
> + more_ts = !!(reg & TJA1120_MORE_TS);
> reg = phy_read_mmd(phydev, MDIO_MMD_VEND1, TJA1120_EGRESS_TS_DATA_S);
> valid = !!(reg & TJA1120_TS_VALID);
> - if (!valid)
> - goto tja1120_get_hwtxts_out;
> -
> + if (!valid) {
> + if (!more_ts)
> + goto tja1120_get_hwtxts_out;
> + /* Bug workaround for TJA1120 enegineering samples: move the
> + * new timestamp from the FIFO to the buffer.
> + */
> + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1,
> + TJA1120_EGRESS_TS_END, TJA1120_TS_VALID);
> + valid = true;
> + }
> nxp_c45_read_egress_ts(priv, hwts);
> phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, TJA1120_EGRESS_TS_DATA_S,
> TJA1120_TS_VALID);
> --
> 2.34.1
>
>
--
/Horatiu
next prev parent reply other threads:[~2023-06-19 8:58 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 13:53 [PATCH net-next v1 00/14] Add TJA1120 support Radu Pirea (NXP OSS)
2023-06-16 13:53 ` [PATCH net-next v1 01/14] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling Radu Pirea (NXP OSS)
2023-06-16 20:36 ` Andrew Lunn
2023-06-19 8:42 ` Radu Pirea (OSS)
2023-06-16 13:53 ` [PATCH net-next v1 02/14] net: phy: nxp-c45-tja11xx: use phylib master/slave implementation Radu Pirea (NXP OSS)
2023-06-16 20:37 ` Andrew Lunn
2023-06-16 13:53 ` [PATCH net-next v1 03/14] net: phy: nxp-c45-tja11xx: remove RX BIST frame counters Radu Pirea (NXP OSS)
2023-06-16 20:39 ` Andrew Lunn
2023-06-22 12:21 ` Radu Pirea (OSS)
2023-06-16 13:53 ` [PATCH net-next v1 04/14] net: phy: nxp-c45-tja11xx: add *_reg_field functions Radu Pirea (NXP OSS)
2023-06-16 20:42 ` Andrew Lunn
2023-06-16 13:53 ` [PATCH net-next v1 05/14] net: phy: nxp-c45-tja11xx: prepare the ground for TJA1120 Radu Pirea (NXP OSS)
2023-06-16 19:35 ` Simon Horman
2023-06-19 7:53 ` Horatiu Vultur
2023-06-16 13:53 ` [PATCH net-next v1 06/14] net: phy: add 1000baseT1 to phy_basic_t1_features Radu Pirea (NXP OSS)
2023-06-16 20:49 ` Andrew Lunn
2023-06-19 11:01 ` Radu Pirea (OSS)
2023-06-16 13:53 ` [PATCH net-next v1 07/14] net: phy: nxp-c45-tja11xx: add TJA1120 support Radu Pirea (NXP OSS)
2023-06-16 13:53 ` [PATCH net-next v1 08/14] net: phy: nxp-c45-tja11xx: enable LTC sampling on both ext_ts edges Radu Pirea (NXP OSS)
2023-06-19 8:10 ` Horatiu Vultur
2023-06-19 8:36 ` Radu Pirea (OSS)
2023-06-16 13:53 ` [PATCH net-next v1 09/14] net: phy: nxp-c45-tja11xx: read egress ts on TJA1120 Radu Pirea (NXP OSS)
2023-06-16 13:53 ` [PATCH net-next v1 10/14] net: phy: nxp-c45-tja11xx: handle FUSA irq Radu Pirea (NXP OSS)
2023-06-16 20:55 ` Andrew Lunn
2023-06-19 6:31 ` Radu Pirea (OSS)
2023-06-16 13:53 ` [PATCH net-next v1 11/14] net: phy: nxp-c45-tja11xx: run cable test with the PHY in test mode Radu Pirea (NXP OSS)
2023-06-16 13:53 ` [PATCH net-next v1 12/14] net: phy: nxp-c45-tja11xx: read ext trig ts TJA1120 Radu Pirea (NXP OSS)
2023-06-19 8:49 ` Horatiu Vultur
2023-06-19 10:07 ` Radu Pirea (OSS)
2023-06-19 10:48 ` Horatiu Vultur
2023-06-20 14:31 ` Radu Pirea (OSS)
2023-06-16 13:53 ` [PATCH net-next v1 13/14] net: phy: nxp-c45-tja11xx: reset PCS if the link goes down Radu Pirea (NXP OSS)
2023-06-16 21:00 ` Andrew Lunn
2023-06-19 6:17 ` Radu Pirea (OSS)
2023-06-16 13:53 ` [PATCH net-next v1 14/14] net: phy: nxp-c45-tja11xx: timestamp reading workaround for TJA1120 Radu Pirea (NXP OSS)
2023-06-19 8:58 ` Horatiu Vultur [this message]
2023-06-19 9:46 ` Radu Pirea (OSS)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230619085831.dnzg2i5mqysc6r3r@soft-dev3-1 \
--to=horatiu.vultur@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=radu-nicolae.pirea@oss.nxp.com \
--cc=richardcochran@gmail.com \
--cc=sebastian.tobuschat@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).