Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp218959rwe; Fri, 14 Apr 2023 01:28:16 -0700 (PDT) X-Google-Smtp-Source: AKy350YDSHVtQ9RU3zKydQTvgXYKGNMhTY/3R1Q6Xg7v5tRArUdxxMXUSH9C/EopXFM5Iu3zrlc/ X-Received: by 2002:a05:6a20:e94:b0:eb:f7d2:565 with SMTP id fk20-20020a056a200e9400b000ebf7d20565mr4875846pzb.29.1681460896338; Fri, 14 Apr 2023 01:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681460896; cv=none; d=google.com; s=arc-20160816; b=ldN4indWJpUoF8bsjHnUAmXt7Z8Ka+e37hx1Yq5UUTJ/oeiZ54AZPFasxaLi/YSC0e u+u/I3ftfdUA3PxXpVgxN5m48R2rD08ecTPDOi9ua0QWOojTau8H93QNfd4qTFGnE/HC BVlJMU9yDSr6uWAf5cmyDnNMevmDSGh8IS9aBqT6Yd4Zt4rbcSNxBGnbECZ26xCw77mj sPXurnl7UwF0VZ0GoryxK69GkJM82xR1sDGb63M/jlyJ9OomBEDUvqhjLseerEcRSWD6 LRxjO8QsVp0DSglEykwJeISPF3yPS0pE7yjZt4P1CEp4ithdCWzRI/vbAyuNQg4l+Zn4 HI8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=G4/RXnf+xtd0govAPJ2izjwTQ0WYE++VuETHu/FRUS4=; b=Fq1Hp7NKxcG6PGmhoLbRNfCloy0erf6EfJ2p0dAedN9tA+iZZ2F8XgV8hjfkYEO8fc FZnzvO+PzJdWWpgF7IAhCCzARSu+7wmg/EbYkeQ3+Ri29vszMm43s7UeHyVRuFMNK085 MuIIAZ8vycYAzdocVkn5T6qK3fvfR6vQpri5SbQnY7kqRlG3oWYDYuk/4/Ye+QrMhoHf 6KVnza7I51rRFLJE5S+OaPGnQX9k55atf7mKxAqMJr2wFM/eqRG94eqZlJwLkPKR6nvN qDOXnirqSCZg+wNOVeM/GzqM6v2K6Hu9GJm/gfSh8f9lYkmyHYdkbxCx2R4EC63hvyY4 +yTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=QOHxlzrQ; 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 s1-20020a63dc01000000b0051b614be920si2343772pgg.498.2023.04.14.01.28.04; Fri, 14 Apr 2023 01:28:16 -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=QOHxlzrQ; 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 S230329AbjDNI16 (ORCPT + 99 others); Fri, 14 Apr 2023 04:27:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230213AbjDNI1c (ORCPT ); Fri, 14 Apr 2023 04:27:32 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB262900C; Fri, 14 Apr 2023 01:27:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1681460829; x=1712996829; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=w2+6B68URgmKUVKHyS0K12IEVdDx3OVx3qeOmOW7/u8=; b=QOHxlzrQUM2Nz4j8qTFJmw/aWGEObVGFfH7W2bAbUx9RQG91N8z1o1gN 1pe1Y2kEq///IFZrqElbxrdUwzbfmxuRNCjeNPxFIdE2zJ8HJj3X6DIiD E4/MdFbK81zaJW+jpuXm5jaisRqTaMPa3LdpZOt4l9fZhX/T2u7N7Fo8S 8joCUc1nJt8SPOHDCe0hwzroKjZmjtx9U4xw6v/n6KTSzpFLz3jvuWWTQ vXBv3bsssVqfXSJzH6ifjS0aGk968D3HH1q4LivqJLT/+O3ZvgVfEzQ00 H/AXDLNyeAd4FL93/RoY+EmGTofxoLOoJar0LwogjVXkBrvWGL7/Sq1cg Q==; X-IronPort-AV: E=Sophos;i="5.99,195,1677567600"; d="scan'208";a="220867924" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 14 Apr 2023 01:27:04 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 14 Apr 2023 01:27:03 -0700 Received: from soft-dev3-1.microsemi.net (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; Fri, 14 Apr 2023 01:27:02 -0700 From: Horatiu Vultur To: , CC: , , , , , , , Horatiu Vultur Subject: [PATCH net-next] net: phy: micrel: Fix PTP_PF_PEROUT for lan8841 Date: Fri, 14 Apr 2023 10:26:59 +0200 Message-ID: <20230414082659.1321686-1-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,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 If the 1PPS output was enabled and then lan8841 was configured to be a follower, then target clock which is used to generate the 1PPS was not configure correctly. The problem was that for each adjustments of the time, also the nanosecond part of the target clock was changed. Therefore the initial nanosecond part of the target clock was changed. The issue can be observed if both the leader and the follower are generating 1PPS and see that their PPS are not aligned even if the time is allined. The fix consists of not modifying the nanosecond part of the target clock when adjusting the time. In this way the 1PPS get also aligned. Fixes: e4ed8ba08e3f ("net: phy: micrel: Add support for PTP_PF_PEROUT for lan8841") Signed-off-by: Horatiu Vultur --- drivers/net/phy/micrel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 3fee682603ef5..382144a6306f0 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -4025,7 +4025,7 @@ static int lan8841_ptp_update_target(struct kszphy_ptp_priv *ptp_priv, const struct timespec64 *ts) { return lan8841_ptp_set_target(ptp_priv, LAN8841_EVENT_A, - ts->tv_sec + LAN8841_BUFFER_TIME, ts->tv_nsec); + ts->tv_sec + LAN8841_BUFFER_TIME, 0); } #define LAN8841_PTP_LTC_TARGET_RELOAD_SEC_HI(event) ((event) == LAN8841_EVENT_A ? 282 : 292) -- 2.38.0