From patchwork Wed Feb 1 14:31:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 93033 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2443604qgi; Wed, 1 Feb 2017 06:32:21 -0800 (PST) X-Received: by 10.99.36.3 with SMTP id k3mr4080403pgk.136.1485959541065; Wed, 01 Feb 2017 06:32:21 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m32si19326794pld.31.2017.02.01.06.32.20; Wed, 01 Feb 2017 06:32:21 -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 S1751719AbdBAOb6 (ORCPT + 7 others); Wed, 1 Feb 2017 09:31:58 -0500 Received: from mail-wj0-f177.google.com ([209.85.210.177]:35405 "EHLO mail-wj0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751718AbdBAOb4 (ORCPT ); Wed, 1 Feb 2017 09:31:56 -0500 Received: by mail-wj0-f177.google.com with SMTP id b20so20805821wjs.2 for ; Wed, 01 Feb 2017 06:31:56 -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=r2na34FpogMkG++2SWU5aW2AviMUGR7jHrU4VHLQYFo=; b=V4Qri9+DO/byuwSrFMjty3tFXf59cpNNDr0LQHpwMLUxlhuOZTJIbmjbsJqaBQAr1c I9AlysKv/F1WN8eqgme+Xh2Bk68o462G+7/AMjyMAAduFH7X0e22L/P9TshIjlIfrY+5 EaZHwq0gU1Vd9q7V0bE4Yrb6A3dIKTYCKnBYc= 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=r2na34FpogMkG++2SWU5aW2AviMUGR7jHrU4VHLQYFo=; b=iVd3UTINd5mBrHcVUNlHmiF6TWEB1zIoWGF+ZJMybKURuPKJGqRSpSnI4584/lVFI1 F6yw5QrmJJ/hKE1Ic4jmDueDgyRN6ol+2fHXW9jH1V/K5ihZ9Mjwe9ypwIZw2q6grk26 IlxSwKd9+gqW6Ej9mIgaKkL88Oe6K/90JjqHd7NggYQmfrbxV47HaN2WSmDkDPU6i4WK zUR+w5EBL1w0Tj3sOZJJgMco/7js+ecNfBfFFjwAXQ2/7rWREOIs3oyjS8yMeN2FVStu pBAlJTdCubHCb1jvS62XW7UCdnGO6kDFq+g7vYifU6hXBX8hZCUgbIWuiUWAW/CwYEJ3 u96Q== X-Gm-Message-State: AIkVDXLKRsLLeu99c1ggczB3+puKo12NGedYWzZdq91qzV1ySf+AHbxdOFJ3m94kBQ2w+Tg/ X-Received: by 10.223.164.85 with SMTP id e21mr3173167wra.111.1485959515424; Wed, 01 Feb 2017 06:31:55 -0800 (PST) Received: from localhost.localdomain (host81-158-165-111.range81-158.btcentralplus.com. [81.158.165.111]) by smtp.gmail.com with ESMTPSA id l37sm34420245wrc.41.2017.02.01.06.31.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 06:31:53 -0800 (PST) From: Lee Jones To: gregkh@linuxfoundation.org, jslaby@suse.com, linux-serial@vger.kernel.org, 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 v2 03/10] serial: st-asc: Read in all Pinctrl states Date: Wed, 1 Feb 2017 14:31:38 +0000 Message-Id: <20170201143145.31962-4-lee.jones@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170201143145.31962-1-lee.jones@linaro.org> References: <20170201143145.31962-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 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) -- 2.9.3 -- 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..1058020 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -37,10 +38,16 @@ #define ASC_FIFO_SIZE 16 #define ASC_MAX_PORTS 8 +/* Pinctrl states */ +#define DEFAULT 0 +#define NO_HW_FLOWCTRL 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 +701,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 +728,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; + } + + /* "no-hw-flowctrl" state is optional */ + ascport->states[NO_HW_FLOWCTRL] = + pinctrl_lookup_state(ascport->pinctrl, "no-hw-flowctrl"); + if (IS_ERR(ascport->states[NO_HW_FLOWCTRL])) + ascport->states[NO_HW_FLOWCTRL] = NULL; + return 0; }