]> git.sur5r.net Git - u-boot/blobdiff - drivers/gpio/at91_gpio.c
nitrogen6x: display: add support for LG-9.7 LVDS display
[u-boot] / drivers / gpio / at91_gpio.c
index 6073843b5efdbf8be158a221409780cadb44ba73..6517af162815ea8e5715dabb390ed46de12f4617 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)
  *
 #include <config.h>
 #include <common.h>
 #include <asm/io.h>
-#include <asm/sizes.h>
+#include <linux/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)
 {
@@ -33,6 +34,7 @@ static struct at91_port *at91_pio_get_port(unsigned port)
 #endif
 #endif
        default:
+               printf("Error: at91_gpio: Fail to get PIO base!\n");
                return NULL;
        }
 }
@@ -199,7 +201,7 @@ int at91_set_pio_output(unsigned port, u32 pin, int value)
        struct at91_port *at91_port = at91_pio_get_port(port);
        u32 mask;
 
-       if ((port < ATMEL_PIO_PORTS) && (pin < 32)) {
+       if (at91_port && (port < ATMEL_PIO_PORTS) && (pin < 32)) {
                mask = 1 << pin;
                writel(mask, &at91_port->idr);
                writel(mask, &at91_port->pudr);
@@ -356,9 +358,6 @@ int at91_get_pio_value(unsigned port, unsigned pin)
 
 /* Common GPIO API */
 
-#define at91_gpio_to_port(gpio)                (gpio / 32)
-#define at91_gpio_to_pin(gpio)         (gpio % 32)
-
 int gpio_request(unsigned gpio, const char *label)
 {
        return 0;