From patchwork Wed Oct 24 19:18:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1640211 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 2D673DFABE for ; Wed, 24 Oct 2012 19:19:54 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TR6T3-0006re-Th; Wed, 24 Oct 2012 19:18:18 +0000 Received: from mail.free-electrons.com ([88.190.12.23]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TR6T0-0006r3-19 for linux-arm-kernel@lists.infradead.org; Wed, 24 Oct 2012 19:18:14 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 4054A196; Wed, 24 Oct 2012 21:18:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham version=3.3.1 Received: from localhost (humanoidz.org [82.247.183.72]) by mail.free-electrons.com (Postfix) with ESMTPSA id 398AFDE; Wed, 24 Oct 2012 21:17:59 +0200 (CEST) From: Thomas Petazzoni To: Sebastian Hesselbarth , Jason Cooper , Andrew Lunn , Gregory Clement Subject: [PATCH] [RFC] pinctrl: mvebu: reset pins to an UNKNOWN state on startup Date: Wed, 24 Oct 2012 21:18:01 +0200 Message-Id: <1351106281-31288-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Olof Johansson , Linus Walleij , linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Stephen Warren X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Note: this patch is a *RFC*, it is not intended for merging, only to get a discussion started. The code is horrible, makes terrible assumptions and so on. On many platforms, most of the pinmux initialization is done in the bootloader, and therefore persists when we boot the Linux kernel. This prevents us from making sure that the pinmux configuration in the board device trees is correct. One idea to make sure our device trees are correct in terms of pinmuxing is to set the state of each pin to an unavailable function during the initialization of the pinctrl driver. This way, only pins that are explicitly configured through proper device tree attributes will actually be functional. Remaining questions to solve: * Is this useful? * How to figure out what function number is a good function number to set all pins to at startup? It could be passed by the SoC-specific pinctrl drivers. * Maybe some pins should be excluded for this, especially if the console serial port pins are muxed. On Armada XP, it's not the case: UART0 RX/UART0 TX pins are not part of MPPs, so we can clear all pins. But on other mvebu platforms, it may be the case. * If this sounds like an interesting thing, should we keep it only at the mvebu driver level, or make it something more generically available in the pinctrl subsystem? Signed-off-by: Thomas Petazzoni --- drivers/pinctrl/pinctrl-mvebu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/pinctrl-mvebu.c b/drivers/pinctrl/pinctrl-mvebu.c index 8e6266c..32a9cbe 100644 --- a/drivers/pinctrl/pinctrl-mvebu.c +++ b/drivers/pinctrl/pinctrl-mvebu.c @@ -739,6 +739,9 @@ int __devinit mvebu_pinctrl_probe(struct platform_device *pdev) dev_info(&pdev->dev, "registered pinctrl driver\n"); + for (n = 0; n < pctl->num_groups; n++) + mvebu_pinconf_group_set(pctl->pctldev, n, 7); + /* register gpio ranges */ for (n = 0; n < soc->ngpioranges; n++) pinctrl_add_gpio_range(pctl->pctldev, &soc->gpioranges[n]);