From patchwork Wed Oct 4 11:17:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13408637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 004B3E7B5EE for ; Wed, 4 Oct 2023 11:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t6ifv5Fd6omqhSgBOK9sZCO+DhfSkI/Ny4izS6ijszU=; b=YsDrqcNc50eB12 9w55qSV7b9xNKfO47qY9sT8w/6CyxEZkTcJ7LLciQ1xxT/mxhxFo0lpcKrvZLMYBg7YMbi1nmv+M7 ti37rUDAxj0CrUJ1L8+14atyhjhm11RLfo14kPyingFzNsl/E7qrPsNEHW0lhDZQMxWaDcGIYq49s auCuo/I3ln7CKya1AXSI6pnb5BnP0NIOgn591q6w2+nyaQr5Vlpupse6GxFkiml+uUY0E9Zp4XyFY 6+KMEWfqwx4bq30lquSvjJA1PvKEH2/rZLRCK/jsEXXl7FsDTCfvKQM1fMEIv+P7sSnlqSQH+7hpP GTQa1eG5jbGxE6bmoKyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnzsr-00HSnQ-2C; Wed, 04 Oct 2023 11:17:41 +0000 Received: from mail-vi1eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7d00::610] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnzsn-00HSiV-1E for linux-phy@lists.infradead.org; Wed, 04 Oct 2023 11:17:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K/BohecXWzD877Bc1yhXEzizt6UMX7BIYl331jZHWfXkLTpb2cvpqga77jRtG98pqP3sSX6BNTt6plJYYr3rinKCXfqHF5Q3VlyXqrLMWNy9FxEa6GBKZMfb8p6yOzTRV0zWqj0wir3UvFrwmsMXwgmHZl/C7FbkiWJVQ4XUWb5Xh4RtqKtpauvHFaUZH7Nqlkarze9eKOhWyNLaSO3gdudOJq9lIckq/k8swWbxEWYqyHVqOYTJ8DAy2R4gj5dOwYTP2RXWr7N6NJPSip7Fi53JqD2HX8CuGFSfsfs95BoDpNV4HCgthVWLuAldoUBDPeu77L//KzcTfBx588zQnA== 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=xUhszzw6Eg8/yiEvcOL9JdV3piTNEWQts4rWeH5019c=; b=dnD0idSYElkKUzPIv8OBZZQF1hASYR9+s4ijm2mg7rGxPxjbUT0Z1cct996eVRWgrrTKnp/iLNwaS3VAn7HHWD9pvUjHKX5uzwHozosvrt6roXO1/FPny+Qs9tPjpthUTdfQtVqCrkOmTE69rjQwxq4LUnEHmg9bInHnkBSfZIQOu8ytcYC2J1jdv0l7bXDgJAMxVeXItn+JVLEcOGPHkyQoJWKbH5/YhDsq+Th3L5NPTdJc9hVOH24/cJpi/VpIq8XRB+Hy5P6L26h8TcPgUqJcFAoeE9ap/OcVDzc/j9l0iKx10ejcTa/Wk5Vy9NQz0Ybuq/61XiNs9AWsGYiz0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xUhszzw6Eg8/yiEvcOL9JdV3piTNEWQts4rWeH5019c=; b=nUP9aLESNyCFYv5bKxl06OuOfqScGfGvcl6FwrMflXf4b+qaqFgaMiSdQ4BvfgqqJXxDjIpt8i0b+L9Fg3HWjJB/pTIIf/e4COTdK+wZ/2vKRsr1hVeLCvGEz300NPCMsGZC3aSiZ22TvbBCMgMrNJI0zjF1vkI+ldfDK9bAyZ4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by PAWPR04MB9911.eurprd04.prod.outlook.com (2603:10a6:102:38b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.36; Wed, 4 Oct 2023 11:17:23 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::568a:57ee:35b5:e454]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::568a:57ee:35b5:e454%3]) with mapi id 15.20.6838.024; Wed, 4 Oct 2023 11:17:22 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, linux-phy@lists.infradead.org Cc: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Ioana Ciornei , Vinod Koul , Kishon Vijay Abraham I , linux-kernel@vger.kernel.org Subject: [PATCH net 1/3] phy: lynx-28g: cancel the CDR check work item on the remove path Date: Wed, 4 Oct 2023 14:17:06 +0300 Message-Id: <20231004111708.3598832-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004111708.3598832-1-vladimir.oltean@nxp.com> References: <20231004111708.3598832-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR02CA0119.eurprd02.prod.outlook.com (2603:10a6:20b:28c::16) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|PAWPR04MB9911:EE_ X-MS-Office365-Filtering-Correlation-Id: 7cbe6c47-8158-4e8e-b311-08dbc4cb7b3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RFts6I4np5M/FYzNxzRVgKNPyeqms3AZpb+JUL6az0yjK/gPxZNX9zHnsusvWEDmgYLwoh+5D9b8i6rinqZFf8pNeics1FSp5CkAUqYf2Dtng29ictLRVlcqbG4sZTQSx5n/FgntcyZzRvUHvBrhjDM4/aHp4dUKV8a3cUpxFw6TFtLtI9zQh7NtLdduxX8K9jBlo7FbevEtoUHvZmJdSyn5PYRST/pPr0kHXNH8So21S26qLXZyFsEj3sHBk8cdyCjxuW8/XwPY0BxMHcQ82iSAn9D6a9gf66qysZKusFOz6RGTIR7gIwXNtEHY0DvHpLfFC2wwkOV0E6PbEuGZzV0N1fYFXwcKdn6UorjEb8rWYk4gdizCL3X+2SXYI91AFoUFS4iVUIhEBffbQ3pd6qDCgXZI7L0Vxg0viWR5opzFLv1NvV0hVm5YBMUraECXmSdQgU386xDMM11ZMiasr13IieKLb8mUELhvau1APZ+r5OKbe8bzgS/hTEpvIxvKTtbI5QMgJC8xREY3p7xX2d3XTKXJLfIQR+/PhJop4qeCOoV7B1aBpZpmsEW1cKNM4qJ9yUcQH6xXFIQ1BZL5KjpCxbZppsSbhC0IPNKz8JA3WBr6U1kmNXtRgOIaRFWC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(346002)(39860400002)(396003)(136003)(366004)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(316002)(66556008)(66476007)(54906003)(66946007)(2616005)(1076003)(26005)(6512007)(52116002)(6666004)(38350700002)(38100700002)(86362001)(36756003)(478600001)(6486002)(6506007)(2906002)(41300700001)(8676002)(8936002)(44832011)(4326008)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iRWMAiaLYadNca8S5A/VqBGrsHLHCBy8h/JeF9sF/iL2sJBwcWpzSHzs03OR4Rw9qix2JIkWdxGuA6kl764KyBPlr9ljS6Ojg0X7W8n0ZVVEZXmk9MNGqCrVUnXy4KRO55lbkqbrSRUTWtsHdeiQuzgh5c5by32PfaJ8GmasKon69u4wSZaJcASjgYU1uEiurMwiK+uLSTsSVU5/W4kWG/l+DZuoKCZin8oKmG421PNLRLi3qhDwjZy+Wt03MYn4PYPvWont17ZcFoOT7+kA/0ydMA/Z3A4pF/InIsISst0x0H+32TnsQYnplJvDUJJgmXdjh62ZE+EjXzthYUz9BH8a59CmrWNKA6Rs5r/PTNvpe69ZCwKX9cv3bTrB8lNG40jFNq3+dbJTmIct5UAx+w7LsA91gkq6yOJhD74PocVYRahV96S7uCQjTOg/d5fOh9tv0xmGc1D45FnO6OgSEb/wRxao6RueQx6sMeKFXmxJMqW+HjFH3X2IqZLpodOZXeoHwugZi8G2G7IS8GBi1VnRcsmXv5vj/LchbvhLMUJ7WVmc1x0oq1/1tSWGADYNINi+5Ktf9TnLFEt5l5SNmkX1pHEiWksem6PZeTdJmG7ZD4uy/CiM5awGl4jyw8qlS4u5vCPrPL+061yppl0dydxTulxTjK9yfD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04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 11:17:22.9544 (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: 5qPGDykns/ZwvDUzJ/t6RQLDe3pM4sBfSQ8vuHMuyoZfrvJmDaHyCqe/tYvEkhzO0SoVUVPJC0ZaXIGlYEDDPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9911 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_041737_434178_44930BB3 X-CRM114-Status: GOOD ( 14.43 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Ioana Ciornei The blamed commit added the CDR check work item but didn't cancel it on the remove path. Fix this by adding a remove function which takes care of it. Fixes: 8f73b37cf3fb ("phy: add support for the Layerscape SerDes 28G") Signed-off-by: Ioana Ciornei Signed-off-by: Vladimir Oltean --- drivers/phy/freescale/phy-fsl-lynx-28g.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-lynx-28g.c b/drivers/phy/freescale/phy-fsl-lynx-28g.c index 4f036c77284e..c6323669f119 100644 --- a/drivers/phy/freescale/phy-fsl-lynx-28g.c +++ b/drivers/phy/freescale/phy-fsl-lynx-28g.c @@ -604,6 +604,14 @@ static int lynx_28g_probe(struct platform_device *pdev) return PTR_ERR_OR_ZERO(provider); } +static void lynx_28g_remove(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct lynx_28g_priv *priv = dev_get_drvdata(dev); + + cancel_delayed_work_sync(&priv->cdr_check); +} + static const struct of_device_id lynx_28g_of_match_table[] = { { .compatible = "fsl,lynx-28g" }, { }, @@ -612,6 +620,7 @@ MODULE_DEVICE_TABLE(of, lynx_28g_of_match_table); static struct platform_driver lynx_28g_driver = { .probe = lynx_28g_probe, + .remove_new = lynx_28g_remove, .driver = { .name = "lynx-28g", .of_match_table = lynx_28g_of_match_table, From patchwork Wed Oct 4 11:17:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13408635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 249A8E7B5EE for ; Wed, 4 Oct 2023 11:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=F2cFibg7p5oPU6Sq7TaNtMAjzJ3N9qdQNu35IP1103E=; b=LS7/3Bn9/24PKS 66e1SwOdvIgNkH7PQSRWD6yO3W3KnU35SLz4aWDxizV++UYkOny6tn7LZKxsM9lrp0rtzgHZCaKPA TFj9PqLzDdvIFgLkpqevbrfmpwsTXOY2RT7tjCjQA5kHqTPoNPWWiaUOQ12tNaL7cxi3m8T8wlbd7 B77u8zQDy19t8gmOimULgMVlQu5KOMiOQ4Kju6kv+gftBsBwcxDs4Im/dcvI1jQSBWirDCQTnpSGQ IYzFDPVibp93KqUc+VQt/JaDdzMlJZzEdyTMC9jLi+I5svUQfdx4QIWslbYyShUYh71b9cqtlTTqu JXwFNioyrfLDfiMW4gaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnzsl-00HSk3-2l; Wed, 04 Oct 2023 11:17:35 +0000 Received: from mail-vi1eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7d00::610] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnzsj-00HSiV-0m for linux-phy@lists.infradead.org; Wed, 04 Oct 2023 11:17:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R8UCVZOFvUKoYXB9Uk5myr9iJOf0vvb9mSOjvszNXhS8g0DpxJyxh38qy67IPLaErsmPKpuVMWogZVRLOAQmSirScnbDjYP5bFZRAGYspez752v6r2+/1E/5g3fYwc/UPHv3K33/eJ18B9Q3PMxhUpzDXtvme3EnIxGcenoUEqqOSdP5N2PjcD2riS6LSirF5QGxulLFAvaikTnALrOXe8MI4V77bzq0rCODukEgCJMSdDz/79pAcI0D55WjMWFzkqC/+Egl8NMPkptQNBWt3PO0vPkV5QaEthNGTbJLtMhP9Gri06J6hOQMoErqlMPgdh38WBsY7Bva4Q7+QqJe4Q== 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=jGoIo37IfSbBawdoyVc/JL0/ZWGDg1A5XpIqUx1V/PY=; b=SQIdVg7WMVkRmzMqdn6hq3XUK88MvASMYWxoFJ4A6IUvuzXF4fQc+y47L7R2DvyTfbui/Nrli7Ue+bCuMablREl5a1LWd0xA3q4b3QcQd/63r4kTqumvb1lbV9MygQLiG4ejbIzw88x21Z8UvhKgIXcwmeZ5XwtyV+/idJ5W5juYMC+z7ledyU27VE7b7TEhRU2n7xUFZpd/UbpGReog5SXCobXvzJQ3OHSz4bf6fjoAMcsNLaoFZmQijonvPngS6m5LlmKOcKZdV2p9dLjLespfDXuVkY6L/1we+Z/SqSoghTZOc5po8FUJQhWxb17vTZ4kOMcBveEbg9VjEq9y2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jGoIo37IfSbBawdoyVc/JL0/ZWGDg1A5XpIqUx1V/PY=; b=gQfIlXhI5XBFAZgWZ62JVwta/cXPvZs7DdkRcqNqg4+/P3pKrVxcp/3RffQf+nX6H1a6Byj4DwNhT7PDmO9XCbMAPwd6vumnUsQCQ2xjGWjsEweYyt/t7qu3WYdzKs1DrLENZTYmpXtTqAXt5qm/WPhOMktQaoP6nCIFVF5AB2M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by PAWPR04MB9911.eurprd04.prod.outlook.com (2603:10a6:102:38b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.36; Wed, 4 Oct 2023 11:17:23 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::568a:57ee:35b5:e454]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::568a:57ee:35b5:e454%3]) with mapi id 15.20.6838.024; Wed, 4 Oct 2023 11:17:23 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, linux-phy@lists.infradead.org Cc: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Ioana Ciornei , Vinod Koul , Kishon Vijay Abraham I , linux-kernel@vger.kernel.org Subject: [PATCH net 2/3] phy: lynx-28g: lock PHY while performing CDR lock workaround Date: Wed, 4 Oct 2023 14:17:07 +0300 Message-Id: <20231004111708.3598832-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004111708.3598832-1-vladimir.oltean@nxp.com> References: <20231004111708.3598832-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR02CA0119.eurprd02.prod.outlook.com (2603:10a6:20b:28c::16) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|PAWPR04MB9911:EE_ X-MS-Office365-Filtering-Correlation-Id: 1dccd4eb-9bb2-4b9f-c045-08dbc4cb7bae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eXC4MJrVnvaSlIppsm7Y/XVu7o5IDxzjDQtSqPq65+/kxHG5fVX9CELROo9p0oMqiukiLuV9InBTzkFRDKl5geyG+8UNw7sTtLC3hDBgSKLefiV+PFzO6I9GvQBU1UnWSXdi56OyJ7FHCc/xCJFA/hlI59YoEGKzvbN0AnZmX2M5m4pKARAb9nkcGN4WzpvXtqEP8YPhyFcU725A2KDEG5rIxI14S+0tGbchT8/Uqm52PiL1v5LaanndK1vYa2ZRJtl1hOjQnjJjbNYP64xeJpLI2T1w4PVPRbCE91QIV6GIwPHls7LFJSg4kGH740vLfjIx+dPBpnBp9ymmOQw7zuvr8hPBjamFqcZFGWPfvv/pSDPePHy0YTggYfW31A1tyG/otVmU/hdkRmDE0zGnFq35qQEsRQSfGcIayKPHkri3q/eeCtTgbHbZo70lnorbZ4WGI9cp19+N+gMkax9l28b1BVuwNISvl8j1QATFbB1T/aiy6TaVA54mhbMCD87cOKxxQgSapJwdN9QHga8DjxukbeeWRh5WFZtnXn27rBJNrcWBwCbLqZn/qTKzUfyLRtiCTD5TkaYSS6rRHaBlN180w4Zkwdaj+prfKofTIFuy2TGogw9qrYvHmtvFHzFU X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(346002)(39860400002)(396003)(136003)(366004)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(316002)(66556008)(66476007)(54906003)(66946007)(2616005)(1076003)(26005)(83380400001)(6512007)(52116002)(6666004)(38350700002)(38100700002)(86362001)(36756003)(478600001)(6486002)(6506007)(2906002)(41300700001)(8676002)(8936002)(44832011)(4326008)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hHb1q8UcVtq/gk1mxoILJT5FqqSqdk02ziMUIYnq2h5D7t2vnvMtxbIYt9StIz367iNqteE8wXgJa1d/ZKbYsyuEqFjn9OtRyb3Wt5PNjTOtAahPK3PGy5lip+C4Y9e2FHqi4/dnLslKIO6bZr9YoKYdI1XW2QJ04MQkvZBXEL9G+V8CNwJ2t+2azDDy31TIXY2G8FfM8EOLfyAUla0lKA/Kh3JFvk16xghvJWx4aeOHxNz1ktcYrrPEVVA4okdKDcVaDpxex1OlnJ2o3oFBSzteL51e2R6Cv2rVnvuiwLWrxNu8rx13H5ydMJyKbVh6uIRUZK9qCgQRVTD6aJXBuAJ2XR74JS9nspRXMGQlcumSnia1xtd5wvD7tviiETqn7KubSgr6SmrWRFw0ivv4sBX/tsF5Lhw+Fj2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xtRCAmzyjsDpTVxh3ZptbUn/FPBjsIU4PCLIRReh+uenR06cQBaA9fxWtM6Es6FvpaWsxPt9u8I0K9LYg5BqfggO7ae3hx1JQCpZuicPb5/P8Hw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1dccd4eb-9bb2-4b9f-c045-08dbc4cb7bae X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 11:17:23.7218 (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: Q+/5o+Dbrs4h5xCdQp3u6iQUJBtCoyAbDUOutHjtVYmMQ/ClMI2SzVz24P9/s9gGTVNhF5iXgo6tv6uY41NEuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9911 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_041733_281629_B291034F X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org lynx_28g_cdr_lock_check() runs once per second in a workqueue to reset the lane receiver if the CDR has not locked onto bit transitions in the RX stream. But the PHY consumer may do stuff with the PHY simultaneously, and that isn't okay. Block concurrent generic PHY calls by holding the PHY mutex from this workqueue. Fixes: 8f73b37cf3fb ("phy: add support for the Layerscape SerDes 28G") Signed-off-by: Vladimir Oltean --- drivers/phy/freescale/phy-fsl-lynx-28g.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-lynx-28g.c b/drivers/phy/freescale/phy-fsl-lynx-28g.c index c6323669f119..d5385d36735d 100644 --- a/drivers/phy/freescale/phy-fsl-lynx-28g.c +++ b/drivers/phy/freescale/phy-fsl-lynx-28g.c @@ -508,11 +508,12 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work) for (i = 0; i < LYNX_28G_NUM_LANE; i++) { lane = &priv->lane[i]; - if (!lane->init) - continue; + mutex_lock(&lane->phy->mutex); - if (!lane->powered_up) + if (!lane->init || !lane->powered_up) { + mutex_unlock(&lane->phy->mutex); continue; + } rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); if (!(rrstctl & LYNX_28G_LNaRRSTCTL_CDR_LOCK)) { @@ -521,6 +522,8 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work) rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); } while (!(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE)); } + + mutex_unlock(&lane->phy->mutex); } queue_delayed_work(system_power_efficient_wq, &priv->cdr_check, msecs_to_jiffies(1000)); From patchwork Wed Oct 4 11:17:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13408636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 919F6E7B5F4 for ; Wed, 4 Oct 2023 11:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NNYpgclr71RRJi7GTi+hAIBZRQ7aYKM+VPUm3vmg0cw=; b=uX5nbETgmqaWmd LX92r+NywjtiikJY0CQ17SMDbzK4GUJQRKGaDVCK+zdd+GhVJpQrPNb8RJAAHZtuWiozSqygyFaBd HQjmTgBZ+lUv4tVk+wdVi0Y1k8SaCvBns6tPTtl7yFD9x7LosrSlBGQMh4L58rtK26X1JI+jjL58U oFmhTTy4ZT5EbuWHxEiUXXggSl2PH/vSJXzqgcbMN4x1OgwXfbPbbp5ixkJtPYMrdVYHWUn7MR3g0 uTFdlg+WRTvE9UTDmFvtNzPOpO1jwmZvZpM8HLWTzM8Ad854LMM/RFOtcbaT8aTqsge9KZJ+8oPaX hRAsNcjYTzgOyCEY/h2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnzso-00HSlo-0j; Wed, 04 Oct 2023 11:17:38 +0000 Received: from mail-vi1eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7d00::610] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnzsk-00HSiV-35 for linux-phy@lists.infradead.org; Wed, 04 Oct 2023 11:17:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=guD++ZG4zWg4OaiR7f5LT2tuDJ6vITr/Ng6ep3BldLAdHeJ3AEOAg+c1MSuImUfOyAiDvIeftMrVLqAdaruPyUGl3vT5Ls4bdebupz47AYycb61ssphOkygyiQeh7s/EbDbBIaAecmC1JKODKRUnFXgJZNWNI5GCWOOgq4L73EQ1WlLChqj8LcHs0wp/xC6uZL9xcAgqLOi0ZmBcTCOM8XrBGiaaF0HYFMf63fHwFKmqrrydvpwCf9TXAyd96ucHoTWPF25ZfCEDIwDpP7vwPDwNM7x+Ng5uh94dxM/QoChDLtrbgMrqdVryTLJZYT//SZf6YPUC9981J5ykMk6Grw== 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=PfBpsr5loHx0M3PWrCkscibuUZoXkmjr3n85GaOmIIU=; b=QR6UAWQrZrn5hN5Y9XJC12E+wIr6txSAvSXF4YDu0tUHE5ViXheYIDqGiCqFJsAOngZejDH4f+vGiKcPfxoE0rFDbcEMfZW5qKOJbM6Qhq8gQRaRFT6G1VqEa0AiL1Tf5FO5GJElnTvogalfyJ5nUvvlTz8/VfdoFYjQBpPlTkuoEz+fssxERjhnUu1veofG7JGqQSXnIebvXxDGHFDs54FmRUf6yYOBImr2Ct5hMVA0fa/aGeNijTP9qnsF4Z2EIvC7H/Y6GcFCI8r+et0+IvbiQc0GHvOsvy0hs3GDVAzGxmKpRo5aCTqmtGWSdBh6iJZyn8NmZw9mVCervUzmHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PfBpsr5loHx0M3PWrCkscibuUZoXkmjr3n85GaOmIIU=; b=L+xyG6wSdpDJy8sixlUai2zkhZjWMj6JjI+Kkvbft3w005A7T1J7KLRzP92RWQLKyHULHOaWzK/wXWdffX8gQzmqQFVzkZ1P4jkhiGEuM2E53CSD4Ex1rsXwKBkJ2m56YeXsq5kONxppg+zT1qNrrovwJ/eXH9Q+X8cOIDE74nI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by PAWPR04MB9911.eurprd04.prod.outlook.com (2603:10a6:102:38b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.36; Wed, 4 Oct 2023 11:17:24 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::568a:57ee:35b5:e454]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::568a:57ee:35b5:e454%3]) with mapi id 15.20.6838.024; Wed, 4 Oct 2023 11:17:24 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, linux-phy@lists.infradead.org Cc: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Ioana Ciornei , Vinod Koul , Kishon Vijay Abraham I , linux-kernel@vger.kernel.org Subject: [PATCH net 3/3] phy: lynx-28g: serialize concurrent phy_set_mode_ext() calls to shared registers Date: Wed, 4 Oct 2023 14:17:08 +0300 Message-Id: <20231004111708.3598832-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004111708.3598832-1-vladimir.oltean@nxp.com> References: <20231004111708.3598832-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR02CA0119.eurprd02.prod.outlook.com (2603:10a6:20b:28c::16) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|PAWPR04MB9911:EE_ X-MS-Office365-Filtering-Correlation-Id: 347fb13a-3dce-4112-f465-08dbc4cb7c25 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Iqx81h1ug1viH2sz2NnGpCNh+45c5nYFV0HaPYmuG7cxfsGiwx7MdGbvaZgJzrmL1+Ah+bE+Wiq0WuT0n9Wfl2hURCMbF42VRJrGPPiC+Fy/lACyknWcHPQcsuacVG0s+V5HS/LmB7V20hzWQg8BZ/EjogHDHGUoFblATrecJuiaftQQ9jo0ibVr8pEPLkIGHWaGQ1JK50vSp2Lz+86tadX5KmcmKl5lUmWh+rIjN2M6suF6qZR0o8SU8JExBCmuFiPnC7x5S30uG2z4ZfgNy6LNnv47Omjfl0HlEyE7UdZUgxseT6vNI3a1g96tAtJWPLkBS2g+VaUKVbg1Qqdk41tgtJGbj7uUFMTM45DPDoz2ErVOKDoKZTR7TvnkcSWP1EhsdoqcWCDrF4APNddP/z5X4nfrAe/RWx9oxNvcdmSMeqWiyjUCZgMeOqnpwLYf9Duqipc8ZdNGVKWomWdz8dzpyb2txEwrzFfd3VCgnZNsrR0gLZXsvnQowHld2EMeULhUxJ/heL+x6i0SHzDZQwjwDBfDZ1WQEC73zL0UUJBEdgMuhFvPweWehYAZHCeORn0Qa2H2emFLs/cAF+tG/EZG0huKTFgP/3aDBniS/VLrEK7F+KcxW0OEJhi03Nw1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(346002)(39860400002)(396003)(136003)(366004)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(316002)(66556008)(66476007)(54906003)(66946007)(2616005)(1076003)(26005)(83380400001)(6512007)(52116002)(6666004)(38350700002)(38100700002)(86362001)(36756003)(478600001)(6486002)(6506007)(2906002)(41300700001)(8676002)(8936002)(44832011)(4326008)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vK0tRTwR4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xsUSz9GpPF3sknefCdlgDcP3jTJX2IfrnrtnZyMP4F0lwVczgZkS6vUFvjTdR+SIFjB/taurtKjXBJW5hdVxp7v+UgPqO4XImZ7TDgQYGJex3p+qeNbrEeCmbbyqyD38rrIBhXEMr738rAYi6BWP9II5ds06vggr6Q29gCa9kvhZoMhw39G6LpFdpu52tEG5CYXCB/AaVB3QnmYAmCX8a33tqLcWapma9IpiuYASRo0HW6iFWj8Nxy6QkfYiAgjisYtBjZONAY/CUziArmymYNHCx+KP0xYaGk3qou1RU2+wgF3KFVNZcCo+C8MNyY+x9ZlvzSjrZy0W1KFT+pyJgJk9wQuuaBHZny77F0Zrzww7tSJVRM9gDT5lKWFhCvRptAYsA+ZW4vZYCLlTVc9MiT3E3SbNcHXL7zkempoaJuj9XMOohsjeLkXBQtmxwAQixOxw6+ewtp5im7u3LqnrbkNHpABoHtDMLZxO/qDxpyMlAdDOSPh93HpdjctlniC6meoBROn1ZD3kWnQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 347fb13a-3dce-4112-f465-08dbc4cb7c25 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 11:17:24.4684 (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: W/xWOsfdUICK3kxeEoW/JuWDehAXFoS/np6CNfQd2ZmyU6A+kN3P0sgkpt8FpYfx7MdGhiedn/7/TgLE1v9ycQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9911 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_041734_998886_14C8DA05 X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The protocol converter configuration registers PCC8, PCCC, PCCD (implemented by the driver), as well as others, control protocol converters from multiple lanes (each represented as a different struct phy). So, if there are simultaneous calls to phy_set_mode_ext() to lanes sharing the same PCC register (either for the "old" or for the "new" protocol), corruption of the values programmed to hardware is possible, because lynx_28g_rmw() has no locking. Add a spinlock in the struct lynx_28g_priv shared by all lanes, and take the global spinlock from the phy_ops :: set_mode() implementation. There are no other callers which modify PCC registers. Fixes: 8f73b37cf3fb ("phy: add support for the Layerscape SerDes 28G") Signed-off-by: Vladimir Oltean --- drivers/phy/freescale/phy-fsl-lynx-28g.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-lynx-28g.c b/drivers/phy/freescale/phy-fsl-lynx-28g.c index d5385d36735d..e2187767ce00 100644 --- a/drivers/phy/freescale/phy-fsl-lynx-28g.c +++ b/drivers/phy/freescale/phy-fsl-lynx-28g.c @@ -127,6 +127,10 @@ struct lynx_28g_lane { struct lynx_28g_priv { void __iomem *base; struct device *dev; + /* Serialize concurrent access to registers shared between lanes, + * like PCCn + */ + spinlock_t pcc_lock; struct lynx_28g_pll pll[LYNX_28G_NUM_PLL]; struct lynx_28g_lane lane[LYNX_28G_NUM_LANE]; @@ -397,6 +401,8 @@ static int lynx_28g_set_mode(struct phy *phy, enum phy_mode mode, int submode) if (powered_up) lynx_28g_power_off(phy); + spin_lock(&priv->pcc_lock); + switch (submode) { case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_1000BASEX: @@ -413,6 +419,8 @@ static int lynx_28g_set_mode(struct phy *phy, enum phy_mode mode, int submode) lane->interface = submode; out: + spin_unlock(&priv->pcc_lock); + /* Power up the lane if necessary */ if (powered_up) lynx_28g_power_on(phy); @@ -596,6 +604,7 @@ static int lynx_28g_probe(struct platform_device *pdev) dev_set_drvdata(dev, priv); + spin_lock_init(&priv->pcc_lock); INIT_DELAYED_WORK(&priv->cdr_check, lynx_28g_cdr_lock_check); queue_delayed_work(system_power_efficient_wq, &priv->cdr_check,