Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829AbbLLLYf (ORCPT ); Sat, 12 Dec 2015 06:24:35 -0500 Received: from mail-lf0-f47.google.com ([209.85.215.47]:34568 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752388AbbLLLXs (ORCPT ); Sat, 12 Dec 2015 06:23:48 -0500 From: "Matwey V. Kornilov" To: gregkh@linuxfoundation.org, jslaby@suse.com, peter@hurleysoftware.com, andy.shevchenko@gmail.com, gnomes@lxorguk.ukuu.org.uk Cc: "Matwey V. Kornilov" , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v5 3/3] tty: 8250_omap: Use software emulated RS485 direction control Date: Sat, 12 Dec 2015 14:23:36 +0300 Message-Id: <1449919416-1980-4-git-send-email-matwey@sai.msu.ru> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1449919416-1980-1-git-send-email-matwey@sai.msu.ru> References: <1449919416-1980-1-git-send-email-matwey@sai.msu.ru> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1796 Lines: 53 Use software emulated RS485 direction control to provide RS485 API existed in omap_serial driver. Note that 8250_omap issues interrupt on shift register empty which is single prerequesite for using software emulated RS485. Signed-off-by: Matwey V. Kornilov --- drivers/tty/serial/8250/8250_omap.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index 826c5c4..323c0a4 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -698,6 +698,23 @@ static void omap_8250_throttle(struct uart_port *port) pm_runtime_put_autosuspend(port->dev); } +static int omap_8250_rs485_config(struct uart_port *port, struct serial_rs485 *rs485) +{ + struct uart_8250_port *up = up_to_u8250p(port); + + if (rs485->flags & SER_RS485_ENABLED && !serial8250_em485_enabled(up)) { + port->rs485 = *rs485; + return serial8250_em485_init(up); + } + + if (serial8250_em485_enabled(up) && !(rs485->flags & SER_RS485_ENABLED)) + serial8250_em485_destroy(up); + + port->rs485 = *rs485; + + return 0; +} + static void omap_8250_unthrottle(struct uart_port *port) { unsigned long flags; @@ -1144,6 +1161,7 @@ static int omap8250_probe(struct platform_device *pdev) up.port.shutdown = omap_8250_shutdown; up.port.throttle = omap_8250_throttle; up.port.unthrottle = omap_8250_unthrottle; + up.port.rs485_config = omap_8250_rs485_config; if (pdev->dev.of_node) { const struct of_device_id *id; -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/