Message ID | 20231119112856.11587-6-l.sanfilippo@kunbus.com |
---|---|
State | New |
Headers | show
Return-Path: <linux-serial-owner@vger.kernel.org> 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 5A533C5AD4C for <linux-serial@archiver.kernel.org>; Sun, 19 Nov 2023 11:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232100AbjKSLdh (ORCPT <rfc822;linux-serial@archiver.kernel.org>); Sun, 19 Nov 2023 06:33:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230444AbjKSLdT (ORCPT <rfc822;linux-serial@vger.kernel.org>); Sun, 19 Nov 2023 06:33:19 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2065.outbound.protection.outlook.com [40.107.104.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6304E19B7; Sun, 19 Nov 2023 03:31:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EZZO99TYhUAuwAU/VRsfU4Y7Mvt+DWVKX5PpufP9z9sFE+tZQ0Y4xRwAKeYlI1gEMc6vCz17EGw5alIxdhMdQBTThErUvqLVBCKlA9xNXhODq/0y5n6uIciZQvSvcH3GG6xelhSnRUfIdHjCh9mvxK2k6YA4qok86r0X1Yg4WB1ZzMqaWBT79YjLvRX6cKs73zmiLky3M0LmVFCSyojhXpRStJBKrejuJhFJJTDZu5AA9KmXOUYHFPI/Sjl9y6dqF/xeW8WyhmCuwXv0PBVToBLPlru1tOHwFwmCtIFaeKgmHj0ksx/nwveF6RotZofZPDrTicTa5JH3mdZAT17ZVw== 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=K+1MxCDAL+VXAwZ1w1tZbusxF2hjn3qObDdr33XIjkI=; b=moTK5RxQmomR3mOjqSF3yMEcFjtptadirU20qzvYVqi74AKfIhKU2nnAbm4WkzjDnceSojs51QGC8hFSZo4M5dKegHePPrfvzctfAxJNf1KdkpPzJ5/1iamSK0WR8RAOFaP37etfRrvZcrK2mCZSS9izok9WerH+QHG/Mew3Oi0BjqQxe4HzvMy3vQ8ra4g1hONXLR2EAOWpx7ZL7comV3mis/Wmq4AFzHb8R4L2fOIo1stz/jj8HwQ+OjKZydeKEGNF4P8/bP5613LIT/cZm4Amq9XNjjCYb2kxQ769TBNe/UmUmcfqRqJFEb2nDiKNrm7M8zDeSSY1nSN53OKJhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kunbus.com; dmarc=pass action=none header.from=kunbus.com; dkim=pass header.d=kunbus.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kunbus.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K+1MxCDAL+VXAwZ1w1tZbusxF2hjn3qObDdr33XIjkI=; b=D34l9eQNS9HV75e/oog0ZDLfiw90Q+PNZN2RTojKky7+EwvjLR0v7k2U6wuIa7+OsRffbMZrGCjcdYdvCJYT5yO8GWTJKjU5F9frqjo0iLHXqwPZ4C1jPPNEaf3Sg2MAPFzgSgG2tKXtLIs7C5+HzDB2QSLc4tQP6ifA/lDxBTE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kunbus.com; Received: from VI1P193MB0413.EURP193.PROD.OUTLOOK.COM (2603:10a6:803:4e::14) by AM8P193MB1060.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:1e5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.26; Sun, 19 Nov 2023 11:30:01 +0000 Received: from VI1P193MB0413.EURP193.PROD.OUTLOOK.COM ([fe80::653f:d0f3:e7f6:8c06]) by VI1P193MB0413.EURP193.PROD.OUTLOOK.COM ([fe80::653f:d0f3:e7f6:8c06%5]) with mapi id 15.20.7002.025; Sun, 19 Nov 2023 11:30:01 +0000 From: Lino Sanfilippo <l.sanfilippo@kunbus.com> To: gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: u.kleine-koenig@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, cniedermaier@dh-electronics.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com, Lino Sanfilippo <l.sanfilippo@kunbus.com>, stable@vger.kernel.org Subject: [RESEND PATCH v4 5/7] serial: core, imx: do not set RS485 enabled if it is not supported Date: Sun, 19 Nov 2023 12:28:53 +0100 Message-ID: <20231119112856.11587-6-l.sanfilippo@kunbus.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231119112856.11587-1-l.sanfilippo@kunbus.com> References: <20231119112856.11587-1-l.sanfilippo@kunbus.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-ClientProxiedBy: FR5P281CA0007.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f2::17) To VI1P193MB0413.EURP193.PROD.OUTLOOK.COM (2603:10a6:803:4e::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1P193MB0413:EE_|AM8P193MB1060:EE_ X-MS-Office365-Filtering-Correlation-Id: 64c9931d-4f02-4340-29b7-08dbe8f2de83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q0LGHB0c7TTeM05ow5gD+ElnnQL/FhDSeVFQhodrWPZS0SwP7AzQNQP5bYlw+4HKxeGCN6FXOl7gKrShGUbOXRdt1EZy/q/Sx2BVnpUfMBQEZklWLZvWX1OGnb+gVwjc0fNzdR3+NSOfCycUrq33XJe7NIiY1wUYXwI+Ivi/Bq+3sU7hk3VX6x9jkCmOHqGs82qJN1fVG8yeaQfE8b9Ji1wiUtgPyOCUndDHQNTtCuv1F1bnkVM+Jtks81qGg12LAKY2avguv2ve9G50tW/vFy5JEgmylJxKO7DVJdNUKq0GlUZ7hBf/mzZsMY46u/3YekOlQwlKcSYnGzVZwdFCcXbuEDpWEZSf1tdAn+YTNnMiM5jqGC+h8Jnkk6ldlH9Q5+thPTDsz/ifi+D+b/iMGbrpXAYcoFCSI7vuaSmqkK+F9ZmNLPgkFi6wVotrKp4JBRtNsIUHZejQY87Ru6PJEZApAEfljwIYA7xGDrOyATDLV+36PGp0Kn81Rmy1DolcPSeGNjCGwlaAhXfBcJ2S/B1QIhF7rl5ic0BHKx0zJ2E9ToWbeSS1xHONi9XnNBNp X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1P193MB0413.EURP193.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(346002)(136003)(396003)(366004)(39830400003)(376002)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(6506007)(6512007)(52116002)(66946007)(66556008)(316002)(4326008)(8676002)(8936002)(66476007)(6486002)(478600001)(83380400001)(1076003)(2616005)(38100700002)(6666004)(5660300002)(7416002)(2906002)(86362001)(41300700001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?u08pylkliJKBLhRlkJ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RksdsRb5wA?= =?utf-8?q?VMSrai+McS5TclcI8yjF78RX8W4bcZtI6p5AdF+lqMmcWdv94cFeuhUPf2Vi2gE30?= =?utf-8?q?4/XJchiuZp17WyHlFcd/AY7eHtOEurOfWRyA2FpngB52JHM/HgHyDlSDBtxqfTMaw?= =?utf-8?q?JsEV2C5xGEKLfpbZOM+tsBOEV8ka3yk/JdPsxCm7L6eUMFqgv+F8p4+rdmk3MJZ7g?= =?utf-8?q?nHeBoCjWPPs8RCoGrjvqdopHIIoTIJugO7Re565CStt5SoCPe7XYtyi5z7LfxP9dP?= =?utf-8?q?4kNxss6fAYlIbNfpZ5pWVDmNkQZvYiGVnQhpiZCsk6pYl6N0uTVsQjEE9irtGwGmW?= =?utf-8?q?iUXs09P+SdjVMiPwrF2rJxjww3gynzh+WsOpzC6JY9JSNDxTgZNeWP6LQavWLrXwV?= =?utf-8?q?gLXFqB5ogVaHisvkzrzf3U01X7pNPGQghgJrvTgYKFoWU3ieg3ziebp+DZ3w1t/pu?= =?utf-8?q?FyQ7N9NpY8Lus7Cs/Lf6nsnst7+vEf4xCYAeErj34xWdoHqNbqSi/ikoSILt9XiHK?= =?utf-8?q?JTSljUcY7wfSU3lxOvAtYKHyROBbFa0L4svUo5r5lRFVqLv9xvyjyopwv7Q+5qPY/?= =?utf-8?q?9w1o80pJSqGjbcfuB08mh4pWyVuAs1qARM+JUEhConhUXeZtlsPBsVKTxjVD/jP4e?= =?utf-8?q?ubhjkXAUoQYa4EkSf0I1T0bjT5vdXLI5sfw4mHCx/TdkeXmMGmIOVWH/l7hr5LUjG?= =?utf-8?q?46BEvMsNSw1?= X-OriginatorOrg: kunbus.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64c9931d-4f02-4340-29b7-08dbe8f2de83 X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0413.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2023 11:30:01.7062 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: aaa4d814-e659-4b0a-9698-1c671f11520b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pPdr3yjCygk46Gx015I+queD7HnsBbnEMDZHMDEjI5HrMAfVD+qJWxtZ1wSA24RKSqFKTaJMUPthXVNzXrjkpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P193MB1060 Precedence: bulk List-ID: <linux-serial.vger.kernel.org> X-Mailing-List: linux-serial@vger.kernel.org |
Series |
Fixes and improvements for RS485 (RESEND)
|
expand
|
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 9cffeb23112b..98b78d360a74 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2328,10 +2328,6 @@ static int imx_uart_probe(struct platform_device *pdev) return ret; } - if (sport->port.rs485.flags & SER_RS485_ENABLED && - (!sport->have_rtscts && !sport->have_rtsgpio)) - dev_err(&pdev->dev, "no RTS control, disabling rs485\n"); - /* * If using the i.MX UART RTS/CTS control then the RTS (CTS_B) * signal cannot be set low during transmission in case the diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index b636e2ce6e8b..518e19036983 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3588,6 +3588,9 @@ int uart_get_rs485_mode(struct uart_port *port) u32 rs485_delay[2]; int ret; + if (!(port->rs485_supported.flags & SER_RS485_ENABLED)) + return 0; + ret = device_property_read_u32_array(dev, "rs485-rts-delay", rs485_delay, 2); if (!ret) {
If the imx driver cannot support RS485 it sets the ports rs485_supported structure to NULL. But it still calls uart_get_rs485_mode() which may set the RS485_ENABLED flag nevertheless. This may lead to an attempt to configure RS485 even if it is not supported when the flag is evaluated in uart_configure_port() at port startup. Avoid this by bailing out of uart_get_rs485_mode() if the RS485_ENABLED flag is not supported by the caller. With this fix a check for RTS availability is now obsolete in the imx driver, since it can not evaluate to true any more. Remove this check, too. Fixes: 00d7a00e2a6f ("serial: imx: Fill in rs485_supported") Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: stable@vger.kernel.org Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> --- drivers/tty/serial/imx.c | 4 ---- drivers/tty/serial/serial_core.c | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-)