From patchwork Fri Apr 29 00:53:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 616546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qwwFG2BBGz9sdQ for ; Fri, 29 Apr 2016 10:54:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=googlemail.com header.i=@googlemail.com header.b=XsFT27K3; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752861AbcD2Axt (ORCPT ); Thu, 28 Apr 2016 20:53:49 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35761 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752625AbcD2Axm (ORCPT ); Thu, 28 Apr 2016 20:53:42 -0400 Received: by mail-wm0-f65.google.com with SMTP id e201so1730145wme.2; Thu, 28 Apr 2016 17:53:40 -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=XsFT27K3rLpALaVzlxgDV2WvLhjPtGmTK0J78Jsmul2G/9uHrJ3QpLP3LG4mthRIBv RHTHtfbQdbIqB5ZCl9oIGJpXxdvPUpC/Z0e0nk5wnqzmxLHSLEfDfCHmMwSNSSig0hnf oqaFKcgAq2DOf9/gRZDHyah4QLP/PurRtFpPfw/VqkNEcnL+VvnqWSDxWRrK+mP4YUzZ XstRK2xgZcg4E6ZY8wh9GXuWhs5sf/nJrpAfL4L7HE8/E5tQmaBvug8S+lFPW/OUFEeR vNEgaKrUPfsVD5cOMm67F+J43fdINJ59W9C5aBaLBTsA/aOlEI1dbElB4clrFJ0fuW4U HXFg== 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=C2NBsJI1mkHvQZSIJV5EMmWExfI6hisbvxB7yBvyhnp9AUNUSU59UqfL//fyjLBNRu 5XSw7epICRbgan8CLeJjrcuAcMkVYWxyyPa7lfiNoanLRItvRii4XD1sLRMIPbN3O/7j /V5+gAVi6HbIqnpgZtZh0XXcmb+VeEQ15DSSXGYwQ+WxkPJ0ySSayxwk+PHqKeNBjNJ/ bhFwyK0FEgthUeeKK2TuFAIRNLpLQVc65yiIr3snuiJ40D78jqx15yJutTAqhQjsOn2n pBGxuxWU8g6ii2Tl7cousgYMfaCVC9o6n6Fo+ehxRQrQwHvJdjAG7aXJKztIUZk31ob1 WOjg== X-Gm-Message-State: AOPr4FUAOXHNYI1Co5H27gvVLkT2mvT1akzcSjytqveoSSvdir+qo1ir5sTl7dJRv0WPKw== X-Received: by 10.28.145.67 with SMTP id t64mr797825wmd.56.1461891220022; Thu, 28 Apr 2016 17:53:40 -0700 (PDT) Received: from debian64.daheim (p5B2E6CB2.dip0.t-ipconnect.de. [91.46.108.178]) by smtp.googlemail.com with ESMTPSA id b12sm674135wmb.0.2016.04.28.17.53.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2016 17:53:39 -0700 (PDT) Received: from chuck by debian64.daheim with local (Exim 4.87) (envelope-from ) id 1avwgb-0007QO-EV; Fri, 29 Apr 2016 02:53:37 +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 Cc: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= , Kumar Gala , Alexander Shiyan , Ian Campbell , Mark Rutland , Pawel Moll , Rob Herring , Alexandre Courbot , Linus Walleij , Christian Lamparter Subject: [RFC v5 4/4] gpio: dt-bindings: add gpio-mmio bindings Date: Fri, 29 Apr 2016 02:53:17 +0200 Message-Id: X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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; + };