From patchwork Tue Jun 23 21:38:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 487796 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 9FF73140311 for ; Wed, 24 Jun 2015 07:43:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=a824LepR; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A9924B76D; Tue, 23 Jun 2015 23:42:30 +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 JmuCk2IyInrT; Tue, 23 Jun 2015 23:42:30 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 75D6A4B76F; Tue, 23 Jun 2015 23:41:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8BE2B4B65F for ; Tue, 23 Jun 2015 23:40:13 +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 5DQsEDelsTuJ for ; Tue, 23 Jun 2015 23:40:13 +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 mail-ie0-f171.google.com (mail-ie0-f171.google.com [209.85.223.171]) by theia.denx.de (Postfix) with ESMTPS id 806094B676 for ; Tue, 23 Jun 2015 23:40:00 +0200 (CEST) Received: by ieqy10 with SMTP id y10so21148405ieq.0 for ; Tue, 23 Jun 2015 14:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=FplZOZeGMnR1/VE1UgvejYR8GIF0V6Z4OoM1q4bdAxA=; b=a824LepRPYmBxYrpQEIdfIOseSG+4mbopBiE49L4Q2kb4izdchgpsLOacaqICqASpc aM8PxXihEU77PC5v/xV93TI0KOnUsoqXWhKwYiCx2OlJnmr1OPEB+GzvIYYC5O1U5NnI rO4frdWrxADSj6oF9DuufKtmLPotORLOXidJzxoju++KfIe0/qYzQQSw29Trba+uaXIK ONSCauLMiy0vVIbEn54kGbKP32rDUL4zQm/Qs09ZgCHagSQ5VBKj7MIep1p7FQz85gMa ea0MKwzrLnVgr+9ywYI5Ior42OLe0b+OLPCVp6WkzwIwnsGFJx8qhnDgtbGjnbn2O0+l VywQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=FplZOZeGMnR1/VE1UgvejYR8GIF0V6Z4OoM1q4bdAxA=; b=nJ1LRN+jd1sJzToVz4FSQD6q1V/aYxYWRH3dy8Zg9ms9htkfsESrioK7D4f2EfFgQw wXeep3psrE0bxPckDaV1+bxjz0K5/tufQnQNLOg9bFe0iKsTFjXpXrVX1dktd/FXdewb 7VrWvv2pDwTh/N4kmQR+EkrlYE+RohDK21Pquq/V10VRF+Zm0vxANZORDX3AfYK6Knbd g6jSZcdrA3k3IYX0GY0KBcUYsW1TVTnVo8QHqMe2Rbm7dzPkpg54T6kpPFwvwPD7dwdj sK5PddQ+6WHnRYbiBydguEL6rWkRf0ZsZODaXG87IguC4nWAwUgP4iwgvae+QHz2ICW6 Nb5w== X-Gm-Message-State: ALoCoQkVVj+vmdXeTERgvUH0ALhc//k7vDN7LOrzKunnGjsqjkQUMRemb8f/zfvLtpvaJ7LAFhUE X-Received: by 10.50.43.227 with SMTP id z3mr5077616igl.22.1435095599790; Tue, 23 Jun 2015 14:39:59 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:29dc:b646:97d0:4c6e]) by mx.google.com with ESMTPSA id ot6sm605167igb.11.2015.06.23.14.39.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2015 14:39:57 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id B2903222038; Tue, 23 Jun 2015 15:39:50 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 23 Jun 2015 15:38:41 -0600 Message-Id: <1435095556-15924-20-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef In-Reply-To: <1435095556-15924-1-git-send-email-sjg@chromium.org> References: <1435095556-15924-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , Przemyslaw Marczak Subject: [U-Boot] [PATCH v3 19/54] dm: gpio: Add dm_gpio_request() to manually request a GPIO 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 function can be used for testing to manually request a GPIO for use, without resorting to the legacy GPIO API. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None drivers/gpio/gpio-uclass.c | 2 +- include/asm-generic/gpio.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index c6fd580..4efda31 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -127,7 +127,7 @@ static int gpio_find_and_xlate(struct gpio_desc *desc, return ops->xlate ? ops->xlate(desc->dev, desc, args) : 0; } -static int dm_gpio_request(struct gpio_desc *desc, const char *label) +int dm_gpio_request(struct gpio_desc *desc, const char *label) { struct udevice *dev = desc->dev; struct gpio_dev_priv *uc_priv; diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index b1cf95c..0af599f 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -434,6 +434,18 @@ int gpio_request_list_by_name(struct udevice *dev, const char *list_name, int flags); /** + * dm_gpio_request() - manually request a GPIO + * + * Note: This function should only be used for testing / debugging. Instead. + * use gpio_request_by_name() to pull GPIOs from the device tree. + * + * @desc: GPIO description of GPIO to request (see dm_gpio_lookup_name()) + * @label: Label to attach to the GPIO while claimed + * @return 0 if OK, -ve on error + */ +int dm_gpio_request(struct gpio_desc *desc, const char *label); + +/** * gpio_get_list_count() - Returns the number of GPIOs in a list * * Counts the GPIOs in a list. See gpio_request_by_name() for additional