From patchwork Mon Sep 9 10:59:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 1159674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46RlYc3Hdhz9sNT for ; Mon, 9 Sep 2019 21:00:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390900AbfIILAC (ORCPT ); Mon, 9 Sep 2019 07:00:02 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:37843 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390885AbfIILAA (ORCPT ); Mon, 9 Sep 2019 07:00:00 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i7HOn-0003wJ-Jf; Mon, 09 Sep 2019 12:59:57 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1i7HOm-0006LO-SB; Mon, 09 Sep 2019 12:59:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org Subject: [PATCH RFC] gpio: define gpio-init nodes to initialize pins similar to hogs Date: Mon, 9 Sep 2019 12:59:19 +0200 Message-Id: <20190909105919.30418-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-gpio@vger.kernel.org Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Sometimes it is handy to be able to easily define a "safe" state for a GPIO. This might for example be used to ensure that an ethernet phy is properly reset during startup or just that all pins have a defined state to minimize leakage current. As such a pin must be requestable (and changable) by a device driver, a gpio-hog cannot be used. So define a GPIO initializer with a syntax identical to a GPIO hog just using "gpio-init" as identifier instead of "gpio-hog". The usage I have in mind (and also implemented in a custom patch stack on top of barebox already) is targeting the bootloader and not necessarily Linux as such an boot-up initialisation should be done as early as possible. Not-yet-signed-off-by: Uwe Kleine-König --- Hello, maybe it also makes sense to use "gpio-safe"? Maybe it (then) makes sense to reset the gpio in the indicated state after it is released? Also it might be beneficial to make the wording more explicit in the description and for example tell that only one of gpio-hog and gpio-init must be provided. Best regards Uwe Documentation/devicetree/bindings/gpio/gpio.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index a8895d339bfe..5b7883f5520f 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt @@ -182,13 +182,16 @@ gpio-controller@00000000 { "poweroff", "reset"; } -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. +The GPIO chip may contain GPIO hog and init definitions. GPIO hogging is a +mechanism providing automatic GPIO request and configuration as part of the +gpio-controller's driver probe function. An GPIO initializer is similar but +doesn't prevent later requesting and reconfiguration. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-init: A property specifying that this child node represents a GPIO + initializer. - gpios: Store the GPIO information (id, flags, ...) for each GPIO to affect. Shall contain an integer multiple of the number of cells specified in its parent node (GPIO controller node).