Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2683950rwd; Fri, 16 Jun 2023 07:02:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ43VXGPtCHjRpXLSaQyEbWGSanbbdo6Ls11C03G6JsOo8swCuITKItDAqEjlUh3WPa4vD5B X-Received: by 2002:a05:6a00:13a8:b0:666:7bc5:532c with SMTP id t40-20020a056a0013a800b006667bc5532cmr2442075pfg.16.1686924128293; Fri, 16 Jun 2023 07:02:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686924128; cv=pass; d=google.com; s=arc-20160816; b=oI5caiWgm8wPeYMwNESte1Vqb/wTYUoRFjGN+q7vPmkD//UEIi48kZnI7vhBW+N0c7 Ory90jDCm6/Pbd8fO6DyCuKj58guI8zqK5vQSlXL5uK50Qc+Gtu3OQ7krAZ2JPwiZv3T xTd9FeXrYLcFohOBCufayfOHdqPkX/xhR4KjP1K/XbZ3vP+ZaIz7d/LrhDTnNHiOao1H pRkgR5mMM40ZcrapNfs5PzocwQGcf1soK0lOZoCeJ0p2lOxUquI8rxTGoOFac79zaxtX 8eiPWkWoxsD44QGMLFOR0PTDI5VF1Cpq38kQH72bbuLx1u3KwUjA43qYADy7IVnMiyyR KEqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cKDDXI7iHZPHpsZrNbsFSU0Z5I8BG7ZUHE9W8dIte5E=; b=Qj0JBWYKsKAoOkDO0oUm1gSBrh6glWFE2O/5xauMuap49WIT/hBzM/Rf8VyVRLuUV6 WdaGdjML4xZ5T4EKN/eKwfpRuMqtiRypVFWKVchkIGdhhbWmFbXVzW3Lf9TMB1HPzddo 8flIWTyHS0kLSI0uE+yvk54seDgK5v5HosTvjNt94llF4RtPKqSldzFqFEn8mlUZrK8u Pi5LA+NIKw8sAe4/iAi1qfcMg/O5nFx6+MEViqaDBKunj7uANiPEELq2CtGNsLZqT4ul UnhwhYuc04I7m/X882VDaC21FlnFkpD1wZ10kldNmuuNN6Jf0z1J2NNcEFpUqm/rFGDC m1Pg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=Sbl8pSd8; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020aa79613000000b006642e5dd54dsi11947989pfg.116.2023.06.16.07.01.52; Fri, 16 Jun 2023 07:02:08 -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=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=Sbl8pSd8; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344586AbjFPNyC (ORCPT + 99 others); Fri, 16 Jun 2023 09:54:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234426AbjFPNx7 (ORCPT ); Fri, 16 Jun 2023 09:53:59 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2080.outbound.protection.outlook.com [40.107.6.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBDD30E1; Fri, 16 Jun 2023 06:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W8yBCIrFeFfozkm7itoga40kpA5kSxQISDpyeh5KyOrNDGEqExXi/O6CnE+gzSgXScU+2iC83g8gpYHYL6cSKvBmQgIPSs1hWNdMzLJ5epsZjfyddT2UOyp865vU8tX38hCrN7tmjAO1napqIx7s7qh1dz214E+4Rhh/nsL4MEZRsvdwu71Drjsey2DrN1HMxak0Tgq7ONpXWOkVNV7n1lHZvU9ynlw43qPbXxRmKFo0d2ZGZOHq63FsFckUtgSOapdRye6tRhKhLcm5OWi2o/u1pAOq+7ipYC4mHALGSLPnne9CpfUn2kOCYa5Jo9NGrdSqYsEnrxKFiFWhggk4jg== 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=cKDDXI7iHZPHpsZrNbsFSU0Z5I8BG7ZUHE9W8dIte5E=; b=HvOEFa6cmMDxNMGpr9Zc7K250DGLKG5UZJHjzcpRO5pCUGL2JkDqzEAcxAAtJG2K5O7aDK2iCBaJBxeRgVt/wi++A7T22Pq7R0ihocEDJZbl1KyOVLB34/AQJxReyUUj3SqxFEZBL/Tj0KjPEohvSDxCvV79cUbToDD+lqA3eQStZGETG5Pao1FSYqPqBzZ6OjpbPrGhfCRi1+ut64Y/j1h8NRbgPUF81mbu0MMXgPjTs1aIFw2KY3H58N7n0CGe0Kk0Puq9sp5wEMlymvt/UX/azB97dx/vc+wbpUU22njMDP4x2ZprCEgCK/q9/W7L/myIfUgbSdpD20rCtLwVRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cKDDXI7iHZPHpsZrNbsFSU0Z5I8BG7ZUHE9W8dIte5E=; b=Sbl8pSd8CjEZZFUkuX2ct6SEN3xRmEltTc3uWX90LHVrlN/d5kSj61lUwaYRqSV/VLUK0e/DfYmnGs5vwD9W+gFrQsvJYab1ka0zjGsKMvrnqSpJt0r+ruZ0N1SIKi/6XYzSOx1ZL4yUzWE83bzMGqEntlO2b2FyhhTo4B2fXqk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM9PR04MB8954.eurprd04.prod.outlook.com (2603:10a6:20b:409::7) by PA4PR04MB9318.eurprd04.prod.outlook.com (2603:10a6:102:2a5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.25; Fri, 16 Jun 2023 13:53:55 +0000 Received: from AM9PR04MB8954.eurprd04.prod.outlook.com ([fe80::5356:c79f:ef9f:dc29]) by AM9PR04MB8954.eurprd04.prod.outlook.com ([fe80::5356:c79f:ef9f:dc29%4]) with mapi id 15.20.6500.029; Fri, 16 Jun 2023 13:53:55 +0000 From: "Radu Pirea (NXP OSS)" To: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sebastian.tobuschat@nxp.com, "Radu Pirea (NXP OSS)" , stable@vger.kernel.org Subject: [PATCH net-next v1 01/14] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling Date: Fri, 16 Jun 2023 16:53:10 +0300 Message-Id: <20230616135323.98215-2-radu-nicolae.pirea@oss.nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616135323.98215-1-radu-nicolae.pirea@oss.nxp.com> References: <20230616135323.98215-1-radu-nicolae.pirea@oss.nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM0PR01CA0106.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::47) To AM9PR04MB8954.eurprd04.prod.outlook.com (2603:10a6:20b:409::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8954:EE_|PA4PR04MB9318:EE_ X-MS-Office365-Filtering-Correlation-Id: 86830ac1-62d2-4f9f-8e98-08db6e711fc2 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SS2PbCXaJ6JIpIHfKSHvMIQagDu+k5GAx0/GJRALjr6l+NN383uumfPBahTQ7EuBIwOGjt6Pnrzyl1eIZXKSnakivQO8UG6QPO6NgCMV5/8VvC1qXO9JkyOvVtOmrwbEfvrGT3ak7oVpv0dwOMCwQ98a9oqCzBoWwLMq2H7ceyAPZv7obvsveXnBAxz35GGC0HZfSD4sIzdTSpbmubMNBqNRK9y0SZrG7n8KDNSDwealFAYyVAiFNeX8O/Kuf0tA7Tmm9zZkFXArqP8y1UhOclv5cQCB2NkQ0to3q4xQtjmKBBXgU9WNsDI+NewdCCFoIdvIXzPchA1zlxDuvns4fvwkDGOHXMXYeuVF47FLB+eqnQ73s4hFz8iLEyGh7vgcVzPfaNi5161TILd/22fBap0RzMrhkiJ/idlnGq5DXz26pGn3QBSe03t6544m+uuAum1gwu9JHGKzIpV58hhb2zyT1nngHg6W6CBJ5gfBgM4XxoRTtNAUSRROaME8Gotvb/Hw2fqcTHbbI5ydeziYiNLmOUYg8NiheVMrrfxYZOUKnOCfduTnYVvz0X/CJaPEUa2Od4FMIP3veFZeoht/n4oXhYUuRXCzIZvWsMIyj66sir8G5dotuvPAvAR5XXhI X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8954.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(366004)(346002)(136003)(376002)(451199021)(41300700001)(52116002)(86362001)(66556008)(66946007)(316002)(6486002)(8676002)(8936002)(6666004)(66476007)(4326008)(478600001)(7416002)(6512007)(5660300002)(26005)(83380400001)(6506007)(1076003)(2906002)(186003)(38350700002)(2616005)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ICNGlSXTCC670Q3Mf9XdwFoa8eAmrJZEsfku6BQ+mpa/R05IKaps1H1pjW0z?= =?us-ascii?Q?eWtFEgyg/dLL9Z4x1abTpYY5Wtf+oVpYw2r2XrNrMPSlVT3Hl3iEoBGH41mY?= =?us-ascii?Q?FXxpumy6u+43DxlDw/eVp0OchwkSkI6oKCDlb9MUwX0az2s/k4YTTX6q8C/K?= =?us-ascii?Q?XPYl/Bwmp5CCrBf5tnFkmxxgA13FKfwuzkUjOyqzus5830fAOwNUa7Dt7nnY?= =?us-ascii?Q?gBdaOQznAxNDE6jh7DayKprqc8ehP0Hk+2Okr0M5SV62/fSR7+fwNC1HPbdl?= =?us-ascii?Q?k861ko/K2g/W/lY3rkErYV4j6PcqTJ57Bs5m7/haXhvttj2fDx33T03T99n9?= =?us-ascii?Q?+D94nXyTk4cGWFIWnxvWUfFQQZnERTQHAOxh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ECfvZiUAlNvbY5SYsq27u7GRq11HbbehUNG90YDcOJRZSg?= =?us-ascii?Q?0P6SRc6zX3BTAMsLW1Ri44eDzff5xHZZxAqJ5F3QdxwMG5dDYQZVj7Dl2EUn?= =?us-ascii?Q?2GjlH2CncZITliqdm1fq/IDTKy3lc7lRfLmkn1jwUy90vj7vcfiRAl+xw9LF?= =?us-ascii?Q?4JutLU8A4lhRdqarNwrAZZ4YAFyw4eJWWYIgcSBVEAhhLL4K7uiAsCqoCZ+N?= =?us-ascii?Q?qLVe+PWyQsQlbdAeVwjgi4qJhDHXpk8mGVDmUjwWve7JY4WQGuYLt8wJlsAj?= =?us-ascii?Q?Y2Ud51/ulFUHE+Xqz+6aY3reY8IkaHDEPrrbTR6DGPIkr0A8F4gbbcipxUz/?= =?us-ascii?Q?gg=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86830ac1-62d2-4f9f-8e98-08db6e711fc2 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8954.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 13:53:54.9411 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yVfoYhVY7bnvArGjPkqM/CkEcM/Cu9qVhUd7vjKmANRS2RgZVt5ZlAvgr7V9k4uRl+XNN5MUG7suHVjQmxNNVm6O7d6kWMqYZvYYdQSLiqI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9318 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 .config_intr() handles only the link event interrupt and should disable/enable the PTP interrupt also. It's safe to disable/enable the PTP irq even if the egress ts irq is disabled. This interrupt, the PTP one, acts as a global switch for all PTP irqs. Fixes: 514def5dd339 ("phy: nxp-c45-tja11xx: add timestamping support") CC: stable@vger.kernel.org # 5.15+ Signed-off-by: Radu Pirea (NXP OSS) --- drivers/net/phy/nxp-c45-tja11xx.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c index 029875a59ff8..7b213c3f4536 100644 --- a/drivers/net/phy/nxp-c45-tja11xx.c +++ b/drivers/net/phy/nxp-c45-tja11xx.c @@ -63,6 +63,9 @@ #define VEND1_PORT_ABILITIES 0x8046 #define PTP_ABILITY BIT(3) +#define VEND1_PORT_FUNC_IRQ_EN 0x807A +#define PTP_IRQS BIT(3) + #define VEND1_PORT_INFRA_CONTROL 0xAC00 #define PORT_INFRA_CONTROL_EN BIT(14) @@ -890,12 +893,20 @@ static int nxp_c45_start_op(struct phy_device *phydev) static int nxp_c45_config_intr(struct phy_device *phydev) { - if (phydev->interrupts == PHY_INTERRUPT_ENABLED) + /* The return value is ignored on purpose. It might be < 0. + * 0x807A register is not present on SJA1110 PHYs. + */ + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, + VEND1_PORT_FUNC_IRQ_EN, PTP_IRQS); return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, VEND1_PHY_IRQ_EN, PHY_IRQ_LINK_EVENT); - else + } else { + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + VEND1_PORT_FUNC_IRQ_EN, PTP_IRQS); return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, VEND1_PHY_IRQ_EN, PHY_IRQ_LINK_EVENT); + } } static irqreturn_t nxp_c45_handle_interrupt(struct phy_device *phydev) -- 2.34.1