From patchwork Fri Apr 14 08:26:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 83291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp221975vqo; Fri, 14 Apr 2023 01:33:26 -0700 (PDT) X-Google-Smtp-Source: AKy350Z8NfgtYtNQguasYuLC5Bhuc9RJejQwq1E+srBkcIsyAaN8JRpvNA9bDf0IfXd3K1Vh2uhF X-Received: by 2002:a17:903:1109:b0:1a6:4a2b:7920 with SMTP id n9-20020a170903110900b001a64a2b7920mr2364058plh.23.1681461206406; Fri, 14 Apr 2023 01:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681461206; cv=none; d=google.com; s=arc-20160816; b=xgml0/tYOGO2u2LNp8R4XqI2bvwAD5iO4p0sp3j3sVTOV2JVfkDIizdjFL7rF0S3e+ 7QOi3nQyqTAzKG4v8PJ8PUEIqTP4SsAIm150L5fFcs+Au7AdurQ7CVbwIaDb0orHTPt7 dS2zKM8Z6v0a4MZ5gGf0iuEYDhfnfagigDTYR7ytkcu1PxVOAs3+gJtNauwRp0SMB8WC hnjvO4NOSKcEanJl/dkTIeziqW+Na/SZwOzzAs+mZT1Faneiy8SWFil/gtkJSzsmJ1qT 7Gg7HMaNG3He2P6VWaSkpak2pxDOAeHVxOKhBHd1xW4Qf9H5X58viD4zKV8vn5p649OD /GmA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a170902db0f00b001a22560151asi4248018plx.325.2023.04.14.01.33.14; Fri, 14 Apr 2023 01:33:26 -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 S230301AbjDNI17 (ORCPT + 99 others); Fri, 14 Apr 2023 04:27:59 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763139866017662542?= X-GMAIL-MSGID: =?utf-8?q?1763139866017662542?= 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)