From patchwork Mon Jun 6 10:03:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 12870210 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C10FECCA473 for ; Mon, 6 Jun 2022 10:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z/Dt8DBMIzT4yiIJYxGg4F88fCCr9ut8pIAELfJ2rAA=; b=1BSx/Bgh+cnxub T2rYRXJP+qCcR7VebwpeOY0z0XwXlQ5IZP+FjpiHAwG2nYHodcIhiPqY1qYmSYlTkiE0TAYN0axzr 1NXPvJYKW0aO6SP9VpzB+aDzVE1cBW0IdwX/ug9QoRCJsnGuRGnxfY7zHecjZzTuK7YjlsO6EcCWz X4Y+drw5sNpER0dIP1/7xhU5Tdmzh1fIkj/09sfrq15wlzEeAGG0ru3UhjGoBPzA1qLBHQ54LBEZ1 zOtPGRmfPejaA9h89yRUrg+ahujVjl0EZnd9Jjy1uw7yYZW1MfNP95L8FC4lWjQTlGdHFOgXsUkQR il+2jtGnV387s365nWeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9bx-000bHl-2c; Mon, 06 Jun 2022 10:05:25 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9bT-000b1u-Hd for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 10:04:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654509895; x=1686045895; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2Rq6Epv0uyMLUulCniZ8IRYQ84/AGOV0y8cwA8BYZnA=; b=YMW2+mUWWFtCYuTF3vwNO7CR+FjArAo9w8uRsF/kIbWDyBJZtzXEDfmR odeL/Gd7vWx3QVWAnl8Mh8fQ8hsgyusqYF+heSr0BwDhOa6KHL7Vluk3c dQMdfkxQoEXx1o0DGG/HxisI9vcc0NcqOpb9O/cw5CUAzb/DUBrihNuB2 L1ugdpRd/SOjuf5oTs5bGtRs6n6u3/hD3Z69Yxz/Z44vU3HQalsBUYUks PdP7Z4lC2g9g1a0GpJytuz8JztWfjzVCCd2ZnAPfRD9zPJq8YznTPF/uZ R/CtNA/ODt2js3cLMfU8MaEmFx9/janlJmY/1phfx4oDZsP7rSRUYW4+t w==; X-IronPort-AV: E=McAfee;i="6400,9594,10369"; a="339884695" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="339884695" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:04:55 -0700 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="635523402" Received: from amkossek-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.57.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:04:52 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 01/36] serial: Add uart_rs485_config() Date: Mon, 6 Jun 2022 13:03:58 +0300 Message-Id: <20220606100433.13793-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_030455_739105_603DFCE9 X-CRM114-Status: GOOD ( 15.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A few serial drivers make a call to rs485_config() themselves (all these seem to relate to init). Convert them all to use a common helper which makes it easy to make adjustments on tasks related to it as serial_rs485 struct sanitization is going to be added. In pci_fintek_setup() (in 8250_pci.c), the rs485_config() call was made with NULL, however, it can be changed to pass uart_port's rs485 struct. No other callers should pass NULL into rs485_config() so the NULL check can now be eliminated. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_pci.c | 6 ++---- drivers/tty/serial/8250/8250_port.c | 2 +- drivers/tty/serial/fsl_lpuart.c | 2 +- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/serial_core.c | 6 ++++++ include/linux/serial_core.h | 1 + 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index a17619db7939..fb0a49e39072 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -1562,9 +1562,7 @@ static int pci_fintek_rs485_config(struct uart_port *port, pci_read_config_byte(pci_dev, 0x40 + 8 * *index + 7, &setting); - if (!rs485) - rs485 = &port->rs485; - else if (rs485->flags & SER_RS485_ENABLED) + if (rs485->flags & SER_RS485_ENABLED) memset(rs485->padding, 0, sizeof(rs485->padding)); else memset(rs485, 0, sizeof(*rs485)); @@ -1689,7 +1687,7 @@ static int pci_fintek_init(struct pci_dev *dev) * pciserial_resume_ports() */ port = serial8250_get_port(priv->line[i]); - pci_fintek_rs485_config(&port->port, NULL); + uart_rs485_config(&port->port); } else { /* First init without port data * force init to RS232 Mode diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 78b6dedc43e6..d7384ab364d2 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3199,7 +3199,7 @@ static void serial8250_config_port(struct uart_port *port, int flags) autoconfig(up); if (port->rs485.flags & SER_RS485_ENABLED) - port->rs485_config(port, &port->rs485); + uart_rs485_config(port); /* if access method is AU, it is a 16550 with a quirk */ if (port->type == PORT_16550A && port->iotype == UPIO_AU) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 0d6e62f6bb07..509a7912fa9d 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2724,7 +2724,7 @@ static int lpuart_probe(struct platform_device *pdev) sport->port.rs485.delay_rts_after_send) dev_err(&pdev->dev, "driver doesn't support RTS delays\n"); - sport->port.rs485_config(&sport->port, &sport->port.rs485); + uart_rs485_config(&sport->port); ret = devm_request_irq(&pdev->dev, sport->port.irq, handler, 0, DRIVER_NAME, sport); diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 7d2094dc5a59..9ce09b81ac9b 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2338,7 +2338,7 @@ static int imx_uart_probe(struct platform_device *pdev) dev_err(&pdev->dev, "low-active RTS not possible when receiver is off, enabling receiver\n"); - imx_uart_rs485_config(&sport->port, &sport->port.rs485); + uart_rs485_config(&sport->port); /* Disable interrupts before requesting them */ ucr1 = imx_uart_readl(sport, UCR1); diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 9a85b41caa0a..8466181db4e9 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1276,6 +1276,12 @@ static int uart_get_icount(struct tty_struct *tty, return 0; } +int uart_rs485_config(struct uart_port *port) +{ + return port->rs485_config(port, &port->rs485); +} +EXPORT_SYMBOL_GPL(uart_rs485_config); + static int uart_get_rs485_config(struct uart_port *port, struct serial_rs485 __user *rs485) { diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index cbd5070bc87f..d3ebb4db2d80 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -592,4 +592,5 @@ static inline int uart_handle_break(struct uart_port *port) !((cflag) & CLOCAL)) int uart_get_rs485_mode(struct uart_port *port); +int uart_rs485_config(struct uart_port *port); #endif /* LINUX_SERIAL_CORE_H */ From patchwork Mon Jun 6 10:04:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 12870211 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84620C433EF for ; Mon, 6 Jun 2022 10:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iGs9KvpuPe8VosYOCgzaCmyBsIBbCbyebREDVuM5RK4=; b=LXmfwd+MN65Z73 c7sNExrKP7Zstnqmvu/hRreIiQSj8F5rs6/KFPu0k+IK68stLDGLJ8/1eGYT2a9QYZsqxfGgLmtmi Z5S3ZyzngHjYIJBJ+NeeZXro3CvJsjjtmGdLvPc43TVkM2pmTyP8sc9lSdS+VTMOtTAp/rbQXT8pa w8wHwVC1tadLW3hLfSCTASxYG07PBE0WI6ePq1I+3JhMU4d4mhnir48Saz67G6J71TL0I1YLocCWf RWvm/J3d0tEyG8pRkRngbkJZdjfHDhEQnWzBeKSlOc1ZjnrvoZD+z+YfUe9TYc2oDzDM7TQSbxM7a ErXxrLcJpPaPaL/7kkbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9cb-000bdA-1w; Mon, 06 Jun 2022 10:06:05 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9bh-000b8i-25; Mon, 06 Jun 2022 10:05:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654509909; x=1686045909; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7X5MPO2HXoQHC4qsFsROjNvsfaX0x10tatJ5YNAZRDs=; b=PXK6kRMlYHvauTIdE39K9jy1ca5QosF3nMxvk4f7s2ikWiNSPbN0LNl1 ISzTgfODiz0pQ6cGify3CXJx6bGJa1cdLQl/UsaNPykpP1RElSgBm7rgj jnb8JcTgqdGux61puNq+AsJWv6tQDbA/iYvhMMM1J0azm8E5oDt5W56oe ZK8Pb73DqT2UXa1hS2SmsvMWJAqqryg5ydrNpQxcpEgXkfQsIdjbsMmFg A2aQuhne8TazI4yq67OWQ71szm2R/R1HA6ilefC+ZP9q9PK/67DPxH+9D B9KvcxrxvmLnEjNcsss1KxK2SsbgmEXvZir2EFtZP7xKpMvG+yeBeLRj+ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10369"; a="275421035" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="275421035" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:07 -0700 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="635523506" Received: from amkossek-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.57.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:04 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Florian Fainelli , Ray Jui , Scott Branden , Broadcom Kernel Team , Nicolas Saenz Julienne , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 05/36] serial: 8250_bcm2835aux: Use serial8250_em485_supported Date: Mon, 6 Jun 2022 13:04:02 +0300 Message-Id: <20220606100433.13793-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_030509_162011_D393BACA X-CRM114-Status: UNSURE ( 8.39 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org bcm2835aux uses em485, fill in rs485_supported accordingly. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_bcm2835aux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c index 2a1226a78a0c..d9f1e618cfbd 100644 --- a/drivers/tty/serial/8250/8250_bcm2835aux.c +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c @@ -108,6 +108,7 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) up.port.flags = UPF_SHARE_IRQ | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_SKIP_TEST | UPF_IOREMAP; up.port.rs485_config = serial8250_em485_config; + up.port.rs485_supported = &serial8250_em485_supported; up.rs485_start_tx = bcm2835aux_rs485_start_tx; up.rs485_stop_tx = bcm2835aux_rs485_stop_tx; From patchwork Mon Jun 6 10:04:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 12870212 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D98FC43334 for ; Mon, 6 Jun 2022 10:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=E7wKPjK70rAF9OekzF5EmDyyhnE77A0dL+3cS6zd/tM=; b=v/DcqIgbhWCTgG Mo6n5OEkHxz26chMtKsIgq+uAT2r2ubG5Kh7hRa+Ds7W3ruYh57PJVZBTLujug64Tu4bV3hlMfMYi RPJGXmTHDap3VqTRtie4P++ftlJ9iZUf71M2pM4Npq6Q7pYiI1+1gWcmEX6627ycsnz8GXEk3Q/is uqUdeSjvsXeGdlhswn8MPQ3FrafbmU8oNVvfYJA/9HsAu0r1O7J7yVSyZOJ4AkrAfPyOmiKpnK/u2 20Rx1YL5lajWqaudtjKuz42e9gPeKUMlpnkhLHc5BwIizqIRCj4jXhLcI2+B/HUA1+wsOy8IvFYKq 3Nins/cGLyO5XLb8yhFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9cu-000bod-EY; Mon, 06 Jun 2022 10:06:24 +0000 Received: from mga05.intel.com ([192.55.52.43]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9bs-000bFN-6j for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 10:05:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654509920; x=1686045920; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uiu6/OhYYKXexbF3L+XQuHEeDHHGh13iJur0g7QkeDo=; b=hhMPAN1d/xXNiRjz6elxAEThcOlzP2FZU1AzbjCkK/arUBOP6bBreD5E wHWxiX2SyaTSakea6tJ4u7H9K3BxfelWm8gkm3o5FHXD958WCdj3nKqfZ uzf4apxSPAIQ1dzX4Hh8K92a/pNUnRyiGGwcVztJb77yXxZ3fcb0LEfGy vx5u0LgJeUdxyHhnz1abwGMuPkZ9lgjYTjqQjeSSCcg9BIr6h+v8NYEXe 5VDhglHSMeEpvT4mFcx354Ja56b5UkI9006ln2QlBYtmX2YDFt2QIlxqz XGR/Va8g2VknHQnEPXHuYlkuTwH7JAcvepJFuKJxqP0KOx26B+qIZ+I7D A==; X-IronPort-AV: E=McAfee;i="6400,9594,10369"; a="362987046" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="362987046" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:19 -0700 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="635523608" Received: from amkossek-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.57.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:17 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Vladimir Zapolskiy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 09/36] serial: 8250_lpc18cc: Fill in rs485_supported Date: Mon, 6 Jun 2022 13:04:06 +0300 Message-Id: <20220606100433.13793-10-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_030520_296716_F5A6B709 X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add information on supported serial_rs485 features. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_lpc18xx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/tty/serial/8250/8250_lpc18xx.c b/drivers/tty/serial/8250/8250_lpc18xx.c index 570e25d6f37e..66ce5d05fe9c 100644 --- a/drivers/tty/serial/8250/8250_lpc18xx.c +++ b/drivers/tty/serial/8250/8250_lpc18xx.c @@ -98,6 +98,12 @@ static void lpc18xx_uart_serial_out(struct uart_port *p, int offset, int value) writel(value, p->membase + offset); } +static const struct serial_rs485 lpc18xx_rs485_supported = { + .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND, + .delay_rts_after_send = 1, + /* Delay RTS before send is not supported */ +}; + static int lpc18xx_serial_probe(struct platform_device *pdev) { struct lpc18xx_uart_data *data; @@ -168,6 +174,7 @@ static int lpc18xx_serial_probe(struct platform_device *pdev) uart.port.uartclk = clk_get_rate(data->clk_uart); uart.port.private_data = data; uart.port.rs485_config = lpc18xx_rs485_config; + uart.port.rs485_supported = &lpc18xx_rs485_supported; uart.port.serial_out = lpc18xx_uart_serial_out; uart.dma = &data->dma; From patchwork Mon Jun 6 10:04:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 12870214 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B55B7C43334 for ; Mon, 6 Jun 2022 10:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+dNYXQ5H8he+s52RyRE/08fMJsxIiqhKVQxzF/hioh4=; b=0ghwTPWjeuV9pB ZKBZnhZtiCau1Wi+qpvrma1NmLFibnFQDEyZeCLJb3+XOOPWuc75vrzTVFEujlJVpo7QL60wSK31H dKTGMWEJguxm6hg0stYcv7Rm22cYAbnOHGoHaxMVcEvxMDNzeXH913RWf/AUYUa+PVB+2I0SjNb7y xB2LSZnQRXjtlEinZjyScMmOsbwSGrdwc/Cv8Is9LgVED/EjAUKuqNa6TUZ/UA7SfrMaCAbd4EfTd dJIy4IWy03C2OrWDaQwMhJzzeadotxHzOgRSwxATeCHBHTZCoJIlD5NDlvZdWX2yduphKoBAHfwfN i6s4SfSTVH9PJPCcH1xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9dP-000c4e-39; Mon, 06 Jun 2022 10:06:55 +0000 Received: from mga18.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9c8-000bNz-Tw for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 10:05:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654509936; x=1686045936; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WndMwTVfuW00rnE/S6LgTXND/zSnSa30GDTQqWRCwI8=; b=hHE2W06YlK+ItNQYMWYHY0U+xNz3LDnMX5WbYI8mjpL6eIhrjOEFyE7u 2l/m4ACY9Adl9GoUgt2qspaxuQuvYYBvFtl4OpsfvDmqiksEnNjUKKTCf CxcAgiKJPpw2+gsA3NWqzIeIrgo4vNeSAhu8iS6nDaTGJNaLgkNqi1sSS hbKGm/ZhN+Ic6u0WbsS1mBkMMvw3I94AFzjmzFEfm4jg1k8C1TDxR8D/4 TEEkoq+bOajzQ75hWF+ljINpwTrlbfgq8e/ukFIX7wDPBWZ4qePkDystN D6F9WyJDbwJCZqL8vAh3zY0SGMYaqLhu2uuB3CmG91V7rmFy+uHU2mG3e g==; X-IronPort-AV: E=McAfee;i="6400,9594,10369"; a="258916749" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="258916749" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:34 -0700 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="635523712" Received: from amkossek-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.57.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:31 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Richard Genoud , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 14/36] serial: atmel: Fill in rs485_supported Date: Mon, 6 Jun 2022 13:04:11 +0300 Message-Id: <20220606100433.13793-15-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_030537_164478_FF68766C X-CRM114-Status: GOOD ( 10.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add information on supported serial_rs485 features. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/atmel_serial.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index dd1c7e4bd1c9..74dd1d3ac46f 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -2473,6 +2473,12 @@ static const struct uart_ops atmel_pops = { #endif }; +static const struct serial_rs485 atmel_rs485_supported = { + .flags = SER_RS485_ENABLED | SER_RS485_RTS_AFTER_SEND | SER_RS485_RX_DURING_TX, + .delay_rts_before_send = 1, + .delay_rts_after_send = 1, +}; + /* * Configure the port from the platform device resource info. */ @@ -2494,6 +2500,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, port->mapbase = mpdev->resource[0].start; port->irq = platform_get_irq(mpdev, 0); port->rs485_config = atmel_config_rs485; + port->rs485_supported = &atmel_rs485_supported; port->iso7816_config = atmel_config_iso7816; port->membase = NULL; From patchwork Mon Jun 6 10:04:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 12870215 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C7C9C43334 for ; Mon, 6 Jun 2022 10:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jFJMND6O7SljyjXGMNQHEyigdTTe7AMvFqtTRHU0HBo=; b=WKaDBprTXv4B/f 27vQjA7SHkIjEA1LNts0t1KuUdlnYaEj2cwZxLYirGD3yz4ZE2MINAMSyMpkQSc4B/gGl5Tr6fHOT jIo1+hCmIrAQzI8Ycko3tFzBcRCigOBVB8lhq1RHaW649P+mvBG3AcMAROHJU2VTgyh64jr3Qt7B1 yifFg/dpvLxd9XaS0eRa6srNOs8/UA2pVRTLpbRHBuGZPBpvZD7h9Ognip1VyVN/9V+enufrpw8gl P9N3Oorr3Go1M3HsEMMa1SPRjiAcZ/7vPWFGCbzIVUIQ/4C5J2ezgW7N0lNIjBfRmgFdVicI/bc2J fSSw+YxF9I7ksCU8BKHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9ea-000cjq-7S; Mon, 06 Jun 2022 10:08:09 +0000 Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9cE-000bS8-Ea for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 10:05:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654509942; x=1686045942; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xfl+6OEZtY6tN3qb8+voitCmW0WYuA4tz0RJFqBgckQ=; b=esvgFIuWIW6a4zbf7G+QZjzKz04Qb8fvO4ucnffot1uTYbO8pOhjJKZ7 9AEeUaZMgcuFHLuIAUMvBGNOBNpL9GKzh0zT4PDIQ3BRTsuBqHa0kn71k BHtInNfISTn3l14H91vtNlz5XG7+/PPT/Ql3j4NCbUpD/tuBDOfT5beq/ dGnzORw6Gsu95glvnPMYR/Asp3xIdp0QcKnrb/6+OwtY55vJNM3112zhL QnNdYiWxU5jCdlbNk8Ce2JnopH7NZyp4+kgAa1Woi4eNMB7Z9iVi/fG6+ VaRA6SfN4nu6Cpveb5WkFosPvKxHl3c1T9MbMss4SjWJqeEkJMVT5EGY5 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10369"; a="276681741" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="276681741" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:41 -0700 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="635523733" Received: from amkossek-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.57.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:38 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 16/36] serial: imx: Fill in rs485_supported Date: Mon, 6 Jun 2022 13:04:13 +0300 Message-Id: <20220606100433.13793-17-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_030542_570803_5D02A522 X-CRM114-Status: GOOD ( 14.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add information on supported serial_rs485 features. In the case where RTS is lacking, RS485 cannot be enabled so provide zero rs485_supported for that case. Perhaps it would make sense to not provide rs485_config() at all in that case but such a change would have userspace visible impact/change in behavior so this patch does not attempt it. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/imx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 9ce09b81ac9b..ba853bc9b4db 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2200,6 +2200,14 @@ static enum hrtimer_restart imx_trigger_stop_tx(struct hrtimer *t) return HRTIMER_NORESTART; } +static const struct serial_rs485 imx_no_rs485 = {}; /* No RS485 if no RTS */ +static const struct serial_rs485 imx_rs485_supported = { + .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND | + SER_RS485_RX_DURING_TX, + .delay_rts_before_send = 1, + .delay_rts_after_send = 1, +}; + /* Default RX DMA buffer configuration */ #define RX_DMA_PERIODS 16 #define RX_DMA_PERIOD_LEN (PAGE_SIZE / 4) @@ -2279,6 +2287,11 @@ static int imx_uart_probe(struct platform_device *pdev) sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE); sport->port.ops = &imx_uart_pops; sport->port.rs485_config = imx_uart_rs485_config; + /* RTS is required to control the RS485 transmitter */ + if (sport->have_rtscts || sport->have_rtsgpio) + sport->port.rs485_supported = &imx_rs485_supported; + else + sport->port.rs485_supported = &imx_no_rs485; sport->port.flags = UPF_BOOT_AUTOCONF; timer_setup(&sport->timer, imx_uart_timeout, 0); From patchwork Mon Jun 6 10:04:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 12870216 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 342A0C43334 for ; Mon, 6 Jun 2022 10:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BkaLfndc3vteJVV8LxMlyt26NTbe6R5fMPgY8O+A508=; b=FWrSI21ZDmP0bB c7Olu50JodkkmFHWTXY/ETd1/5bLn1Ta3/cBtEvThKaGU/3aq4FdoQfcufyeE1BS9JLsZlbPt7j/j OAV/dmhnGp4wWo8tSwuQIZwmHlqHIR0TxhqtdsKt9Bc5TrdO3+MSdfq2jtnUVsimnqkk8bUjx/fQ8 gpIpNSwNQmRybh8UL7G22AuXWRUHOoqulnbI+WhtC4Tt8RbmgN93LF2G7nmJXStyfq0+CZ2jJcBIL FjUmnC9asLWIvIYi3Vk/mPgpyMaXfi8Mo+vlnblK9LlpW1v9F2I6dXFfsMOdLeYg+sdy2mJQj6Ajv /urp5I/3ZAQhvgUBY1Dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9fQ-000dB8-Ns; Mon, 06 Jun 2022 10:09:01 +0000 Received: from mga03.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9cS-000bZ3-I4 for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 10:05:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654509956; x=1686045956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZM/pEhOqDZJ2vEjEvweRMXHfCanuCKshhfEXaADs/+c=; b=N6EEUbPGSKk+3XbEX0IjJLdPZzn1UkgX3jJ+XFs0Q/f99hDr7hps52iV K7dY1ndy2OrSFGxoGlIC+z7B+g5K3Ef40oChYOp/obvLq5jS5ecogMHhm j4SlFTBskd1iJ08CFcrwahBUL7m3WoKtoRNtun0xO3fg+B336mVVPnlL4 yCeMzjrhHmF85LJI3+H1Vhmkycmz1z5+BQZZvm8cbIC+skTkSQprIVjFF eAM+jqGPbzFfA3TJgxD458wapyvKsmZb9lCwFaDjxc60cw3gOEdVL4OG3 LZgfALBJhouH41VCrPAdE8+V/yNsCyhROSEyp5zLyiMWVWJqxBmyGsz3k Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10369"; a="276875856" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="276875856" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:55 -0700 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="635523787" Received: from amkossek-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.57.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:05:52 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 21/36] serial: stm32: Fill in rs485_supported Date: Mon, 6 Jun 2022 13:04:18 +0300 Message-Id: <20220606100433.13793-22-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_030556_714317_18960E92 X-CRM114-Status: UNSURE ( 8.86 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add information on supported serial_rs485 features. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/stm32-usart.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index b7b44f4050d4..db3dd9731ee1 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -1375,6 +1375,13 @@ static void stm32_usart_deinit_port(struct stm32_port *stm32port) clk_disable_unprepare(stm32port->clk); } +static const struct serial_rs485 stm32_rs485_supported = { + .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND | + SER_RS485_RX_DURING_TX, + .delay_rts_before_send = 1, + .delay_rts_after_send = 1, +}; + static int stm32_usart_init_port(struct stm32_port *stm32port, struct platform_device *pdev) { @@ -1394,6 +1401,7 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE); port->irq = irq; port->rs485_config = stm32_usart_config_rs485; + port->rs485_supported = &stm32_rs485_supported; ret = stm32_usart_init_rs485(port, pdev); if (ret) From patchwork Mon Jun 6 10:04:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 12870217 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2AE5AC433EF for ; Mon, 6 Jun 2022 10:11:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KE8/nCt4ftyjs+y4xdvYwCwtEk1FdgolCqW17TEsKiM=; b=FbGVl+ZDzVrO6w UibdZB72eAQMelEFJ0ecFhsUMDtYJYIqlewhmfqLG9bFDt9JokJplEAF1sC5lcYPJsbYJFPVIk4Lb YJrsRdK61zz/s6GS8V3OC5bf2DyoqzWFIuF9brXD120d/bGkeCMn+aHuAPoPU1MM587BtfDuNxKfz qiZz9kJfoWAjS4QgbV9lIClbifYvBOPg1B4Rpcg+up4wK55MeVCcRWsc7AyJqXsNhIcc5ztfJODnQ xWLvndQCrUaGe9FQCzKjEmuy5XhpN8n2QaP29pP0ViwQRXIy6NjKA90AJ+nl9Mes6WRs02DcepeLH Zq9MoEy7mEy7PO0zcV7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9gM-000de5-Pq; Mon, 06 Jun 2022 10:09:59 +0000 Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9ci-000bhX-IG for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 10:06:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654509972; x=1686045972; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AqwC+FxddxhYwSjVH6EJblIR6L9xqWvygg7hjybJuBc=; b=EDtK9dCayGucEKOKhm7p57tuZteo4Vfnp6oTx2AINk7fELcsqZRb7Vnu SEjEy2EFLriJZwRzogfGtC01yJCv2vDJrFIFxMYQAlgrXae8xi0pmmmy2 kD78C7VPnSvzKwcN5ZP+UrC60E8URdfquaWeSkJSELVIRYLULoqoBijSh TjCgQS5GQ97wXu9Z1nyyeZ4x/Re8Wf7xnXo1V/X+KGO7USG8RTgJ91cXG fn6XN2m15wXHDphFae514EEDUpAGEdsFfYpp7FBVZW92Wcmtnbqv+kjLo 0vHjpTgyLCLPF2jqKbVDLV/GxOVN/rGFTETIXYXS3gsqmAehmErPPTKxQ Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10369"; a="276681774" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="276681774" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:06:11 -0700 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="635523845" Received: from amkossek-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.57.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:06:09 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Vladimir Zapolskiy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 27/36] serial: 8250: lpc18xx: Remove serial_rs485 sanitization Date: Mon, 6 Jun 2022 13:04:24 +0300 Message-Id: <20220606100433.13793-28-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_030612_673177_A69E0942 X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Serial core handles serial_rs485 sanitization and copying rs485 struct. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_lpc18xx.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/tty/serial/8250/8250_lpc18xx.c b/drivers/tty/serial/8250/8250_lpc18xx.c index 66ce5d05fe9c..3a1cb51cbc91 100644 --- a/drivers/tty/serial/8250/8250_lpc18xx.c +++ b/drivers/tty/serial/8250/8250_lpc18xx.c @@ -40,14 +40,6 @@ static int lpc18xx_rs485_config(struct uart_port *port, u32 rs485_dly_reg = 0; unsigned baud_clk; - if (rs485->flags & SER_RS485_ENABLED) - memset(rs485->padding, 0, sizeof(rs485->padding)); - else - memset(rs485, 0, sizeof(*rs485)); - - rs485->flags &= SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | - SER_RS485_RTS_AFTER_SEND; - if (rs485->flags & SER_RS485_ENABLED) { rs485_ctrl_reg |= LPC18XX_UART_RS485CTRL_NMMEN | LPC18XX_UART_RS485CTRL_DCTRL; @@ -73,14 +65,9 @@ static int lpc18xx_rs485_config(struct uart_port *port, / baud_clk; } - /* Delay RTS before send not supported */ - rs485->delay_rts_before_send = 0; - serial_out(up, LPC18XX_UART_RS485CTRL, rs485_ctrl_reg); serial_out(up, LPC18XX_UART_RS485DLY, rs485_dly_reg); - port->rs485 = *rs485; - return 0; } From patchwork Mon Jun 6 10:04:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 12870218 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9E74C43334 for ; Mon, 6 Jun 2022 10:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3rIzDYpCTLAJ0upHOjS4aLI1b3jSNdl/gGRyc7swmss=; b=1M7M97gkezOCsG SAaaHPgNMfDnglN3SAgz046dM99jQ0uFWbtXYU6NJV0fB1liOC+KdHUNJ3RdyxQe0MV2/tU/BAbsA 6ptHyGYKqhex3HgllGyiFvgrcHb0uwGNL0yypJiVGQ8JytgVZs8cYbVS17IYeFZSj/1BGSyE93XiW bbn8cQkhE5UqLcrwcm86XUWIqn/s53FRTvjUmB4u7pYoDByTWEFrbKAXs3s9dvkul8GgxloUPK+n2 ciBqs1CGWhgEIocK/5xy3jwrOnWxwfoxNgqZRNS1nvxPXZD8YMtWlYmBXEni/3vgnge6TsytGvD5T A8JhPrRlG8DdBAgdtuDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9h9-000e0T-5h; Mon, 06 Jun 2022 10:10:47 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9cw-000bq6-MB for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 10:06:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654509986; x=1686045986; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7XJq3KuEwylRleSQc/kmsQM+84+gFlD9hNoKE43ukeE=; b=TCDO5eVXQ+w4bw109315m9zeLTX1V5oYlmIdqAQ1zpFvvbczPfXg64Qt no6tqj/1Ewwyppx8D5eZBlN7LyGvIZvKGB9pYBzjvw8PplZOP18u7Tk2Q NQvj28UhVJTsiklOu2i+lKa6X8elgxIqSBptkl3vgAt2JSNK70DD5ZlXl GBE/tjFsqLtd5P1NUTSAetgKi4nwAWxUbTKkf9X7WxOxMclDV9oJrz13o fqOXN9rwNsGcC4eugDx/IjWQh0TJK6eESbao7mmaDDeINXAYsk0id+hqS OjA7FZ1YiK6iyxNCP4YJF25HVUa/qOTQvBWC1942kgANqapc1RuD294XO g==; X-IronPort-AV: E=McAfee;i="6400,9594,10369"; a="256480552" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="256480552" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:06:23 -0700 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="635523878" Received: from amkossek-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.57.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 03:06:20 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 31/36] serial: imx: Remove serial_rs485 sanitization Date: Mon, 6 Jun 2022 13:04:28 +0300 Message-Id: <20220606100433.13793-32-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_030626_797678_F8791D54 X-CRM114-Status: GOOD ( 11.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver provides different rs485_supported for the case where RTS is not available making it unnecessary to handle it in imx_uart_rs485_config. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/imx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index ba853bc9b4db..1e96ddd2e262 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1913,10 +1913,6 @@ static int imx_uart_rs485_config(struct uart_port *port, struct imx_port *sport = (struct imx_port *)port; u32 ucr2; - /* RTS is required to control the transmitter */ - if (!sport->have_rtscts && !sport->have_rtsgpio) - rs485conf->flags &= ~SER_RS485_ENABLED; - if (rs485conf->flags & SER_RS485_ENABLED) { /* Enable receiver if low-active RTS signal is requested */ if (sport->have_rtscts && !sport->have_rtsgpio &&