Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751610AbdFIOQb (ORCPT ); Fri, 9 Jun 2017 10:16:31 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:39371 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751534AbdFIOQa (ORCPT ); Fri, 9 Jun 2017 10:16:30 -0400 From: Oleksij Rempel To: kernel@pengutronix.de, Linus Walleij , Alexandre Courbot , Rob Herring , Mark Rutland , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, barebox@lists.infradead.org Cc: Oleksij Rempel Subject: [PATCH v1 1/1] gpio: of: provide option generic property for initial line states Date: Fri, 9 Jun 2017 16:16:22 +0200 Message-Id: <20170609141622.21502-1-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.11.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1781 Lines: 45 This property is needed for barebox or may be other bootloaders to set proper gpio configuration as early as possible. This example is mainly based on "lines-initial-states" property from this binding documentation: Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt Signed-off-by: Oleksij Rempel --- Documentation/devicetree/bindings/gpio/gpio.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index 84ede036f73d..60f8e8d8ab32 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt @@ -181,6 +181,26 @@ gpio-controller@00000000 { "poweroff", "reset"; } +Optionally, a GPIO controller may have a "gpio-lines-initial-states" property. +This is an array of values that specifies the initial state of each line. When +a value is set to one, the corresponding line will be initialized to the input +(pulled-up) state. When the values is set to two, the line will be initialized +the low-level output state. If values is set to zero the line will be +initialized to the input state. +If the property is not specified no specific configuration will be set. Driver +should reuse HW configuration provided by bootloader or other system. + +Example: + +gpio-controller@00000000 { + compatible = "foo"; + reg = <0x00000000 0x1000>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <9>; + gpio-lines-initial-states = <0>, <1>, <2>, <0>, <0>, <2>, <2>, <1>, <1>; +} + The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism providing automatic GPIO request and configuration as part of the gpio-controller's driver probe function. -- 2.11.0