From patchwork Wed Aug 10 05:17:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hershberger X-Patchwork-Id: 109324 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 95904B70C3 for ; Wed, 10 Aug 2011 13:23:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 94E8928264; Wed, 10 Aug 2011 05:23:25 +0200 (CEST) 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 jM0S-Ml2YSoZ; Wed, 10 Aug 2011 05:23:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 831AC2825C; Wed, 10 Aug 2011 05:23:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 641DF281B2 for ; Wed, 10 Aug 2011 05:23:11 +0200 (CEST) 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 NaUYWp8o+gZV for ; Wed, 10 Aug 2011 05:23:08 +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 spamkiller06.natinst.com (mailserver6.natinst.com [130.164.80.6]) by theia.denx.de (Postfix) with ESMTP id 0C7C828246 for ; Wed, 10 Aug 2011 05:23:06 +0200 (CEST) Received: from mailserv58-us.natinst.com (nb-hsrp-1338.natinst.com [130.164.19.133]) by spamkiller06.natinst.com (8.14.4/8.14.4) with ESMTP id p7A3N4fK008396; Tue, 9 Aug 2011 22:23:04 -0500 Received: from localhost.localdomain ([130.164.14.197]) by mailserv58-us.natinst.com (Lotus Domino Release 8.5.2FP1) with ESMTP id 2011080922230446-93301 ; Tue, 9 Aug 2011 22:23:04 -0500 From: Joe Hershberger To: u-boot@lists.denx.de Date: Wed, 10 Aug 2011 00:17:05 -0500 Message-Id: <1312953426-22696-1-git-send-email-joe.hershberger@ni.com> X-Mailer: git-send-email 1.6.0.2 X-MIMETrack: Itemize by SMTP Server on MailServ58-US/AUS/H/NIC(Release 8.5.2FP1|November 29, 2010) at 08/09/2011 10:23:04 PM, Serialize by Router on MailServ58-US/AUS/H/NIC(Release 8.5.2FP1|November 29, 2010) at 08/09/2011 10:23:04 PM, Serialize complete at 08/09/2011 10:23:04 PM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.4.6813, 1.0.211, 0.0.0000 definitions=2011-08-10_01:2011-08-10, 2011-08-09, 1970-01-01 signatures=0 Cc: Joe Hershberger Subject: [U-Boot] [PATCH 1/2] omap3+: Add OMAP support for cmd_gpio X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add a shim driver to drivers/gpio that maps the standard GPIO API to the OMAP GPIO API Empty gpio.h is needed in the asm/arch dirs for omap3 and omap4 due to include in asm/gpio.h Signed-off-by: Joe Hershberger Cc: Joe Hershberger Cc: Sandeep Paulraj --- arch/arm/include/asm/arch-omap3/gpio.h | 1 + arch/arm/include/asm/arch-omap4/gpio.h | 1 + drivers/gpio/Makefile | 1 + drivers/gpio/omap_gpio.c | 69 ++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h create mode 100644 drivers/gpio/omap_gpio.c diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/arch-omap3/gpio.h new file mode 100644 index 0000000..fdeeadb --- /dev/null +++ b/arch/arm/include/asm/arch-omap3/gpio.h @@ -0,0 +1 @@ +/* gpio.h */ diff --git a/arch/arm/include/asm/arch-omap4/gpio.h b/arch/arm/include/asm/arch-omap4/gpio.h new file mode 100644 index 0000000..fdeeadb --- /dev/null +++ b/arch/arm/include/asm/arch-omap4/gpio.h @@ -0,0 +1 @@ +/* gpio.h */ diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 62ec97d..f9bef58 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -31,6 +31,7 @@ COBJS-$(CONFIG_MARVELL_MFP) += mvmfp.o COBJS-$(CONFIG_MXC_GPIO) += mxc_gpio.o COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P) += s5p_gpio.o +COBJS-$(CONFIG_OMAP_GPIO) += omap_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c new file mode 100644 index 0000000..4873065 --- /dev/null +++ b/drivers/gpio/omap_gpio.c @@ -0,0 +1,69 @@ +/* + * Adapter to OMAP GPIO handling. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include + +/* + * Generic_GPIO primitives. + */ + +int gpio_request(int gp, const char *label) +{ + return omap_request_gpio(gp); +} + +void gpio_free(int gp) +{ +} + +/* set GPIO pin 'gp' as an input */ +int gpio_direction_input(int gp) +{ + omap_set_gpio_direction(gp, 1); + return 0; +} + +void gpio_toggle_value(int gp) +{ + omap_set_gpio_dataout(gp, !omap_get_gpio_datain(gp)); +} + +/* set GPIO pin 'gp' as an output, with polarity 'value' */ +int gpio_direction_output(int gp, int value) +{ + omap_set_gpio_dataout(gp, value); + omap_set_gpio_direction(gp, 0); + return 0; +} + +/* read GPIO IN value of pin 'gp' */ +int gpio_get_value(int gp) +{ + return omap_get_gpio_datain(gp); +} + +/* write GPIO OUT value to pin 'gp' */ +void gpio_set_value(int gp, int value) +{ + omap_set_gpio_dataout(gp, value); +}