]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Blackfin: bf533-stamp: convert eth/flash swap logic to gpio framework
authorMike Frysinger <vapier@gentoo.org>
Wed, 2 Jun 2010 10:18:57 +0000 (06:18 -0400)
committerMike Frysinger <vapier@gentoo.org>
Tue, 13 Jul 2010 21:50:50 +0000 (17:50 -0400)
Rather than bang MMRs directly, use the new portmux framework to handle
the details.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
board/bf533-stamp/bf533-stamp.c

index fd10eae2f1223923ff7176d79e6090bd774e7521..935aad240b9e2f0c8a335dd802209d840589a403 100644 (file)
@@ -27,8 +27,7 @@
 
 #include <common.h>
 #include <netdev.h>
-#include <asm/io.h>
-#include "bf533-stamp.h"
+#include <asm/gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -46,15 +45,10 @@ int checkboard(void)
  */
 void swap_to(int device_id)
 {
-       bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF1 | PF0);
-       SSYNC();
-       bfin_write_FIO_FLAG_C(PF1);
-       if (device_id == ETHERNET)
-               bfin_write_FIO_FLAG_S(PF0);
-       else if (device_id == FLASH)
-               bfin_write_FIO_FLAG_C(PF0);
-       else
-               printf("Unknown device to switch\n");
+       gpio_request(GPIO_PF0, "eth_flash_swap");
+       gpio_request(GPIO_PF1, "eth_flash_swap");
+       gpio_direction_output(GPIO_PF0, device_id == ETHERNET);
+       gpio_direction_output(GPIO_PF1, 0);
        SSYNC();
 }
 
@@ -75,24 +69,23 @@ int misc_init_r(void)
 #define STATUS_LED_OFF 0
 #define STATUS_LED_ON  1
 
+static int gpio_setup;
+
 static void stamp_led_set(int LED1, int LED2, int LED3)
 {
-       bfin_write_FIO_INEN(bfin_read_FIO_INEN() & ~(PF2 | PF3 | PF4));
-       bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4));
-
-       if (LED1 == STATUS_LED_OFF)
-               *pFIO_FLAG_S = PF2;
-       else
-               *pFIO_FLAG_C = PF2;
-       if (LED2 == STATUS_LED_OFF)
-               *pFIO_FLAG_S = PF3;
-       else
-               *pFIO_FLAG_C = PF3;
-       if (LED3 == STATUS_LED_OFF)
-               *pFIO_FLAG_S = PF4;
-       else
-               *pFIO_FLAG_C = PF4;
-       SSYNC();
+       if (!gpio_setup) {
+               gpio_request(GPIO_PF2, "boot_progress");
+               gpio_request(GPIO_PF3, "boot_progress");
+               gpio_request(GPIO_PF4, "boot_progress");
+               gpio_direction_output(GPIO_PF2, LED1);
+               gpio_direction_output(GPIO_PF3, LED2);
+               gpio_direction_output(GPIO_PF4, LED3);
+               gpio_setup = 1;
+       } else {
+               gpio_set_value(GPIO_PF2, LED1);
+               gpio_set_value(GPIO_PF3, LED2);
+               gpio_set_value(GPIO_PF4, LED3);
+       }
 }
 
 void show_boot_progress(int status)