Message ID | 20231018174840.28977-6-l.sanfilippo@kunbus.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4963941vqb; Wed, 18 Oct 2023 10:50:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxnRMJk7UTNsl9o3OtP4NdHWke9x4sFv0zErHbkwIPt/IQTNVy9X/PanDqnxRObso9DDhy X-Received: by 2002:a05:6870:1cc:b0:1e9:e0df:eeec with SMTP id n12-20020a05687001cc00b001e9e0dfeeecmr62981oad.37.1697651412872; Wed, 18 Oct 2023 10:50:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697651412; cv=pass; d=google.com; s=arc-20160816; b=zT9uK0M42MIcl/4ELc5n24QHHAezV4nD98uCk8iRyKX3YKB1CZFyoMv1zoVNotnM6p /Nc70ObsGd1ThM8KAeug4sgPHKQXO/83DHh480lbRmaZFQdDwesUkoQHugTukVPgeIy7 JzMklduGoeVfHzTRFIUmPLrosFLvVXSxcyFz0o/WALQ/EAhxhB6CEyk9EpkxQgvz/cGk MNPS6FzU7OBpHjb9AU9TZjByNqlfFwRmfnCFbbZlbxFaIJlqJsyJV5vU9OY7PLNT2dj0 uk7vR3P6/eBe7OBM76exIwhIpoxo+w7R+wy2ntRXmKeoUVBzGfPeet7oPMRgdpULaAWD 3O+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Jty28h9E0xtb68sEWjbyY0P2pj9xkcJFJp53NmKQG+U=; fh=TkiyChPg6bbF3HR9T06bpNLcepPHbldn/GrIZCqgMvI=; b=rtc1GkDtxeLbE4hYQbYMJ9LYZyo+72iYsO+eELOfky1z/k4+Cxhkt1bGETqz/jhGC1 z3/CKwxp/BdCjjlXpbWPPtyVMH2loKxDnboYtugAiNb6HV8vcCJIjSE4vwgZLnf/alz/ MzLb2N7DG/PSCol0rQL1Ktf8QUoC/RL4NZNfuWAqbK44k40WUeaUnrXSrFU4nS32hPx+ DG5/ppfnNp9icYprtKMEM10moExUedmAJaPIztkUGg7Ekcdhu23pC4Qv7KG/kcl5uEZA 1HIynAX84CtyZy+wmKYHoZXa4kIWoW733QsCY5LzstwXkU6KDsztB/c0HeTRy5qL4jJI KsbA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kunbus.com header.s=selector1 header.b=l+eAnmdu; arc=pass (i=1 spf=pass spfdomain=kunbus.com dkim=pass dkdomain=kunbus.com dmarc=pass fromdomain=kunbus.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kunbus.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l190-20020a6388c7000000b005ac8d44bad5si2501596pgd.7.2023.10.18.10.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 10:50:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kunbus.com header.s=selector1 header.b=l+eAnmdu; arc=pass (i=1 spf=pass spfdomain=kunbus.com dkim=pass dkdomain=kunbus.com dmarc=pass fromdomain=kunbus.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kunbus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 27B9081B94F5; Wed, 18 Oct 2023 10:50:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231772AbjJRRuF (ORCPT <rfc822;zwp10758@gmail.com> + 24 others); Wed, 18 Oct 2023 13:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231354AbjJRRtq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Oct 2023 13:49:46 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2047.outbound.protection.outlook.com [40.107.22.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44AC5112; Wed, 18 Oct 2023 10:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Om64yqT6QtA9XIsqZl0GfdomHbPCvLmoyO5UJksiXefv+C7xZnz56ivs7UcSrPxufXZZfXYb9wYyUjO+ozf1qb7aeiA/4r0CDBmjkJ3pEMvBvPGQ2JUV6Mc1n3l8klSo6dzpBGE6oTk07tPLiynW15OjpdC7Hx/Is+phGPiXj9cRGayY8vrnh7cSLRgvBmF2/iTYbAtwyMOE35olNZIreaPr1CLSFrl6PgFPU/Hobhc2UH0LLj6ilLURX2BaV9ZjMUVfGcHMDDU9HpmgjqyualrwtjLtf4Tgv6alNaqF7dXzfQ0pyuUmKHafS5OVjJK8++1UH5CQ4dxpcqaTYJ5Etg== 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=Jty28h9E0xtb68sEWjbyY0P2pj9xkcJFJp53NmKQG+U=; b=ge58wig/MMVgy57YNCIPSYsFAllTU4SLFRV+d5CFrCMWvYzG0N/evARgUB5jZyR3IRKPbZV3EATXXYBkAHivr0mI99W7nmBhZ4y1xFwGHaJaR4KogI6MC+wESk9GjTGsfkM/NeGAlY9oM8wvbZeDQS0sTKZdBtL3n/UuNjVqJ7H24VjAYUONBQnmhkoPwJsCrtWZiBP5Lu7NrhFXGwV4sBHsHSIjYjxzpNqvAf8Z5fBi44swP7ceD0AJzYtRHmkEc0emccsc4dvGkvXmjKt8kejtHua6AY98IQ9zeznTClZYEyCTMlHJot+YjSPL/2hS+ccu8CUyCZeCEgVFnOs4jw== 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=Jty28h9E0xtb68sEWjbyY0P2pj9xkcJFJp53NmKQG+U=; b=l+eAnmduG0YpjI7aCljrJG9ORqd+EBhRFaBNSFHsgMY/W3ifBygnYLNOyANpNWs2mIKB9stP2MMIr0ESYxoeyZcnB8RjkAmOvQkNcW6dGh9Pyb+PkM1aBWKC8dnyAtDXamoF8EiBXE9HDKqqggNKOf26pGtkMd7zdYEg32j1EzU= 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 AS8P193MB1478.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:350::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 17:49:40 +0000 Received: from VI1P193MB0413.EURP193.PROD.OUTLOOK.COM ([fe80::550d:2425:c0ed:3e59]) by VI1P193MB0413.EURP193.PROD.OUTLOOK.COM ([fe80::550d:2425:c0ed:3e59%3]) with mapi id 15.20.6886.034; Wed, 18 Oct 2023 17:49:40 +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: [PATCH v4 5/7] serial: core, imx: do not set RS485 enabled if it is not supported Date: Wed, 18 Oct 2023 19:48:38 +0200 Message-Id: <20231018174840.28977-6-l.sanfilippo@kunbus.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231018174840.28977-1-l.sanfilippo@kunbus.com> References: <20231018174840.28977-1-l.sanfilippo@kunbus.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-ClientProxiedBy: FR0P281CA0130.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:97::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_|AS8P193MB1478:EE_ X-MS-Office365-Filtering-Correlation-Id: 72b92e88-ba23-4c86-a918-08dbd0029a22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KDOMFT4bE62M04KLes3Y92TMGUbPgcsnfvRWdFlzkZIKiGR/fVnfZ+0HitHq3GBO2HL3/piUfbry6ujuwqEkTxtsKk76vNT2nVMF7ZUMi8rmjYciqRVr5VIlVAVoIDSOKX9KaSXo+XgWEyf5LOsyHf8/hGfmCSDqj93vfbk8amt1o3qcNSQgcEyKrkWsJnsTSqHwAlQMX610Dfw37vKTlnu3QN1v7qI1browjrcV0XNXTGTHOcmMgU3ipoBYI9uXqq8bx4YA0Z3jthW16zbCRvrXlvbqofeG/ad+5kdf0z473fRF6h/Bkj6RR0RDFZLbIJIKpvrdn9TJ3/yzW4grkK2KvjAB4SqFWFpQwv48K5s3mt2o9XkQQXAufLVpqFbJk4Z2eTrhrETJ8a1VKFg1E9jv2ToE4yDX9QCWROIXXGHj7HrRZ5maPPnq6t268dCS+Z+iKu9pd5uzuQxKcOlFdlWNFBT+2Bz5uiLVtPx5v/nLnEI6nm444GHJBdX6/0tHmxQdXLDr9PbV8tdxAPjVHzwknSZwuo/U1iaGIK9oAs0QvYV/HdEiZF+r/nuSzgdk 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)(396003)(39840400004)(376002)(346002)(366004)(136003)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(36756003)(66946007)(66556008)(66476007)(86362001)(38100700002)(1076003)(2616005)(83380400001)(6512007)(52116002)(6506007)(7416002)(6486002)(316002)(478600001)(5660300002)(4326008)(8676002)(41300700001)(2906002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?U+0r05znMH5+SvnOv9rbFGY+CteN?= =?utf-8?q?WN8afrDfeu4ZtU3mKZKT5Fn8qWVjlLchBYcLPfJQto7GPgR6wWKDuX9McgtHDHugo?= =?utf-8?q?IMNXju1Q6SHsNAT4z4joCsMfcgIT8xNRU/2ZNXJFHxIYzNHX9OkTGYCmukTAAXYEJ?= =?utf-8?q?YG6Md9dcopW+9brzJc9b8c5zm6tpuOOz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j+iyYPcgnoZuswjzf2XArJgSpyynEaGBr2JKDRyr+7yru/aSXxn?= =?utf-8?q?OX0OnHgSX/IiWeZQyQU5BMzEjtW3WgoucfzhdeDgCYagONsYBAWbCWKHKr4mGaWZL?= =?utf-8?q?kw3Oruwzgge0tySWDvVC4ZswN40urISCqw9P4+yYiqizZ12njRySMUNmrPLWWyhF2?= =?utf-8?q?YvJq4bCgmRx6uJ0p7FxmtVZSQlWjYYMdQqDCmLHP46EMtpycB2Uk/Se6QmHDLace8?= =?utf-8?q?B3Z6lhtMjcYtQ5TdXpfoOVvAMPmeR1fO5OS/ICZ4/V2vW9COu05Pnjliv2aaAqGtK?= =?utf-8?q?DqXwOQw1t7cR/RTCY84co7RBBHhIGPEXL4JcGepxNYmTmIg1sJACxlTQX9TBaN4oQ?= =?utf-8?q?q1i05vsqfnstpBM3vwzOLDo6sh2lj/BZTO5HU47T0Ia6L6x8G3BK63//bhXd8SxN5?= =?utf-8?q?4Z8x9VIZl/TRNRoMW11xN2up9bSdd6mMNir3Vfyo+FCOJcfrXDmucZqIJfdxz/td8?= =?utf-8?q?jUtcDRI5nFiFlFfUJNfnyzvJnnuBS0c0Ss2fZ1mAOp2osNHkhJsg6uMH7eOBqvZfj?= =?utf-8?q?MLOSxp62qo+?= X-OriginatorOrg: kunbus.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72b92e88-ba23-4c86-a918-08dbd0029a22 X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0413.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:49:39.9162 (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: 0aP0OJ5xQjQtUKhP3as4G8AuHwhn8gk4iza0d9j7nnK2WyXfZ84qJSd01bT29XU1hDGVTaluT/FLHhM7pVfl+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P193MB1478 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 10:50:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780116527820039147 X-GMAIL-MSGID: 1780116527820039147 |
Series |
Fixes and improvements for RS485
|
|
Commit Message
Lino Sanfilippo
Oct. 18, 2023, 5:48 p.m. UTC
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(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index edb2ec6a5567..c8c19bf8585d 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2332,10 +2332,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 49dd5e864719..c85275a573e3 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3586,6 +3586,9 @@ int uart_get_rs485_mode(struct uart_port *port) int ret; int rx_during_tx_gpio_flag; + 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) {