From patchwork Mon Mar 27 11:06:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 75352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1434764vqo; Mon, 27 Mar 2023 04:29:07 -0700 (PDT) X-Google-Smtp-Source: AK7set8++m/IekjMcsXcPSA1UjLROkVgUxy72QQCDF/qPoQY+l7xr9XuwBiBhPxq/2T9CmM8c1fZ X-Received: by 2002:a05:6a20:6723:b0:da:501:55e with SMTP id q35-20020a056a20672300b000da0501055emr9884740pzh.40.1679916547619; Mon, 27 Mar 2023 04:29:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679916547; cv=pass; d=google.com; s=arc-20160816; b=w8S7DYCkuN0AH9ZlC79Pac2oCLIO6BGqJ7vcCV4AL1C9tQKajMPGfZxpNgb5u8Kn3/ xVejcPOwmdeO14VyoPUlrjq8tCEP07/c2xehEQMtyohLjOum1TbZOvFQZcKLRhpH1QpM gBh2WqWfDS1opno1O6gDhwhM3p+TROueVRZ/KEP6YwAj+4anjMBEH9a+lkWl1LTDX2J+ GRUONLmiYFBTHGHYjc/KJzJXa7wAmPRLlKiUQTLRC4LWFE+8hX0ND/aaAnOD+NVwRgnC YxaTelW1gb/LPnZG4WI2GpS5+3r1l3q7qVK1eeFYwojWXahjBJ55bVmSUJmJMSsmRTQw E0Vg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Spn8Pi1i4yafXE9SaGQap1MRbPwCW9izTJUcHEd7LXY=; b=V8UrZdvHWOU35oqwY7sSv45BhjsbSOgt+bnGVledJXbWKcWeqsX9PlztT4nihpVobz AZrWCHUEYFkOu5Bsc3A3rUQ/UbUe71Lj3pRidwNUl6CUEpzpgyoaoHIA1nAO0G4Wmg/S pkf8mVEe2/mOYdWp+TtTBCumIqfSxCHfAuX4mEVsI3RdWOnjeDzhYWV9Dkx2iIoNInBx rJ2WgO56MuEU0zxLVVWfkQv7JRqHVpFT03np2bFEwApkl0X3+IBXhvaiU0/tZpFuefZU 75ewJhAF86pXEUnMkHEV4BD3HMwOqFYMEbU8pkTKSXKrdmVF0E9wRKWIzxr3UIAtYD6N EtlA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Xm9St+q1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13-20020a63ec4d000000b0050be42c6f04si27285907pgj.539.2023.03.27.04.28.54; Mon, 27 Mar 2023 04:29:07 -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=@amd.com header.s=selector1 header.b=Xm9St+q1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbjC0LGa (ORCPT + 99 others); Mon, 27 Mar 2023 07:06:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbjC0LGX (ORCPT ); Mon, 27 Mar 2023 07:06:23 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2084.outbound.protection.outlook.com [40.107.223.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DBFF468E; Mon, 27 Mar 2023 04:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ca7Uqam4WVgjArgeV3TaTjiSa42xxi/8A4YUatFjqZvy65Cj6ZlYQCjX1vrVaqFgBnbBcK/UfCgsEvzd8Z9QBATAgwT5fLppUoQr/fAQdL7YTeac0ee3zbceql6VRaJp5YUpp7lLBWi33/c0wEo4EKRc+y9cHw1OIUrjB/sfQFCJtqaqWnC6Ak1L9xNIYvcwQNRRfUH7RZ7ZtfjJejD0vXg276x/zxftd18kCiakuYkFG/UmsGVXTOpkTfn3d/9DZpctKvkzOdKa8jPmwuyeXy9GaYyORlF5gnrbmW4QjXO8g5jQaC1eg5CJl2iNfCxYF4R6nO75FzBlOu1zF5ClvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Spn8Pi1i4yafXE9SaGQap1MRbPwCW9izTJUcHEd7LXY=; b=mXevP6NeQxZ1CTQ+oL7Y8XnI+xHs1n3nQrtv3VOdv71Y59NaiQgMVMV+ceJuPb931rp1VG5URJY9eK2dPXYDAxer88H9vpaCiNuGhiT826ml13Ym4Y6GrQkAq5p+k5hKdkFmnIq2X3wcIoGixyKUyeG14mXje5reVLIV7zGX9Jx1LhzYqTx6DjMjmnNVi9z0YHbr8Hgt08g68b8jpdUBPFatqWL4v7Xa+8tgANZKlu47dbUHdtbheFggDFfAtwFkleV5VX3TCBd7dCLbykq2qq/Kh7W5Wyrn9gFe/c4niL3L8M+cjsNVUhj/QcLmVcLbg1BsN3QxykblUtUr3BfFfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Spn8Pi1i4yafXE9SaGQap1MRbPwCW9izTJUcHEd7LXY=; b=Xm9St+q1z971fTfqCifzDL/1/9ys3YHdtOPltW12siQFvGKwi7tcGT4msPdLWjUXeJKO5FHr1rqsL/7Yc191V7A5VdLkoJtKJQoU+EugTCYPwsaDPSta9MXsmRjagyvnUbodUDr9aV9TJ1MrU/QVUzdol26cJmKPMRRFuALf6uE= Received: from BN8PR03CA0033.namprd03.prod.outlook.com (2603:10b6:408:94::46) by DS0PR12MB8480.namprd12.prod.outlook.com (2603:10b6:8:159::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.30; Mon, 27 Mar 2023 11:06:20 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::81) by BN8PR03CA0033.outlook.office365.com (2603:10b6:408:94::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41 via Frontend Transport; Mon, 27 Mar 2023 11:06:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6222.22 via Frontend Transport; Mon, 27 Mar 2023 11:06:19 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 27 Mar 2023 06:06:15 -0500 Received: from xhdharinik40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 27 Mar 2023 06:06:12 -0500 From: Harini Katakam To: , , , , , , , CC: , , , , Subject: [PATCH net-next v3 1/3] net: macb: Update gem PTP support check Date: Mon, 27 Mar 2023 16:36:05 +0530 Message-ID: <20230327110607.21964-2-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230327110607.21964-1-harini.katakam@amd.com> References: <20230327110607.21964-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT044:EE_|DS0PR12MB8480:EE_ X-MS-Office365-Filtering-Correlation-Id: b5f1dc5d-7f66-4137-9b1c-08db2eb34b24 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6TAQIxwf3xz668imLXIKW6jUbi+dD+Uf1LGqDm3Bs35MdysjG27g55GI/CkwST0WwCats2Gt1CJVbOw8ZOMWxJuIZWa8Dnr5qMOjYb2J3be6F/d4UW8Zpyp2hDlLLsOiAK8lYLBmYOYRLy2G3XQ0BClk8U0CIM24sN8ugJPw1SDGB9ZQ4ygwkbF7rA8z9fRHCmPwvI4uAhEX3WvhK0oJm0rVmc/iLYlVnl/FP5rg8ri9AulO2JWQs1tGa5N7tzd1ZiujydrXcPFGSAjNaiISnRT/wAXMZ1NhRoCw+K4R39gtyqysK/1FFOMb8+NvpfQ79IBE1RuPCHbP5BcKXwrviApf1M2v+sni9ysYJNCVP+ipsm2Q8WVFezXdP6vX0n6op05FX+kxvmrxLP8wZEWxtDZe/UJC485dr1I4aMY2FRbaljNt6+XZROewshApIwTGtNQ5JrDkjidZLpVAwa9BEcSoG7xeHVZzfQCZ7LhsJykfTu9y52HFQ/bvw6OgFlCHIUMMAUm2IBnnV1+X0/7AF+lcmo2UoewVT2hwzUW7CXKuOQKOMH2U1KzES0e74uuxNMIuHuF+0ssM9aAE652WBhNHhtrRH+rjVL1ZT21ZDQi6ZuGfYYz0FzFF5dro44LGSttO/AFpx2zEWqJ6Yry7T223xBOW7k7hhDzvNrYDFdKN7d4xQ6Zt4kuMV1lsTuDJkeaJrQYcO2sRwj9ueW8jKD9DxRp9i2ellB3TT0q7Ug8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(136003)(39860400002)(396003)(451199021)(46966006)(36840700001)(40470700004)(356005)(81166007)(7416002)(8936002)(5660300002)(82310400005)(186003)(1076003)(36756003)(26005)(2616005)(2906002)(40480700001)(6666004)(47076005)(86362001)(36860700001)(83380400001)(426003)(336012)(44832011)(40460700003)(82740400003)(4326008)(8676002)(54906003)(70586007)(70206006)(41300700001)(478600001)(110136005)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 11:06:19.6052 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5f1dc5d-7f66-4137-9b1c-08db2eb34b24 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8480 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=unavailable 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?1761520174122813891?= X-GMAIL-MSGID: =?utf-8?q?1761520174122813891?= There are currently two checks for PTP functionality - one on GEM capability and another on the kernel config option. Combine them into a single function as there's no use case where gem_has_ptp is TRUE and MACB_USE_HWSTAMP is false. Signed-off-by: Harini Katakam --- v3: New patch drivers/net/ethernet/cadence/macb.h | 2 +- drivers/net/ethernet/cadence/macb_main.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index c1fc91c97cee..b6c5ecbd572c 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -1363,7 +1363,7 @@ static inline bool macb_is_gem(struct macb *bp) static inline bool gem_has_ptp(struct macb *bp) { - return !!(bp->caps & MACB_CAPS_GEM_HAS_PTP); + return (IS_ENABLED(CONFIG_MACB_USE_HWSTAMP) && (!!(bp->caps & MACB_CAPS_GEM_HAS_PTP))); } /** diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index f77bd1223c8f..bcda6a08706f 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3889,7 +3889,6 @@ static void macb_configure_caps(struct macb *bp, dcfg = gem_readl(bp, DCFG2); if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0) bp->caps |= MACB_CAPS_FIFO_MODE; -#ifdef CONFIG_MACB_USE_HWSTAMP if (gem_has_ptp(bp)) { if (!GEM_BFEXT(TSU, gem_readl(bp, DCFG5))) dev_err(&bp->pdev->dev, @@ -3899,7 +3898,6 @@ static void macb_configure_caps(struct macb *bp, bp->ptp_info = &gem_ptp_info; } } -#endif } dev_dbg(&bp->pdev->dev, "Cadence caps 0x%08x\n", bp->caps); From patchwork Mon Mar 27 11:06:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 75344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1423286vqo; Mon, 27 Mar 2023 04:08:52 -0700 (PDT) X-Google-Smtp-Source: AKy350b3MAOOiIJO6kwBsgNKUSwFIzzbAHfCf/iVkusCpxVNiwEepq4hPEXYYxx6hDiYazhT3uuU X-Received: by 2002:aa7:d74b:0:b0:4fb:5607:6a24 with SMTP id a11-20020aa7d74b000000b004fb56076a24mr11258454eds.8.1679915332646; Mon, 27 Mar 2023 04:08:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679915332; cv=pass; d=google.com; s=arc-20160816; b=SXGPkov9AtfxWO3KDBhAPYM0JpQR27drwsUls2zt87DRxw4aVxAqUck6Cp7FdReWRt +DUwxGnT0wDWbhTxcegssA5U6VpCpg2si+CX9hxesUYJ535hbdMEGQqtx59ZuF87gRYP OaT510ndYanFhFF084VZ1YL5nikB3OzRVVYIzyOna6Cg+tVkSZODkFuRRbGBPqPTdt3k E0UeZAFi9pFcTwRrc3gDUWI2wtl1g3dF3JVMEK/ijLXu/ZUbIH6PB/IevQmapNX7H4zT XcIrSTgdA0zSVjTYrvy2OG5LyV6bgqGz+2sBxDWszjypDFVtOCpGjCCwFMCD+X4VvYUF PUzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PvEfM7eFDANdWGdIwIUHZ7Dn+qMTX0hyO3ElqEwHaEM=; b=zaJZ4Wyf7tnmRR4YBFp2F147KxVjSna7xnhNIEHDy/ZgPfEpUfZHB7jv4ny+RgUF31 tNh4mzYdt2YNqoAiZJQQgx7+utfO8USh0nChFzvcLvaST/fqV4FNYuXP8WDEkIFatPlg IZ8ix0frhwFJrgDykkFHFWVkCWaEn0J3tKSll7h3URCOP3i/b9FkpKkR4sfSz7lmkWZY qcVMRwiLiu7/jiT4sX5I+rNoiY0i3A7bEfgtyr7ghu/CjhYy51L4zZVgQAwMev7yt1X0 Hb2LGtQfeQqGdJ4EkQk5pthAc0qDeOqhi7/884PSmy1I/RemzySKGxFT+pn/z26gFraz OVtw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=DyxZJaBK; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc23-20020a056402205700b004fae45d5b7esi26899145edb.534.2023.03.27.04.08.28; Mon, 27 Mar 2023 04:08:52 -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=@amd.com header.s=selector1 header.b=DyxZJaBK; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232341AbjC0LHL (ORCPT + 99 others); Mon, 27 Mar 2023 07:07:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230344AbjC0LHI (ORCPT ); Mon, 27 Mar 2023 07:07:08 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C476546A6; Mon, 27 Mar 2023 04:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZyioYEVbB23iM7kdFMGQkNBFWCuZwnSYG1fwXjZXG5l2/AkgG5i6NXolHeF4Ubwb+x42/xhhzhJf049XeQprdKfd7r6WNBNpo+1Vp55rnk8fcAIQ8UY1bXVrAQKbAiMM4vuIoCM7ZsloOYsCZ4f7Iwmufi7lu8kNpln0YfUQNqxrKARMTVaRSpQyQiKdh25mcsSFVMqRkxDtFFtnouAuCWF3MdTQ6AN8ysAOvo9q8ge9PPbsvhDjxg8LKeHPpxAwX7beBAZYaRC8L96+LTc3gSgMKYzsvbNzEBa0NkyMPafQfcVCHMk32haYegbm+46ChDJpmk6lmbrdqDwaSmN1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PvEfM7eFDANdWGdIwIUHZ7Dn+qMTX0hyO3ElqEwHaEM=; b=ZlCS3rmI99JLBg3jRRILGtK/opDQpq9HmAEN5jlP7Wo5UlDlKs8kYKUgwxpngrMU2rkW83O0w0Nf409adUblKWuFfVGvUc26mNY9X9CuLM1+Ysg1qRinen02JxMMw+NN/9q6HSFu3WupVH3t3aPyM42Pi0pXum6GVyvmTTVbT1zpMZ18XLTSbcjzc9lFU9nWQBf+ytkO/kMY4q5oBkeMOMD5+L0Bc/VVt1Djoxbynxfzx12SDewneZ3xEiptfoS9St85sfKwMInxXJUzQ0B1tGci2R5Zbxzb+JKtAmEh4lhcq+gxmMONSQLqeM6FDjcUzvx+ypui4aerabtZMLTeuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PvEfM7eFDANdWGdIwIUHZ7Dn+qMTX0hyO3ElqEwHaEM=; b=DyxZJaBKFydsHSo4L6DAFDXXkA1HPUsGTldWNlnopHFHYQxpzYZCGmP9fymqdO7U1kW6KydlL2+DjoeeByc2mvvYbZC9wSLDqUyty+lr0WeRssnBOcYSkfS9oir8KfAoVrCMdsruP78KXlc7cHwe67tazr75CnSkh9hzKh8AyEc= Received: from BN0PR04CA0040.namprd04.prod.outlook.com (2603:10b6:408:e8::15) by CH0PR12MB5299.namprd12.prod.outlook.com (2603:10b6:610:d6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Mon, 27 Mar 2023 11:06:55 +0000 Received: from BN8NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e8:cafe::8e) by BN0PR04CA0040.outlook.office365.com (2603:10b6:408:e8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.43 via Frontend Transport; Mon, 27 Mar 2023 11:06:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT056.mail.protection.outlook.com (10.13.177.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6222.22 via Frontend Transport; Mon, 27 Mar 2023 11:06:54 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 27 Mar 2023 06:06:50 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 27 Mar 2023 06:06:19 -0500 Received: from xhdharinik40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 27 Mar 2023 06:06:15 -0500 From: Harini Katakam To: , , , , , , , CC: , , , , Subject: [PATCH net-next v3 2/3] net: macb: Enable PTP unicast Date: Mon, 27 Mar 2023 16:36:06 +0530 Message-ID: <20230327110607.21964-3-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230327110607.21964-1-harini.katakam@amd.com> References: <20230327110607.21964-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT056:EE_|CH0PR12MB5299:EE_ X-MS-Office365-Filtering-Correlation-Id: 34799ebf-2d04-46d3-f434-08db2eb36022 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7cCfa4y0ldOjhpDWgktiY/zRGy/Yg4zNh2Uup4apiEToR7Mpc/xzQKltTsZL/crg3+HZC3CjzR+2PcKiGVYP6s7/RmhDjJux5CmfkKvdiPMuvBxhRJ/7Ij+bu28F6aeGyWzsQxtxqN59XJghW00grMztf/n80IRHTKVk/FMo4AnAwrydKLPIffaCC/xdp7fJ4jaGFT+4zTSa/+5bV6qGZel+SrwsmpPcEbPIUPR0qygVToXbHPrydKTy57nsfp1zeJY0byFgJuoWwoPwAA4MCC1/29No12pznXCiTdi4OoY0/JTzJkQei6UOvoVRSzCYoL+hW8NKPR4/bOOMY+ar4g3rXtEyjWQrpOXGc3cK6TDfOrbNMhvdNb7obPYfmUahSelZOzxx4EPB78TlDI85dcNHNzyEpkj6JU3SgXpFHkcSrXlDsqVWFUQ6JT8R8hutX7NnNtNymyHKhL+/xr6LjzOcy9hOjUpAeM2Whcmctx9OMMLuDgK5ykERQCtrzjU+csZ+WDiC7k6kqpJ8wEPrqD0UwTD9gvcDoR+UsKMr2qtXZ3oBAlwhJQKOXz5A6ps7Te4pxvLufGVZa/TIMo5SkMNLdoUNNgL5lRiXZbXf5YLydToFbTw4aQSC60723HlkwChRWvhqGhqYX5Nx1idQWZ+NTtc0JV4POZLusegiD94oDLHkgSZtXlXuXXwFYwrDI6q+5U7xT9LlnzC6hTabwUCQF2rZupotgTbs0gaGA0s= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(39860400002)(346002)(396003)(451199021)(46966006)(36840700001)(40470700004)(70586007)(6666004)(356005)(2616005)(40460700003)(86362001)(426003)(40480700001)(47076005)(70206006)(4326008)(8676002)(82310400005)(82740400003)(41300700001)(316002)(110136005)(54906003)(186003)(36756003)(478600001)(36860700001)(336012)(83380400001)(26005)(2906002)(7416002)(81166007)(8936002)(5660300002)(1076003)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 11:06:54.9515 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34799ebf-2d04-46d3-f434-08db2eb36022 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5299 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=unavailable 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?1761518899916349527?= X-GMAIL-MSGID: =?utf-8?q?1761518899916349527?= From: Harini Katakam Enable transmission and reception of PTP unicast packets by updating PTP unicast config bit and setting current HW mac address as allowed address in PTP unicast filter registers. Signed-off-by: Harini Katakam Signed-off-by: Michal Simek Signed-off-by: Radhey Shyam Pandey --- v3: Remove config check as it is handled in gem_has_ptp v2: Handle operation using a single write as suggested by Cladiu drivers/net/ethernet/cadence/macb.h | 4 ++++ drivers/net/ethernet/cadence/macb_main.c | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index b6c5ecbd572c..709e3b560883 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -95,6 +95,8 @@ #define GEM_SA4B 0x00A0 /* Specific4 Bottom */ #define GEM_SA4T 0x00A4 /* Specific4 Top */ #define GEM_WOL 0x00b8 /* Wake on LAN */ +#define GEM_RXPTPUNI 0x00D4 /* PTP RX Unicast address */ +#define GEM_TXPTPUNI 0x00D8 /* PTP TX Unicast address */ #define GEM_EFTSH 0x00e8 /* PTP Event Frame Transmitted Seconds Register 47:32 */ #define GEM_EFRSH 0x00ec /* PTP Event Frame Received Seconds Register 47:32 */ #define GEM_PEFTSH 0x00f0 /* PTP Peer Event Frame Transmitted Seconds Register 47:32 */ @@ -245,6 +247,8 @@ #define MACB_TZQ_OFFSET 12 /* Transmit zero quantum pause frame */ #define MACB_TZQ_SIZE 1 #define MACB_SRTSM_OFFSET 15 /* Store Receive Timestamp to Memory */ +#define MACB_PTPUNI_OFFSET 20 /* PTP Unicast packet enable */ +#define MACB_PTPUNI_SIZE 1 #define MACB_OSSMODE_OFFSET 24 /* Enable One Step Synchro Mode */ #define MACB_OSSMODE_SIZE 1 #define MACB_MIIONRGMII_OFFSET 28 /* MII Usage on RGMII Interface */ diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index bcda6a08706f..9b85b05c20cd 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -287,6 +287,11 @@ static void macb_set_hwaddr(struct macb *bp) top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4))); macb_or_gem_writel(bp, SA1T, top); + if (gem_has_ptp(bp)) { + gem_writel(bp, RXPTPUNI, bottom); + gem_writel(bp, TXPTPUNI, bottom); + } + /* Clear unused address register sets */ macb_or_gem_writel(bp, SA2B, 0); macb_or_gem_writel(bp, SA2T, 0); @@ -773,8 +778,12 @@ static void macb_mac_link_up(struct phylink_config *config, spin_unlock_irqrestore(&bp->lock, flags); - /* Enable Rx and Tx */ - macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE)); + /* Enable Rx and Tx; Enable PTP unicast */ + ctrl = macb_readl(bp, NCR); + if (gem_has_ptp(bp)) + ctrl |= MACB_BIT(PTPUNI); + + macb_writel(bp, NCR, ctrl | MACB_BIT(RE) | MACB_BIT(TE)); netif_tx_wake_all_queues(ndev); } From patchwork Mon Mar 27 11:06:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 75345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1423639vqo; Mon, 27 Mar 2023 04:09:32 -0700 (PDT) X-Google-Smtp-Source: AKy350ZUi18nXZ+M+ikhkX+o8uFFeo7Uqd3rOSUGQymuhYoGZxt/rmFbZA1q+Csx0VEbboxualyi X-Received: by 2002:a17:906:aac4:b0:933:3705:a9f0 with SMTP id kt4-20020a170906aac400b009333705a9f0mr11826998ejb.19.1679915372310; Mon, 27 Mar 2023 04:09:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679915372; cv=pass; d=google.com; s=arc-20160816; b=FIlmJXq8r31G/8C3e4GHTPx0zFrpPAnCW8D5l+9OpLy0RY2YxbIl3PWux567yv8rOy ZJ9gYruMc5LgIVJseDUXihTsTz2yHLP9y+l1iIFPYWSprQBAr/x6ERIbYxbH2GlT/ecF +O3FPqcNmw06RGpsBeVwxCNv3/ch6dM8RHpJN/g4DjsqDFNhAU4a4IQHFUY1LZp8/V/S wvEy1eUd0bxrAZMrv6nZnxrigXk+1LE61Fojc9i2QgG0/vWIhABqncykxVqxCm64mBTG Ey45uxDO7NEDiKOnHNjdIB3XzVZT63e4Sm7ojBCqXu6bi3d26e5qL4LGGtGUMXd+MMTd 8Gnw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sZM9LHbl9/pdkshnCwgZ1Td4H1TAYtRXnqKnaU2BhJc=; b=Aqz+uCg9sAWhab+RrDMDS/szv9S7mv7Yv4bprFE1ZH/gHMX2c5+TnWqAZWtxYw/DgM +LBb2CjuJCsthWjQ5YtFSsyaaHRpKGMVyIoPPv39Q6tF4NmlV6G/GKGJoKs/snoVSg6i Lq5yGpzMGJWnLHuHkzVJyDtZNORGnk7i/NfinLDlzC3JUNAXPeNckj9nDuXc7a/l8xJJ uFYYGXiiE4yb8zv9N99XQ0pLH6+AAa6ULgzOEVs/wbFMMyTS0UlZuWzBo5uFNYDBruwI 9rYqCTKip+JSrZ/HqL8F+Qjlgkz/6BsUtUz/MClkES/B7k4R6AMn3Pff1dRo6iPc+flh eyiA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GKbO5Agc; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ty20-20020a170907c71400b009334c541c5bsi20861590ejc.102.2023.03.27.04.09.08; Mon, 27 Mar 2023 04:09:32 -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=@amd.com header.s=selector1 header.b=GKbO5Agc; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232372AbjC0LHR (ORCPT + 99 others); Mon, 27 Mar 2023 07:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232366AbjC0LHM (ORCPT ); Mon, 27 Mar 2023 07:07:12 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA3354C18; Mon, 27 Mar 2023 04:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AGMdvSBW4c1KT4NcoHiJDZgU8aU9ifVtEV46qmCjA8NPr7G17JxXQQ0oiWUQGTKt59TwgDuvLys1u115BiksXn6GK35cLLdH8adaB7V9eqC1SqmcFX14Zghf3+GTvCGDG9mlSmo42SnNaRg8G+XlyYPSF6m8Ovh2l2RQn+i9kxI3MhaAs5uwSE0VQwEdSvXHuVSVi9vC5YdKpREwd0yP9hUe8UugP/lR1V1kZgcrm3wrqaJ/tZTMHK/CF04h5yTC0tiRzMwnM4kO8pD5tko6kaJV/kn5tByXe0ZT1pjAyldOfoJ7+Xcmt2ikYCY7+0caJ2tIgAmn3WtW5DpbGdmMhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sZM9LHbl9/pdkshnCwgZ1Td4H1TAYtRXnqKnaU2BhJc=; b=ItwCT9erIAPt3kSlmqIoWg8C7uR3PzNfTYfjGBNG8mp+k1N1UARWoEpggJfqHbuMK41beBaFY9eUEmemKHJPKMN3EZPIp3mXoeheGqcs5Me8Nhvk1fpBQ6qXKQenlzHYSyFi0B68RkVgUBB55XOFqhAn5lMQeVxMyhXNRijxYC0QQE2GJ7q5l0nX3KZIyYyq5E8hwcYC56ZrEKJT5g/MilqtFIvHrejSm23+8XH1hTBBmTp272FKoXYHIBI/4158ZfW6pN0CtO3g04dXuq2jDoj/u0Rlbh8PnXLkqObwBHZ2AtfqELGlN5AwKnILKP8dPjRs6wwtIXImKXUHwnAsJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sZM9LHbl9/pdkshnCwgZ1Td4H1TAYtRXnqKnaU2BhJc=; b=GKbO5AgcokeV1vLJ82B2Gk9GEQTBEG53vugzjAqZFPPOBQvtHG79GRdPv40yGjbl+HUI/Y2yr1nd0QsapD6rx7X77ByUadT+1/gNOeC29zy7ffeyVsWJJv6o544v2XJ03ODmsPftZpcgT0r4fDLYN4hZEY9sUdiRLlr1aEwDgXc= Received: from DM6PR10CA0010.namprd10.prod.outlook.com (2603:10b6:5:60::23) by SJ1PR12MB6073.namprd12.prod.outlook.com (2603:10b6:a03:488::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Mon, 27 Mar 2023 11:07:03 +0000 Received: from DS1PEPF0000E650.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::1e) by DM6PR10CA0010.outlook.office365.com (2603:10b6:5:60::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.43 via Frontend Transport; Mon, 27 Mar 2023 11:07:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E650.mail.protection.outlook.com (10.167.18.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Mon, 27 Mar 2023 11:07:03 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 27 Mar 2023 06:07:02 -0500 Received: from xhdharinik40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 27 Mar 2023 06:06:19 -0500 From: Harini Katakam To: , , , , , , , CC: , , , , Subject: [PATCH net-next v3 3/3] net: macb: Optimize reading HW timestamp Date: Mon, 27 Mar 2023 16:36:07 +0530 Message-ID: <20230327110607.21964-4-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230327110607.21964-1-harini.katakam@amd.com> References: <20230327110607.21964-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E650:EE_|SJ1PR12MB6073:EE_ X-MS-Office365-Filtering-Correlation-Id: fbefec9d-b77b-4cb2-d2a7-08db2eb3653d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PQiB+OmwRHnuz1+RhiFJNXXrQB9WIB8REnzgp7owubUjKfy5TWyTWoJcBywCoyP2Js+CXsDh403AwaiiYs5hiqImD9mUHt4a9AaemyhSOAyaeCYJD8KJ1esiupoI/L/KWauTkyZ5//Wr0FJHhbsGy+18JXS1uKyJ/RW25wZckavdWBQfMHwRqmXLxoTRnBcQcb56vOtlwtOvC26N5or9WYueWCey/gkBo5QtjF4zDFDNv78X+/4kxbFNzIlNSz3bjI1cH7dGIgwMOEJrB2F9ARzORhr1VfwSAMVLyed1Vn0tLPvij/g8G8A+BflY0+66xHBgdnFG8olz/bcOOicxdUQ8cQRh+OuxcsOt+2349M/XD1/7M1XQFHr63367nw1up3bDvqVpKloLjBp4KUMNjK1ScuvedthhnUz3I8m4h3MOKENIE6RlfZkMQ3s0kX1aB1dtTtpsqxkon0g/NJ1wpkq+atCRN+n3qGq1vqIoDPHu0y54BTH3MO7DqWxhj1a58xU8pdrDEItNa0ybZL1B0TSOMek5Fj18KwS8Q75UPnLgszQKtGYT13s6F9gRjlwjHhNnVDSJynxdhjZE1ASkrK9Kv1vrdCsfhhRpjHKKyZ+rzPN9+LWelUyo8RpHyK1tRuf3dn/UedfHtMnK9xrUL/nIQrSb/7Jc/X9Y04k5lfMAI+JjK+bc+rbtTY8nfvB5PKh+Mpsh+XdceKPtUNVdaHD+FsIax0DMq0YSNJubu10= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(40460700003)(41300700001)(70586007)(70206006)(4326008)(186003)(36756003)(2906002)(83380400001)(5660300002)(7416002)(36860700001)(336012)(44832011)(82310400005)(426003)(47076005)(356005)(86362001)(82740400003)(2616005)(81166007)(8936002)(40480700001)(6666004)(8676002)(54906003)(110136005)(478600001)(26005)(1076003)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 11:07:03.4850 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fbefec9d-b77b-4cb2-d2a7-08db2eb3653d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E650.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6073 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=unavailable 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?1761518941240456972?= X-GMAIL-MSGID: =?utf-8?q?1761518941240456972?= From: Harini Katakam The seconds input from BD (6 bits) just needs to be ORed with the upper bits from timer in this function. Avoid addition operation every single time. Seconds rollover handling is left untouched. Signed-off-by: Harini Katakam Signed-off-by: Michal Simek Signed-off-by: Radhey Shyam Pandey --- v3: No change v2: - Update HW timestamp logic to remove sec_rollover variable as per Cladiu's comment - Remove Richard Cochran's ACK on original patch as the patch changed drivers/net/ethernet/cadence/macb_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c index f962a95068a0..51d26fa190d7 100644 --- a/drivers/net/ethernet/cadence/macb_ptp.c +++ b/drivers/net/ethernet/cadence/macb_ptp.c @@ -258,6 +258,8 @@ static int gem_hw_timestamp(struct macb *bp, u32 dma_desc_ts_1, */ gem_tsu_get_time(&bp->ptp_clock_info, &tsu, NULL); + ts->tv_sec |= ((~GEM_DMA_SEC_MASK) & tsu.tv_sec); + /* If the top bit is set in the timestamp, * but not in 1588 timer, it has rolled over, * so subtract max size @@ -266,8 +268,6 @@ static int gem_hw_timestamp(struct macb *bp, u32 dma_desc_ts_1, !(tsu.tv_sec & (GEM_DMA_SEC_TOP >> 1))) ts->tv_sec -= GEM_DMA_SEC_TOP; - ts->tv_sec += ((~GEM_DMA_SEC_MASK) & tsu.tv_sec); - return 0; }