From patchwork Tue Oct 22 08:43:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13845333 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 AE570D1CDB8 for ; Tue, 22 Oct 2024 08:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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:In-Reply-To:References:List-Owner; bh=X6hrUn/HotgPfyIsbxxBO3trV1dgy7qwIeCsrEiWcvs=; b=1JlGPN9LM5M27TVgwmnBDQ1lyb uw2aMeoN+osawWfH1O+qWOnL5VJos1C4EcvW/I64Iw/oATSm5gs+1VnDqABcri+GL6YVvfzb44BjX qQBBCq87G6Wd5Iyen8u7XQd5wprgVPRlNwtkklDg1kPNv0E7wkxfJq94Y6QHHaVpbn9dFgMyFOHBt IIwtUdY7mzjkVwxBw2Tmcg2kI3SWA24AtIXv8TTIyJ7puhu0UqVkAtSTXDhuKBxJo/xQuRbMnI9bG VyJ6JZ7NK4pspIdmkwFJa0el0qTQ8p3ZRl3sXBtMiG5vz42kmKMQDrETm8SSYCNqMyUgJqA327FOZ 5aXJhzxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t3Ab8-0000000AERB-30lS; Tue, 22 Oct 2024 08:50:38 +0000 Received: from mail-psaapc01on20705.outbound.protection.outlook.com ([2a01:111:f403:200e::705] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t3AVI-0000000ADH1-1h6h; Tue, 22 Oct 2024 08:44:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WN7MLG+7ZGOGdPe7KuNVHDbiEnd3yquHJZc/xEz92h/nQKL1f17XzrUG7ZH4jsJcwlbst5b7Q81Qfco0DSENp03U2VuptcNuWk40T/xO9Hg5YRp+NyMsxOJBDzyo0kA0UQyHfdXCwna8wyGxoO9cKcI5GcKMyzAnJ9gQOZMUfAPnN3i24h9+bKfi/e5q9aitgQOvJLM+oin09xA+boIhxnuAvyPcMJGINDWvWnWGcCvfhdaHIhkePkv3vVNp25O2Ap0lEeXSqsU65/l3VVdJX1e/geoSZjj/6adeoMK4tnSacv1DJuSmO8j8UA2CHyWg/7h9e8sXePP/cb7b9bpXMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=X6hrUn/HotgPfyIsbxxBO3trV1dgy7qwIeCsrEiWcvs=; b=YDa2BSyBbeSNRJYUPPVwGgzFSDP9fEfmqVCpUWH8eXbWcLZ8nlb01B0V2/U3lUsyupcMmtbpaXv2l196sDcskcnVqmCQAMIOHMq11uOHPE9n278ihhqH0LnTiCQBntUddDa7cDfxclSF/eU5WXgx2NVLrJQFY2kjKxAJquv6rKfIILNe5U3MxwRD4bc2tXaHFfcCQPDgmc47JfuG8Wt50wDl1hAa1pJRwBtPT2oqLNqvhLEj1fqPDLDF4QO0ETrHogwtnGIgkkqO1V1tP8KpVrrjdid1jQAnvUcSPFesV5lpJGreStyGi5Hk9QNGHF/KQ5JYJdlmEdJoi1KCWErVlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fibocom.com; dmarc=pass action=none header.from=fibocom.com; dkim=pass header.d=fibocom.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fibocomcorp.onmicrosoft.com; s=selector1-fibocomcorp-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X6hrUn/HotgPfyIsbxxBO3trV1dgy7qwIeCsrEiWcvs=; b=RZyKmLDXk2J1bFZQRvlfjxu9+CL+cR/PAu2Yqv9xm/sOkK3EmEbwKzepKnPwrJfw1N4joVrllSUnQfxKt2a/GwjWX2iRyLSP2l5xu4jhTsMfv3b6/sJzMN3iBXvyhtp5id1fqFP0zfDqAB1UUDxvLc41fweGivCXy5MwWw7RNjs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=fibocom.com; Received: from TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6) by SI2PR02MB5562.apcprd02.prod.outlook.com (2603:1096:4:1a6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.23; Tue, 22 Oct 2024 08:44:11 +0000 Received: from TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b]) by TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b%4]) with mapi id 15.20.8069.027; Tue, 22 Oct 2024 08:44:10 +0000 From: Jinjian Song To: chandrashekar.devegowda@intel.com, chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com, m.chetan.kumar@linux.intel.com, ricardo.martinez@linux.intel.com, loic.poulain@linaro.org, ryazanov.s.a@gmail.com, johannes@sipsolutions.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, angelogioacchino.delregno@collabora.com, linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com, corbet@lwn.net, linux-mediatek@lists.infradead.org, helgaas@kernel.org, danielwinkler@google.com, korneld@google.com, Jinjian Song Subject: [net-next v2] net: wwan: t7xx: reset device if suspend fails Date: Tue, 22 Oct 2024 16:43:48 +0800 Message-Id: <20241022084348.4571-1-jinjian.song@fibocom.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR01CA0027.apcprd01.prod.exchangelabs.com (2603:1096:4:192::7) To TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY0PR02MB5766:EE_|SI2PR02MB5562:EE_ X-MS-Office365-Filtering-Correlation-Id: 31570f44-8815-4824-80f7-08dcf275b299 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: cAId+YUbnXXqRo3S9hvSDBLzXgac0C5oCSt33epIh/sGbH/RHG6a80PVOqIOnHKxvzE/ttNk82AxcVc8GmnuSouJZOtOyiSuJ2Mfq9NH3nHuezzbYbJkUAqUkLfr+xUT3tzvZ9CN3SGTPLTiLyp/Qxw/3RnogR3u0/Nbjez+3exvMiIV2T2QwSvutLgumWfqR20m437bKCTOCsZC84G01N6yrqxAHrGYfEiQdV5uZOL8qGiWlYNYvGSVWrTUMySuoXy1l1ci8NXBu6D0plOe3B/VaUxvKP4WanWfpKjReoiuvWPSVyUl8kxJN2Iov/4Byk9Q1nCC6sbBZ/WmeWfOQ2dQX2EL+FOjqzwWf1b+Gbg7xRuWtczaZtJz7jy9wy6pCJyubMunkcq0j8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PM;H:TY0PR02MB5766.apcprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(7416014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jSPezyVLB51jNmDWvwpHidWpBS8A7G/DdRlBgTZWFMC6wGmPVlGzzAxy7vcnC5J2Er6mJWwHd0O6i2S3U2Lqt2OG16EbeRQ0XzTOOCx02E1XJEfdSk5zxdnMrVDgeUwSE4DdABm0PrMU5JWdwLkyhzbPI+H3Mi6Hyjs9O4z6UUf6FhtTY9iRKv3qMGkbpi5G20jftBJxpltUsZIjaslg3tbo/7tc7wk5i5BU7279puGpEhy+Rg9n8YnMjblwFOsFvFtIe49msuVwrJSbE4vi64cdE8GLQGEPsEWSGzOE7OZ9E5iqphkqcjq+n2bitFnDbRPKqeFGZzNqDKFN3TcCIRnOvoZnmY+g0yJhPdvc1xJuhEfZuamybjQsVKnuW6zs8NjAaSwXYr0et/vQVD1C1rBK2wIfHFojwqxvCgy2OhwBrZ69Fsanhi0bieLdy1Wyg1o5gKBY08WJ+o7Ua0jQMG8NFPAXij1/y8co79ApK4b79hU6u5PkqFBxNtMFSLsx/u7Cmie0yrf/Ejj0nFD1IwKA5wJchkn7lx0Q1f2JrIN/BwO1ffZr45wbNo2fzRb2yI3L5kyQjJBsjuMAV+8H/nfk5rmvhrQo3/jCqL424AjiWctIz8GIX+1VelY7NhDXdfEEyaZ4CtQhUEXQBpKnqM92VHmhpsnPOn2jHc7QL83jClRKBr4WQlQEQq3MBbkAb0XO+6FE5vug9sxgLXiZOjwQ/5LTRFjhqUzCvGd4krccoZF8iXiK5Ibvu3g0zPWCUEP3N5dQM2DfQdqmVf5pMrFpbt63qAdxJc9kOeG3R6cajtk342n1m9uwnm2KUZRsvf3RQ7/ix3WQ3MccFVtXPu5Z3pZIyunpZZawW49U2QDH30Ycest0jmbNQaVsbJq2Ia+DpR0Ee4YXn6t9xXoe4ADoErnpA+FxWb9Kr2MWKz+D61+KpjiR8EzKtnCCMyn4LmC53uYIgX1cFhBK7aIsLpCIQ2bfhoL6dlT5AQbC8v+TuK3SqsFUJKqponfFtDuKC9Ef5fZE6Df4A/4shFq0gbaHEl1yvIzWrjwUnVxxKvwD8wSVrAKnsXFwCFofZIDloUvZyBqI8enVoClE4+j9MwCuR+Oa16jkfLZ4bn2FBTf8WxEOI02SY+guunAa5uVYy9tga2qAqlfUIufMAAuE8WN/fkiAuwYH3vtmCECTxnSMXq6Ukx5HU0kebNO+21GAyyeV0DtJf36seV5JsN2e59z3NWD/8AaS4ClbCNTabQJJElh6H2flNvfGYqstU8KHQkz0qLA74sWVqJQVfHpBiDvzxaZ1Y2T6MnCFIfaOWMlvNZc+ZQx1mNqbndbehM98/GSWD4EFilFKhV+sOw99VdgusbQbyJujF31cWYBiuzqRz+hORBhYosb2Z5EJXYZuKqC7sNYVjYu4fKjrJDnoZNI5LZUtSMw0ZGn8auIfjxUY4wdB/23/I+1Hm83gTWvoQJAzbH9XjnlrtmbpJzDnUCTMfAEOwbKXkby/GoDGQEDRb3UNoSXhWlRwT3e/qw+MUvUpP1cUufM7tJMr1e9tejm108sXvR6DCOE+RxkJqdwclON4BK+3BqLK9ztgoVzV/QI+n1qpw/iOfNBSUfEi3Q== X-OriginatorOrg: fibocom.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31570f44-8815-4824-80f7-08dcf275b299 X-MS-Exchange-CrossTenant-AuthSource: TY0PR02MB5766.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 08:44:10.4853 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 889bfe61-8c21-436b-bc07-3908050c8236 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KduZDVeG8o1ij6ie4xqdRKuFT2c+mOwYAhR+AQU73HbfYAd/Xwvi2kFCUEdB6+atRuwk5dnPZjAJYCElUGGdaF3MmzYmzLjieXTH41a0BCQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR02MB5562 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241022_014436_453957_C0EE2539 X-CRM114-Status: UNSURE ( 9.44 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org If driver fails to set the device to suspend, it means that the device is abnormal. In this case, reset the device to recover when PCIe device is offline. Signed-off-by: Jinjian Song --- V2: * Add judgment, reset when device is offline --- drivers/net/wwan/t7xx/t7xx_pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wwan/t7xx/t7xx_pci.c b/drivers/net/wwan/t7xx/t7xx_pci.c index e556e5bd49ab..4f89a353588b 100644 --- a/drivers/net/wwan/t7xx/t7xx_pci.c +++ b/drivers/net/wwan/t7xx/t7xx_pci.c @@ -427,6 +427,10 @@ static int __t7xx_pci_pm_suspend(struct pci_dev *pdev) iowrite32(T7XX_L1_BIT(0), IREG_BASE(t7xx_dev) + ENABLE_ASPM_LOWPWR); atomic_set(&t7xx_dev->md_pm_state, MTK_PM_RESUMED); t7xx_pcie_mac_set_int(t7xx_dev, SAP_RGU_INT); + if (pci_channel_offline(pdev)) { + dev_err(&pdev->dev, "Device offline, reset to recover\n"); + t7xx_reset_device(t7xx_dev, PLDR); + } return ret; }