]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/blackfin/cpu/gpio.c
Merge branch 'master' of git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / arch / blackfin / cpu / gpio.c
index f9aff4d894ae95f2d69239e60127485cc5b1a1cc..4b4cf93c2dc06d2c3aab7ad4dfb8f59cfc011dfe 100644 (file)
@@ -12,6 +12,7 @@
 #include <asm/gpio.h>
 #include <asm/portmux.h>
 
+#ifndef CONFIG_ADI_GPIO2
 #if ANOMALY_05000311 || ANOMALY_05000323
 enum {
        AWA_data = SYSCR,
@@ -758,6 +759,54 @@ void bfin_reset_boot_spi_cs(unsigned short pin)
        udelay(1);
 }
 
+int name_to_gpio(const char *name)
+{
+       int port_base;
+
+       if (tolower(*name) == 'p') {
+               ++name;
+
+               switch (tolower(*name)) {
+#ifdef GPIO_PA0
+               case 'a': port_base = GPIO_PA0; break;
+#endif
+#ifdef GPIO_PB0
+               case 'b': port_base = GPIO_PB0; break;
+#endif
+#ifdef GPIO_PC0
+               case 'c': port_base = GPIO_PC0; break;
+#endif
+#ifdef GPIO_PD0
+               case 'd': port_base = GPIO_PD0; break;
+#endif
+#ifdef GPIO_PE0
+               case 'e': port_base = GPIO_PE0; break;
+#endif
+#ifdef GPIO_PF0
+               case 'f': port_base = GPIO_PF0; break;
+#endif
+#ifdef GPIO_PG0
+               case 'g': port_base = GPIO_PG0; break;
+#endif
+#ifdef GPIO_PH0
+               case 'h': port_base = GPIO_PH0; break;
+#endif
+#ifdef GPIO_PI0
+               case 'i': port_base = GPIO_PI0; break;
+#endif
+#ifdef GPIO_PJ
+               case 'j': port_base = GPIO_PJ0; break;
+#endif
+               default:  return -1;
+               }
+
+               ++name;
+       } else
+               port_base = 0;
+
+       return port_base + simple_strtoul(name, NULL, 10);
+}
+
 void gpio_labels(void)
 {
        int c, gpio;
@@ -774,3 +823,19 @@ void gpio_labels(void)
                        continue;
        }
 }
+#else
+struct gpio_port_t * const gpio_array[] = {
+       (struct gpio_port_t *)PORTA_FER,
+       (struct gpio_port_t *)PORTB_FER,
+       (struct gpio_port_t *)PORTC_FER,
+       (struct gpio_port_t *)PORTD_FER,
+       (struct gpio_port_t *)PORTE_FER,
+       (struct gpio_port_t *)PORTF_FER,
+       (struct gpio_port_t *)PORTG_FER,
+#if defined(CONFIG_BF54x)
+       (struct gpio_port_t *)PORTH_FER,
+       (struct gpio_port_t *)PORTI_FER,
+       (struct gpio_port_t *)PORTJ_FER,
+#endif
+};
+#endif