]> git.sur5r.net Git - u-boot/commitdiff
Add ADI Blackfin support
authorWolfgang Denk <wd@pollux.denx.de>
Sun, 12 Mar 2006 01:10:00 +0000 (02:10 +0100)
committerWolfgang Denk <wd@pollux.denx.de>
Sun, 12 Mar 2006 01:10:00 +0000 (02:10 +0100)
- add support for Analog Devices Blackfin BF533 CPU
- add support for the ADI BF533 Stamp uClinux board
- add support for the ADI BF533 EZKit board
Patches by Richard Klingler, June 11th 2005:

15 files changed:
CHANGELOG
Makefile
common/cmd_bootm.c
config.mk
drivers/cfi_flash.c
drivers/smc91111.c
drivers/smc91111.h
examples/Makefile
examples/smc91111_eeprom.c
examples/stubs.c
include/flash.h
include/image.h
include/linux/stat.h
rtc/Makefile
tools/mkimage.c

index a11dd4d7409955aaad2f734226f213007e7730c6..20e875aabf393edc2f54bac8c810c85934d4ad8c 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,12 @@
 Changes since U-Boot 1.1.4:
 ======================================================================
 
+* Add ADI Blackfin support
+  - add support for Analog Devices Blackfin BF533 CPU
+  - add support for the ADI BF533 Stamp uClinux board
+  - add support for the ADI BF533 EZKit board
+  Patches by Richard Klingler, 11 Jun 2005
+
 * Add loads of ntohl() in image header handling
   Patch by Steven Scholz, 10 Jun 2005
 
index fefcbbac0a7b186ed9ec60c4093a5dd9b47ae287..0c8137f0eb1c929b8b573edcaeaf5952b7b52f66 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -85,6 +85,9 @@ endif
 ifeq ($(ARCH),microblaze)
 CROSS_COMPILE = mb-
 endif
+ifeq ($(ARCH),blackfin)
+CROSS_COMPILE = bfin-elf-
+endif
 endif
 endif
 
@@ -111,6 +114,10 @@ endif
 ifeq ($(CPU),mpc85xx)
 OBJS += cpu/$(CPU)/resetvec.o
 endif
+ifeq ($(CPU),bf533)
+OBJS += cpu/$(CPU)/start1.o    cpu/$(CPU)/interrupt.o  cpu/$(CPU)/cache.o
+OBJS += cpu/$(CPU)/cplbhdlr.o  cpu/$(CPU)/cplbmgr.o    cpu/$(CPU)/flush.o
+endif
 
 LIBS  = lib_generic/libgeneric.a
 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
@@ -1859,6 +1866,19 @@ suzaku_config:   unconfig
        @echo "#define CONFIG_SUZAKU 1" >> include/config.h
        @./mkconfig -a $(@:_config=) microblaze microblaze suzaku AtmarkTechno
 
+#########################################################################
+## Blackfin
+#########################################################################
+ezkit533_config        :       unconfig
+       @./mkconfig $(@:_config=) blackfin bf533 ezkit533
+
+stamp_config   :       unconfig
+       @./mkconfig $(@:_config=) blackfin bf533 stamp
+
+dspstamp_config        :       unconfig
+       @./mkconfig $(@:_config=) blackfin bf533 dsp_stamp
+
+#########################################################################
 #########################################################################
 #########################################################################
 
@@ -1870,6 +1890,7 @@ clean:
        rm -f examples/hello_world examples/timer \
              examples/eepro100_eeprom examples/sched \
              examples/mem_to_mem_idma2intr examples/82559_eeprom \
+             examples/smc91111_eeprom \
              examples/test_burst
        rm -f tools/img2srec tools/mkimage tools/envcrc tools/gen_eth_addr
        rm -f tools/mpc86x_clk tools/ncb
index 8bb524bfe10228b0c7d1d160a5f540c7a2ceb366..5b93bddf98335f50d92a7fbd3449bbe0c78bcf1d 100644 (file)
@@ -252,6 +252,8 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        if (hdr->ih_arch != IH_CPU_MICROBLAZE)
 #elif defined(__nios2__)
        if (hdr->ih_arch != IH_CPU_NIOS2)
+#elif defined(__blackfin__)
+       if (hdr->ih_arch != IH_CPU_BLACKFIN)
 #else
 # error Unknown CPU type
 #endif
index d85ac36b5e602c3e80c67c8c5cb1d767f6f49680..dfbb1b7c6f220f4f12f467e66fb76c7d979e5ae4 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -53,6 +53,10 @@ PLATFORM_CPPFLAGS+= -D__ARM__
 endif
 endif
 
+ifeq ($(ARCH),blackfin)
+PLATFORM_CPPFLAGS+= -D__BLACKFIN__ -mno-underscore
+endif
+
 ifdef  ARCH
 sinclude $(TOPDIR)/$(ARCH)_config.mk   # include architecture dependend rules
 endif
index ff4d85f3f0dd60f1edc0c00516092fe7dc78e42f..a989d346629e8c5ff046b40500d15e3a3c2f1d32 100644 (file)
@@ -878,18 +878,27 @@ static void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset
                debug ("fwc addr %p cmd %x %x 8bit x %d bit\n", addr.cp, cmd,
                       cword.c, info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
                *addr.cp = cword.c;
+#ifdef CONFIG_BLACKFIN
+               asm("ssync;");
+#endif
                break;
        case FLASH_CFI_16BIT:
                debug ("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr.wp,
                       cmd, cword.w,
                       info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
                *addr.wp = cword.w;
+#ifdef CONFIG_BLACKFIN
+               asm("ssync;");
+#endif
                break;
        case FLASH_CFI_32BIT:
                debug ("fwc addr %p cmd %x %8.8lx 32bit x %d bit\n", addr.lp,
                       cmd, cword.l,
                       info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
                *addr.lp = cword.l;
+#ifdef CONFIG_BLACKFIN
+               asm("ssync;");
+#endif
                break;
        case FLASH_CFI_64BIT:
 #ifdef DEBUG
@@ -904,6 +913,9 @@ static void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset
                }
 #endif
                *addr.llp = cword.ll;
+#ifdef CONFIG_BLACKFIN
+               asm("ssync;");
+#endif
                break;
        }
 }
index 84e243ddd5282e145b8e7f957ad3b8a305929ba0..f91e4b984369fca9c75138be33a808134e779610 100644 (file)
@@ -160,6 +160,9 @@ extern void eth_halt(void);
 extern int eth_rx(void);
 extern int eth_send(volatile void *packet, int length);
 
+#ifdef SHARED_RESOURCES
+       extern void swap_to(int device_id);
+#endif
 
 /*
  . This is called by  register_netdev().  It is responsible for
@@ -533,6 +536,9 @@ static void smc_shutdown()
        SMC_SELECT_BANK( 0 );
        SMC_outb( RCR_CLEAR, RCR_REG );
        SMC_outb( TCR_CLEAR, TCR_REG );
+#ifdef SHARED_RESOURCES
+       swap_to(FLASH);
+#endif
 }
 
 
@@ -1511,6 +1517,9 @@ static void print_packet( byte * buf, int length )
 #endif
 
 int eth_init(bd_t *bd) {
+#ifdef SHARED_RESOURCES
+       swap_to(ETHERNET);
+#endif
        return (smc_open(bd));
 }
 
index c3c33672abcf1f95a7e9fd204587ec8fba699326..d03cbc320bf11a1bc8071f24259e0a15202982b7 100644 (file)
@@ -185,6 +185,8 @@ typedef unsigned long int           dword;
 
 #ifdef CONFIG_ADNPESC1
 #define        SMC_inw(r)      (*((volatile word *)(SMC_BASE_ADDRESS+((r)<<1))))
+#elif CONFIG_BLACKFIN
+#define        SMC_inw(r)      ({ word __v = (*((volatile word *)(SMC_BASE_ADDRESS+(r)))); asm("ssync;"); __v;})
 #else
 #define        SMC_inw(r)      (*((volatile word *)(SMC_BASE_ADDRESS+(r))))
 #endif
@@ -192,6 +194,8 @@ typedef unsigned long int           dword;
 
 #ifdef CONFIG_ADNPESC1
 #define        SMC_outw(d,r)   (*((volatile word *)(SMC_BASE_ADDRESS+((r)<<1))) = d)
+#elif CONFIG_BLACKFIN
+#define        SMC_outw(d,r)   {(*((volatile word *)(SMC_BASE_ADDRESS+(r))) = d);asm("ssync;");}
 #else
 #define        SMC_outw(d,r)   (*((volatile word *)(SMC_BASE_ADDRESS+(r))) = d)
 #endif
index 2f8c4c40352cb614cd6c186783ac6b371b9e63e2..fee26741d07d08cee78d7fa84dc083f7dfe3ba25 100644 (file)
@@ -53,6 +53,10 @@ ifeq ($(ARCH),microblaze)
 LOAD_ADDR = 0x80F00000
 endif
 
+ifeq ($(ARCH),blackfin)
+LOAD_ADDR = 0x1000
+endif
+
 include $(TOPDIR)/config.mk
 
 SREC   = hello_world.srec
@@ -73,6 +77,11 @@ SREC   += sched.srec
 BIN    += sched.bin sched
 endif
 
+ifeq ($(ARCH),blackfin)
+SREC   += smc91111_eeprom.srec
+BIN    += smc91111_eeprom.bin smc91111_eeprom
+endif
+
 # The following example is pretty 8xx specific...
 ifeq ($(CPU),mpc8xx)
 SREC   += timer.srec
index 885f9336cd9e22211d80025a16253dff34876ff9..98e3e86ffa555906b0eb34c2cd3fff40fb425767 100644 (file)
@@ -214,13 +214,11 @@ int smc91111_eeprom (int argc, char *argv[])
 
                        switch (what) {
                        case 1:
-                               printf ("Writing EEPROM register %02x with %04x\n",
-                                       reg, value);
+                               printf ("Writing EEPROM register %02x with %04x\n", reg, value);
                                write_eeprom_reg (value, reg);
                                break;
                        case 2:
-                               printf ("Writing MAC register bank %i,
-                                       reg %02x with %04x\n", reg >> 4, reg & 0xE, value);
+                               printf ("Writing MAC register bank %i, reg %02x with %04x\n", reg >> 4, reg & 0xE, value);
                                SMC_SELECT_BANK (reg >> 4);
                                SMC_outw (value, reg & 0xE);
                                break;
index d4c6e063e3ed1428f0eb4d7a84710b4496e6e34e..1797274eb4e42c06ec988b938e986264bc8d1e9d 100644 (file)
@@ -125,6 +125,19 @@ gd_t *global_data;
 "      lwi     r5, r5, %1\n"                   \
 "      bra     r5\n"                           \
        : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
+#elif defined(CONFIG_BLACKFIN)
+/*
+ * P5 holds the pointer to the global_data, P0 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x)                 \
+        asm volatile (                 \
+"       .globl " #x "\n"               \
+#x ":\n"                               \
+"      P0 = [P5 + %0]\n"               \
+"      P0 = [P0 + %1]\n"               \
+"      JUMP (P0)\n"                    \
+       : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "P0");
 #else
 #error stubs definition missing for this architecture
 #endif
index 849319178973600ff24c985b8246e776612ecd7e..4c68c6832f769b32c6a839fa0b2ccc2f9f7eb52b 100644 (file)
@@ -242,6 +242,7 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of
 #define STM_ID_29W320DT 0x22CA22CA     /* M29W320DT ID (32 M, top boot sector) */
 #define STM_ID_29W320DB 0x22CB22CB     /* M29W320DB ID (32 M, bottom boot sect)        */
 #define STM_ID_29W040B 0x00E300E3      /* M29W040B ID (4M = 512K x 8)  */
+#define FLASH_PSD4256GV 0x00E9         /* PSD4256 Flash and CPLD combination   */
 
 #define INTEL_ID_28F016S    0x66a066a0 /* 28F016S[VS] ID (16M = 512k x 16)     */
 #define INTEL_ID_28F800B3T  0x88928892 /*  8M = 512K x 16 top boot sector      */
index af37bcad5aae712549fc38cd764ed59f95849ca4..139df0b2d1e783b836a81689a053071bd290f1a8 100644 (file)
@@ -75,6 +75,7 @@
 #define IH_CPU_NIOS            13      /* Nios-32      */
 #define IH_CPU_MICROBLAZE      14      /* MicroBlaze   */
 #define IH_CPU_NIOS2           15      /* Nios-II      */
+#define IH_CPU_BLACKFIN                16      /* Blackfin     */
 
 /*
  * Image Types
index 2f7a3b36acf08862dc486fd1364bf7e0cc91c3cf..f9422cb1fafcf2d2bb24e2b36ece2fe39335bda2 100644 (file)
@@ -67,7 +67,7 @@ struct stat {
 
 #endif /* __PPC__ */
 
-#if defined (__ARM__) || defined (__I386__) || defined (__M68K__)
+#if defined (__ARM__) || defined (__I386__) || defined (__M68K__) || defined (__blackfin__)
 
 struct stat {
        unsigned short st_dev;
index 4ceac76933e8050249f074436c7cef158fb54f35..b08057e2f1360105d048365aa6863be70b08fbf3 100644 (file)
@@ -28,8 +28,8 @@ include $(TOPDIR)/config.mk
 LIB    = librtc.a
 
 OBJS   = date.o   \
-         ds12887.o ds1302.o ds1306.o ds1307.o ds1337.o \
-         ds1556.o ds164x.o ds174x.o \
+         bf533_rtc.o ds12887.o ds1302.o ds1306.o ds1307.o \
+         ds1337.o ds1556.o ds164x.o ds174x.o \
          m41t11.o max6900.o m48t35ax.o mc146818.o mk48t59.o \
          mpc5xxx.o mpc8xx.o pcf8563.o s3c24x0_rtc.o rs5c372.o
 
index 70452db1c086c1f20d4cd236e671473c29c516e2..5222bb21a5b038da4462f1005d4c9781907cdd7e 100644 (file)
@@ -93,6 +93,7 @@ table_entry_t arch_name[] = {
     {  IH_CPU_SH,              "sh",           "SuperH",       },
     {  IH_CPU_SPARC,           "sparc",        "SPARC",        },
     {  IH_CPU_SPARC64,         "sparc64",      "SPARC 64 Bit", },
+    {  IH_CPU_BLACKFIN,        "blackfin",     "Blackfin",     },
     {  -1,                     "",             "",             },
 };