summaryrefslogtreecommitdiff
path: root/board/bf533-stamp
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-01-17 23:08:42 +0100
committerWolfgang Denk <wd@denx.de>2010-01-17 23:08:42 +0100
commit3e3989619f5ed3ee28002d985f3da28540586ab9 (patch)
treed4434455cafdc0c750aa26e642949232ffd0b2d3 /board/bf533-stamp
parent64917ca38933d10b3763f61df7a1e58e1e127b52 (diff)
parent846a6391e4bc9fdd721753a1021953ff0ca17c27 (diff)
downloadu-boot-imx-3e3989619f5ed3ee28002d985f3da28540586ab9.zip
u-boot-imx-3e3989619f5ed3ee28002d985f3da28540586ab9.tar.gz
u-boot-imx-3e3989619f5ed3ee28002d985f3da28540586ab9.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-blackfin
Diffstat (limited to 'board/bf533-stamp')
-rw-r--r--board/bf533-stamp/Makefile1
-rw-r--r--board/bf533-stamp/bf533-stamp.c120
-rw-r--r--board/bf533-stamp/ide-cf.c90
3 files changed, 94 insertions, 117 deletions
diff --git a/board/bf533-stamp/Makefile b/board/bf533-stamp/Makefile
index dbba12b..832037b 100644
--- a/board/bf533-stamp/Makefile
+++ b/board/bf533-stamp/Makefile
@@ -30,6 +30,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).a
COBJS-y := $(BOARD).o
+COBJS-$(CONFIG_STAMP_CF) += ide-cf.o
COBJS-$(CONFIG_VIDEO) += video.o
SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index a226910..4abad08 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -39,13 +39,6 @@ int checkboard(void)
return 0;
}
-phys_size_t initdram(int board_type)
-{
- gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
- gd->bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
- return gd->bd->bi_memsize;
-}
-
/* PF0 and PF1 are used to switch between the ethernet and flash:
* PF0 PF1
* flash: 0 0
@@ -69,118 +62,11 @@ void swap_to(int device_id)
/* miscellaneous platform dependent initialisations */
int misc_init_r(void)
{
- int i;
- int cf_stat = 0;
-
- /* Check whether CF card is inserted */
- *pFIO_EDGE = FIO_EDGE_CF_BITS;
- *pFIO_POLAR = FIO_POLAR_CF_BITS;
- for (i = 0; i < 0x300; i++)
- asm("nop;");
-
- if ((*pFIO_FLAG_S) & CF_STAT_BITS) {
- cf_stat = 0;
- } else {
- cf_stat = 1;
- }
-
- *pFIO_EDGE = FIO_EDGE_BITS;
- *pFIO_POLAR = FIO_POLAR_BITS;
-
- if (cf_stat) {
- printf("Booting from COMPACT flash\n");
-
- for (i = 0; i < 0x1000; i++)
- asm("nop;");
- for (i = 0; i < 0x1000; i++)
- asm("nop;");
- for (i = 0; i < 0x1000; i++)
- asm("nop;");
-
- serial_setbrg();
- ide_init();
-
- setenv("bootargs", "");
- setenv("bootcmd",
- "fatload ide 0:1 0x1000000 uImage-stamp;bootm 0x1000000;bootm 0x20100000");
- } else {
- printf("Booting from FLASH\n");
- }
-
- return 0;
-}
-#endif
-
#ifdef CONFIG_STAMP_CF
+ cf_ide_init();
+#endif
-void cf_outb(unsigned char val, volatile unsigned char *addr)
-{
- /*
- * Set PF1 PF0 respectively to 0 1 to divert address
- * to the expansion memory banks
- */
- *pFIO_FLAG_S = CF_PF0;
- *pFIO_FLAG_C = CF_PF1;
- SSYNC();
-
- *(addr) = val;
- SSYNC();
-
- /* Setback PF1 PF0 to 0 0 to address external
- * memory banks */
- *(volatile unsigned short *)pFIO_FLAG_C = CF_PF1_PF0;
- SSYNC();
-}
-
-unsigned char cf_inb(volatile unsigned char *addr)
-{
- volatile unsigned char c;
-
- *pFIO_FLAG_S = CF_PF0;
- *pFIO_FLAG_C = CF_PF1;
- SSYNC();
-
- c = *(addr);
- SSYNC();
-
- *pFIO_FLAG_C = CF_PF1_PF0;
- SSYNC();
-
- return c;
-}
-
-void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
-{
- int i;
-
- *pFIO_FLAG_S = CF_PF0;
- *pFIO_FLAG_C = CF_PF1;
- SSYNC();
-
- for (i = 0; i < words; i++) {
- *(sect_buf + i) = *(addr);
- SSYNC();
- }
-
- *pFIO_FLAG_C = CF_PF1_PF0;
- SSYNC();
-}
-
-void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
-{
- int i;
-
- *pFIO_FLAG_S = CF_PF0;
- *pFIO_FLAG_C = CF_PF1;
- SSYNC();
-
- for (i = 0; i < words; i++) {
- *(addr) = *(sect_buf + i);
- SSYNC();
- }
-
- *pFIO_FLAG_C = CF_PF1_PF0;
- SSYNC();
+ return 0;
}
#endif
diff --git a/board/bf533-stamp/ide-cf.c b/board/bf533-stamp/ide-cf.c
new file mode 100644
index 0000000..23e786b
--- /dev/null
+++ b/board/bf533-stamp/ide-cf.c
@@ -0,0 +1,90 @@
+/*
+ * CF IDE addon card code
+ *
+ * Enter bugs at http://blackfin.uclinux.org/
+ *
+ * Copyright (c) 2005-2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <config.h>
+#include <asm/blackfin.h>
+#include "bf533-stamp.h"
+
+void cf_outb(unsigned char val, volatile unsigned char *addr)
+{
+ /* "ETHERNET" means the expansion memory banks */
+ swap_to(ETHERNET);
+
+ *addr = val;
+ SSYNC();
+
+ swap_to(FLASH);
+}
+
+unsigned char cf_inb(volatile unsigned char *addr)
+{
+ unsigned char c;
+
+ swap_to(ETHERNET);
+
+ c = *addr;
+ SSYNC();
+
+ swap_to(FLASH);
+
+ return c;
+}
+
+void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
+{
+ int i;
+
+ swap_to(ETHERNET);
+
+ for (i = 0; i < words; i++) {
+ *(sect_buf + i) = *addr;
+ SSYNC();
+ }
+
+ swap_to(FLASH);
+}
+
+void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
+{
+ int i;
+
+ swap_to(ETHERNET);
+
+ for (i = 0; i < words; i++) {
+ *addr = *(sect_buf + i);
+ SSYNC();
+ }
+
+ swap_to(FLASH);
+}
+
+void cf_ide_init(void)
+{
+ int i, cf_stat;
+
+ /* Check whether CF card is inserted */
+ bfin_write_FIO_EDGE(FIO_EDGE_CF_BITS);
+ bfin_write_FIO_POLAR(FIO_POLAR_CF_BITS);
+ for (i = 0; i < 0x300; i++)
+ asm volatile("nop;");
+
+ cf_stat = bfin_read_FIO_FLAG_S() & CF_STAT_BITS;
+
+ bfin_write_FIO_EDGE(FIO_EDGE_BITS);
+ bfin_write_FIO_POLAR(FIO_POLAR_BITS);
+
+ if (!cf_stat) {
+ for (i = 0; i < 0x3000; i++)
+ asm volatile("nop;");
+
+ ide_init();
+ }
+}