From patchwork Thu Aug 8 14:03:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 817996 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061.outbound.protection.outlook.com [40.107.22.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F99018DF99; Thu, 8 Aug 2024 13:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723125286; cv=fail; b=ZlxrHdepJSgDD/3DOzsziEKIpULhAsjePysbAHvqsw53EouDaMG43QpHwewHChTXfX/GKhzMfJp4SFQf67R6VfOWEDGg75ckmIzLGvR8cA6YY7Lr9SPhVmG0BMoqd8X6MEcXJhjp3go5FDYxz8gNDesXjz6R7exeM1N9RkdrAvI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723125286; c=relaxed/simple; bh=Q+MOBBZrdemLe14wKZNAMuaHo8diD0o4+uXVWKsyexw=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=CHplCJCjvTGHjR3niJVtnl3omOFe0RP5oRroI6yZLWKryv8MxNxTwCwETfcoK6E4KeHdqb9c4b+S8xt2+Df//vNV9D0IMlJeTdMaGVn7kNrshK7KSbRLXbY/6BjGouOUFkVISradXMMT+cAq6AWTEiEP84sC84eAG8FGbHN+Wl8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=CupkaX+7; arc=fail smtp.client-ip=40.107.22.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="CupkaX+7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vtjoXqP+2YNSXoemvKjUhUcIzOCfrp57qIGoOJz2jnHJ9XWiEHBNQE9wB/1AvTOTwYJtW3E2Wx0gXZpspSuyau2WqpxLi6pnUtt6EINntzSoQvAdj8SAMWUrzX3VWe32BGuuH5jRVbWReYFYOc+chL2yhXtVpa3zgVB4XIowSbesQqWb3v7K69K7/KBehJiZ6XaTXwR+7J2zUuH/jq1Zy7aUD36ImRr1Nc8Snv0z+MXM69qJfp/j+5DI53bu8CbjjcNAcTzay19Gm/UJwt1VNobLNUFIlMISQcMox4X7Qas4EsEfHBi+8st9ui4njtN62HBPSlngN/kE23M9AkM4dQ== 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=sYqVut4YS4qoRYOC3ogsdkuAYxjRq60eISiCoVVb9FQ=; b=HCCBeAbLfYN0V7vSmW7cuUfH2Ulw863jbcwkzpgzzWKYX47lBempkxg1CjehIJsOTqxKjYblWFhWRK4xNMLG9sKr9r3ULs3T/TtKq+ygwADkmzNFE/KpSmZMfHY8abFclaZErp+G/btgOuaDdhaM8au5CDuZKjj6M0pPM8gXeWdaDhpLX32I3Tn4oNr/Yfii1AT/XasUovDJrg/KnnWryjMzfPNlE43R8OFN6eA3zKaFpOIxbcWBVw1BGTkcA/SaYV5U9LinNvf9JfOCOHKxN7yDFhbEQTtsjE5RYWjKBJre9lcOK+GhAR/DOl8YrtqpbWtY+qNpA6tNmCI0Xr4KEg== 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=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sYqVut4YS4qoRYOC3ogsdkuAYxjRq60eISiCoVVb9FQ=; b=CupkaX+7cHYrP+gHrO0XYa8vmCulRYBnZBUtKAA8uvwlhTI+rjjm2mKc5OOf42/YNjunoIqG2fnmwNvkd8YkaVsPZoxJtMuGdd0GAw0FQR6uJp9YhcfEC9zvBa3qlvaLuQVK2Nc2zxqfCb4gaNkU51HpqTUWu7SoewuI82EiamEAvtqvTLHBN9JXGXmBmaXZ0BKkPun80jgyvZHqa5TQ7z3G2+Kx952qBEj20a088PC/F4DpL7wmke6Jr3VCPZgOqOwDewisehAm+rTUyQEf6e3ja19YM3FTeQm+rtIividZXWniiS8wRYbeQ7Hof7rwOfH93oheApA1251ssPhLaA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by AS8PR04MB8530.eurprd04.prod.outlook.com (2603:10a6:20b:421::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.13; Thu, 8 Aug 2024 13:54:41 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%4]) with mapi id 15.20.7784.020; Thu, 8 Aug 2024 13:54:41 +0000 From: "Peng Fan (OSS)" To: gregkh@linuxfoundation.org, jirislaby@kernel.org, alexander.stein@ew.tq-group.com, u.kleine-koenig@pengutronix.de Cc: sherry.sun@nxp.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Peng Fan Subject: [PATCH] tty: serial: fsl_lpuart: mark last busy before uart_add_one_port Date: Thu, 8 Aug 2024 22:03:25 +0800 Message-Id: <20240808140325.580105-1-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 X-ClientProxiedBy: SI2PR04CA0017.apcprd04.prod.outlook.com (2603:1096:4:197::15) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AS8PR04MB8530:EE_ X-MS-Office365-Filtering-Correlation-Id: 541c7868-0042-47de-6378-08dcb7b1a693 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 0FXTJ472LCyOApINET2qhHllsPVzc7Iz/oYmeNu/PzIVfuBG9SQx75EGKcUrHoqYXJaErWj8Tf/QlCwEcGWX9ejNguoXapT6BflKcQFs8KShk3d6xOEolVwaW3MHOsNJUIElQNE/HerNWO+jKprYzkYHR8UL7gTQ1lhMiN7jl32ob/UX6e0KyuTBgSZFFCVL7GyjUFmAL0CKuhFp4m+gsf7/jPPtTnvUOvmQigXZ8QjfaqujWshS4fKqQ4vYKXe2bOUoR84qG/IDQaWeka9NOCv0eMLz5apemvRNj2+vQul74XM9AZZATwXbNtmWPtL/F4xP3QjR64zQ1mBCDA4USbtTBH44hBOFhFK+Kv+8nklC/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CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8459.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QuS018bxUHWO/Fwg8IvgPpKKu96eF2C8AkcsSd6ULvDU5t/FMfEHt4tlFnSPyVr9GHBI7quOv1XgcOP+0jv9v2R+dSANHVSnnTv1l2iboGmNYRdKmyNfnZmedt+1SqvRunB2dJ4O0bxRquBNycc3jSYBhCGLs23GPzo3a/BpvoUSzFrntQvlLXTep7/AhsIvzxUjFl1w/aIPeMTdYmD9YjJBojUNPiBxEACxPZ3LAB/mpp9LhCezxEzt65io95zXdEi1e5/pexwtNUL1Kc7BXGa3KnhsEtsf6FRmg7zbT7k07I0T3khTKAKh8xQQeVuI2SmO4dphGPrkbDLLqn02a30IUTSrnb5RioYgHO6Gv4eAlAK2R9LwqaD12E24J498Db4Xce6AANC7PPwp0xRGQZGs7AcbRl871ZZ74x2MtWyRYyu7SVopWfpKeV7yCrKSu+SqYRetWTVXNINKbgvLTpnNld/JCTIuBbAvpLKbeoy36YIATcWYnkQIhxe5RZgyTAzRv1bPGVYjbeSFIiTlsP3RJBi4G4pUi78ESC/KjCJ0/B3z4UhcFzZWPEkzeO2gfiEd4MfnPHa5nj9Y/PdA8D7U+EGcQ185Ap4+UjC1MAipeIEDKB7+hs8Xx5NUE2NoNq+aTKK2/0GSIt/tuwm+hSiqnhy+/ko0/XMGcFyHnAMTWIRyHWdwxKHyXYThgCh4YqZjIexyzwlndIry8EYZQ21pYyUBqhi1lQJP5NJ9On6PMF33cycsDJ2nRO6UJiKGgQ0/Mi7FVJ8mCAiTx4zPouiJSk3Q/P69W1rV2FPNPgvxEd676c3GxFjAnRnZLq27Cur2p5+UAi9+3GglGAdQ/2WpCMkoLGTLGFxvt35BBgyKcLjhQXoVOOVLRWvIhWWlq0OcSooyQN1D7qPW3BcTPGK1X2HNZXlfLxWMUZQgMqT70Tu+/eK6SxatAcY6zlyOlyx/SSNARBuxxrunNTmZc8h84sH9siz1NdZDh/JpuKNFKJuQk6/OMfVfEnTIf+qmg1yFnXPvKROb9zkZ290wPj8ODtu8KkjErR4r44gmLxe0Zmgo71ptfFQKfopQc9MsehYQX6s2phbjOkRM8WCOjJRFZ2nDHcYm2JQZxxB5J5iCMr0jqDqSOc/q0lXUxYp4gDF5c+nM+E0Qk1SosvYQEnzC0oljhgncXzLVoKJmOUdgn0yMHfR/CEWR1/3gCKZPxRDiPyTN+iIPXXXY4CE/iLptG+zAa9Lb1x+8+qHKFuPPJ8aNwSf1Xo/LtLR2inltrIH95Gf7M1kkMto3sIsGjvOGCuYTJUGq9kOTGgXJv/GWQfmpdtOvDMHp+sSKrKg0Xl/8gIHVzBlLJN/WOzpSaAG9Myl0Ksh2e9GZY/yiv/eYHEjz8UbPnH//bZie6CKuaraT7UpZCDqPjzIrC7KvWeQCxbfuAP1ZqGC8bM8KVQquB1vPp2oFeSqbykee0ruvdKl4nC0bGiZrsw2/ywmIadGzN9efuepHm+W1FrJ9z9wbEYcuxMvJSvvh3pxJWfclyqtdR44vdzgMSWRIbIvxEd6dvmaf4OsTl2XhaVoLu+IraMl81v4Vz1HU1Tnme3K+ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 541c7868-0042-47de-6378-08dcb7b1a693 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2024 13:54:41.3221 (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: Eacq10E7vvE0m1BiMAjbmSFiz+xgIjvxIVnzsvVabaqSU0wbtk8rne4p0FM2caBw/lOv+MYKB1/P4Y5mAig6Xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8530 From: Peng Fan With "earlycon initcall_debug=1 loglevel=8" in bootargs, kernel sometimes boot hang. It is because normal console still is not ready, but runtime suspend is called, so early console putchar will hang in waiting TRDE set in UARTSTAT. The lpuart driver has auto suspend delay set to 3000ms, but during uart_add_one_port, a child device serial ctrl will added and probed with its pm runtime enabled(see serial_ctrl.c). The runtime suspend call path is: device_add |-> bus_probe_device |->device_initial_probe |->__device_attach |-> pm_runtime_get_sync(dev->parent); |-> pm_request_idle(dev); |-> pm_runtime_put(dev->parent); So in the end, before normal console ready, the lpuart get runtime suspended. And earlycon putchar will hang. To address the issue, mark last busy just after pm_runtime_enable, three seconds is long enough to switch from bootconsole to normal console. Fixes: 43543e6f539b ("tty: serial: fsl_lpuart: Add runtime pm support") Signed-off-by: Peng Fan --- drivers/tty/serial/fsl_lpuart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 615291ea9b5e..77efa7ee6eda 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2923,6 +2923,7 @@ static int lpuart_probe(struct platform_device *pdev) pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); + pm_runtime_mark_last_busy(&pdev->dev); ret = lpuart_global_reset(sport); if (ret)