From patchwork Mon Oct 9 20:53:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 115306 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2984906qgn; Mon, 9 Oct 2017 13:54:22 -0700 (PDT) X-Google-Smtp-Source: AOwi7QArnXwHfZrP+xjXY7dJzVI41MZIjDen1jjaryPkQ4R0y+tOdjY/DVXw/l1vgEXn3gen20n/ X-Received: by 10.99.152.68 with SMTP id l4mr10201640pgo.443.1507582462038; Mon, 09 Oct 2017 13:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507582462; cv=none; d=google.com; s=arc-20160816; b=cB1pJQMPyTPmERN7b3Rw8sL7rbZrr+N8ia4Hz6tHlS+bRSstt+cfCEgDLPS03JtqfM qKiaEhNWsUUUiFYdvdPCuWRQp2HfJ+WZN40qwntYGNGcgGUGqFz2pqr8wnnNXAUvrshj n2WfzJzK1pvfJDmZ2lV9Vpm2by6Yge2xj8vWzTzMKbeeJVLiHFl/kc5npL0J6ajnoc6Z Gzt45AHmMLSjGgTrnw/hlJYNucoczahg+6N4LBtRDNhrsdImOcpaYj+iYnxq49UcJSiK FfSk+I3bNCRC76M++F/rllYcFWOEZer1KUbXhLkuPiYGTyQihuamFws7R3ZEl46iiqIk 56fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=azNDTWKpT3fysRYet/rrIqmlCuTXnDph+IcDV5hZC9k=; b=JgaAHEiaBrIdwh/AtkoSnNqu6DUoTrZ7D9NnIyngddTX8TzsbhAxd+cG7kNMVhJ5+M QJGpLY7Zv8lpy5AKBOV1l3MuyqfC105L46RlOkMxIZswVEumC9KR2vXQeBGjbCmWuPlz ODKIeFbz9ECJqjMW3hPWTzanq1R2dQ7vLPsHU+OnW3SeDBf2TUNW4qbk6h7pVoyh0o29 WCmVvwoP6cqMrrp2a+y9nznja2WbehizKDlnYR9eVruUaCn20YYYBmSY5iumenau95kd Jb1P8Gid0690zZH5+o/SMU7vT+4rH/fdJM6zKcFtE0PEr9zHqYWXd45U9VRtOuESoWr4 IRRA== 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 d6si7625207pfc.318.2017.10.09.13.54.21; Mon, 09 Oct 2017 13:54:22 -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 S1755526AbdJIUyT (ORCPT + 26 others); Mon, 9 Oct 2017 16:54:19 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:44578 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755071AbdJIUxn (ORCPT ); Mon, 9 Oct 2017 16:53:43 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id D9FA72092D; Mon, 9 Oct 2017 22:53:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LFbn-TOU-1-209-191.w86-201.abo.wanadoo.fr [86.201.56.191]) by mail.free-electrons.com (Postfix) with ESMTPSA id AE4C0208C1; Mon, 9 Oct 2017 22:53:40 +0200 (CEST) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , linus.walleij@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH v2 1/3] pinctrl: sunxi: Introduce the strict flag Date: Mon, 9 Oct 2017 22:53:37 +0200 Message-Id: X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Our pinctrl device should have had strict set all along. However, it wasn't the case, and most of our old device trees also have a pinctrl group in addition to the GPIOs properties, which mean that we can't really turn it on now. All our new SoCs don't have that group, so we should still enable that mode on the newer one though. In order to enable it by default, add a flag that will allow to disable that mode that should be set by pinctrl drivers that cannot be migrated. Signed-off-by: Maxime Ripard --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 12 +++++++++++- drivers/pinctrl/sunxi/pinctrl-sunxi.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) -- git-series 0.9.1 diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 52edf3b5988d..3bbb34435e0f 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -1245,6 +1245,7 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, struct pinctrl_desc *pctrl_desc; struct pinctrl_pin_desc *pins; struct sunxi_pinctrl *pctl; + struct pinmux_ops *pmxops; struct resource *res; int i, ret, last_pin, pin_idx; struct clk *clk; @@ -1305,7 +1306,16 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, pctrl_desc->npins = pctl->ngroups; pctrl_desc->confops = &sunxi_pconf_ops; pctrl_desc->pctlops = &sunxi_pctrl_ops; - pctrl_desc->pmxops = &sunxi_pmx_ops; + + pmxops = devm_kmemdup(&pdev->dev, &sunxi_pmx_ops, sizeof(sunxi_pmx_ops), + GFP_KERNEL); + if (!pmxops) + return -ENOMEM; + + if (desc->disable_strict_mode) + pmxops->strict = false; + + pctrl_desc->pmxops = pmxops; pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl); if (IS_ERR(pctl->pctl_dev)) { diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index 1bfc0d8a55df..11b128f54ed2 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h @@ -112,6 +112,7 @@ struct sunxi_pinctrl_desc { unsigned irq_banks; unsigned irq_bank_base; bool irq_read_needs_mux; + bool disable_strict_mode; }; struct sunxi_pinctrl_function { From patchwork Mon Oct 9 20:53:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 115305 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2984655qgn; Mon, 9 Oct 2017 13:54:00 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDXotONMj+6fVp5tKRT7RE+M7AM0szQJoGqRispqPSI8IXJACIs+kVbEcBfJx8CQ49kyPKM X-Received: by 10.101.65.13 with SMTP id w13mr2436975pgp.54.1507582440877; Mon, 09 Oct 2017 13:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507582440; cv=none; d=google.com; s=arc-20160816; b=XfD6iSYzE6f6X3FhhrKsaU/t2DGxHWxZAQgOgqfLO2jyV/qn79er0K42m08pGHko5f eGB8pk6V0vFt5+HNcZX85rmlaPPDhzAjq3VvUXaVPXbK4NsyZkDO1NYOrVlGvmzWYS2Z te03Azrg9CWZw7unxx7OdBvxaPAGW9QFeZ4McdRI+S6D5qrNC+Tom/kH7sYLXfSuXvmJ l19K8ICZ0LTYQ/t7dKXah2D1STgL0G6WigFJ8hiC4Djz2k7YUF0uoRvfRCeoczwmyhde h+9KcOJBA0ggpO/eRpXEoCZZvt8CVguoLSfNn6nuX44ImOt9CxhHQC2mtodr8GamxJfK EX4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=senc6U01NFLWfjYTototyzUo91DQEJcbAZk4Ola2izQ=; b=lz5+4pCvqzZeB8CkGoLkwxAxk1GwY+bd4fBFCW22xAcOzVAQy5bTopAEf/VlFDkufm wykepnJXiPyfMH66SK5HCTdQjATWrV3+zaHPVmBOSWpSdGICl6rX3H4nszjsb/lf3C65 h1PpbIYnVZLOw956OoOfjOuuWlxIYW05+ngWfWBmTY7npp0KAikwOsntXaOWTDXoauEj zjX5pkRfJ76EWGv36c3fzmZhL7jB3goRl2YW1AvUh3s7kkDoRCMBAmpmWUEPC4PuKrRv B+7rDUxYmchefffXfDDldvWsv0g13mYccJQkIVAkCGmF6zbdxrJrPqYxA6q9LsLI0uAZ UPmg== 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 67si1815497pgg.733.2017.10.09.13.54.00; Mon, 09 Oct 2017 13:54:00 -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 S1755487AbdJIUxq (ORCPT + 26 others); Mon, 9 Oct 2017 16:53:46 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:44588 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755433AbdJIUxo (ORCPT ); Mon, 9 Oct 2017 16:53:44 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id AF7702092F; Mon, 9 Oct 2017 22:53:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LFbn-TOU-1-209-191.w86-201.abo.wanadoo.fr [86.201.56.191]) by mail.free-electrons.com (Postfix) with ESMTPSA id 857A5208C1; Mon, 9 Oct 2017 22:53:41 +0200 (CEST) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , linus.walleij@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH v2 3/3] pinctrl: sunxi: Enforce the strict mode by default Date: Mon, 9 Oct 2017 22:53:39 +0200 Message-Id: X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The strict mode should always have been enabled on our driver, and leaving it unchecked just makes it harder to find a migration path as time passes. Let's enable it by default now so that hopefully the new SoCs should be safe. Acked-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 + 1 file changed, 1 insertion(+) -- git-series 0.9.1 diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 3bbb34435e0f..4b6cb25bc796 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -696,6 +696,7 @@ static const struct pinmux_ops sunxi_pmx_ops = { .get_function_groups = sunxi_pmx_get_func_groups, .set_mux = sunxi_pmx_set_mux, .gpio_set_direction = sunxi_pmx_gpio_set_direction, + .strict = true, }; static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,