summaryrefslogtreecommitdiff
path: root/board/cm-bf527
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-07-15 20:48:46 (GMT)
committerWolfgang Denk <wd@denx.de>2010-07-15 20:48:46 (GMT)
commit93502a5e0adcfc0ce6cf8e3daa7eb9a4f4e53658 (patch)
tree85bf8677d8e8095ef18453199a99c5e4131d217d /board/cm-bf527
parentdce6538f5d21a0def8a4df5328d536abed3e136a (diff)
parentd6f324d03d7829a1da1dee8b60f91b173a3976f0 (diff)
downloadu-boot-93502a5e0adcfc0ce6cf8e3daa7eb9a4f4e53658.tar.xz
Merge branch 'master' of ../master
Diffstat (limited to 'board/cm-bf527')
-rw-r--r--board/cm-bf527/Makefile2
-rw-r--r--board/cm-bf527/gpio.c74
-rw-r--r--board/cm-bf527/gpio_cfi_flash.c21
3 files changed, 10 insertions, 87 deletions
diff --git a/board/cm-bf527/Makefile b/board/cm-bf527/Makefile
index c2cd244..bad018a 100644
--- a/board/cm-bf527/Makefile
+++ b/board/cm-bf527/Makefile
@@ -29,7 +29,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).a
-COBJS-y := $(BOARD).o gpio.o gpio_cfi_flash.o
+COBJS-y := $(BOARD).o gpio_cfi_flash.o
SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y))
diff --git a/board/cm-bf527/gpio.c b/board/cm-bf527/gpio.c
deleted file mode 100644
index 7e0babe..0000000
--- a/board/cm-bf527/gpio.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Control GPIO pins on the fly
- *
- * Copyright (c) 2008 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <command.h>
-
-#include <asm/blackfin.h>
-
-int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- if (argc != 3) {
- show_usage:
- printf("Usage:\n%s\n", cmdtp->usage);
- return 1;
- }
-
- /* parse the behavior */
- ulong port_cmd = 0;
- switch (argv[1][0]) {
- case 'i': break;
- case 's': port_cmd = (PORTFIO_SET - PORTFIO); break;
- case 'c': port_cmd = (PORTFIO_CLEAR - PORTFIO); break;
- case 't': port_cmd = (PORTFIO_TOGGLE - PORTFIO); break;
- default: goto show_usage;
- }
-
- /* parse the pin with format: [p]<fgh><#> */
- const char *str_pin = argv[2];
-
- /* grab the [p]<fgh> portion */
- ulong port_base;
- if (*str_pin == 'p') ++str_pin;
- switch (*str_pin) {
- case 'f': port_base = PORTFIO; break;
- case 'g': port_base = PORTGIO; break;
- case 'h': port_base = PORTHIO; break;
- default: goto show_usage;
- }
-
- /* grab the <#> portion */
- ulong pin = simple_strtoul(str_pin+1, NULL, 10);
- ulong pin_mask = (1 << pin);
- if (pin > 15)
- goto show_usage;
-
- /* finally, let's do it: set direction and exec command */
- switch (*str_pin) {
- case 'f': bfin_write_PORTF_FER(bfin_read_PORTF_FER() & ~pin_mask); break;
- case 'g': bfin_write_PORTG_FER(bfin_read_PORTG_FER() & ~pin_mask); break;
- case 'h': bfin_write_PORTH_FER(bfin_read_PORTH_FER() & ~pin_mask); break;
- }
-
- ulong port_dir = port_base + (PORTFIO_DIR - PORTFIO);
- if (argv[1][0] == 'i')
- bfin_write16(port_dir, bfin_read16(port_dir) & ~pin_mask);
- else {
- bfin_write16(port_dir, bfin_read16(port_dir) | pin_mask);
- bfin_write16(port_base + port_cmd, pin_mask);
- }
-
- printf("gpio: pin %li on port %c has been %c\n", pin, *str_pin, argv[1][0]);
-
- return 0;
-}
-
-U_BOOT_CMD(gpio, 3, 0, do_gpio,
- "gpio - set/clear/toggle gpio output pins\n",
- "<s|c|t> <port><pin>\n"
- " - set/clear/toggle the specified pin\n");
diff --git a/board/cm-bf527/gpio_cfi_flash.c b/board/cm-bf527/gpio_cfi_flash.c
index 7167680..f8ccc07 100644
--- a/board/cm-bf527/gpio_cfi_flash.c
+++ b/board/cm-bf527/gpio_cfi_flash.c
@@ -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);
}