From patchwork Mon Dec 25 11:35:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 758575 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2052.outbound.protection.outlook.com [40.107.7.52]) (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 149EF52F8F; Mon, 25 Dec 2023 11:36:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kunbus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kunbus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kunbus.com header.i=@kunbus.com header.b="no0UPUwQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DFMvX2cqB4MV0caLkGCbYe38JMLpp3gOkodkG7o8LkCohpkAZ4hKT0hJKCbIQ5N3omFJcctyCguqgc8zR+od2KKs2fIeEk5pwAOJhtJ7bXRg6Wj0qwxdIXM+rI7MTd+zkd1yacd9PbVS4tzqwGiAhiIBKTYWkG9iure+addGErnt1TGdP4qE7J3guOXd0AicI2kqkQB8dkbB9b2RbwmyVpBhMy5qSvD/3BbfkQ1F8if86E5yPWD05k6JnlaQhOCczdOp0qmdp6+2RoWGgKHi0IKPF8hXVA7q6yVbCvR8A3v0dz/3PE3QVj4j8RjkH+huZXu1XOidXcMUb+7IhbDpfA== 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=/ROGmuOC2TLqjECCgazHB9VmmEt4XgeMwjvGKQa0cQI=; b=DS2AiYxJCcigOl9SWHlQJbSjNDZHdkZY8AIkRK8DkfS0vdcNblNRQamMApihyA4s5TQUBT8lq+xB8SWumnhSEXTfVIXYFxyhmMP+v2co+Cwq6S3gliDLz6BBMWfJ2jZQhiJ2PhDC8KYlH/gB3ys/sapzwFG6sUqYNLsd3R3kO+l6Z6jbJbzRnUyFqJxTVhea6UTZHeD7QtiP1UZmcVjNOEWlWoYhsAbIPH05K5surnjoogHE9wbOyMKJ24zHL00cbcUqAZmnJCzwCNTmjMXxJamcM+zSlkoxxXXlgOKzvDhF2dBNjFSBL8PNZ9WWGkt6TOVf3gbWED8FJt315M4BWg== 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=/ROGmuOC2TLqjECCgazHB9VmmEt4XgeMwjvGKQa0cQI=; b=no0UPUwQ6FA6scLTzxETjAPz8yXSmAp//CSh2wr+8G8g/7dqcTvVB5NdIXe601as15kztalLT7PptROvgsZMjhZTjFqDjQGSC3+78pcMtudcNH1wdQn5v7YowiSRV9qNDA8s64rTlh/j940j4tHdgZXoEWreyd6Ll8W8b0s9nRw= 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 AS8P193MB2061.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:44d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Mon, 25 Dec 2023 11:35:56 +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.7113.026; Mon, 25 Dec 2023 11:35:56 +0000 From: Lino Sanfilippo 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, hugo@hugovil.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com, Lino Sanfilippo , stable@vger.kernel.org Subject: [PATCH v6 6/7] serial: omap: do not override settings for RS485 support Date: Mon, 25 Dec 2023 12:35:22 +0100 Message-ID: <20231225113524.8800-7-l.sanfilippo@kunbus.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231225113524.8800-1-l.sanfilippo@kunbus.com> References: <20231225113524.8800-1-l.sanfilippo@kunbus.com> X-ClientProxiedBy: FR5P281CA0055.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f0::17) To VI1P193MB0413.EURP193.PROD.OUTLOOK.COM (2603:10a6:803:4e::14) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1P193MB0413:EE_|AS8P193MB2061:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e8ec249-c1a4-450b-2ab8-08dc053da808 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vx2UV8R5h3VLPB4KJlIRch5nVKThQ9aHSrs32vQcxB09mHjEddEiFH5N4EHIhbp9g+SMf4HJbatuj9jrgKP866ljcmRf2rbU7jXamIHO7t59FEktR09Z0qQhgWqqlSj2Km4m3g3mK9XdNGNrTTVuPnh9+lE1elfPAseBiUCBrOG6ZhY7Q1f63odIBKZilF+VtG+SdgjKaiqalAxdFCom5Nvotx4WUopsagJJZHiUYqhgDtbgwUnbHowNO5HvStKezAs9Ajb8JsHF3XsrER+VvJ3xk7MMj291b3AdV7WY1ThyI+xgPSzhpSJcK0vbhhY4PgOPFGXFX2oRANcw/B15yqnJtUUzr3AaAET863QFe+bGrzFLdbEc/zxOre91EZfLGI267eDP9bnmqU/aANWbSloFwmpuyqrQdg0y8yQrVk4XOqa5Vc7VrbxqfTRAvlRvQ1FuuQPzoGjv2eXMhbf+NpJZ49Kj0qHNbM64fh6NOKRyGa6xD2UDRlAumilMk9pmZ7SmBMkOjTkrzgHPN/AzCu5yxvAQvT6bxNzyMBqmwlFTn5EsRmtIo2cbYa0hw3RX 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)(39830400003)(366004)(346002)(136003)(376002)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(2616005)(6666004)(6486002)(478600001)(2906002)(8676002)(8936002)(5660300002)(36756003)(7416002)(52116002)(6512007)(6506007)(66556008)(66476007)(4326008)(66946007)(316002)(83380400001)(86362001)(1076003)(41300700001)(38100700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2TlGRWmsH/EkwMNsS1FPAce1CRSDyYmZ98XMFI76VFzms6H9xBeL+12GfPaFMsauB16mJ661Lko2tcSDNPfXwdfFwS5wl6cLJir1bZTlj4gtENySeg/B3XeX8lDx7RHO3wsZ+oJwT5qhKIKikO8erNgI74EiE8xLXtS9cQF/1BXlFiTUqbebCVaWDE9rzT3PAz8s12o7EIg3U4gDu50EdnY7Hp5v5AftflpUH+KC9JB76qN+XUBIgcv+TXuL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uZCPDCvHeCmNN/2vbFJCMGthEjGdT5VYmibc3ngoI3yE/IUjEl87ZgjxkbMGXMT7MpoGkiJ9g3ZYk0nfr19gfJN6Abl6sxhzW1FYR+Fu6RGK+5eHT0qJg+s3aN2iS1XYP7/yAUt9YA5LkDeKbe/rBUmeibEFdLPXcickuINjfgRIOPnQRqgDzPOZZtVFuN3Btbp97spltTQ5087enkAqL7zdWzt96dnMehDKmRBMieJB7CnN9CSsOyI+yqh5XcecGhBTATF9pYMbfgPr8LWiCpcI+mas2Y9ccbqH14mhwEHYTgihnJpK+9oxEVjzJ0vQ3TWqwV X-OriginatorOrg: kunbus.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e8ec249-c1a4-450b-2ab8-08dc053da808 X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0413.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Dec 2023 11:35:55.1328 (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: jivhMEjxjQ7hctgKLt4/1a0f4GQMAzY2ydnYFwLA5+VZKIs/M78JN9XKJsq9iwnyTvzYXb2zQ7bvdhKaBWOcIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P193MB2061 The drivers RS485 support is deactivated if there is no RTS GPIO available. This is done by nullifying the ports rs485_supported struct. After that however the settings in serial_omap_rs485_supported are assigned to the same structure unconditionally, which results in an unintended reactivation of RS485 support. Fix this by moving the assignment to the beginning of serial_omap_probe_rs485() and thus before uart_get_rs485_mode() gets called. Also replace the assignment of rs485_config() to have the complete RS485 setup in one function. Fixes: e2752ae3cfc9 ("serial: omap: Disallow RS-485 if rts-gpio is not specified") Cc: stable@vger.kernel.org Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/omap-serial.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index ad4c1c5d0a7f..b563c109caa9 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1497,6 +1497,9 @@ static int serial_omap_probe_rs485(struct uart_omap_port *up, if (!np) return 0; + up->port.rs485_config = serial_omap_config_rs485; + up->port.rs485_supported = serial_omap_rs485_supported; + ret = uart_get_rs485_mode(&up->port); if (ret) return ret; @@ -1604,17 +1607,11 @@ static int serial_omap_probe(struct platform_device *pdev) dev_info(up->port.dev, "no wakeirq for uart%d\n", up->port.line); - ret = serial_omap_probe_rs485(up, &pdev->dev); - if (ret < 0) - goto err_rs485; - sprintf(up->name, "OMAP UART%d", up->port.line); up->port.mapbase = mem->start; up->port.membase = base; up->port.flags = omap_up_info->flags; up->port.uartclk = omap_up_info->uartclk; - up->port.rs485_config = serial_omap_config_rs485; - up->port.rs485_supported = serial_omap_rs485_supported; if (!up->port.uartclk) { up->port.uartclk = DEFAULT_CLK_SPEED; dev_warn(&pdev->dev, @@ -1622,6 +1619,10 @@ static int serial_omap_probe(struct platform_device *pdev) DEFAULT_CLK_SPEED); } + ret = serial_omap_probe_rs485(up, &pdev->dev); + if (ret < 0) + goto err_rs485; + up->latency = PM_QOS_CPU_LATENCY_DEFAULT_VALUE; up->calc_latency = PM_QOS_CPU_LATENCY_DEFAULT_VALUE; cpu_latency_qos_add_request(&up->pm_qos_request, up->latency);