From patchwork Fri Dec 2 14:11:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 86303 Delivered-To: patch@linaro.org Received: by 10.182.112.6 with SMTP id im6csp336060obb; Fri, 2 Dec 2016 06:11:43 -0800 (PST) X-Received: by 10.84.193.101 with SMTP id e92mr96533237pld.12.1480687903781; Fri, 02 Dec 2016 06:11:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si5344560plj.180.2016.12.02.06.11.43; Fri, 02 Dec 2016 06:11:43 -0800 (PST) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934219AbcLBOLj (ORCPT + 25 others); Fri, 2 Dec 2016 09:11:39 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:37186 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934154AbcLBOLf (ORCPT ); Fri, 2 Dec 2016 09:11:35 -0500 Received: by mail-wm0-f41.google.com with SMTP id t79so16853574wmt.0 for ; Fri, 02 Dec 2016 06:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5TLXfuT/MwISG1/dkr3iCtiZO5sZ8dG0/+bCeJiJJls=; b=TqhVYl8X3Tk50itoMv5OIUmYKGTgJjxsGCk6MSRIt+fwsl3SC0gWnfCy1txqVYFkQZ JrALW4RZWkDV19ulcXdNHR0XsmaUxN9GKvnGBTGyA90zmn5btbCBUjHriNWkULEIVxvc Y6f1kJLtvnRHzfShqftAWvnQOY26fS1RUPJNA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5TLXfuT/MwISG1/dkr3iCtiZO5sZ8dG0/+bCeJiJJls=; b=g8y++fZh7KjE7XNSQsTqgsB0Hhp3ZxQF/ZKx9tZX1T6upU3J1u95g+W01CCndxeqPd xYCfrtxAu3LWPrDYYF/C0kn8EPmAgSdR+F5OcX3kWcuAbqT8WI9U1srIrkAuZJW4MxgP M80K/6Ey0LkNPFcLPQg+X0voarEPiiDDEY1goEltBm3s8DrG9QTMZXN3dVdB60jU0Uhg dCpsJf6FeQO3wpDBuZwyWyYBhPylhzQeReKLDDS3cFDifarrwR7w1zAl2tO461f8nGUE ton0xZrskg32evAK60x5cGOsDtxpMGyBo9C0sh8Hh+A17uULikcT4/u8IOLPJNG+qVHq sAkg== X-Gm-Message-State: AKaTC005k418+4+4IwClwwdtxc066IweaJzFjFlRr87oxWM591I8llIqWFd5zAFDc/5RHu5X X-Received: by 10.28.95.85 with SMTP id t82mr2992289wmb.56.1480687845368; Fri, 02 Dec 2016 06:10:45 -0800 (PST) Received: from localhost.localdomain (host81-129-169-233.range81-129.btcentralplus.com. [81.129.169.233]) by smtp.gmail.com with ESMTPSA id n17sm5808199wjq.6.2016.12.02.06.10.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Dec 2016 06:10:44 -0800 (PST) From: Lee Jones To: gregkh@linuxfoundation.org, jslaby@suse.com, patrice.chotard@st.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, linux-serial@vger.kernel.org, Lee Jones Subject: [PATCH 2/3] serial: st-asc: Provide RTS functionality Date: Fri, 2 Dec 2016 14:11:45 +0000 Message-Id: <20161202141146.31281-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161202141146.31281-1-lee.jones@linaro.org> References: <20161202141146.31281-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Until this point, it has not been possible for serial applications to toggle the UART RTS line. This can be useful with certain configurations. For example, when using a Mezzanine on a Linaro 96board, RTS line is used to take the the on-board microcontroller in and out of reset. Signed-off-by: Lee Jones --- drivers/tty/serial/st-asc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.10.2 diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index 379e5bd..ce46898 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -30,6 +30,7 @@ #include #include #include +#include #define DRIVER_NAME "st-asc" #define ASC_SERIAL_NAME "ttyAS" @@ -38,6 +39,7 @@ struct asc_port { struct uart_port port; + struct gpio_desc *rts; struct clk *clk; unsigned int hw_flow_control:1; unsigned int force_m1:1; @@ -381,12 +383,16 @@ static unsigned int asc_tx_empty(struct uart_port *port) static void asc_set_mctrl(struct uart_port *port, unsigned int mctrl) { + struct asc_port *ascport = to_asc_port(port); + /* * This routine is used for seting signals of: DTR, DCD, CTS/RTS * We use ASC's hardware for CTS/RTS, so don't need any for that. * Some boards have DTR and DCD implemented using PIO pins, * code to do this should be hooked in here. */ + + gpiod_set_value(ascport->rts, mctrl & TIOCM_RTS); } static unsigned int asc_get_mctrl(struct uart_port *port) @@ -731,12 +737,20 @@ MODULE_DEVICE_TABLE(of, asc_match); static int asc_serial_probe(struct platform_device *pdev) { int ret; + struct device_node *np = pdev->dev.of_node; struct asc_port *ascport; + struct gpio_desc *gpiod; ascport = asc_of_get_asc_port(pdev); if (!ascport) return -ENODEV; + gpiod = devm_get_gpiod_from_child(&pdev->dev, "rts", &np->fwnode); + if (!IS_ERR(gpiod)) { + gpiod_direction_output(gpiod, 0); + ascport->rts = gpiod; + } + ret = asc_init_port(ascport, pdev); if (ret) return ret;