From patchwork Fri Nov 29 11:13:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Bie=C3=9Fmann?= X-Patchwork-Id: 295264 X-Patchwork-Delegate: andreas.biessmann@googlemail.com 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 E46A82C0086 for ; Fri, 29 Nov 2013 22:14:45 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 42101A7602; Fri, 29 Nov 2013 12:14:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 tttX-F0ChOnZ; Fri, 29 Nov 2013 12:14:43 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 21567A750C; Fri, 29 Nov 2013 12:14:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D6C3DA750C for ; Fri, 29 Nov 2013 12:14:37 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 HEDEreTOkvmf for ; Fri, 29 Nov 2013 12:14:33 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=ERR(-1.5) (only DNSBL check requested) Received: from mail-bk0-f50.google.com (mail-bk0-f50.google.com [209.85.214.50]) by theia.denx.de (Postfix) with ESMTPS id 0EAD4A75FD for ; Fri, 29 Nov 2013 12:14:24 +0100 (CET) Received: by mail-bk0-f50.google.com with SMTP id e11so4157958bkh.23 for ; Fri, 29 Nov 2013 03:14:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=3UAU5KtNg33rRdVg+2GIe5iI50VSMqZ/GR5s/gJQt4g=; b=Fgxq7/221vYr6/zNygsS1w3WNPljj6O/5+Sl8XncQQkLEmNOFmAYs3Sw2fiADlTguJ 5NL4oYNQ4CrjmHzkXtfZAEcCS631/FqpLkaLsOxWcLN7yMBniB49TWgxbDSRafefLLnG clr1dQajjhdOhmwuixQWFxYimgUG/hmS7uopoRtJVjiO3H9Od0uWYZCg+/fk6l2KCl59 9AISOff2j9tQ8Iz7QZPVAaUy+CIWpb57Fr4jTfsfhqboQvbfZrt7FRXkh4MFNEwhqxLk CsinHVMcdBQBay2mYwJiZ1e+b34L49Gzk1lwY3BhnKGFiViMzkhZMZt31Pfm37w1FNDk nc6w== X-Received: by 10.204.117.3 with SMTP id o3mr1600183bkq.38.1385723663798; Fri, 29 Nov 2013 03:14:23 -0800 (PST) Received: from localhost ([2a01:198:47b:1:210:75ff:fe1a:cd1e]) by mx.google.com with ESMTPSA id z6sm63103357bkn.8.2013.11.29.03.14.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 29 Nov 2013 03:14:23 -0800 (PST) From: =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= To: u-boot@lists.denx.de Date: Fri, 29 Nov 2013 12:13:43 +0100 Message-Id: <1385723626-1586-2-git-send-email-andreas.devel@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1385723626-1586-1-git-send-email-andreas.devel@googlemail.com> References: <1385723626-1586-1-git-send-email-andreas.devel@googlemail.com> MIME-Version: 1.0 Cc: Daniel Gorsulowski , egnite GmbH , Eric Benard Subject: [U-Boot] [PATCH 1/4] at91: add new gpio pin definitions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch define new names for GPIO pins on at91 devices. Follow up patches will convert the whole infrastructure to use these new definitions. Signed-off-by: Andreas Bießmann Tested-by: Bo Shen --- arch/arm/include/asm/arch-at91/gpio.h | 24 +++++++++++++++++++++++- drivers/gpio/at91_gpio.c | 4 +--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/arch-at91/gpio.h b/arch/arm/include/asm/arch-at91/gpio.h index 0700427..b340afe 100644 --- a/arch/arm/include/asm/arch-at91/gpio.h +++ b/arch/arm/include/asm/arch-at91/gpio.h @@ -231,4 +231,26 @@ static inline unsigned pin_to_mask(unsigned pin) #define at91_set_gpio_value(x, y) at91_set_pio_value(x, y) #define at91_get_gpio_value(x) at91_get_pio_value(x) #endif -#endif + +#define GPIO_PIOA_BASE (0) +#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) +#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) +#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) +#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32) +#define GPIO_PIN_PA(x) (GPIO_PIOA_BASE + (x)) +#define GPIO_PIN_PB(x) (GPIO_PIOB_BASE + (x)) +#define GPIO_PIN_PC(x) (GPIO_PIOC_BASE + (x)) +#define GPIO_PIN_PD(x) (GPIO_PIOD_BASE + (x)) +#define GPIO_PIN_PE(x) (GPIO_PIOE_BASE + (x)) + +static inline unsigned at91_gpio_to_port(unsigned gpio) +{ + return gpio / 32; +} + +static inline unsigned at91_gpio_to_pin(unsigned gpio) +{ + return gpio % 32; +} + +#endif /* __ASM_ARCH_AT91_GPIO_H */ diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index af09786..8b76666 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -14,6 +14,7 @@ #include #include #include +#include static struct at91_port *at91_pio_get_port(unsigned port) { @@ -356,9 +357,6 @@ int at91_get_pio_value(unsigned port, unsigned pin) /* Common GPIO API */ -#define at91_gpio_to_port(gpio) (gpio / 32) -#define at91_gpio_to_pin(gpio) (gpio % 32) - int gpio_request(unsigned gpio, const char *label) { return 0;