From patchwork Thu Apr 28 09:05:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 8967181 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2224C9F1D3 for ; Thu, 28 Apr 2016 09:23:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4494A20212 for ; Thu, 28 Apr 2016 09:23:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49897201EF for ; Thu, 28 Apr 2016 09:23:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1avi98-0000nf-Ep; Thu, 28 Apr 2016 09:22:06 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1avi96-0000Zp-8F for linux-arm-kernel@bombadil.infradead.org; Thu, 28 Apr 2016 09:22:04 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by casper.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1avhtY-0001DE-Ux for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2016 09:06:01 +0000 Received: by mail-wm0-x243.google.com with SMTP id n129so11658257wmn.1 for ; Thu, 28 Apr 2016 02:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references:mime-version:content-transfer-encoding; bh=5gsffRvn+Jf8gX9z/4y4PDNeFY1tc27tB0suqGqbTS0=; b=bsUnqCuxzIS6yoxx3hZESUa8RRyEQxIs+1NGi7Edlm7ifse1iXNrIOnbDZ6C89dxuK OvJGJKqexKVd/6cDqQVPctLV4wvTAV+4RwNAVwvq9UbrdjAB1tkc7FSEnioRmuMnBLOB AcLrppkaxwIq8ebbrXBfv+HupSUvg4V8bEbry/7kvXq8D+kr011NfCVPUJTfXV3+c3hN jb1ylgGXduGJ580agRusP8vnsEoca1fKZO7rX065zA8UjFKJmCgYMpx6o+egu+SAzL6m 2w8T2+/rzaoOP60U2cQJW30clrD/n76BfmBCKMqrCLtCn2s0KuLBfAim/naGNCPJP1Rh 10OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references:mime-version :content-transfer-encoding; bh=5gsffRvn+Jf8gX9z/4y4PDNeFY1tc27tB0suqGqbTS0=; b=RBu9niEKR2rhDUGw2gGqFsjf+cGXy7Mh3MF0yuylRTVLA2zInn49YJmCilQJjZkBw2 zWYe6+McjnafMxi7iif6gNP+BkBa0Bqs1hC1VEaZ38uyxEwaUZfmvnwxfd3+WvvWozOI ow87a7+9AqD1fWyd8NqdecIKfTmXA+SnM3fk5kAyVJB2rNxUAYLzb8OnvkTHJXTmQUrs ftkYZe8k5Pg3bf3OECvTcK28t0C4gW6azbqf9POa89qbsYQQqE/7AuYNI3EPLFGoYaCR NPSM00UuM1NRw7vygyxmFl1GjsJw2K29B4UR/ag5EiqAc91EPJLDSKXYx10S1UdW7b0k PuLA== X-Gm-Message-State: AOPr4FVXNg6TO3tGSAMNY2DVjwq4Nj4npMXiLWCbRzNKYujm4dgX3/AxAB9Jv/7fY8UPSw== X-Received: by 10.28.14.2 with SMTP id 2mr11978858wmo.14.1461834338946; Thu, 28 Apr 2016 02:05:38 -0700 (PDT) Received: from debian64.daheim (p5B2E6CB2.dip0.t-ipconnect.de. [91.46.108.178]) by smtp.googlemail.com with ESMTPSA id a207sm12990814wma.8.2016.04.28.02.05.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2016 02:05:36 -0700 (PDT) Received: from chuck by debian64.daheim with local (Exim 4.87) (envelope-from ) id 1avht5-0001wU-Dq; Thu, 28 Apr 2016 11:05:31 +0200 From: Christian Lamparter To: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC v4 8/8] gpio: dt-bindings: add gpio-mmio bindings Date: Thu, 28 Apr 2016 11:05:18 +0200 Message-Id: <262d58824524c19917e6bf760da1c8ea2b6a616c.1461806071.git.chunkeey@googlemail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160428_100601_030006_C63D4C57 X-CRM114-Status: GOOD ( 21.70 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Alexandre Courbot , =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= , Alexander Shiyan , Pawel Moll , Ian Campbell , Linus Walleij , Rob Herring , Kumar Gala , Christian Lamparter 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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: Álvaro Fernández Rojas This patch adds the device tree bindings for the gpio-mmio. The gpio-mmio is already part of a the GPIO generic library. Signed-off-by: Álvaro Fernández Rojas Signed-off-by: Christian Lamparter --- .../devicetree/bindings/gpio/gpio-mmio.txt | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-mmio.txt diff --git a/Documentation/devicetree/bindings/gpio/gpio-mmio.txt b/Documentation/devicetree/bindings/gpio/gpio-mmio.txt new file mode 100644 index 0000000..cc7f0b1 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-mmio.txt @@ -0,0 +1,73 @@ +Bindings for the generic driver for memory-mapped GPIO controllers. + +Required properties: + - compatible: should be "linux,gpio-mmio" + - reg-names: must contain + "dat" - data register + may contain + "set" - data set register + "clr" - data clear register + "dirout" - direction output register + "dirin" - direction input register + - reg: address + size pairs describing the GPIO register sets; + order must correspond with the order of entries in reg-names + - #gpio-cells = must be set to 2 + - gpio-controller: Marks the device node as a gpio controller. + +Optional properties: + - ngpio: specifies the number of gpio mapped in the register. + - big-endian: force big endian register accesses. + - big-endian-byte-order: assign GPIOs in reverse order. + - unreadable-reg-set: data set register is not readable. + - read-output-reg-set: cache value set for reads. + - unreadable-reg-dir: dirout/dirin register is not readable. + - no-output: GPIOs are read-only. + +The GPIO generic library provides support for memory-mapped GPIO +controllers. The configuration is detected by which resources are present. +The simplest form of a GPIO controller that the driver support is just a +single "dat" register, where GPIO state can be read and/or written. +However, the driver supports far more: + - 8/16/32/64 bits registers. The number of GPIOs is automatically + determined by the width of the registers. + - GPIO controllers with clear/set registers. + - GPIO controllers with a single "dat" register. + - Big endian bits/GPIOs ordering. + +For setting GPIO's there are three configurations: + 1. single input/output register resource (named "dat"), + 2. set/clear pair (named "set" and "clr"), + 3. single output register resource and single input resource + ("set" and dat"). + +For setting the GPIO direction, there are three configurations: + a. simple bidirectional GPIOs that requires no configuration. + b. an output direction register (named "dirout") + where a 1 bit indicates the GPIO is an output. + c. an input direction register (named "dirin") + where a 1 bit indicates the GPIO is an input. + +Examples: + + /* Configuration for single input/output register + * for eight simple bidirectional GPIOs. + */ + gpio_a_1 { + compatible = "linux,gpio-mmio"; + reg = <0x18000000 0x1>; + reg-names = "dat"; + #gpio-cells = <2>; + gpio-controller; + }; + + /* Configuration for set/clear pair registers with + * 32 output direction register GPIOs. + */ + gpio_b_2 { + compatible = "linux,gpio-mmio"; + reg = <0x18000000 0x4>, <0x18000010 0x4>, + <0x18000004 0x4>, <0x18000008 0x4>; + reg-names = "dat", "set", "clr", "dirout"; + #gpio-cells = <2>; + gpio-controller; + };