]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Blackfin: convert gpio flash logic to common gpio layer
authorMike Frysinger <vapier@gentoo.org>
Wed, 2 Jun 2010 09:22:16 +0000 (05:22 -0400)
committerMike Frysinger <vapier@gentoo.org>
Mon, 5 Jul 2010 09:30:08 +0000 (05:30 -0400)
Use the common gpio layer rather than bang on MMRs directly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
board/cm-bf527/gpio_cfi_flash.c
board/cm-bf537e/gpio_cfi_flash.c
board/cm-bf537u/gpio_cfi_flash.c
board/tcm-bf537/gpio_cfi_flash.c

index 71676803f5c4c7a943a4f6b9f0ad51453010e410..f8ccc078ec1e213fb20bdd13ef19859e7ba7d16f 100644 (file)
@@ -8,12 +8,13 @@
 
 #include <common.h>
 #include <asm/blackfin.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include "gpio_cfi_flash.h"
 
-#define GPIO_PIN_1  PH9
+#define GPIO_PIN_1  GPIO_PH9
 #define GPIO_MASK_1 (1 << 21)
-#define GPIO_PIN_2  PG11
+#define GPIO_PIN_2  GPIO_PG11
 #define GPIO_MASK_2 (1 << 22)
 #define GPIO_MASK   (GPIO_MASK_1 | GPIO_MASK_2)
 
@@ -21,16 +22,10 @@ void *gpio_cfi_flash_swizzle(void *vaddr)
 {
        unsigned long addr = (unsigned long)vaddr;
 
-       if (addr & GPIO_MASK_1)
-               bfin_write_PORTHIO_SET(GPIO_PIN_1);
-       else
-               bfin_write_PORTHIO_CLEAR(GPIO_PIN_1);
+       gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
 
 #ifdef GPIO_MASK_2
-       if (addr & GPIO_MASK_2)
-               bfin_write_PORTGIO_SET(GPIO_PIN_2);
-       else
-               bfin_write_PORTGIO_CLEAR(GPIO_PIN_2);
+       gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
 #endif
 
        SSYNC();
@@ -57,7 +52,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
 
 void gpio_cfi_flash_init(void)
 {
-       bfin_write_PORTHIO_DIR(bfin_read_PORTHIO_DIR() | GPIO_PIN_1);
-       bfin_write_PORTGIO_DIR(bfin_read_PORTGIO_DIR() | GPIO_PIN_2);
+       gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
+#ifdef GPIO_MASK_2
+       gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
+#endif
        gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
 }
index a9e69cfe418e75c1ef6ce5f7f7597a14fe121110..79ee844135fff9c4102eb4957f26b4cbc5ee0c23 100644 (file)
@@ -8,10 +8,11 @@
 
 #include <common.h>
 #include <asm/blackfin.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include "gpio_cfi_flash.h"
 
-#define GPIO_PIN_1  PF4
+#define GPIO_PIN_1  GPIO_PF4
 #define GPIO_MASK_1 (1 << 21)
 #define GPIO_MASK   (GPIO_MASK_1)
 
@@ -19,16 +20,10 @@ void *gpio_cfi_flash_swizzle(void *vaddr)
 {
        unsigned long addr = (unsigned long)vaddr;
 
-       if (addr & GPIO_MASK_1)
-               bfin_write_PORTFIO_SET(GPIO_PIN_1);
-       else
-               bfin_write_PORTFIO_CLEAR(GPIO_PIN_1);
+       gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
 
 #ifdef GPIO_MASK_2
-       if (addr & GPIO_MASK_2)
-               bfin_write_PORTGIO_SET(GPIO_PIN_2);
-       else
-               bfin_write_PORTGIO_CLEAR(GPIO_PIN_2);
+       gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
 #endif
 
        SSYNC();
@@ -55,6 +50,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
 
 void gpio_cfi_flash_init(void)
 {
-       bfin_write_PORTFIO_DIR(bfin_read_PORTFIO_DIR() | GPIO_PIN_1);
+       gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
+#ifdef GPIO_MASK_2
+       gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
+#endif
        gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
 }
index 68633ec78d985302c8d70efdfb50147e2fc8025f..416c6895003dfad5382915a4f9d84576c839d0c4 100644 (file)
@@ -8,10 +8,11 @@
 
 #include <common.h>
 #include <asm/blackfin.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include "gpio_cfi_flash.h"
 
-#define GPIO_PIN_1  PH0
+#define GPIO_PIN_1  GPIO_PH0
 #define GPIO_MASK_1 (1 << 21)
 #define GPIO_MASK   (GPIO_MASK_1)
 
@@ -19,16 +20,10 @@ void *gpio_cfi_flash_swizzle(void *vaddr)
 {
        unsigned long addr = (unsigned long)vaddr;
 
-       if (addr & GPIO_MASK_1)
-               bfin_write_PORTHIO_SET(GPIO_PIN_1);
-       else
-               bfin_write_PORTHIO_CLEAR(GPIO_PIN_1);
+       gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
 
 #ifdef GPIO_MASK_2
-       if (addr & GPIO_MASK_2)
-               bfin_write_PORTGIO_SET(GPIO_PIN_2);
-       else
-               bfin_write_PORTGIO_CLEAR(GPIO_PIN_2);
+       gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
 #endif
 
        SSYNC();
@@ -55,6 +50,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
 
 void gpio_cfi_flash_init(void)
 {
-       bfin_write_PORTHIO_DIR(bfin_read_PORTHIO_DIR() | GPIO_PIN_1);
+       gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
+#ifdef GPIO_MASK_2
+       gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
+#endif
        gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
 }
index ac8587c9cf8c7d039b23c34e2df7b141a1dbc7a0..08ea7af1fe361e7766f94f1af0a80f11d167d52e 100644 (file)
@@ -8,12 +8,13 @@
 
 #include <common.h>
 #include <asm/blackfin.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include "gpio_cfi_flash.h"
 
-#define GPIO_PIN_1  PF4
+#define GPIO_PIN_1  GPIO_PF4
 #define GPIO_MASK_1 (1 << 21)
-#define GPIO_PIN_2  PF5
+#define GPIO_PIN_2  GPIO_PF5
 #define GPIO_MASK_2 (1 << 22)
 #define GPIO_MASK   (GPIO_MASK_1 | GPIO_MASK_2)
 
@@ -21,16 +22,10 @@ void *gpio_cfi_flash_swizzle(void *vaddr)
 {
        unsigned long addr = (unsigned long)vaddr;
 
-       if (addr & GPIO_MASK_1)
-               bfin_write_PORTFIO_SET(GPIO_PIN_1);
-       else
-               bfin_write_PORTFIO_CLEAR(GPIO_PIN_1);
+       gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
 
 #ifdef GPIO_MASK_2
-       if (addr & GPIO_MASK_2)
-               bfin_write_PORTFIO_SET(GPIO_PIN_2);
-       else
-               bfin_write_PORTFIO_CLEAR(GPIO_PIN_2);
+       gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
 #endif
 
        SSYNC();
@@ -57,6 +52,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
 
 void gpio_cfi_flash_init(void)
 {
-       bfin_write_PORTFIO_DIR(bfin_read_PORTFIO_DIR() | GPIO_PIN_1 | GPIO_PIN_2);
+       gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
+#ifdef GPIO_MASK_2
+       gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
+#endif
        gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
 }