From patchwork Wed Jul 9 10:22:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?S=C3=B8rensen=2C_Stefan?= X-Patchwork-Id: 368164 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 4C94F140108 for ; Wed, 9 Jul 2014 20:24:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755289AbaGIKYq (ORCPT ); Wed, 9 Jul 2014 06:24:46 -0400 Received: from [207.46.163.190] ([207.46.163.190]:7437 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755193AbaGIKYo (ORCPT ); Wed, 9 Jul 2014 06:24:44 -0400 Received: from e37108.spectralink.com (93.166.232.46) by DM2PR07MB333.namprd07.prod.outlook.com (10.141.98.17) with Microsoft SMTP Server (TLS) id 15.0.985.8; Wed, 9 Jul 2014 10:22:51 +0000 Received: by e37108.spectralink.com (sSMTP sendmail emulation); Wed, 09 Jul 2014 12:22:37 +0200 From: =?UTF-8?q?Stefan=20S=C3=B8rensen?= To: CC: , =?UTF-8?q?Stefan=20S=C3=B8rensen?= Subject: [PATCH net-next] dp83640: Adjust ptp event timestamps Date: Wed, 9 Jul 2014 12:22:23 +0200 Message-ID: <1404901343-19445-1-git-send-email-stefan.sorensen@spectralink.com> X-Mailer: git-send-email 1.9.3 MIME-Version: 1.0 X-Originating-IP: [93.166.232.46] X-ClientProxiedBy: DB4PR04CA0007.eurprd04.prod.outlook.com (25.160.41.17) To DM2PR07MB333.namprd07.prod.outlook.com (10.141.98.17) X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 0267E514F9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(6009001)(189002)(199002)(76482001)(50466002)(50986999)(19580395003)(81542001)(64706001)(87976001)(92566001)(85306003)(69596002)(102836001)(101416001)(62966002)(20776003)(77156001)(83322001)(19580405001)(88136002)(66066001)(80022001)(46102001)(36756003)(89996001)(23676002)(47776003)(83072002)(99396002)(85852003)(31966008)(106356001)(95666004)(81342001)(21056001)(92726001)(105586002)(2351001)(81156004)(79102001)(4396001)(229853001)(87286001)(77096002)(42186005)(86362001)(77982001)(33646001)(104166001)(107046002)(74662001)(50226001)(110136001)(74502001); DIR:OUT; SFP:; SCL:1; SRVR:DM2PR07MB333; H:e37108.spectralink.com; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; LANG:en; X-OriginatorOrg: spectralink.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From the dp86340 Software Development Guide: Event timestamp values should be adjusted by 3*reference clock period + 11 ns = 35 ns to compensate for input path and synchronization delays. So subtract 35ns from event timestamps. Signed-off-by: Stefan Sørensen Acked-by: Richard Cochran --- drivers/net/phy/dp83640.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 53bd1af..76fbd39 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -755,6 +755,9 @@ static int decode_evnt(struct dp83640_private *dp83640, event.type = PTP_CLOCK_EXTTS; event.timestamp = phy2txts(&dp83640->edata); + /* Compensate for input path and synchronization delays */ + event.timestamp -= 35; + for (i = 0; i < N_EXT_TS; i++) { if (ext_status & exts_chan_to_edata(i)) { event.index = i;