From patchwork Tue Sep 3 05:55:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonic Zhang X-Patchwork-Id: 272110 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E361E2C00A8 for ; Tue, 3 Sep 2013 15:47:53 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759597Ab3ICFru (ORCPT ); Tue, 3 Sep 2013 01:47:50 -0400 Received: from mail-db8lp0188.outbound.messaging.microsoft.com ([213.199.154.188]:33169 "EHLO db8outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759592Ab3ICFrt (ORCPT ); Tue, 3 Sep 2013 01:47:49 -0400 Received: from mail135-db8-R.bigfish.com (10.174.8.246) by DB8EHSOBE022.bigfish.com (10.174.4.85) with Microsoft SMTP Server id 14.1.225.22; Tue, 3 Sep 2013 05:47:47 +0000 Received: from mail135-db8 (localhost [127.0.0.1]) by mail135-db8-R.bigfish.com (Postfix) with ESMTP id 4A67B4C0049; Tue, 3 Sep 2013 05:47:47 +0000 (UTC) X-Forefront-Antispam-Report: CIP:137.71.25.57; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta2.analog.com; RD:nwd2mail11.analog.com; EFVD:NLI X-SpamScore: 1 X-BigFish: VS1(zzzz1f42h1ee6h1ce5h1fdah201ch2073h1202h1fd0h1e76h1d1ah1cabh1d2ah1fc6hzz1de098h1de097h8275bhz31h87h2a8h839hd24he5bh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h13eah1441h14ddh1504h1537h15a8h162dh1631h1758h17eeh1898h18e1h1946h19b5h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1fe8h1ff5h129fi1155h) Received-SPF: softfail (mail135-db8: transitioning domain of gmail.com does not designate 137.71.25.57 as permitted sender) client-ip=137.71.25.57; envelope-from=sonic.adi@gmail.com; helo=nwd2mta2.analog.com ; 2.analog.com ; X-FB-DOMAIN-IP-MATCH: fail Received: from mail135-db8 (localhost.localdomain [127.0.0.1]) by mail135-db8 (MessageSwitch) id 1378187265395628_13116; Tue, 3 Sep 2013 05:47:45 +0000 (UTC) Received: from DB8EHSMHS027.bigfish.com (unknown [10.174.8.231]) by mail135-db8.bigfish.com (Postfix) with ESMTP id 5C3684A0047; Tue, 3 Sep 2013 05:47:45 +0000 (UTC) Received: from nwd2mta2.analog.com (137.71.25.57) by DB8EHSMHS027.bigfish.com (10.174.4.37) with Microsoft SMTP Server (TLS) id 14.16.227.3; Tue, 3 Sep 2013 05:47:44 +0000 Received: from NWD2HUBCAS5.ad.analog.com (nwd2hubcas5.ad.analog.com [10.64.72.161]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id r837YO7Y005387 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 3 Sep 2013 03:34:24 -0400 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS5.ad.analog.com (10.64.72.161) with Microsoft SMTP Server id 14.3.123.3; Tue, 3 Sep 2013 01:46:38 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id r835kZuh014326; Tue, 3 Sep 2013 01:46:36 -0400 Received: from nine.analog.com (unknown [10.99.22.80]) by linux.site (Postfix) with ESMTP id 962A435E2D3F; Mon, 2 Sep 2013 16:23:29 -0600 (MDT) From: Sonic Zhang To: Giuseppe Cavallaro , CC: , Sonic Zhang Subject: [PATCH] driver:stmmac: Adjust time stamp increase for 0.465 ns accurate only when Time stamp binary rollover is set. Date: Tue, 3 Sep 2013 13:55:07 +0800 Message-ID: <1378187707-17928-1-git-send-email-sonic.adi@gmail.com> X-Mailer: git-send-email 1.8.2.3 MIME-Version: 1.0 X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Sonic Zhang The synopsys spec says When TSCRLSSR is cleard, the rollover value of sub-second register is 0x7FFFFFFF(0.465 ns per clock). Signed-off-by: Sonic Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c index def7e75..76ad214 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c @@ -45,8 +45,8 @@ static void stmmac_config_sub_second_increment(void __iomem *ioaddr) data = (1000000000ULL / 50000000); /* 0.465ns accuracy */ - if (value & PTP_TCR_TSCTRLSSR) - data = (data * 100) / 465; + if (!(value & PTP_TCR_TSCTRLSSR)) + data = (data * 1000) / 465; writel(data, ioaddr + PTP_SSIR); }