From e83486ab596a8b0a5e33056826613ef99766b85e Mon Sep 17 00:00:00 2001 From: Hamish Guthrie Date: Mon, 28 May 2007 13:47:22 +0000 Subject: [PATCH] userspace gpio driver for .21 SVN-Revision: 7368 --- .../at91-2.6/patches/003-gpio-driver.patch | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/target/linux/at91-2.6/patches/003-gpio-driver.patch b/target/linux/at91-2.6/patches/003-gpio-driver.patch index c14542acc6..aa5a2e32e1 100644 --- a/target/linux/at91-2.6/patches/003-gpio-driver.patch +++ b/target/linux/at91-2.6/patches/003-gpio-driver.patch @@ -1,16 +1,28 @@ -diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/gpio.c linux-2.6.19.2/arch/arm/mach-at91rm9200/gpio.c ---- linux-2.6.19.2.old/arch/arm/mach-at91rm9200/gpio.c 2007-03-06 22:49:37.000000000 +0100 -+++ linux-2.6.19.2/arch/arm/mach-at91rm9200/gpio.c 2007-03-07 10:25:41.000000000 +0100 -@@ -28,7 +28,7 @@ +--- linux-2.6.21.1.orig/arch/arm/mach-at91/gpio.c 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1/arch/arm/mach-at91/gpio.c 2007-05-28 15:30:48.000000000 +0200 +@@ -27,6 +27,7 @@ static struct at91_gpio_bank *gpio; static int gpio_banks; -- +static u32 pio_gpio_pin[4] = { 0, 0, 0, 0 }; + static inline void __iomem *pin_to_controller(unsigned pin) +@@ -71,9 +72,13 @@ { -@@ -113,10 +113,13 @@ + void __iomem *pio = pin_to_controller(pin); + unsigned mask = pin_to_mask(pin); ++ int bank = (pin - PIN_BASE) / 32; + + if (!pio) + return -EINVAL; ++ ++ pio_gpio_pin[bank] |= mask; ++ + __raw_writel(mask, pio + PIO_IDR); + __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR)); + __raw_writel(mask, pio + PIO_PER); +@@ -130,10 +135,13 @@ { void __iomem *pio = pin_to_controller(pin); unsigned mask = pin_to_mask(pin); @@ -24,7 +36,7 @@ diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/gpio.c linux-2.6.19.2/arch __raw_writel(mask, pio + PIO_IDR); __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR)); __raw_writel(mask, pio + PIO_ODR); -@@ -134,10 +137,13 @@ +@@ -151,10 +159,13 @@ { void __iomem *pio = pin_to_controller(pin); unsigned mask = pin_to_mask(pin); @@ -38,7 +50,7 @@ diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/gpio.c linux-2.6.19.2/arch __raw_writel(mask, pio + PIO_IDR); __raw_writel(mask, pio + PIO_PUDR); __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR)); -@@ -214,6 +220,18 @@ +@@ -262,6 +273,18 @@ } EXPORT_SYMBOL(at91_get_gpio_value); @@ -57,10 +69,9 @@ diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/gpio.c linux-2.6.19.2/arch /*--------------------------------------------------------------------------*/ #ifdef CONFIG_PM -diff -urN linux-2.6.19.2.old/drivers/char/Kconfig linux-2.6.19.2/drivers/char/Kconfig ---- linux-2.6.19.2.old/drivers/char/Kconfig 2007-03-06 22:49:37.000000000 +0100 -+++ linux-2.6.19.2/drivers/char/Kconfig 2007-03-07 01:08:57.000000000 +0100 -@@ -1064,5 +1064,12 @@ +--- linux-2.6.21.1.orig/drivers/char/Kconfig 2007-05-28 12:22:29.000000000 +0200 ++++ linux-2.6.21.1/drivers/char/Kconfig 2007-05-28 15:37:43.000000000 +0200 +@@ -1087,5 +1087,12 @@ The SPI driver gives user mode access to this serial bus on the AT91RM9200 processor. @@ -69,24 +80,22 @@ diff -urN linux-2.6.19.2.old/drivers/char/Kconfig linux-2.6.19.2/drivers/char/Kc + depends on ARCH_AT91RM9200 && MACH_VLINK + default n + help -+ Provides a handler for LED and GPIO in userspace ++ Provides a handler GPIO's in userspace + endmenu -diff -urN linux-2.6.19.2.old/drivers/char/Makefile linux-2.6.19.2/drivers/char/Makefile ---- linux-2.6.19.2.old/drivers/char/Makefile 2007-03-06 22:49:37.000000000 +0100 -+++ linux-2.6.19.2/drivers/char/Makefile 2007-03-07 01:08:05.000000000 +0100 -@@ -92,6 +92,7 @@ +--- linux-2.6.21.1.orig/drivers/char/Makefile 2007-05-28 12:22:29.000000000 +0200 ++++ linux-2.6.21.1/drivers/char/Makefile 2007-05-28 15:38:11.000000000 +0200 +@@ -95,6 +95,7 @@ obj-$(CONFIG_TELCLOCK) += tlclk.o obj-$(CONFIG_AT91_SPI) += at91_spi.o obj-$(CONFIG_AT91_SPIDEV) += at91_spidev.o -+obj-$(CONFIG_AT91_VLIO) += vlink_giu.o ++obj-$(CONFIG_AT91_VLIO) += vlink_giu.o obj-$(CONFIG_WATCHDOG) += watchdog/ obj-$(CONFIG_MWAVE) += mwave/ -diff -urN linux-2.6.19.2.old/drivers/char/vlink_giu.c linux-2.6.19.2/drivers/char/vlink_giu.c ---- linux-2.6.19.2.old/drivers/char/vlink_giu.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.2/drivers/char/vlink_giu.c 2007-03-07 01:21:21.000000000 +0100 +--- linux-2.6.21.1.orig/drivers/char/vlink_giu.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1/drivers/char/vlink_giu.c 2007-05-28 15:39:47.000000000 +0200 @@ -0,0 +1,256 @@ +/* + * Driver for FDL Versalink GPIO @@ -344,14 +353,3 @@ diff -urN linux-2.6.19.2.old/drivers/char/vlink_giu.c linux-2.6.19.2/drivers/cha +MODULE_AUTHOR("Hamish Guthrie "); +MODULE_DESCRIPTION("FDL Versalink GPIO Driver"); +MODULE_LICENSE("GPL"); -diff -urN linux-2.6.19.2.old/include/asm-arm/arch-at91rm9200/gpio.h linux-2.6.19.2/include/asm-arm/arch-at91rm9200/gpio.h ---- linux-2.6.19.2.old/include/asm-arm/arch-at91rm9200/gpio.h 2007-01-10 20:10:37.000000000 +0100 -+++ linux-2.6.19.2/include/asm-arm/arch-at91rm9200/gpio.h 2007-03-07 01:17:23.000000000 +0100 -@@ -189,6 +189,7 @@ - /* callable at any time */ - extern int at91_set_gpio_value(unsigned pin, int value); - extern int at91_get_gpio_value(unsigned pin); -+extern int at91_is_pin_gpio(unsigned pin); - - /* callable only from core power-management code */ - extern void at91_gpio_suspend(void);