Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753562AbcD2O3Q (ORCPT ); Fri, 29 Apr 2016 10:29:16 -0400 Received: from mail-ob0-f169.google.com ([209.85.214.169]:33876 "EHLO mail-ob0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753077AbcD2O3O convert rfc822-to-8bit (ORCPT ); Fri, 29 Apr 2016 10:29:14 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 29 Apr 2016 16:29:13 +0200 Message-ID: Subject: Re: [RFC v5 4/4] gpio: dt-bindings: add gpio-mmio bindings From: Linus Walleij To: Christian Lamparter Cc: "linux-gpio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , =?UTF-8?B?w4FsdmFybyBGZXJuw6FuZGV6IFJvamFz?= , Kumar Gala , Alexander Shiyan , Ian Campbell , Mark Rutland , Pawel Moll , Rob Herring , Alexandre Courbot Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2827 Lines: 85 On Fri, Apr 29, 2016 at 2:53 AM, Christian Lamparter wrote: > 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 I share your ambition to create something generic for this class of hardware(s). > +Bindings for the generic driver for memory-mapped GPIO controllers. > + > +Required properties: > + - compatible: should be "linux,gpio-mmio" Why? "memory-mapped-gpio" sits nicely with me. Read another very generic binding for inspiration: Documentation/devicetree/bindings/leds/register-bit-led.txt > + - 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 I would just be more verbose: data-in-register data-out-set-register data-out-clear-register direction-output-register direction-input-register Some should be optional so we can support input-only and output-only GPIO controllers too. I would take this opportunity to add bindings also for stuff that the generic MMIO driver does not support today but could be made to support: open-drain-register open-source-register debounce-register etc > +Optional properties: > + - ngpio: specifies the number of gpio mapped in the register. Just reference the generic docs. > + - 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. I think it's better to imply that if there is no data-in-register specified, then it is output-only etc. > +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. Skip this. It is Linux-specific. Yours, Linus Walleij