summaryrefslogtreecommitdiff
path: root/board/bf533-stamp/bf533-stamp.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-06-02 06:18:57 -0400
committerMike Frysinger <vapier@gentoo.org>2010-07-13 17:50:50 -0400
commit6cfcf5840b2fe00ed0088f0e1fa75590c3cd0dbc (patch)
tree5026b5782cc1d676b5bb5e1ed5e6180d362fc78c /board/bf533-stamp/bf533-stamp.c
parent37a4b75d4c30a37bda2bf8ae0c192446425b6f28 (diff)
Blackfin: bf533-stamp: convert eth/flash swap logic to gpio framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'board/bf533-stamp/bf533-stamp.c')
-rw-r--r--board/bf533-stamp/bf533-stamp.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index fd10eae2f1..935aad240b 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -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)