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 <joe.hershber...@ni.com> Cc: Joe Hershberger <joe.hershber...@gmail.com> Cc: Sandeep Paulraj <s-paul...@ti.com> --- Changes for v2: - Changed API to match common gpio API (http://patchwork.ozlabs.org/patch/109904/) 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 | 64 ++++++++++++++++++++++++++++++++ 4 files changed, 67 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..551e387 --- /dev/null +++ b/drivers/gpio/omap_gpio.c @@ -0,0 +1,64 @@ +/* + * 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 <common.h> +#include <asm/omap_gpio.h> + +/* + * Generic_GPIO primitives. + */ + +int gpio_request(unsigned gpio, const char *label) +{ + return omap_request_gpio(gpio); +} + +void gpio_free(unsigned gpio) +{ +} + +/* set GPIO pin 'gpio' as an input */ +int gpio_direction_input(unsigned gpio) +{ + omap_set_gpio_direction(gpio, 1); + return 0; +} + +/* set GPIO pin 'gpio' as an output, with polarity 'value' */ +int gpio_direction_output(unsigned gpio, int value) +{ + omap_set_gpio_dataout(gpio, value); + omap_set_gpio_direction(gpio, 0); + return 0; +} + +/* read GPIO IN value of pin 'gpio' */ +int gpio_get_value(unsigned gpio) +{ + return omap_get_gpio_datain(gpio); +} + +/* write GPIO OUT value to pin 'gpio' */ +void gpio_set_value(unsigned gpio, int value) +{ + omap_set_gpio_dataout(gpio, value); +} -- 1.6.0.2 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot