Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6105267rwd; Mon, 19 Jun 2023 02:18:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6D4QEPK+wPFtk/FYv61u4bCKLbEYzQHsjcpM7fVaJTqpuiJuYEWHAY9lrj7715ceXa4RoT X-Received: by 2002:a05:6359:6796:b0:130:e2e2:9d25 with SMTP id sq22-20020a056359679600b00130e2e29d25mr3248169rwb.13.1687166330531; Mon, 19 Jun 2023 02:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687166330; cv=none; d=google.com; s=arc-20160816; b=jLbCDMN4c6MUyNLmh+YV4JtA77N34fx/0+39Hmt0ERLpmLt/6BAyV3Ru6VTFAg9JO6 ShrbgOBcIQ7UyP2YmBoSg2d7G3f9ClMIuIVva1K+MCP4DfiFHbnRZKesH1K6Rv8DvRG8 QZVBzhlrEXSVty5amf2vo60XBcjbp26u9GA66iapMVEQ8wDk19a5fPTJj5b5f1sVuKvQ xBPzQAFNW8/TJq0qU4qH6+cNs7bX5irR9jfX+756etmzSsYn42+BuRviXU5+bJJjQwQp qAjfAyL+zeYC7jsCJIWkBoYAyC8iNIMswtcHbB/q3nksBFMuqo8FGnBTEiPSu/+Lccdb Ha9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ANhEvnjhdu57/h9YLMy8DxuYY8HShkulpG01Hnilr2I=; b=VOr9j715WyoPZjkN+fliO5zQS3+Fkcvp0dQJ3hauWaEtxn4nf9Mq0euL57R3s7/tLu RusxZbDrOQIZqxW2lZ3ubNavWNL5S6XZuBzazFGjzyZ7KrQmv9+l/0Fkpx/yLo917kLf bxm6tkphFBufSvlIYiMEofH3iKgjdfV6DdEg2rd+8lKpgPVmBxBUx6nNnVxoFgmD/6aD /60UT0nvHwtDWsVTGrm4vecxyHT+Qqclpys4yVV2n2G4a2QXOK3qdvP0x5yItC93VS0P AydRLdhEhcLD5Otyk4IArgAaa59ukN7NauHD4DhSXw3N0GQfFshm3buzJPPBAp8rD3/2 kBRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=J7H0Gx0d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l2-20020a633e02000000b00553b512d1f0si2680816pga.433.2023.06.19.02.18.38; Mon, 19 Jun 2023 02:18:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=J7H0Gx0d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229846AbjFSI7S (ORCPT + 99 others); Mon, 19 Jun 2023 04:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbjFSI66 (ORCPT ); Mon, 19 Jun 2023 04:58:58 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72088D9; Mon, 19 Jun 2023 01:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1687165136; x=1718701136; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=BTctNJGtNKeC547EpUBouwSImLTyx71b0O6iSpMn8wQ=; b=J7H0Gx0dKggIsfcoKSYXW6EaJd9/x7jgu0YeEgIl/emAxB6j+cYWxDBs K4gCeJn3XCBfHBuFQhBVoAGlLtNgbeAW58AH7vah8pqwI3dVTBiSKIlAH 5R87GtTR1PHwKbIrO0N3OMQpQnWAXARMwoNKo3aHdEXqQLsaHjPCiR5ZR OZjbIlwWY+n5BLfkUJIUVZz9cGP1NB5ZLuhMxIrpqOjXPKpdrtCBrh0oY /85YdjMucCJXMVJgW5vNyT3IP4pN1haB/ZCQ5fF/MMsAvnDI7ZXxLEWXg KEtzL9jGbjynOfcMpa1CNaJubUjQiXJUupTNOGibh/8Pl2Wvz8n06HRTc w==; X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="216633003" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 19 Jun 2023 01:58:55 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 19 Jun 2023 01:58:32 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Mon, 19 Jun 2023 01:58:32 -0700 Date: Mon, 19 Jun 2023 10:58:31 +0200 From: Horatiu Vultur To: "Radu Pirea (NXP OSS)" CC: , , , , , , , , , , Subject: Re: [PATCH net-next v1 14/14] net: phy: nxp-c45-tja11xx: timestamp reading workaround for TJA1120 Message-ID: <20230619085831.dnzg2i5mqysc6r3r@soft-dev3-1> References: <20230616135323.98215-1-radu-nicolae.pirea@oss.nxp.com> <20230616135323.98215-15-radu-nicolae.pirea@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20230616135323.98215-15-radu-nicolae.pirea@oss.nxp.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) > --- > 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