From patchwork Tue Jun 25 14:19:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2776811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0494D9F755 for ; Tue, 25 Jun 2013 14:20:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 427D520283 for ; Tue, 25 Jun 2013 14:20:07 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3EC120288 for ; Tue, 25 Jun 2013 14:20:01 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrU69-0007q8-3d; Tue, 25 Jun 2013 14:19:57 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrU64-0001PW-5q; Tue, 25 Jun 2013 14:19:52 +0000 Received: from eu1sys200aog114.obsmtp.com ([207.126.144.137]) by merlin.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrU60-0001OX-SX for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2013 14:19:49 +0000 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob114.postini.com ([207.126.147.11]) with SMTP ID DSNKUcmm5nMmbjf+aMh9UjajQ9Yzo6nBaT7D@postini.com; Tue, 25 Jun 2013 14:19:48 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 076F8304; Tue, 25 Jun 2013 14:19:16 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5DB9E5095; Tue, 25 Jun 2013 14:18:52 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 4BF53A8083; Tue, 25 Jun 2013 16:19:10 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.279.5; Tue, 25 Jun 2013 16:19:15 +0200 From: Linus Walleij To: , Subject: [PATCH] pinctrl: elaborate a bit on arrangements in doc Date: Tue, 25 Jun 2013 16:19:12 +0200 Message-ID: <1372169952-22439-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130625_101949_134740_9D07A998 X-CRM114-Status: GOOD ( 15.99 ) X-Spam-Score: -4.2 (----) Cc: Tony Lindgren , Christian Ruppert , Linus Walleij , Stephen Warren , Rob Landley X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Linus Walleij This elaborates a bit on the pinctrl vs GPIO arangements in the hardware. Inspired by some drawings in a mail from Christian Ruppert. Cc: Rob Landley Cc: Christian Ruppert Signed-off-by: Linus Walleij --- Documentation/pinctrl.txt | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt index 447fd4c..41ecad0 100644 --- a/Documentation/pinctrl.txt +++ b/Documentation/pinctrl.txt @@ -784,11 +784,38 @@ special GPIO-handler is registered. GPIO mode pitfalls ================== -Sometime the developer may be confused by a datasheet talking about a pin -being possible to set into "GPIO mode". It appears that what hardware -engineers mean with "GPIO mode" is not necessarily the use case that is -implied in the kernel interface : a pin that you grab from -kernel code and then either listen for input or drive high/low to +The GPIO portions of a pin and its relation to a certain pin controller +logic can be constructed in several ways. Here are three examples: + +(A) + + +- SPI + Physical pins --- GPIO --- pinctrl -+- I2C + +- mmc + +(B) + +- GPIO + Physical pins -+ +- SPI + +- pinctrl -+- I2C + +- mmc + +(C) + +- SPI + Physical pins --- pinctrl -+- I2C + +- mmc + +- GPIO + +In (A) the GPIO-like functionality of the pin is *always* available. +For example it is possible to read the GPIO input register to "spy" on +the SPI, I2C or MMC line while it is being used by the peripheral. +In (B) the GPIO functionality is orthogonal to any device using the +pin, and in (C) the GPIO case is the same as "some peripheral". + +For this reason the developer may be confused by a datasheet talking +about a pin being possible to set into "GPIO mode". It appears that what +hardware engineers mean with "GPIO mode" is not necessarily the use case +that is implied in the kernel interface : a pin that you +grab from kernel code and then either listen for input or drive high/low to assert/deassert some external line. Rather hardware engineers think that "GPIO mode" means that you can