Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp693040ybh; Wed, 18 Mar 2020 07:28:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsqC2GRE/a39ALVMFGJOU0qIAsOA3LKv0ohs3/sHk7p4yPyLA7XyH33upp6u+xM21u7oABo X-Received: by 2002:a9d:2c69:: with SMTP id f96mr3930029otb.62.1584541718803; Wed, 18 Mar 2020 07:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584541718; cv=none; d=google.com; s=arc-20160816; b=xnvyME/yboLoRwGirLaCxnoqwHU5cHzxxtHhuBR7dLmLQAM7dkptR6KErRG4Y/uTu1 yQuJ+7niss6C3L71ajdV3IpRbDMGZlg9D5AAPYtIFdOSS7MuxcZOTNUPlDq9+Alf40/g bBRkBkjROGpAiPCd5BjT8bGGaMOc3VgE7mc+zROCJkEe5lWw/T290Y36MS540Z7xq/sD MPp1RSo0ER5fisWYDLgkkbBi3BftQL2ftgxerzeGFj3MlPXUNH9NqrgZQefVKKJwm6xg rfnAVYbo416++IcUGoJQWSEIcw+05TUC3v3y1QGbLzYV3OyWWjbVd1sL94qOUwPAeuEL ubbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XSkgbmvduIEnh9ZuYse170VNyLzrhxTpWJwSy17WZlE=; b=tj74WwGcknXVdM7FYZYTfTSebvtaIhHRDQJoTe/Qrg4g6ljr85h+Fz7ATdJf1bjBlZ fGz5dPQGZmLUlJV316O+sPP39N1IDU0kXCYZZG3iuT/fP1vWVGJ+hMY6XwtK7NdaTg20 FN9Svs5+1P3ZeTrer+1BRGyrXoZGEARbHLoY0z6ae0GrKPXr+1VB6Qln6IPJQ5VOyqkn JsSV5r7gO+nT34mHEpqG05ayz+h8jOndAklp813Z2b+frTi1LALYV42L6AJTzdJk/+Ms 47QS0AzMyyYe9A6WK/VucfgiRM2wPYsG7z9VneJRKLf79OtDOC6Df7QKu+PplUYh8P25 yscA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si3532266otr.270.2020.03.18.07.28.26; Wed, 18 Mar 2020 07:28:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727221AbgCRO1U (ORCPT + 99 others); Wed, 18 Mar 2020 10:27:20 -0400 Received: from gloria.sntech.de ([185.11.138.130]:37362 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726971AbgCRO1A (ORCPT ); Wed, 18 Mar 2020 10:27:00 -0400 Received: from [94.134.91.63] (helo=phil.fritz.box) by gloria.sntech.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jEZeo-0004YX-VA; Wed, 18 Mar 2020 15:26:55 +0100 From: Heiko Stuebner To: gregkh@linuxfoundation.org Cc: jslaby@suse.com, andriy.shevchenko@linux.intel.com, matwey.kornilov@gmail.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, heiko@sntech.de, Heiko Stuebner Subject: [PATCH 4/7] serial: 8250: Start rs485 after registering port if rs485 is enabled in probe Date: Wed, 18 Mar 2020 15:26:37 +0100 Message-Id: <20200318142640.982763-5-heiko@sntech.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200318142640.982763-1-heiko@sntech.de> References: <20200318142640.982763-1-heiko@sntech.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiko Stuebner Before registering a port 8250 drivers may read devicetree information regarding rs485 emulation, but starting the em485 emulation at that point would only keep the em485 structure in the template uart port. Also at that point before the port is registered possible gpios for rts/dtr are not acquired yet as well. So simply check after acquiring the port if the rs485-enable flag is set and start the config callback in that case. Signed-off-by: Heiko Stuebner --- drivers/tty/serial/8250/8250_core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index e682390ce0de..beab1c22b34d 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -1068,6 +1068,15 @@ int serial8250_register_8250_port(struct uart_8250_port *up) if (up->dl_write) uart->dl_write = up->dl_write; + if (uart->port.rs485_config && + (uart->port.rs485.flags & SER_RS485_ENABLED)) { + dev_dbg(uart->port.dev, "starting in rs485 mode\n"); + ret = uart->port.rs485_config(&uart->port, + &uart->port.rs485); + if (ret < 0) + goto out_unlock; + } + if (uart->port.type != PORT_8250_CIR) { if (serial8250_isa_config != NULL) serial8250_isa_config(0, &uart->port, -- 2.24.1