From patchwork Wed Dec 14 03:11:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 634144 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E98FC4332F for ; Wed, 14 Dec 2022 03:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237242AbiLNDN5 (ORCPT ); Tue, 13 Dec 2022 22:13:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237247AbiLNDNy (ORCPT ); Tue, 13 Dec 2022 22:13:54 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2083.outbound.protection.outlook.com [40.107.21.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00A18186DF; Tue, 13 Dec 2022 19:13:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VxZFQ0HPaN7vxKtotKzYbuH+LOoyfbUHXOjAAbswOVVXseXM6s1DFBAbSSDoXonkeUA/ECabgLqD9Y8ki6qmIuatmYsJtseFEMIajUQjZApZ/USPfOYREfZxRPRaLO0d05CbYl0KtDpRcMGouGNRUikZSACWPmR+SJxfuCN3SzSeYSM6jgZ2w8V5x39v3QlIl1glH5IF8nTUbW+6Z05u/orxgTTKMFRe7bVyY+xCDRAWVUsnaWoZhaBhZj0W65xBLzG3YaxlPOzPsTgPU+qGx4hBF72clB3nuEV5ESuB48MljKymUqRkTYyXc9TwrzRYoU9YkEayh3yAjzwiw4C3EA== 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=cZKJCUvnSsPAVC6hr+0PQOGpZigHZatHCrNPVTm/luI=; b=obLIWTPHX/ui2FKPQ9UIlsHUmQM1jeDDqONyUaQOfzEd9soHSFQ8WGShpvN3TLoGoZts+hEy8ErLJ1jsKXdKp/EECsv/9sG55geE/cMKbCLT+TpxYiSKUu5hYnTjtaO2yHgQ5+a8LWjytkQamu9axlBOIVSr31NhS3VeqtYg7v0XB8iFTd2I3nmFo+d+5kVdXWIVgXRgWiJ4kn/Kr7t6IYyYzKvb4kpPRitGgYg/LIaM6tm4DmYHdgkE6WCTsv8uCdMNwPX5S/8gf+2JIYknKD/VtYV8MEY3yj5Ihwx8rg19htFnFVpIoh0RA6C2SLJuIj1MKLPydsFXD0qRRIQpog== 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=cZKJCUvnSsPAVC6hr+0PQOGpZigHZatHCrNPVTm/luI=; b=l3IHVSIVnJ3VACVJAy5Tt+x/LRPmoypg5f7apdefqn1iKohSuWtcJ2c6vfJHtUR+8SxWxNFZq45wr0Fm3AfDeW/FSFTQA4JGzZNdtmRycMHuslycoR31Zeygy8ceuLE3hQjRLxOAt0buf49ZsUIfGQS4oqQAXXaWt6rigma5VpA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) by DB9PR04MB8316.eurprd04.prod.outlook.com (2603:10a6:10:246::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Wed, 14 Dec 2022 03:13:49 +0000 Received: from AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::aaa8:55c6:bc8b:6bd1]) by AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::aaa8:55c6:bc8b:6bd1%6]) with mapi id 15.20.5880.019; Wed, 14 Dec 2022 03:13:49 +0000 From: Sherry Sun To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 1/3] tty: serial: fsl_lpuart: disable the CTS when send break signal Date: Wed, 14 Dec 2022 11:11:35 +0800 Message-Id: <20221214031137.28815-2-sherry.sun@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221214031137.28815-1-sherry.sun@nxp.com> References: <20221214031137.28815-1-sherry.sun@nxp.com> X-ClientProxiedBy: SG3P274CA0010.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::22) To AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8404:EE_|DB9PR04MB8316:EE_ X-MS-Office365-Filtering-Correlation-Id: de5d7df3-40f1-4ecc-703f-08dadd813881 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PeAeepqo4rJvC+xKRH8JG7gIa8O5Jc6mnUef8QJgmZ/X3BhUxgOiKgD/r+ifdlKW2FQTphcP7NXLG1xo2JwEot5XqGSQkPCjtslXL7HgIVicTHHH3S1bgwh+TDQUc0g6fNDe3U5uuhyYYBRveKRgcTrqRkrmNISpacu0c/+Pk/l2sQlijkBPc0bVFS7pfZaS/iejUWVn8aDpEoQd4WdTYtdj5F3YztIfcsEFzy0vbQqpnQf3amLLS7p42goCIQpVyuOrE+1PUu7H/cZyoTUb8OZMvcGwcHN5ap8XRhPHi1D/Z56HgGNXBQ9lFhyL281MQF/aZ6+/eGt7jcWVZFa9DZ74DbiyYZ71L8wQBuHv459qbOZp/HnG/YzfMasQRHDCqcc+WOfi0D+U0PvO3tJdAP10ImOaUhw+L9rrbl27bnbxH4RqAh+Bv7Q3Q9IElC36UM1qhki8dfPMyF1R3h9vTF777L7n6vyidizVFTFg6ZebC0xBK0HRISo+tM0Akl7daIbZW8pfngt/fFVWdtYrSdt2q5/J5uDauv+wDHIiP5DxbB8kHXZ4vQpYuRuuJVEF6tpkTW/Ifqc4xp8cNxI/IPXHuQWvG84Z4yKsqnlU0Czwxyr/pOXF5QbhKe7SskiBZ+gJZDwZRlvCGdduLX/cBTtbPs7fVafW011zJL27C3yIXPrDNx2afvSz7e1+nmXdCYYwTcT6peUiKDlJ7E949Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8404.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(136003)(39860400002)(346002)(376002)(396003)(451199015)(36756003)(478600001)(52116002)(44832011)(6666004)(41300700001)(66946007)(2906002)(38100700002)(38350700002)(5660300002)(86362001)(6486002)(2616005)(66476007)(1076003)(6506007)(8676002)(316002)(66556008)(4326008)(6512007)(186003)(8936002)(26005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RfkaSgxLTwUzhhit6Q25C7kigO3bMSvyDd63oRWlTt/aAq+Dw1CV70WgLD3cPOQHIvUHLXfqHWCBHks9/1iQCx7qHpSdpO0atCdDXB8PRZytwUNBngzExIU9kFEgLtu+e7fC4iTjqDI1k2zNeqtjX/QGP35f9ogYYRzEkm99r8M6b/GwP3pN0Y/OZgLcmS5Rcrzzkvdz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qKVL11/ZHxxHfjVFc9LM6I1pxWuj2tshAAQIOX11rdvOWrhMU/9wb4x4n+cmBFDG//7dhh31sv6x7fLm3L6KLGha+R6xssk9bY9RmE093utHU0+c/FQD1VW2eAGvBbI3V0ACqEVFj6dfyGkspssL9SGXcLqBPEr+tD3IXXPe0FZKARowl391iILRTJnbRDi5mHJie8Zb3XJrVQjqC6XB3AArRnIF8RXzm8tbw0/ORBRR8xV4gGjb+Dc0Bzw47mrZb5wsGJS+p4NHGSVMC4gOcSFlWP0APVwL5/dNNmgPosTO30xm/NAE9N2kZwPN/MEj0Fj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: de5d7df3-40f1-4ecc-703f-08dadd813881 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8404.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 03:13:49.7060 (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: sL+ESSSfn5secDYBfdqz2IRgMHiFlmHtrEZwlXxVntLFooyC1hRIgB+MXhllNQtPePJe9R4z1QSM0g1pzMgI1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8316 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org LPUART IP has a bug that it treats the CTS as higher priority than the break signal, which cause the break signal sending through UARTCTRL_SBK may impacted by the CTS input if the HW flow control is enabled. Add this workaround patch to fix the IP bug, we can disable CTS before asserting SBK to avoid any interference from CTS, and re-enable it when break off. Such as for the bluetooth chip power save feature, host can let the BT chip get into sleep state by sending a UART break signal, and wake it up by turning off the UART break. If the BT chip enters the sleep mode successfully, it will pull up the CTS line, if the BT chip is woken up, it will pull down the CTS line. If without this workaround patch, the UART TX pin cannot send the break signal successfully as it affected by the BT CTS pin. After adding this patch, the BT power save feature can work well. Signed-off-by: Sherry Sun --- drivers/tty/serial/fsl_lpuart.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index bb12b328e224..f487d3d2effe 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1464,12 +1464,32 @@ static void lpuart_break_ctl(struct uart_port *port, int break_state) static void lpuart32_break_ctl(struct uart_port *port, int break_state) { - unsigned long temp; + unsigned long temp, modem; + struct tty_struct *tty; + unsigned int cflag = 0; + + tty = tty_port_tty_get(&port->state->port); + if (tty) { + cflag = tty->termios.c_cflag; + tty_kref_put(tty); + } temp = lpuart32_read(port, UARTCTRL) & ~UARTCTRL_SBK; + modem = lpuart32_read(port, UARTMODIR); - if (break_state != 0) + if (break_state != 0) { temp |= UARTCTRL_SBK; + /* + * LPUART CTS has higher priority than SBK, need to disable CTS before + * asserting SBK to avoid any interference if flow control is enabled. + */ + if (cflag & CRTSCTS && modem & UARTMODIR_TXCTSE) + lpuart32_write(port, modem & ~UARTMODIR_TXCTSE, UARTMODIR); + } else { + /* Re-enable the CTS when break off. */ + if (cflag & CRTSCTS && !(modem & UARTMODIR_TXCTSE)) + lpuart32_write(port, modem | UARTMODIR_TXCTSE, UARTMODIR); + } lpuart32_write(port, temp, UARTCTRL); } From patchwork Wed Dec 14 03:11:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 634791 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EDA5C4332F for ; Wed, 14 Dec 2022 03:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237224AbiLNDOD (ORCPT ); Tue, 13 Dec 2022 22:14:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237255AbiLNDOB (ORCPT ); Tue, 13 Dec 2022 22:14:01 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2045.outbound.protection.outlook.com [40.107.21.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33D3F186D7; Tue, 13 Dec 2022 19:13:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hc6pN0uHnZHkSF+oOxZiPdteWuxzBMt57smcD8ZeXLqplE69OyxO4CthNv9uv2G+MT0ccemHlXJdWExKnpEvJGoE7DrGQaywD1bLUxO+XvUe29L8HieYddpJaV46k9PodicbrsfLK6hxB45Gt91XiDf8eqAE9w55HProPilgAlcB5Q7yDqyKaR7oy2nVbWiGplPs7MCZwm3Q8teiV2YePFs6pPwUSUkBOsHPqm7se8BV3tFziFxC56L3K6CCNYiBELAXh8kJeirf+auxwyCObwypJDJk1eRchkuWS4/8tuEgRZowBKxBAm9YBWD/UIFzOueNI2V4JH87goCZwE1QTg== 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=PrFISmB4lMk+DvE0eAeSVmmX1sCY3hUAveXWjtP8BYc=; b=EgfbK3ezucynvyV3F6OfU6/oZqRclAbKsuGuAOtS74tLUhRyZi4SFbYJJWRbraw90lDSQbnx2NbjLsKANW/e13xBy0mQQH7fkkR63dmRx7t2X0icPqREsTGb06kWMyMXPVibJSWNHgAAJi9YwvnkvNNpGHUk3JW2AJcYLH+bi7qCF9UwqATXbbYs9lpAOookt5VFYTM1QznI5zzeKbYygrpGZqKAFkXji+W6+TZwUSUHv7XtMrigA1CbXj4n3Irhamo1n20g2c6g+/gIsDygtPgRQUj5YxwlzN7L/y0cxK8JHukuvylrPH9xeX5wb3wLRQ62qWr6cUHmBw86riYp0w== 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=PrFISmB4lMk+DvE0eAeSVmmX1sCY3hUAveXWjtP8BYc=; b=Tur0dv5Q1oKk6hPBxjcD0k4pCygWvIpkyDeRzQithomRhbpcdicDXJ9rlnxXVV5zxpq3+1w/snfIuU7oltBtN0ksevT7seihMp+SWO+mBiCEtXnTPvCWyc5yeSGunvcczGLY7y2KqC/TevRmDM1PCaP9jfoSd6gKFL5GBkHRDmw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) by DB9PR04MB8316.eurprd04.prod.outlook.com (2603:10a6:10:246::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Wed, 14 Dec 2022 03:13:54 +0000 Received: from AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::aaa8:55c6:bc8b:6bd1]) by AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::aaa8:55c6:bc8b:6bd1%6]) with mapi id 15.20.5880.019; Wed, 14 Dec 2022 03:13:54 +0000 From: Sherry Sun To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 2/3] tty: serial: fsl_lpuart: disable the break condition when shutdown the uart port Date: Wed, 14 Dec 2022 11:11:36 +0800 Message-Id: <20221214031137.28815-3-sherry.sun@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221214031137.28815-1-sherry.sun@nxp.com> References: <20221214031137.28815-1-sherry.sun@nxp.com> X-ClientProxiedBy: SG3P274CA0010.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::22) To AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8404:EE_|DB9PR04MB8316:EE_ X-MS-Office365-Filtering-Correlation-Id: d688fee5-0b37-4ec4-c5fb-08dadd813b77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rJQE1wJlOFYGQXUSBfBwSQq8XWpb0DCA3FlE9qDx2S1tO3QC9wjTZ/RHO1qzeMMH9rYdrxR0pHPpQPU6mmSnOky3K0K/C4hm446tBZqBQr2CKbvwB/sBQ4URffm3SJzUkO28D3aRAUz8z5q6lXVzwmZSxQuv381S4aWn7EKqIGI2iFl9OWoYjzG4u7jwKT8S/GHV1XX/A2xFRaApMwhUvQyQubPjSS3EhDMfLqPeM2tFg0UxCwfLrRISnyslT7K1J6pI0YfI4j5MHyqQ3dXvnCKrOZfWD4W8+536un4ycOj4JIxTpOQrCrW+VdgG1HOGoEuuL3Jg0KFE1TiW3sK5GU6fb6i+HiYrZQmak8S5qK5K6PKxO+g8OhqX3m7F1B8ZWv5hQBdmKllFCCYSWZfJUsIycOxkW3hS9cyse1WUUqnNCpd4sNjqfVA+re7haeX2RVWmLWXJYb1bmJ24qEIM2UtO0WQXJQ20PGsXshPLJ2ju+SQ0h2H/3LpRE5o9I2QxJPbCjy34GO6n/zutzrA63jKBoXnb1u086VRDok1GNmdkx18kUxkl6UfJFuE8Rh+TiPky4EaCm5O/Go4PHt2A/RPpyu6rZSH9pRFQE6EbkxdXBVaLi5jmXKU3Z6kGT4L8GuqiD6WqNQsF5CCsRLbBL3VrVr3aoxDDU2bSNhfYFek11m4occmCwo5q8GX1l/DtR5dkCtUzAE3PwAHP5BL4yA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8404.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(136003)(39860400002)(346002)(376002)(396003)(451199015)(36756003)(478600001)(52116002)(44832011)(6666004)(41300700001)(66946007)(2906002)(4744005)(38100700002)(38350700002)(5660300002)(86362001)(6486002)(2616005)(66476007)(1076003)(6506007)(8676002)(316002)(66556008)(4326008)(6512007)(186003)(8936002)(26005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mNv/PoQIG7UY7MjYGoBjuGoxyvooPGglPYVpx2ioEviDMT/5gVUd0qkJQRZex9eatxNZDjOvxc9X9kU4TiFvM/3o3rgKXFfBv4WPrMq2j98iOKDwSlZrMaQMdDrZizOvbGYbK1EPh3/HSXOrHDFLczIF4GuyZGZJTOqLxkVp0XiC99/8ZByxf7l7ULOvgkmF+GJ8rZ1JtPMV8WdHsSZ6l7YKWcG9mV/b73Dv7wNE4Qo/IrdcP2YYwYE9Hju5MSfDxVcDEXQY98sb5/Fmsmm3AYS7G+Qzjazt4LAGJmSOjSlCMaAojLwDMWFAymtgTBBI3+RXr2HyX5Hkguhr3MX2oJWkz+sgJYUhFsoek6h3aIQiIe0dPSKZ3iH/QBpawYmwmW418TK/q0Mk/5u/nCF4Nm8k93lYj4dHNmoDTrerzQymAJAaS6I+J/NmwZXH43+OEplxGyy9Wcz8D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AarG8fOkaeoWtK6me3QDCcwq1vonhkgBiYErjUMtfLuNpYYMgD1llR0/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d688fee5-0b37-4ec4-c5fb-08dadd813b77 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8404.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 03:13:54.7227 (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: KTaGV1NEpAYo0fCIasx6W3gnl3gDCORsq2gFxtkw5YQ6v2Ri6H+eTa1+rre+BIhZJBnxYyTeVhgsm100Ju3gJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8316 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Need to disable the break condition for lpuart driver when closing the uart port like other uart drivers do. Signed-off-by: Sherry Sun --- drivers/tty/serial/fsl_lpuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index f487d3d2effe..584b26e0b947 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1839,10 +1839,10 @@ static void lpuart32_shutdown(struct uart_port *port) temp &= ~(UARTBAUD_TDMAE | UARTBAUD_RDMAE); lpuart32_write(port, temp, UARTBAUD); - /* disable Rx/Tx and interrupts */ + /* disable Rx/Tx and interrupts and break condition */ temp = lpuart32_read(port, UARTCTRL); temp &= ~(UARTCTRL_TE | UARTCTRL_RE | UARTCTRL_ILIE | - UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE); + UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE | UARTCTRL_SBK); lpuart32_write(port, temp, UARTCTRL); spin_unlock_irqrestore(&port->lock, flags); From patchwork Wed Dec 14 03:11:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 634143 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96732C4332F for ; Wed, 14 Dec 2022 03:14:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237295AbiLNDOT (ORCPT ); Tue, 13 Dec 2022 22:14:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237274AbiLNDOP (ORCPT ); Tue, 13 Dec 2022 22:14:15 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2045.outbound.protection.outlook.com [40.107.21.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E0C927B1F; Tue, 13 Dec 2022 19:14:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QXYOZOFEhDQUa/cECzlBHCNxq7bCva1YswzurstzC3jujKEPuxGlNNVwXllJAb3VIrVnKQcfnWN9lwgN6Vg+EbUW1mUKEIEsFPr6SnPgXHIdYbcxTmcgGi+FyY8buWTJirY5nooSuPcKj9NBpgzxwFOXPnnaVEleuJIRi7BAHQIH9y7UoW8n6Ea1KReOj3ynqxiUB+zxphpdaot6rDdeyPnNoPNMxYC59XSPz+MZtE+vgfw7QM+QUpkXt8slJ8+h4wXsduElRLIXQNlAqPFeGggWJp0c0XbGXfxR+2Eo/8KLVG09LdgeOT4+FJzyZa6g4ZS3aZR3lhX9vqaKkkwS+g== 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=LlvzC77b68ow7y3+PFr6IAby+vveemqBqw/XYJriVjU=; b=J4c6yL2EAh6MVra9qDajgqFEJ+MQbDJmKblc0vgii/46NDUuAucTvt23Va3v4mbKQbHoQZvNQekHuakodEEfh8VBQ4WM2WZlh7wFNSj4gRjpYPJy3cnzZkSVzGIJbeEP4Rc8wsEkqRCNn65wEovaJi7hVppOAwmigV1D/3RLFy/U8uoF5GlzybGstxmH4G7wK+5wRyj/BGwVK6funxtOWJ2/0nSUHLLkVk/jDTdCU3GGur94dYEoG9dS4JkIZIRR/83koCbcV8FsURf7txZaIzLWp5iH5NKeGgBkJ6Uo8Fnjw02JWsZawTYdt7bgPmaIPpQP3ewKXdEypTOEqiAVWw== 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=LlvzC77b68ow7y3+PFr6IAby+vveemqBqw/XYJriVjU=; b=COVdFPc+2SHHXlwY9gDfzJ2K21tBDxMDDEANbKjMmvLKrlws5ENsRKhLDQk3Y6xoGwYsYyQLqeHqiJvmA+puoTYrMR7CljUvmxQR9HHuC7qIY42pxhZcNu9pQupFw6oGCvNgQmwxInqogaVKNcT0gwzSutGKGnpUtPwr50Fqfz4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) by DB9PR04MB8316.eurprd04.prod.outlook.com (2603:10a6:10:246::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Wed, 14 Dec 2022 03:13:58 +0000 Received: from AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::aaa8:55c6:bc8b:6bd1]) by AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::aaa8:55c6:bc8b:6bd1%6]) with mapi id 15.20.5880.019; Wed, 14 Dec 2022 03:13:58 +0000 From: Sherry Sun To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 3/3] tty: serial: imx: disable the break condition when shutdown the uart port Date: Wed, 14 Dec 2022 11:11:37 +0800 Message-Id: <20221214031137.28815-4-sherry.sun@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221214031137.28815-1-sherry.sun@nxp.com> References: <20221214031137.28815-1-sherry.sun@nxp.com> X-ClientProxiedBy: SG3P274CA0010.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::22) To AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8404:EE_|DB9PR04MB8316:EE_ X-MS-Office365-Filtering-Correlation-Id: c84fdd24-ae7b-46db-4ccb-08dadd813d6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R0Z3Mgk7w277KlVQ79l77KeYIDAUvWJ0Ui5p0ODhWtMqYzNucOenddw2f2LPv9xbu9N4w8ihcJmY0u0DK3ELeVXVAMmINhEt3of6QTLFcmrtiGIDECKLwPArQGt8eUwsf1gR2fFeiCtyrgAhV7WGolnth69FCVHnmHKnIWai5dBKPnJ+UO/128RVL/MiYA7TLgUN8fyK0/e6uJAWYCFvKxP/IuCj1zurJzSeXwaEkcNI8vjFlzD/XPSzp6JBs+KqWWQEV+nKwcwFFKLI7UJZNLKkDxpbJDH86RdQhvuKV23WB7Tz4kFBoziHWAGAVuhUQKwyEAbCPwxwhe28jcFqz/OR0YRWdqay1TE3xiRub3b9+EGzR7i2r9DT21Dz2c3/pXnhDrndOG9FJW8eJcXm7C5JyNhYmORfsnuiwHGsmFyXBAVoC09XrUTRCeVFG6xUoZ0ZNFMVBDF1dbtoeOSCX2ii9Ge8tvvf4R4pTC1flHp+yJoOJpsyec1SB0uUUM40vOj2MWPad9GrXAV2/2sq0vH28mvjuX8EhXg+7u1kH62coL7CeoYRX8FXeswJ/bYhslr2ZOZfZ0+oAE/y5DDgSPQn76x7G7rWUZutiKpd33hXHOxGXWmCwl+P5JjaGEKME4uvQSLBMsogAKkxHFVdy6I2aOumCMEt5A0t3VLYopJSFuBFI0jAxkE9x3OB7BL13ypqjDH+dnjTUdks4HaFVg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8404.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(136003)(39860400002)(346002)(376002)(396003)(451199015)(36756003)(478600001)(52116002)(44832011)(6666004)(41300700001)(66946007)(2906002)(38100700002)(38350700002)(5660300002)(86362001)(6486002)(2616005)(66476007)(1076003)(6506007)(8676002)(316002)(66556008)(4326008)(6512007)(186003)(8936002)(26005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tfDYCHQHHm5SR6tpHmbbkwUrjNIGU0OUbwbrRLfMAbDHxPX2ME35bTNqRGwHmUzNmIB0JGEznlMy4YGg1r+Ma96qxQQ5v6P4E3lkJpXR0j1297NDaa5pyfm0z98+lmonyHBiQ1eJI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LFjO9nqo3xzyQygCWtaqiQcAriKVEownbo0qyLLWA5ukpbir0Drr+8SslI1viZ9RcipZ9O7gmvzIp24qkBXEx/9Bg+oDcve9ACk9vfo5wz+2w5lLThSbMSZkshmG+g7TV+cE4p5cF9RRJyLfqRm43UWjaeF5vz/wZhqKKY54Y/q9YeYXslcDoO7wPC16AWj5FxjE4db3bNz6+WPyBsW/pFWghWGhFvLlWYyiFdmgdsQ93lswSUSrUb0Oc5KxPhh17obT5wiMjomycbESJOtv8aUSZv+BtC0U15lIcdauDesBuZQKHMMAT7SMSnOjBheAzBZ8m7SH1bUNJPxRCDe6zWT5ne3PCMPnGKzHPHrGKKcmXrauiS83/z3oZ/ZzIwo8FaaRdcx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c84fdd24-ae7b-46db-4ccb-08dadd813d6a X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8404.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 03:13:58.0835 (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: nOXE1OjpiVSNeBNZu9JjRBbD0Vx7wAhLqiDx3rOdTLda0KVXONco9WWsg3UWFfk3MfAcD7Yc0InxzvdKiWH7tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8316 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The comment in imx_uart_shutdown() says to disable the break condition, but it doesn't actually do that, here fix this by disabling UCR1_SNDBRK when closing the uart port like other uart drivers do. Signed-off-by: Sherry Sun --- drivers/tty/serial/imx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 757825edb0cd..74c9e68fc3bd 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1564,7 +1564,8 @@ static void imx_uart_shutdown(struct uart_port *port) spin_lock_irqsave(&sport->port.lock, flags); ucr1 = imx_uart_readl(sport, UCR1); - ucr1 &= ~(UCR1_TRDYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_RXDMAEN | UCR1_ATDMAEN); + ucr1 &= ~(UCR1_TRDYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_RXDMAEN | + UCR1_ATDMAEN | UCR1_SNDBRK); /* See SER_RS485_ENABLED/UTS_LOOP comment in imx_uart_probe() */ if (port->rs485.flags & SER_RS485_ENABLED && port->rs485.flags & SER_RS485_RTS_ON_SEND &&