From patchwork Tue Feb 17 22:29:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 440738 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 D722E1401DE for ; Wed, 18 Feb 2015 09:32:05 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 903064B723; Tue, 17 Feb 2015 23:31:33 +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 frqUuyIIGmCr; Tue, 17 Feb 2015 23:31:33 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ADA554B764; Tue, 17 Feb 2015 23:31:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4F1374B639 for ; Tue, 17 Feb 2015 23:30:15 +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 6NjA8hAPkDdM for ; Tue, 17 Feb 2015 23:30:15 +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 mail-pa0-f74.google.com (mail-pa0-f74.google.com [209.85.220.74]) by theia.denx.de (Postfix) with ESMTPS id 3AAB64B67E for ; Tue, 17 Feb 2015 23:30:11 +0100 (CET) Received: by pabkx10 with SMTP id kx10so2677519pab.1 for ; Tue, 17 Feb 2015 14:30:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D77+oj1ut63mdrzJWiwtUOwu78qcz6YZhsmgmBXli1c=; b=Xic9XBdU5UC046zjPdQXsS8vC8wjhKY/jFMO3q73VGj+TtYUzsPiflmHJjPpHDkHYI K434Nca9t/ROKx2/z3OW6k6UtWtc3+IAHLQ6mwf9JC10Q2flxsaeO/3P/OkqzAuDCNA+ ciMMmU3pJJRBQhRSryaF4G5HLgJkUL9bQIUy8U6HzwXQXJ2ABG5MorYh0xagI5AG8ECG mbwZXZZ9+pH3JyBDbnn58Xwuf1qaRKHY3MBmCBz4kODmY6a5P0zx8VAbDM3giZZozD7F FRp+aDlRQLlZC04VgAUFHzKnCp2AxcQYio+mGA36il1peikLUJG6N/Vljgw4jNmmpGur mtyg== X-Gm-Message-State: ALoCoQl9nTbbYqMuJJ7E+H/iSx4W5Cz2+YvqZf/ggkC7tdP9osQYqj79d4L+ACAsq66Ah8LRloUt X-Received: by 10.67.29.231 with SMTP id jz7mr27963051pad.9.1424212210238; Tue, 17 Feb 2015 14:30:10 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id kt5si4269511qcb.3.2015.02.17.14.30.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Feb 2015 14:30:10 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id 8jCTlGrt.1; Tue, 17 Feb 2015 14:30:10 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 662FA220784; Tue, 17 Feb 2015 15:30:09 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Tue, 17 Feb 2015 15:29:42 -0700 Message-Id: <1424212195-7501-9-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1424212195-7501-1-git-send-email-sjg@chromium.org> References: <1424212195-7501-1-git-send-email-sjg@chromium.org> Cc: Stephen Warren , Tom Warren Subject: [U-Boot] [PATCH 08/20] dm: gpio: Add an implementation for gpio_get_number() 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" This has a prototype but no implementation. It returns the global GPIO number given a gpio_desc. It is useful for debugging in some cases. Signed-off-by: Simon Glass --- drivers/gpio/gpio-uclass.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 6e05c54..f316fc1 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -721,6 +721,18 @@ static int gpio_renumber(struct udevice *removed_dev) return 0; } +int gpio_get_number(struct gpio_desc *desc) +{ + struct udevice *dev = desc->dev; + struct gpio_dev_priv *uc_priv; + + if (!dev) + return -1; + uc_priv = dev->uclass_priv; + + return uc_priv->gpio_base + desc->offset; +} + static int gpio_post_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev->uclass_priv;