From patchwork Tue Nov 8 21:49:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 692508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tD2yl3XVwz9t1d for ; Wed, 9 Nov 2016 08:49:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hY5i3mDt"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E05A68D585; Tue, 8 Nov 2016 21:49:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ftnkxE80tV2B; Tue, 8 Nov 2016 21:49:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 364FB8D52A; Tue, 8 Nov 2016 21:49:32 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 851581C22F9 for ; Tue, 8 Nov 2016 21:49:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 80FFD8C643 for ; Tue, 8 Nov 2016 21:49:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NmjDiuCnaEC2 for ; Tue, 8 Nov 2016 21:49:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by whitealder.osuosl.org (Postfix) with ESMTPS id B9B6A8C896 for ; Tue, 8 Nov 2016 21:49:27 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id a20so14614617wme.2 for ; Tue, 08 Nov 2016 13:49:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P0sMVJYc8sLmTBpUaJonOT6lL0Wudnmnr1QjI7sYhQ0=; b=hY5i3mDtkcUKgGahv8DTmI5Ya5e/rKqEc0lzCFOP7Icm3/w9+hhPF+igbYN77BaLzA FGndvzIZYFSbuqKslizj/v4tSFoIUtoii3a2MHhwK52zdTqXPtaaQ9mDviYI2bffCMeb fh7WXH6oqvKfKggQUgdGhSC8+FJZ8OXj2WZYFmUgL1LBWDWbsnWg1fIMosuVIN0q4UzH 0kG7Negp7fQkRFpw93OnISJPn2jpjDP1ruvigV7nKUss/Ei0hBijYXnSkLzLRvq3KVAk 6D9IIInrXlTNLoAF2a9N9sj6zNoVuJhUO4WJkfhNgJe3qR0VJVGNLWWMMs6gX8w6i/Mx 6x+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P0sMVJYc8sLmTBpUaJonOT6lL0Wudnmnr1QjI7sYhQ0=; b=BxU93/c7dckvtEDL8tcZK0Xb1t4NFp25tZwpUeELOK1D0gbPByg2HPO/HBtg1B/Ni3 LBMHsq/39ahxKpbGqGGFziGNotZCle4RUrVQT0u5a9RmV9KQPz8h9Kn5adNw1Fyf5JnY l5DSQqb5mnVmyc1QJP5c67yCmScQLD0+vB68Lt2FO2ofIiAU4ctrcFL7W8vX3OFF8hPG ieRFwhKYah+I3IiQ7kIpa4ZlbmgR6r7Rq6ItktwmdRDXdD32WJB1ZLxgGUQ2H4k0+CYK X/v/JKMNfhEkFbIvoXgdgU89jjKmR5ysoJLAxMD+pJmn9hE0njHYOMpZCnABbETlhFAy V7rA== X-Gm-Message-State: ABUngvdguTF3REBbwu88W5JJlKI6Md7PtW1iwYdIdI2WjQwvyAoRdyC86vYta5V5HB4FCg== X-Received: by 10.194.165.228 with SMTP id zb4mr12341372wjb.31.1478641766271; Tue, 08 Nov 2016 13:49:26 -0800 (PST) Received: from localhost.localdomain (188-22-16-81.adsl.highway.telekom.at. [188.22.16.81]) by smtp.gmail.com with ESMTPSA id g17sm39336600wjs.38.2016.11.08.13.49.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Nov 2016 13:49:25 -0800 (PST) From: Richard Cochran To: Date: Tue, 8 Nov 2016 22:49:17 +0100 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Cc: Ulrik De Bie , John Stultz , Manfred Rudigier , intel-wired-lan@lists.osuosl.org, Thomas Gleixner , David Miller , =?UTF-8?q?Stefan=20S=C3=B8rensen?= Subject: [Intel-wired-lan] [PATCH net-next 2/3] ptp: igb: Use the high resolution frequency method. X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" The 82580 and related devices offer a frequency resolution of about 0.029 ppb. This patch lets users of the device benefit from the increased frequency resolution when tuning the clock. Signed-off-by: Richard Cochran --- drivers/net/ethernet/intel/igb/igb_ptp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index a7895c4..c30eea8 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -226,7 +226,7 @@ static int igb_ptp_adjfreq_82576(struct ptp_clock_info *ptp, s32 ppb) return 0; } -static int igb_ptp_adjfreq_82580(struct ptp_clock_info *ptp, s32 ppb) +static int igb_ptp_adjfine_82580(struct ptp_clock_info *ptp, long scaled_ppm) { struct igb_adapter *igb = container_of(ptp, struct igb_adapter, ptp_caps); @@ -235,13 +235,13 @@ static int igb_ptp_adjfreq_82580(struct ptp_clock_info *ptp, s32 ppb) u64 rate; u32 inca; - if (ppb < 0) { + if (scaled_ppm < 0) { neg_adj = 1; - ppb = -ppb; + scaled_ppm = -scaled_ppm; } - rate = ppb; - rate <<= 26; - rate = div_u64(rate, 1953125); + rate = scaled_ppm; + rate <<= 13; + rate = div_u64(rate, 15625); inca = rate & INCVALUE_MASK; if (neg_adj) @@ -1103,7 +1103,7 @@ void igb_ptp_init(struct igb_adapter *adapter) adapter->ptp_caps.max_adj = 62499999; adapter->ptp_caps.n_ext_ts = 0; adapter->ptp_caps.pps = 0; - adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82580; + adapter->ptp_caps.adjfine = igb_ptp_adjfine_82580; adapter->ptp_caps.adjtime = igb_ptp_adjtime_82576; adapter->ptp_caps.gettime64 = igb_ptp_gettime_82576; adapter->ptp_caps.settime64 = igb_ptp_settime_82576; @@ -1131,7 +1131,7 @@ void igb_ptp_init(struct igb_adapter *adapter) adapter->ptp_caps.n_pins = IGB_N_SDP; adapter->ptp_caps.pps = 1; adapter->ptp_caps.pin_config = adapter->sdp_config; - adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82580; + adapter->ptp_caps.adjfine = igb_ptp_adjfine_82580; adapter->ptp_caps.adjtime = igb_ptp_adjtime_i210; adapter->ptp_caps.gettime64 = igb_ptp_gettime_i210; adapter->ptp_caps.settime64 = igb_ptp_settime_i210;