From patchwork Fri Apr 1 15:47:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 604924 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 3qc5l33BSsz9s3T for ; Sat, 2 Apr 2016 03:03:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 50421A7602; Fri, 1 Apr 2016 18:03:09 +0200 (CEST) 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 Pt5YSztJlOJ9; Fri, 1 Apr 2016 18:03:09 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 318D1A75F8; Fri, 1 Apr 2016 17:59:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5074FA74DB for ; Fri, 1 Apr 2016 17:51:04 +0200 (CEST) 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 uqEVD2SgD2Z4 for ; Fri, 1 Apr 2016 17:51:02 +0200 (CEST) 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 fed1rmfepo103.cox.net (fed1rmfepo103.cox.net [68.230.241.145]) by theia.denx.de (Postfix) with ESMTP id 8D68DA7559 for ; Fri, 1 Apr 2016 17:49:07 +0200 (CEST) Received: from fed1rmimpo110.cox.net ([68.230.241.159]) by fed1rmfepo103.cox.net (InterMail vM.8.01.05.15 201-2260-151-145-20131218) with ESMTP id <20160401154905.HGRY3955.fed1rmfepo103.cox.net@fed1rmimpo110.cox.net> for ; Fri, 1 Apr 2016 11:49:05 -0400 Received: from localhost.localdomain ([98.165.107.234]) by fed1rmimpo110.cox.net with cox id d3p31s00A53Tyga013p4HB; Fri, 01 Apr 2016 11:49:04 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020204.56FE9871.0005, 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=HZa0Nnw8 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=sP0fbl_k7B9mOS-DZ1AA: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 Date: Fri, 1 Apr 2016 08:47:36 -0700 Message-Id: <1459525662-28032-2-git-send-email-eric@nelint.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1459525662-28032-1-git-send-email-eric@nelint.com> References: <56FD8B60.8060103@nelint.com> <1459525662-28032-1-git-send-email-eric@nelint.com> Cc: marex@denx.de, swarren@nvidia.com, joe.hershberger@ni.com, purna.mandal@microchip.com, twarren@nvidia.com, p.marczak@samsung.com Subject: [U-Boot] [PATCH 1/7] 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 and architecture-specific xlate routines are handling the parsing of GPIO_ACTIVE_LOW. Since GPIO_ACTIVE_LOW isn't specific to a particular device type, this patch adds support at a global level and removes the need for many of the driver-specific xlate routines. Signed-off-by: Eric Nelson --- drivers/gpio/gpio-uclass.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index b58d4e6..a3cbb83 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,15 @@ static int gpio_find_and_xlate(struct gpio_desc *desc, { struct dm_gpio_ops *ops = gpio_get_ops(desc->dev); + desc->offset = -1; + 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]; - else - desc->offset = -1; - desc->flags = 0; + if ((args->args_count > 1) && + (args->args[1] & GPIO_ACTIVE_LOW)) + desc->flags = GPIOD_ACTIVE_LOW; + } return ops->xlate ? ops->xlate(desc->dev, desc, args) : 0; }