Received: by 10.223.176.5 with SMTP id f5csp813087wra; Sat, 3 Feb 2018 10:53:03 -0800 (PST) X-Google-Smtp-Source: AH8x227yjcnjSgdnk2kBDbitdU0+j91gtOBaY3gE2lAf60XOgLvAlAgmH988v4Rv5LfC+EjVWo0f X-Received: by 10.99.112.23 with SMTP id l23mr6721122pgc.243.1517683983363; Sat, 03 Feb 2018 10:53:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517683983; cv=none; d=google.com; s=arc-20160816; b=qrRvI+VYWMTF6oKfR/+QpG9dz0cJPWwsqTYZQY2kIAb0MKA6xz74E5GGwqv38pXyMY IpElbVwMvMD+F7BtNmh+TxHuEiTq3Mohai0ploUC7IpjdALbKw7l1CU1WmfTETWxcne+ 5PTnhRFWJbIBtg8m8Hrx5SMHfK1RM8dcSFuJ86VzZYwi6p6EzpQFj1AavMiWHs3v1Lhc 1igX7yvWfyOT7nVAwJUh7qSkfWW8erjX/suSVUuedXlBtQI29/0MPfuuy2/JiNh9GJSb HWhSmzzhqs85pwy/e0QauD7+C63eSBhtDW4qvhJMPK3X4qOv2hXOtEpbnBw/C0SwQv+v Lhzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=N0Fjp6SEJoZKdlxVCGWoGMASbPRmhCsMGdzYvDFGunc=; b=NJAjrTE1/rjckLX0zh/Ez6bydxBnjZVj2jvbAzOnguzytR8QED6VdwEWMi95T7R3e8 zJUuKlM77Co/tBfWMyilkNWLbHBDZnoPAMiXmXsT8EqkICmk5P04Mjc4KnmQsvB1ly9S 1kow6oLprzdt3hpPe+CnzUjZw7H8Jh2BGdDGGEmAGvpyt9BNlrnxEiUb2D82xWbq0zT4 a22FebWw7/jWvVAQtQxivuy64qK/Z9NWA41BTI6mGSdV+c3J5grOksn0s1/xQgHGuqF/ bzNovCzDFcd9ukUCjB4l9iHstH4eBO1RiPY+5oSwAfFr4Zb8Q6WqHwBVWwP0EGJwVmBE jQqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=FOPTOfvu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si295268pgn.813.2018.02.03.10.52.48; Sat, 03 Feb 2018 10:53:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=FOPTOfvu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754168AbeBCSvy (ORCPT + 99 others); Sat, 3 Feb 2018 13:51:54 -0500 Received: from mail-co1nam03on0092.outbound.protection.outlook.com ([104.47.40.92]:4928 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752669AbeBCSBX (ORCPT ); Sat, 3 Feb 2018 13:01:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=N0Fjp6SEJoZKdlxVCGWoGMASbPRmhCsMGdzYvDFGunc=; b=FOPTOfvudIYR7lZNYuRpbnb7ZrHgtIaUmOmQDXG3ZYj2hXy0yeICptfYOdeWvj8rPAeLkMN5PC27x/JRyq+7RP0Eor/rtA27/ZeP9b/Y8pF6EWGhw4+EiQiTHkeemh5Oc0KuHkV4zQMN6Sr3s4UYZt+ss3Rls/lFqcdw10WkG4I= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB1092.namprd21.prod.outlook.com (52.132.24.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.485.4; Sat, 3 Feb 2018 18:01:20 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:01:20 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Fredrik Hallenberg , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 039/110] net: stmmac: Fix TX timestamp calculation Thread-Topic: [PATCH AUTOSEL for 4.14 039/110] net: stmmac: Fix TX timestamp calculation Thread-Index: AQHTnRjrjhkIDhoz1EyP685HW5XLLw== Date: Sat, 3 Feb 2018 18:00:47 +0000 Message-ID: <20180203180015.29073-39-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB1092;7:VNuBjcmI5NgMKF+8ljSuXmrVBOV4ZHCkt6fk5QjCOwBoU+t3KmSbCQfsb8fVrYy2PfJuCB7PSWSxl/3Vq57ZbGvyKqX7kevxErXConQp/ijNrmNQDAnzaDBy0zawm+7InWVjeXbCK3IXL6O11pNaDHIrQctJMf1x8XhdA3l5FH/EIGOGllZ5f9Us/xJh0XQU47udjqwHEYggzMM4DtPtH5xYfAqVUg3upFjPr7Qb7auYP8qUuVKaTcva4zgALXjS x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 78ac9780-4a65-4374-de26-08d56b30218f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB1092; x-ms-traffictypediagnostic: BL0PR2101MB1092: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231101)(2400082)(944501161)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:BL0PR2101MB1092;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB1092; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(39380400002)(376002)(346002)(396003)(366004)(189003)(199004)(3280700002)(14454004)(3660700001)(105586002)(3846002)(6666003)(22452003)(6116002)(99286004)(305945005)(7736002)(2950100002)(66066001)(478600001)(54906003)(110136005)(68736007)(316002)(86362001)(106356001)(186003)(26005)(6506007)(76176011)(6346003)(10090500001)(102836004)(6436002)(4326008)(8936002)(2501003)(53936002)(86612001)(2900100001)(6486002)(2906002)(6512007)(25786009)(97736004)(72206003)(1076002)(107886003)(36756003)(5660300001)(5250100002)(39060400002)(8676002)(81156014)(81166006)(10290500003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB1092;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: 3++htn8z0DkXvoSvsuUm7ZjgdjSTHdCvJK0HEeEDai+0gLRaqzlH/TC1Vi2jrW5F8lThtSN97ClKZIeRAhOwpw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78ac9780-4a65-4374-de26-08d56b30218f X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:00:47.4565 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1092 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fredrik Hallenberg [ Upstream commit 200922c93f008e03ddc804c6dacdf26ca1ba86d7 ] When using GMAC4 the value written in PTP_SSIR should be shifted however the shifted value is also used in subsequent calculations which results in a bad timestamp value. Signed-off-by: Fredrik Hallenberg Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/driver= s/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c index 721b61655261..08c19ebd5306 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c @@ -34,6 +34,7 @@ static u32 stmmac_config_sub_second_increment(void __iome= m *ioaddr, { u32 value =3D readl(ioaddr + PTP_TCR); unsigned long data; + u32 reg_value; =20 /* For GMAC3.x, 4.x versions, convert the ptp_clock to nano second * formula =3D (1/ptp_clock) * 1000000000 @@ -50,10 +51,11 @@ static u32 stmmac_config_sub_second_increment(void __io= mem *ioaddr, =20 data &=3D PTP_SSIR_SSINC_MASK; =20 + reg_value =3D data; if (gmac4) - data =3D data << GMAC4_PTP_SSIR_SSINC_SHIFT; + reg_value <<=3D GMAC4_PTP_SSIR_SSINC_SHIFT; =20 - writel(data, ioaddr + PTP_SSIR); + writel(reg_value, ioaddr + PTP_SSIR); =20 return data; } --=20 2.11.0