From patchwork Tue Mar 21 12:40:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 72854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1760770wrt; Tue, 21 Mar 2023 06:01:56 -0700 (PDT) X-Google-Smtp-Source: AK7set+YBSoFPLPcxQaZ2mYjMgV6DOThtceQXEEfvHCbrzECOtUqoinB+55eUzkP3egwOz5GtVVK X-Received: by 2002:a05:6a00:4f:b0:625:ceff:14ba with SMTP id i15-20020a056a00004f00b00625ceff14bamr2330950pfk.25.1679403716255; Tue, 21 Mar 2023 06:01:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679403716; cv=pass; d=google.com; s=arc-20160816; b=JzBC3VUqy1rRFGpKuNd5WXNEtmekpDIGuqZMTWU2rJpUBlj7rDi/7rLPAKOU0rQljo uk2K7Qv/qHI4fSTqixweOVzL7vvKwUvq0VDVz0rv/VRujl9ARPvQWIV8Hk0kXJ4qiIWl ysUCHJHLqmdHM1qNpkRyAyqKPP0+1nGFR2yNcPMQgqrM9MkLMKIpH2Oxm3VEj6kYDHlC H+OM8C9HTNLoD0Hy+7/HxMuZMtmugJOvJhX0nph84tGmUMIibRStk8smTBwS49dqslSM oHbAbUBGav8bDlk2gJXURwC8wLyuNtqbbnA+q7/yha1/WaATY5scRQHFaqRyeBtQaXU5 0RnQ== 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=Gi05toNJXz/rs0Dvqoiewl4UTdYJxCp8LhCVrGszmM0=; b=QaNWR1UztsOmDUqOhJTmbBIzEidCxjT6r17D8fJV3hPnozT2nSv+Snx3koLo2WKkUh RZUNFPZ01Vm9YNt9A5fisytKVzLpqsY/nh0qT6GScgUFDAHi2fazidM1I7Vqa+JlWAl+ L/qXC3w9q5pqE+IdCnBjlKtmcEzrPk8S1HyBx42RHd5jP44k4AIeMHGyBEYMFSpoi9T1 ugtlmwaLFD0PwHhyNaGSMoCDn7Mde8kmoD43zMa5AWpTwDM9zHWkv9uxt5/+QnXnG3WV xppITkDcFJknLUBT5ZufRM4ZjrUMZPkjD1PlPhOb5ci4ovM7Dv5R+FjdXLdUVNRd0kty U83Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pgKorIkm; 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 k189-20020a6384c6000000b004fbe5ede659si13780781pgd.317.2023.03.21.06.01.31; Tue, 21 Mar 2023 06:01:56 -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=pgKorIkm; 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 S229843AbjCUMkq (ORCPT + 99 others); Tue, 21 Mar 2023 08:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbjCUMkl (ORCPT ); Tue, 21 Mar 2023 08:40:41 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2074.outbound.protection.outlook.com [40.107.94.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DCE03BC48; Tue, 21 Mar 2023 05:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i5onZIb2E2VvRdEfoLEEFaHKz5Z6FN/z+vTamKy+zOS6i6DTRfcutPxtEMa2e45AlFZxTEBl1Uv23L0i2MQ3nynZ84egKxUZWebya/PxehkeRoQhZYwDuEp47/xc+lO9EaKvyYh3jfhYIOuJDgiNbtkfK2QkTnEd6QNYTObmCPabxLnWc9W9Q0la73KwG2+4+j18bposXbpn23OhplWd4wTHoXtHOOzcejdTDgpQXx50l0D5m77T246O4PJ+w3UxooIIPWVm32RmldvEnw5Sb5zPE/8GSVuwYVTDOpeYZxXPC+AxQsalclAADMz8bZvPqmI8JF7CEb1g8KkqStHZ8Q== 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=Gi05toNJXz/rs0Dvqoiewl4UTdYJxCp8LhCVrGszmM0=; b=D3MNHbbGCs1JSuBPeNcIMgcv4F5v4S148p88bbhv3tq9TZu+3npKanjjnP3ifjNj6A09xyJNOr/fM8d9KSy/5XJHKh5kZqC9N0yhUSfzM7Uvx7V3cM7NFnoSYxXxt63tYo171h9KpTUEd2lSpJdZiRqtSiiYwFmeo1hLpLhymcgmO1azYxFp/WVhFfzuL2tDUVUMlOcOsrmqE37BreQ8Jir+WCYqAvnbuPzf7mpYqafVhBczb6oweEmJn7IaPBF9NYhW7Kd5suubFnN5eyKlrDzB22bwPHRpWpzL/V04yogZ36k3d1SRqF/lFXgaFpW40uFkfu38k3g3WLlDvGP9mA== 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=Gi05toNJXz/rs0Dvqoiewl4UTdYJxCp8LhCVrGszmM0=; b=pgKorIkmbduqxd7qVI+QAniJXPsoTfcxyURCDIEq3uqGafbxxSIXTZAGXUjfXm5CaPYkLEvjmt1hfyYIyTylaTRFn/hLm8VRBSFrLO3gyhptOn9/cJPjk7Uc8p12SQ5JS3so5M5multl5j1EDMXm8GGIwlJgU8FkLTxb353vHjQ= Received: from MW4PR04CA0211.namprd04.prod.outlook.com (2603:10b6:303:87::6) by DM4PR12MB5819.namprd12.prod.outlook.com (2603:10b6:8:63::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 12:40:15 +0000 Received: from CO1NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:303:87:cafe::bd) by MW4PR04CA0211.outlook.office365.com (2603:10b6:303:87::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Tue, 21 Mar 2023 12:40:15 +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 CO1NAM11FT015.mail.protection.outlook.com (10.13.175.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6222.17 via Frontend Transport; Tue, 21 Mar 2023 12:40:14 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Tue, 21 Mar 2023 07:40:13 -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; Tue, 21 Mar 2023 07:40:13 -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; Tue, 21 Mar 2023 07:40:09 -0500 From: Harini Katakam To: , , , , , , , CC: , , , , Subject: [PATCH net-next v2 1/2] net: macb: Enable PTP unicast Date: Tue, 21 Mar 2023 18:10:04 +0530 Message-ID: <20230321124005.7014-2-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230321124005.7014-1-harini.katakam@amd.com> References: <20230321124005.7014-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT015:EE_|DM4PR12MB5819:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ca0ef80-64c9-4fc3-75f3-08db2a096b76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iXRzkq6sfbkkzCPFnYiQbTWvkny9Kvd2neeaLrzJkYzl/OKqNoINT2uj6w6DuEqkIu3VKVwL+MiHh5xQOOgq0qq/B3mPKHKIuQA6JIdL2gDoGWvSz3ZaZyF4bg+mMx2+OSnKNPehTqGLy4ChSfrMU7vibIzcOjatV5kBy7W8ad+ZlE/ZPjoqztGXL1cmyin8Fa4HpWd18bdi7sPVQIpYKilv5xEG94Ycf/yz2RHqrs0kl2VG75LaMOEKwxdNNRIys8xegUAh+a+imu9FtfVb3s3CQKmUGLSB9eHzvOQxn2nOSKEpmj/y8lg2GvSWVmngPjzyDfEagx3Kkyk1WK+eYu2GsVHnf9KZ52MsXLgOPbBmHDgCdIjhlOGfiOV2Zz/fy0sWWyA2MDtJzt5WdfCIRC1ikbC7MVsD/KJFQOtxfeyY3QsMD3dBXm4UZnjHqT870JW3Ic2AIVM8zeJ+t5keTkXLjVGg7R66m8RzWAZWYxVrQllOAKynrYG3k+TtwUvOBhKQ6xQef3uAfq3Hj1gdnOtRk7CpKJgmELSx2RkLKOenL/8UNDqlLA24u30ry6eYYqRDsQlLoDCJNEjFZcPSgPb+D95CeVGaeUo0BFBCyZl5cs1TaE5MOboseBdEzJpOB48+aRFGywYbL0hmaQNzwZDS5vX7ynsJl9vBVOBTkY6GOIBZN05FGp6uvtIjtifhxASUpv4BUaV7TXr8gAmJ9Miib+sWSvsRrTl+vMUM+rk= 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:(13230025)(4636009)(346002)(136003)(376002)(39860400002)(396003)(451199018)(40470700004)(46966006)(36840700001)(426003)(4326008)(8676002)(70586007)(70206006)(44832011)(7416002)(8936002)(82740400003)(356005)(2616005)(5660300002)(47076005)(186003)(40480700001)(2906002)(81166007)(86362001)(110136005)(83380400001)(41300700001)(1076003)(316002)(54906003)(26005)(36860700001)(6666004)(82310400005)(336012)(36756003)(478600001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 12:40:14.7648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ca0ef80-64c9-4fc3-75f3-08db2a096b76 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: CO1NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5819 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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, URIBL_BLOCKED autolearn=ham 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?1760982431094811353?= X-GMAIL-MSGID: =?utf-8?q?1760982431094811353?= 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 --- 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 | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 9c410f93a103..1aa578c1ca4a 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 51c9fd6f68a4..4c2c82573399 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -288,6 +288,13 @@ 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); +#ifdef CONFIG_MACB_USE_HWSTAMP + if (gem_has_ptp(bp)) { + gem_writel(bp, RXPTPUNI, bottom); + gem_writel(bp, TXPTPUNI, bottom); + } +#endif + /* Clear unused address register sets */ macb_or_gem_writel(bp, SA2B, 0); macb_or_gem_writel(bp, SA2T, 0); @@ -721,8 +728,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 (IS_ENABLED(CONFIG_MACB_USE_HWSTAMP) && 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 Tue Mar 21 12:40: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: 72853 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1754153wrt; Tue, 21 Mar 2023 05:47:48 -0700 (PDT) X-Google-Smtp-Source: AK7set+UMqGgjZXy2MHnmOwpSy8w0FI3gDcn5Gqx5mAWasEIPugwSbRtyuhRTB+eLemY8D+UDdxW X-Received: by 2002:a05:6a00:2d8b:b0:5a8:c913:b108 with SMTP id fb11-20020a056a002d8b00b005a8c913b108mr18885691pfb.9.1679402867701; Tue, 21 Mar 2023 05:47:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679402867; cv=pass; d=google.com; s=arc-20160816; b=MGG4vgQcPwuBNYKBgKh1MO3JzKXUnROMz0PZWUOAZj9UgP3knci8kwxhogfzIYt5hU k5xmn/mRQgw3BiLK2lQi+rZHJlGrA2O1UJfYkT0cNhN2J92OcuU9p7YBu7UStvciNZLD CDZbsf2JfpaxV0uBHY8/IS3nGUQCKK7tEOTP/ADECI7EHLY6YOfy4G4BPFy2tDyKUjlt bMsRa2wTlil1RLZ2QLD+gTzqSPP1+orDEMSEJSsHpPybTHkA5BGwAodaWALGrYVeUfCv TvwR/L3syyFpqXDGU6g2BFnqU8J5kGmQfSHc6NCvZYeysjOlxEcR6he0bIby6INKSjWm TUZQ== 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=6WEEhg49v3+3iROgDmHgjFTD2ZPMS3r+TroKLngfkCs=; b=Jer9OxwAVYn/12pKstIyRizWlF2uB2fqihPRT8JWwKyv/En+nutHl5NBmdIGJtloKk skzcbgKm/B4NJSljE6JhWJy9OUcWc4G4uMhok+fXZbVNy6Jfsuw99odPfIwEDyES+MR4 aiR333ZJZZ9+GhbFEFAWl2hEr+DpHK4tPy3s3zuZR/Af/DRzVseB2Tu4Lk3ADv3D+zpQ epdRbNa/X0qZN4q9qO6WHwB7qOg6BBf/JmxvjaSsTCG3818+zpGa2A9JWttGzSbhnisX Oaeyq95S8lH9cCV10JOmOlx8PMZLbvHn3IPa0t+lAX8Lb8FvXu5NNP9GPfJDT40lT+br GKwQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="ZXf/JO8y"; 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 y11-20020a62f24b000000b0062565210347si12966054pfl.275.2023.03.21.05.47.34; Tue, 21 Mar 2023 05:47:47 -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="ZXf/JO8y"; 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 S229456AbjCUMku (ORCPT + 99 others); Tue, 21 Mar 2023 08:40:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjCUMkm (ORCPT ); Tue, 21 Mar 2023 08:40:42 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2051.outbound.protection.outlook.com [40.107.223.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DE99C14A; Tue, 21 Mar 2023 05:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gy63QcAhDjXWZ0SeHPT5ZVXOGhhSddBJqZkZOS72KQb2EdogwkPO5/hbJIk2E9bmuTKGY+39aF8uRybcJkRjLYYPTf9V9izxX5mqFg6gvNhfx7g2rQFmuJT70dW4Bc+FQpj8x/nzfQugDvj1hlactbYCzvYqDJfSac3M8dzHPMN+rPPd4D9bAo2mBFRDzzQwgeclAeCgIsoO7FSrV8DO6DgkYi608CM4/ZIUWU2Vzf7v4ZybVchgYyCm0yYOEof3+AJIKr5Vyt2fdjYhHNGAJh86+aIkQ5+HCcXDYh4MYAWpbQ4/dUyteFe65Ce0Mzu+xkZPMfWRTJ+n+kTIq7Limg== 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=6WEEhg49v3+3iROgDmHgjFTD2ZPMS3r+TroKLngfkCs=; b=a9td65NlV8FVmS2z+cbPQ4P83Z65apPfRCBf4Y/wz3GpERh7rEYTpepsbI8Zi0VlHhbMOJJS02L05rj7wM1wk0zbsz38JkWKCb9RPR1XQKbjvDQ/S0lzL1leXatYXXl+uyvNU3ZIFYgjwsaw4RI6L4pB4EtnwFWroZzmJrC4cvYXZA4Di17UQCr4aW6QdaDatdlsj+eORc0npHTsOpYdmfLfEDyaS7uDAcWw7Z6PdaVYn2nZ82beUhnpvkRLgty5T5dOWuQv/IcCiEdW1RJBNkyUHIn00ia253n9RsXN7AYri8jEeQHr2EhHZ1pZiwyvWXH9K5UeWyNAr+ecMzYKKA== 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=6WEEhg49v3+3iROgDmHgjFTD2ZPMS3r+TroKLngfkCs=; b=ZXf/JO8ygcoS/veWM+0To8pdVwQz1aX0h/pEB8u22DySVXpmIQGxp5tto2Q0Hsn1JIjmJzCfOQl+sOt57ZILcvY6XAh+gnhW2LtDYOCITSyDIFIWvz/ddltx/LT7rBEKHE3KI6y3dnrO/UoISOwhjSnZviHJgemhyYPaqDBpY/s= Received: from CY5PR14CA0021.namprd14.prod.outlook.com (2603:10b6:930:2::28) by SJ0PR12MB7033.namprd12.prod.outlook.com (2603:10b6:a03:448::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 12:40:18 +0000 Received: from CY4PEPF0000C97B.namprd02.prod.outlook.com (2603:10b6:930:2:cafe::e5) by CY5PR14CA0021.outlook.office365.com (2603:10b6:930:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Tue, 21 Mar 2023 12:40:18 +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 CY4PEPF0000C97B.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Tue, 21 Mar 2023 12:40:17 +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; Tue, 21 Mar 2023 07:40:16 -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; Tue, 21 Mar 2023 07:40:13 -0500 From: Harini Katakam To: , , , , , , , CC: , , , , Subject: [PATCH net-next v2 2/2] net: macb: Optimize reading HW timestamp Date: Tue, 21 Mar 2023 18:10:05 +0530 Message-ID: <20230321124005.7014-3-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230321124005.7014-1-harini.katakam@amd.com> References: <20230321124005.7014-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000C97B:EE_|SJ0PR12MB7033:EE_ X-MS-Office365-Filtering-Correlation-Id: fd5031a2-9b6c-4d06-7dd7-08db2a096d1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bd8hrincujUyR3I5LF1OxxwduC8PbR5bfzlOJT/e9d2jlj7jMFVR2MUEidmvaRhbzWIlz0Rv4ZZf0xXb83GcYqLjVq/UxhxlvEILX+oYsm65Ifd/sPYN0f9rnAXZolmPzw20zgRgvE1VA0kN2782p5P1W1mgod1utmEceZaSzLPOrsx8FHAR/+QgMHDNipL1h45bh43gYSWxe3E7OycIkOMUJzJ+tatCu5T8g7Qmg2gtsbU/QS9kdCVD6ligM0jEQkNfSR4k0sJhaaXVwp35E7ynNriNcgtSIf84NZ7zQ10LgNgBtYxKjJ8Zu7XyJpvudvJNw9tM3Vidwonrpr7+bqFUbO54jQC8rNrc4YJ1I11u0CRVzTF8yzP8wXu/yjvrmkghh3cY4SRoxtFmWssZ9ZyR4j/Cj6zOw7VRB8bThS5AxvTAhD+3ZHvzPUsQf2aTlaI3bjGVK2mJsR072LVJu+eMLEgnIONALOT8NQGeLzADCrI9/0SF1zYxWTpSOKDABAR8YEzFqjEONCNvirN8D1J8cywC1a4Ig9m2MecNwcgHeZkZzmAn4BrEFxz3XKw5JemMY+i32hvnknyjognTwGDLNjva0xIqqirCYdIh0UKXgvaAiusTSFr6JWLTuyX6nMERl4jQMUpFMF27QvKu+P27OihhP5k3ZyAna67TwGNoLZj2srvOBpR3QO1ilQ1g2euRIaOONaqg/wE+gkxHIe67cSyY0h13qBvG/7Waixs= 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:(13230025)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199018)(46966006)(36840700001)(40470700004)(86362001)(26005)(478600001)(316002)(82310400005)(110136005)(54906003)(356005)(8676002)(70586007)(186003)(6666004)(70206006)(1076003)(41300700001)(4326008)(81166007)(82740400003)(40480700001)(5660300002)(7416002)(40460700003)(36756003)(44832011)(8936002)(2616005)(2906002)(36860700001)(336012)(426003)(83380400001)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 12:40:17.5488 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd5031a2-9b6c-4d06-7dd7-08db2a096d1a 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: CY4PEPF0000C97B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7033 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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, URIBL_BLOCKED autolearn=ham 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?1760981541203564316?= X-GMAIL-MSGID: =?utf-8?q?1760981541203564316?= 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 --- 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 e6cb20aaa76a..f9db4501b995 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; }