From patchwork Tue Jan 24 13:43:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 92347 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1717607qgi; Tue, 24 Jan 2017 05:41:31 -0800 (PST) X-Received: by 10.99.170.70 with SMTP id x6mr39209223pgo.14.1485265291188; Tue, 24 Jan 2017 05:41:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si19215130pgz.5.2017.01.24.05.41.30; Tue, 24 Jan 2017 05:41:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751092AbdAXNlW (ORCPT + 7 others); Tue, 24 Jan 2017 08:41:22 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:36536 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751082AbdAXNlU (ORCPT ); Tue, 24 Jan 2017 08:41:20 -0500 Received: by mail-wm0-f51.google.com with SMTP id c85so182149368wmi.1 for ; Tue, 24 Jan 2017 05:41:19 -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=cWir8HxzM72vuu3KYEquZlRtVcV1Kl1Yf9P+1k1geP4=; b=idIaECMAAVSkdSbL+9Dz4nQ/j3MG9HNo28DTSooLjNBC6ZiX126LPLyTUKlQ/fGRYT RVP3QjEC8dccMz8+NEpqKHcCGih1t2zfCBpnhb/uwKnaAG1a1B9uIR5bFsNQjFIAqcpv mtGxBCOXEFinfS7xYKKHIGz7An7r/slPQYES8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cWir8HxzM72vuu3KYEquZlRtVcV1Kl1Yf9P+1k1geP4=; b=JmcgDqbKYCzD+YFs1UyeQSho7RrbSOECAf8OmdO5JQ0in5zn8VtiXVpf1a0fGzJc29 jBumewBP2H3atWbJpn7IdinCSbNTfyJkK9jLHpEo/4Z6ipGJ7KOP/lnUmaeejARJgyQ6 YrZ0F1NP+KdF2oS0tAtoc21lc+/dxAuZzVoOvjKAoyIK6KwD+7JEPMadddkI7BbiKSRj ro6NgcEJWFRaSqjDsdXTuEeIqVovCvh7ZS/IkeaexyPFXbbpRFmxCXMODYip3kOkjtzr 3C2pWf816g7p+4g3FAvhuILeesIH0C6/BLf/WqrW0VWBWd3rxY3sf4KUcsCibT3hLk0B gB0w== X-Gm-Message-State: AIkVDXI0nwpjslA7X/2qM8Yl0GmldVjyg1WL8o1CzEDzLuOg0Bnqf7wLfNhsUvVzoQqYH+XL X-Received: by 10.28.12.68 with SMTP id 65mr10735546wmm.100.1485265278575; Tue, 24 Jan 2017 05:41:18 -0800 (PST) Received: from localhost.localdomain (host81-129-172-30.range81-129.btcentralplus.com. [81.129.172.30]) by smtp.gmail.com with ESMTPSA id d42sm19966165wrd.7.2017.01.24.05.41.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 05:41:17 -0800 (PST) From: Lee Jones To: gregkh@linuxfoundation.org, jslaby@suse.com, linux-serial@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, patrice.chotard@st.com, Lee Jones Subject: [PATCH 3/8] serial: st-asc: Read in all Pinctrl states Date: Tue, 24 Jan 2017 13:43:05 +0000 Message-Id: <20170124134310.27512-4-lee.jones@linaro.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170124134310.27512-1-lee.jones@linaro.org> References: <20170124134310.27512-1-lee.jones@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org There are now 2 possible separate/different Pinctrl states which can be provided from platform data. One which encompasses the lines required for HW flow-control (CTS/RTS) and another which does not specify these lines, such that they can be used via GPIO mechanisms for manually toggling (i.e. from a request by `stty`). Signed-off-by: Lee Jones --- drivers/tty/serial/st-asc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index 397df50..03801ed 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -37,10 +37,16 @@ #define ASC_FIFO_SIZE 16 #define ASC_MAX_PORTS 8 +/* Pinctrl states */ +#define DEFAULT 0 +#define MANUAL_RTS 1 + struct asc_port { struct uart_port port; struct gpio_desc *rts; struct clk *clk; + struct pinctrl *pinctrl; + struct pinctrl_state *states[2]; unsigned int hw_flow_control:1; unsigned int force_m1:1; }; @@ -694,6 +700,7 @@ static int asc_init_port(struct asc_port *ascport, { struct uart_port *port = &ascport->port; struct resource *res; + int ret; port->iotype = UPIO_MEM; port->flags = UPF_BOOT_AUTOCONF; @@ -720,6 +727,27 @@ static int asc_init_port(struct asc_port *ascport, WARN_ON(ascport->port.uartclk == 0); clk_disable_unprepare(ascport->clk); + ascport->pinctrl = devm_pinctrl_get(&pdev->dev); + if (IS_ERR(ascport->pinctrl)) { + ret = PTR_ERR(ascport->pinctrl); + dev_err(&pdev->dev, "Failed to get Pinctrl: %d\n", ret); + } + + ascport->states[DEFAULT] = + pinctrl_lookup_state(ascport->pinctrl, "default"); + if (IS_ERR(ascport->states[DEFAULT])) { + ret = PTR_ERR(ascport->states[DEFAULT]); + dev_err(&pdev->dev, + "Failed to look up Pinctrl state 'default': %d\n", ret); + return ret; + } + + /* "manual-rts" state is optional */ + ascport->states[MANUAL_RTS] = + pinctrl_lookup_state(ascport->pinctrl, "manual-rts"); + if (IS_ERR(ascport->states[MANUAL_RTS])) + ascport->states[MANUAL_RTS] = NULL; + return 0; }