Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3e0cc7ee045fb53e8215fed7442455c0cee0ee93
Commit:     3e0cc7ee045fb53e8215fed7442455c0cee0ee93
Parent:     39cbd4896e39e2b93c33635a9abc1a4405827e14
Author:     Russell King <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 2 14:28:01 2007 +0100
Committer:  Russell King <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 18:53:55 2007 +0100

    [ARM] pxa: Avoid pxa_gpio_mode() in gpio_direction_{in,out}put()
    
    pxa_gpio_mode() is a universal call that fiddles with the GAFR
    (gpio alternate function register.)  GAFR does not exist on PXA3
    CPUs, but instead the alternate functions are controlled via the
    MFP support code.
    
    Platforms are expected to configure the MFP according to their
    needs in their platform support code rather than drivers.  We
    extend this idea to the GAFR, and make the gpio_direction_*()
    functions purely operate on the GPIO level.
    
    This means platform support code is entirely responsible for
    configuring the GPIOs alternate functions on all PXA CPU types.
    
    Signed-off-by: Russell King <[EMAIL PROTECTED]>
---
 arch/arm/mach-pxa/generic.c     |   38 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-pxa/gpio.h |   12 ++----------
 2 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 2263a84..1c34946 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -105,6 +105,44 @@ int pxa_gpio_mode(int gpio_mode)
 
 EXPORT_SYMBOL(pxa_gpio_mode);
 
+int gpio_direction_input(unsigned gpio)
+{
+       unsigned long flags;
+       u32 mask;
+
+       if (gpio > pxa_last_gpio)
+               return -EINVAL;
+
+       mask = GPIO_bit(gpio);
+       local_irq_save(flags);
+       GPDR(gpio) &= ~mask;
+       local_irq_restore(flags);
+
+       return 0;
+}
+EXPORT_SYMBOL(gpio_direction_input);
+
+int gpio_direction_output(unsigned gpio, int value)
+{
+       unsigned long flags;
+       u32 mask;
+
+       if (gpio > pxa_last_gpio)
+               return -EINVAL;
+
+       mask = GPIO_bit(gpio);
+       local_irq_save(flags);
+       if (value)
+               GPSR(gpio) = mask;
+       else
+               GPCR(gpio) = mask;
+       GPDR(gpio) |= mask;
+       local_irq_restore(flags);
+
+       return 0;
+}
+EXPORT_SYMBOL(gpio_direction_output);
+
 /*
  * Return GPIO level
  */
diff --git a/include/asm-arm/arch-pxa/gpio.h b/include/asm-arm/arch-pxa/gpio.h
index 9e99241..9dbc2dc 100644
--- a/include/asm-arm/arch-pxa/gpio.h
+++ b/include/asm-arm/arch-pxa/gpio.h
@@ -38,16 +38,8 @@ static inline void gpio_free(unsigned gpio)
        return;
 }
 
-static inline int gpio_direction_input(unsigned gpio)
-{
-       return pxa_gpio_mode(gpio | GPIO_IN);
-}
-
-static inline int gpio_direction_output(unsigned gpio, int value)
-{
-       return pxa_gpio_mode(gpio | GPIO_OUT |
-                         (value ? GPIO_DFLT_HIGH : GPIO_DFLT_LOW));
-}
+extern int gpio_direction_input(unsigned gpio);
+extern int gpio_direction_output(unsigned gpio, int value);
 
 static inline int __gpio_get_value(unsigned gpio)
 {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to