From patchwork Fri Mar 25 20:12:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 602096 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qWvc02W7Sz9sBf for ; Sat, 26 Mar 2016 07:12:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 48006A748F; Fri, 25 Mar 2016 21:12:27 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id alS_a42uNmyy; Fri, 25 Mar 2016 21:12:26 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 60F314B979; Fri, 25 Mar 2016 21:12:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CE3AA4B979 for ; Fri, 25 Mar 2016 21:12:22 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DtStktb30F8m for ; Fri, 25 Mar 2016 21:12:22 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from fed1rmfepo201.cox.net (fed1rmfepo201.cox.net [68.230.241.146]) by theia.denx.de (Postfix) with ESMTP id 16A9F4B951 for ; Fri, 25 Mar 2016 21:12:18 +0100 (CET) Received: from fed1rmimpo305.cox.net ([68.230.241.173]) by fed1rmfepo201.cox.net (InterMail vM.8.01.05.15 201-2260-151-145-20131218) with ESMTP id <20160325201216.EPEA5597.fed1rmfepo201.cox.net@fed1rmimpo305.cox.net> for ; Fri, 25 Mar 2016 16:12:16 -0400 Received: from localhost.localdomain ([98.165.107.234]) by fed1rmimpo305.cox.net with cox id aLCF1s00853Tyga01LCGyu; Fri, 25 Mar 2016 16:12:16 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020201.56F59BA0.0192, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.1 cv=M9LtU3Es c=1 sm=1 tr=0 a=mmedTQiI2PtWY+RDxZIZmw==:117 a=mmedTQiI2PtWY+RDxZIZmw==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=9_1hYV8uAAAA:8 a=9XGNL58iE9K3rtrPZcYA:9 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (CRAM-MD5) smtp.auth=eric.a.nelson@cox.net From: Eric Nelson To: u-boot@lists.denx.de, sjg@chromium.org Date: Fri, 25 Mar 2016 13:12:11 -0700 Message-Id: <1458936731-13223-1-git-send-email-eric@nelint.com> X-Mailer: git-send-email 2.6.2 Cc: marex@denx.de, twarren@nvidia.com Subject: [U-Boot] [PATCH] dm: gpio: handle GPIO_ACTIVE_LOW flag in DT X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Device tree parsing of GPIO nodes is currently ignoring flags. Add support for GPIO_ACTIVE_LOW by checking for the presence of the flag and setting the desc->flags field to the driver model constant GPIOD_ACTIVE_LOW. Signed-off-by: Eric Nelson --- drivers/gpio/gpio-uclass.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index b58d4e6..6d30612 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -118,12 +119,16 @@ static int gpio_find_and_xlate(struct gpio_desc *desc, { struct dm_gpio_ops *ops = gpio_get_ops(desc->dev); + desc->flags = 0; /* Use the first argument as the offset by default */ - if (args->args_count > 0) + if (args->args_count > 0) { desc->offset = args->args[0]; + if ((args->args_count > 1) && + (args->args[1] & GPIO_ACTIVE_LOW)) + desc->flags = GPIOD_ACTIVE_LOW; + } else desc->offset = -1; - desc->flags = 0; return ops->xlate ? ops->xlate(desc->dev, desc, args) : 0; }