]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/gpio/at91_gpio.c
at91: add new gpio pin definitions
[karo-tx-uboot.git] / drivers / gpio / at91_gpio.c
index 6d227d36fe5fec436df42c551c7fc8a6402554a1..8b766665c689727081eea1e4311498726c2287df 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Memory Setup stuff - taken from blob memsetup.S
+ * Copyright (C) 2013 Bo Shen <voice.shen@atmel.com>
  *
  * Copyright (C) 2009 Jens Scharsig (js_at_ng@scharsoft.de)
  *
@@ -14,6 +14,7 @@
 #include <asm/sizes.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pio.h>
+#include <asm/arch/gpio.h>
 
 static struct at91_port *at91_pio_get_port(unsigned port)
 {
@@ -353,3 +354,43 @@ int at91_get_pio_value(unsigned port, unsigned pin)
 
        return pdsr != 0;
 }
+
+/* Common GPIO API */
+
+int gpio_request(unsigned gpio, const char *label)
+{
+       return 0;
+}
+
+int gpio_free(unsigned gpio)
+{
+       return 0;
+}
+
+int gpio_direction_input(unsigned gpio)
+{
+       at91_set_pio_input(at91_gpio_to_port(gpio),
+                          at91_gpio_to_pin(gpio), 0);
+       return 0;
+}
+
+int gpio_direction_output(unsigned gpio, int value)
+{
+       at91_set_pio_output(at91_gpio_to_port(gpio),
+                           at91_gpio_to_pin(gpio), value);
+       return 0;
+}
+
+int gpio_get_value(unsigned gpio)
+{
+       return at91_get_pio_value(at91_gpio_to_port(gpio),
+                                 at91_gpio_to_pin(gpio));
+}
+
+int gpio_set_value(unsigned gpio, int value)
+{
+       at91_set_pio_value(at91_gpio_to_port(gpio),
+                          at91_gpio_to_pin(gpio), value);
+
+       return 0;
+}