diff options
author | Wolfgang Denk <wd@denx.de> | 2008-03-18 22:15:58 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-03-18 22:15:58 +0100 |
commit | fdeb932b1c8a3b615463995c3452d30ee0b12a33 (patch) | |
tree | e753cbcf649c67445b8c0359d9656fea26a84a4b | |
parent | 3515fd18d4e8e44f863ac7142b55e22b109e9af2 (diff) | |
parent | 1f2a9970109cebf7446e0503b10b71f8673045ee (diff) |
Merge branch 'master' of git://www.denx.de/git/u-boot-blackfin
-rw-r--r-- | MAINTAINERS | 15 | ||||
-rw-r--r-- | blackfin_config.mk | 6 | ||||
-rw-r--r-- | board/bf533-ezkit/bf533-ezkit.c | 7 | ||||
-rw-r--r-- | board/bf533-stamp/bf533-stamp.c | 7 | ||||
-rw-r--r-- | board/bf537-stamp/Makefile | 2 | ||||
-rw-r--r-- | board/bf537-stamp/bf537-stamp.c | 56 | ||||
-rw-r--r-- | board/bf537-stamp/flash-defines.h | 123 | ||||
-rw-r--r-- | board/bf537-stamp/flash.c | 403 | ||||
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/cmd_bootldr.c | 64 | ||||
-rw-r--r-- | common/cmd_cplbinfo.c | 59 | ||||
-rw-r--r-- | include/configs/bf533-ezkit.h | 9 | ||||
-rw-r--r-- | include/configs/bf533-stamp.h | 25 | ||||
-rw-r--r-- | include/configs/bf537-stamp.h | 43 | ||||
-rw-r--r-- | include/configs/bf561-ezkit.h | 6 | ||||
-rw-r--r-- | lib_blackfin/board.c | 3 | ||||
-rw-r--r-- | lib_blackfin/memcmp.S | 3 | ||||
-rw-r--r-- | lib_blackfin/memcpy.S | 3 | ||||
-rw-r--r-- | lib_blackfin/memmove.S | 3 | ||||
-rw-r--r-- | lib_blackfin/memset.S | 3 |
20 files changed, 187 insertions, 655 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index ffe0f512aa9..e31ea06afb4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -704,5 +704,20 @@ Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> MS7720SE SH7720 ######################################################################### +# Blackfin Systems: # +# # +# Maintainer Name, Email Address # +# Board CPU # +######################################################################### + +Mike Frysinger <vapier@gentoo.org> +Blackfin Team <u-boot-devel@blackfin.uclinux.org> + + BF533-EZKIT BF533 + BF533-STAMP BF533 + BF537-STAMP BF537 + BF561-EZKIT BF561 + +######################################################################### # End of MAINTAINERS list # ######################################################################### diff --git a/blackfin_config.mk b/blackfin_config.mk index a7513ea4dcf..d90eb238c32 100644 --- a/blackfin_config.mk +++ b/blackfin_config.mk @@ -24,9 +24,13 @@ PLATFORM_RELFLAGS += -ffixed-P5 PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN +ifneq (,$(CONFIG_BFIN_CPU)) +PLATFORM_RELFLAGS += -mcpu=$(CONFIG_BFIN_CPU) +endif + SYM_PREFIX = _ LDR_FLAGS += --use-vmas -ifeq (,$(findstring s,$(MAKEFLAGS))) +ifneq (,$(findstring s,$(MAKEFLAGS))) LDR_FLAGS += --quiet endif diff --git a/board/bf533-ezkit/bf533-ezkit.c b/board/bf533-ezkit/bf533-ezkit.c index 98ed6f81d2b..738f69c781f 100644 --- a/board/bf533-ezkit/bf533-ezkit.c +++ b/board/bf533-ezkit/bf533-ezkit.c @@ -34,13 +34,6 @@ DECLARE_GLOBAL_DATA_PTR; int checkboard(void) { -#if (BFIN_CPU == ADSP_BF531) - printf("CPU: ADSP BF531 Rev.: 0.%d\n", *pCHIPID >> 28); -#elif (BFIN_CPU == ADSP_BF532) - printf("CPU: ADSP BF532 Rev.: 0.%d\n", *pCHIPID >> 28); -#else - printf("CPU: ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28); -#endif printf("Board: ADI BF533 EZ-Kit Lite board\n"); printf(" Support: http://blackfin.uclinux.org/\n"); return 0; diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c index af035976ff0..c4dde92c1a1 100644 --- a/board/bf533-stamp/bf533-stamp.c +++ b/board/bf533-stamp/bf533-stamp.c @@ -43,13 +43,6 @@ DECLARE_GLOBAL_DATA_PTR; int checkboard(void) { -#if (BFIN_CPU == ADSP_BF531) - printf("CPU: ADSP BF531 Rev.: 0.%d\n", *pCHIPID >> 28); -#elif (BFIN_CPU == ADSP_BF532) - printf("CPU: ADSP BF532 Rev.: 0.%d\n", *pCHIPID >> 28); -#else - printf("CPU: ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28); -#endif printf("Board: ADI BF533 Stamp board\n"); printf(" Support: http://blackfin.uclinux.org/\n"); return 0; diff --git a/board/bf537-stamp/Makefile b/board/bf537-stamp/Makefile index e4888441a97..cdffc333ebf 100644 --- a/board/bf537-stamp/Makefile +++ b/board/bf537-stamp/Makefile @@ -29,7 +29,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o flash.o ether_bf537.o post-memory.o stm_m25p64.o cmd_bf537led.o nand.o +COBJS := $(BOARD).o ether_bf537.o post-memory.o stm_m25p64.o cmd_bf537led.o nand.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/bf537-stamp/bf537-stamp.c b/board/bf537-stamp/bf537-stamp.c index d279817bbab..6ca8e21f3a1 100644 --- a/board/bf537-stamp/bf537-stamp.c +++ b/board/bf537-stamp/bf537-stamp.c @@ -31,7 +31,6 @@ #include <asm/blackfin.h> #include <asm/io.h> #include <net.h> -#include "ether_bf537.h" #include <asm/mach-common/bits/bootrom.h> /** @@ -54,60 +53,8 @@ DECLARE_GLOBAL_DATA_PTR; #define POST_WORD_ADDR 0xFF903FFC -/* - * the bootldr command loads an address, checks to see if there - * is a Boot stream that the on-chip BOOTROM can understand, - * and loads it via the BOOTROM Callback. It is possible - * to also add booting from SPI, or TWI, but this function does - * not currently support that. - */ -int do_bootldr(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) -{ - ulong addr, entry; - ulong *data; - - /* Get the address */ - if (argc < 2) { - addr = load_addr; - } else { - addr = simple_strtoul(argv[1], NULL, 16); - } - - /* Check if it is a LDR file */ - data = (ulong *) addr; - if (*data == 0xFF800060 || *data == 0xFF800040 || *data == 0xFF800020) { - /* We want to boot from FLASH or SDRAM */ - entry = _BOOTROM_BOOT_DXE_FLASH; - printf("## Booting ldr image at 0x%08lx ...\n", addr); - if (icache_status()) - icache_disable(); - if (dcache_status()) - dcache_disable(); - - __asm__("R7=%[a];\n" "P0=%[b];\n" "JUMP (P0);\n": - :[a] "d"(addr),[b] "a"(entry) - :"R7", "P0"); - - } else { - printf("## No ldr image at address 0x%08lx\n", addr); - } - - return 0; -} - -U_BOOT_CMD(bootldr, 2, 0, do_bootldr, - "bootldr - boot ldr image from memory\n", - "[addr]\n - boot ldr image stored in memory\n"); - int checkboard(void) { -#if (BFIN_CPU == ADSP_BF534) - printf("CPU: ADSP BF534 Rev.: 0.%d\n", *pCHIPID >> 28); -#elif (BFIN_CPU == ADSP_BF536) - printf("CPU: ADSP BF536 Rev.: 0.%d\n", *pCHIPID >> 28); -#else - printf("CPU: ADSP BF537 Rev.: 0.%d\n", *pCHIPID >> 28); -#endif printf("Board: ADI BF537 stamp board\n"); printf(" Support: http://blackfin.uclinux.org/\n"); return 0; @@ -187,9 +134,6 @@ int misc_init_r(void) pMACaddr[2], pMACaddr[3], pMACaddr[4], pMACaddr[5]); setenv("ethaddr", nid); } - if (getenv("ethaddr")) { - SetupMacAddr(SrcAddr); - } #endif #endif /* BFIN_BOOT_MODE == BF537_BYPASS_BOOT */ diff --git a/board/bf537-stamp/flash-defines.h b/board/bf537-stamp/flash-defines.h deleted file mode 100644 index 1fa7a10bdac..00000000000 --- a/board/bf537-stamp/flash-defines.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * U-boot - flash-defines.h - * - * Copyright (c) 2005-2007 Analog Devices Inc. - * - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef __FLASHDEFINES_H__ -#define __FLASHDEFINES_H__ - -#include <common.h> - -#define V_ULONG(a) (*(volatile unsigned long *)( a )) -#define V_BYTE(a) (*(volatile unsigned char *)( a )) -#define TRUE 0x1 -#define FALSE 0x0 -#define BUFFER_SIZE 0x80000 -#define NO_COMMAND 0 -#define GET_CODES 1 -#define RESET 2 -#define WRITE 3 -#define FILL 4 -#define ERASE_ALL 5 -#define ERASE_SECT 6 -#define READ 7 -#define GET_SECTNUM 8 -#define FLASH_START_L 0x0000 -#define FLASH_START_H 0x2000 -#define FLASH_MAN_ST 2 -#define RESET_VAL 0xF0 - -flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; - -int get_codes(void); -int poll_toggle_bit(long lOffset); -void reset_flash(void); -int erase_flash(void); -int erase_block_flash(int); -void unlock_flash(long lOffset); -int write_data(long lStart, long lCount, uchar * pnData); -int read_flash(long nOffset, int *pnValue); -int write_flash(long nOffset, int nValue); -void get_sector_number(long lOffset, int *pnSector); -int GetSectorProtectionStatus(flash_info_t * info, int nSector); -int GetOffset(int nBlock); -int AFP_NumSectors = 71; -long AFP_SectorSize2 = 0x10000; -int AFP_SectorSize1 = 0x2000; - -#define NUM_SECTORS 71 - -#define WRITESEQ1 0x0AAA -#define WRITESEQ2 0x0554 -#define WRITESEQ3 0x0AAA -#define WRITESEQ4 0x0AAA -#define WRITESEQ5 0x0554 -#define WRITESEQ6 0x0AAA -#define WRITEDATA1 0xaa -#define WRITEDATA2 0x55 -#define WRITEDATA3 0x80 -#define WRITEDATA4 0xaa -#define WRITEDATA5 0x55 -#define WRITEDATA6 0x10 -#define PriFlashABegin 0 -#define SecFlashABegin 8 -#define SecFlashBBegin 36 -#define PriFlashAOff 0x0 -#define PriFlashBOff 0x100000 -#define SecFlashAOff 0x10000 -#define SecFlashBOff 0x280000 -#define INVALIDLOCNSTART 0x20270000 -#define INVALIDLOCNEND 0x20280000 -#define BlockEraseVal 0x30 -#define UNLOCKDATA1 0xaa -#define UNLOCKDATA2 0x55 -#define UNLOCKDATA3 0xa0 -#define GETCODEDATA1 0xaa -#define GETCODEDATA2 0x55 -#define GETCODEDATA3 0x90 -#define SecFlashASec1Off 0x200000 -#define SecFlashASec2Off 0x204000 -#define SecFlashASec3Off 0x206000 -#define SecFlashASec4Off 0x208000 -#define SecFlashAEndOff 0x210000 -#define SecFlashBSec1Off 0x280000 -#define SecFlashBSec2Off 0x284000 -#define SecFlashBSec3Off 0x286000 -#define SecFlashBSec4Off 0x288000 -#define SecFlashBEndOff 0x290000 - -#define SECT32 32 -#define SECT33 33 -#define SECT34 34 -#define SECT35 35 -#define SECT36 36 -#define SECT37 37 -#define SECT38 38 -#define SECT39 39 - -#define FLASH_SUCCESS 0 -#define FLASH_FAIL -1 - -#endif diff --git a/board/bf537-stamp/flash.c b/board/bf537-stamp/flash.c deleted file mode 100644 index 8252c42fd8c..00000000000 --- a/board/bf537-stamp/flash.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * U-boot - flash.c Flash driver for PSD4256GV - * - * Copyright (c) 2005-2007 Analog Devices Inc. - * This file is based on BF533EzFlash.c originally written by Analog Devices, Inc. - * - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include <malloc.h> -#include <config.h> -#include <asm/io.h> -#include "flash-defines.h" - -void flash_reset(void) -{ - reset_flash(); -} - -unsigned long flash_get_size(ulong baseaddr, flash_info_t * info, int bank_flag) -{ - int id = 0, i = 0; - static int FlagDev = 1; - - id = get_codes(); - if (FlagDev) { - FlagDev = 0; - } - info->flash_id = id; - switch (bank_flag) { - case 0: - for (i = PriFlashABegin; i < SecFlashABegin; i++) - info->start[i] = (baseaddr + (i * AFP_SectorSize1)); - for (i = SecFlashABegin; i < NUM_SECTORS; i++) - info->start[i] = - (baseaddr + SecFlashAOff + - ((i - SecFlashABegin) * AFP_SectorSize2)); - info->size = 0x400000; - info->sector_count = NUM_SECTORS; - break; - case 1: - info->start[0] = baseaddr + SecFlashASec1Off; - info->start[1] = baseaddr + SecFlashASec2Off; - info->start[2] = baseaddr + SecFlashASec3Off; - info->start[3] = baseaddr + SecFlashASec4Off; - info->size = 0x10000; - info->sector_count = 4; - break; - case 2: - info->start[0] = baseaddr + SecFlashBSec1Off; - info->start[1] = baseaddr + SecFlashBSec2Off; - info->start[2] = baseaddr + SecFlashBSec3Off; - info->start[3] = baseaddr + SecFlashBSec4Off; - info->size = 0x10000; - info->sector_count = 4; - break; - } - return (info->size); -} - -unsigned long flash_init(void) -{ - unsigned long size_b; - int i; - - size_b = 0; - for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) { - flash_info[i].flash_id = FLASH_UNKNOWN; - } - - size_b = flash_get_size(CFG_FLASH_BASE, &flash_info[0], 0); - - if (flash_info[0].flash_id == FLASH_UNKNOWN || size_b == 0) { - printf("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n", - size_b, size_b >> 20); - } - - /* flash_protect (int flag, ulong from, ulong to, flash_info_t *info) */ - (void)flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - (flash_info[0].start[2] - 1), &flash_info[0]); -#if (BFIN_BOOT_MODE == BF537_BYPASS_BOOT) - (void)flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, - &flash_info[0]); -#endif - - return (size_b); -} - -void flash_print_info(flash_info_t * info) -{ - int i; - - if (info->flash_id == FLASH_UNKNOWN) { - printf("missing or unknown FLASH type\n"); - return; - } - - switch (info->flash_id) { - case (STM_ID_29W320EB & 0xFFFF): - case (STM_ID_29W320DB & 0xFFFF): - printf("ST Microelectronics "); - break; - default: - printf("Unknown Vendor: (0x%08X) ", info->flash_id); - break; - } - for (i = 0; i < info->sector_count; ++i) { - if ((i % 5) == 0) - printf("\n "); - printf(" %08lX%s", - info->start[i], info->protect[i] ? " (RO)" : " "); - } - printf("\n"); - return; -} - -int flash_erase(flash_info_t * info, int s_first, int s_last) -{ - int cnt = 0, i; - int prot, sect; - - prot = 0; - for (sect = s_first; sect <= s_last; ++sect) { - if (info->protect[sect]) - prot++; - } - if (prot) - printf("- Warning: %d protected sectors will not be erased!\n", - prot); - else - printf("\n"); - - cnt = s_last - s_first + 1; - -#if (BFIN_BOOT_MODE == BF537_BYPASS_BOOT) - printf("Erasing Flash locations, Please Wait\n"); - for (i = s_first; i <= s_last; i++) { - if (info->protect[i] == 0) { /* not protected */ - if (erase_block_flash(i) < 0) { - printf("Error Sector erasing \n"); - return FLASH_FAIL; - } - } - } -#elif (BFIN_BOOT_MODE == BF537_SPI_MASTER_BOOT) - if (cnt == FLASH_TOT_SECT) { - printf("Erasing flash, Please Wait \n"); - if (erase_flash() < 0) { - printf("Erasing flash failed \n"); - return FLASH_FAIL; - } - } else { - printf("Erasing Flash locations, Please Wait\n"); - for (i = s_first; i <= s_last; i++) { - if (info->protect[i] == 0) { /* not protected */ - if (erase_block_flash(i) < 0) { - printf("Error Sector erasing \n"); - return FLASH_FAIL; - } - } - } - } -#endif - printf("\n"); - return FLASH_SUCCESS; -} - -int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt) -{ - int d; - if (addr % 2) { - read_flash(addr - 1 - CFG_FLASH_BASE, &d); - d = (int)((d & 0x00FF) | (*src++ << 8)); - write_data(addr - 1, 2, (uchar *) & d); - write_data(addr + 1, cnt - 1, src); - } else - write_data(addr, cnt, src); - return FLASH_SUCCESS; -} - -int write_data(long lStart, long lCount, uchar * pnData) -{ - long i = 0; - unsigned long ulOffset = lStart - CFG_FLASH_BASE; - int d; - int nSector = 0; - int flag = 0; - - if (lCount % 2) { - flag = 1; - lCount = lCount - 1; - } - - for (i = 0; i < lCount - 1; i += 2, ulOffset += 2) { - get_sector_number(ulOffset, &nSector); - read_flash(ulOffset, &d); - if (d != 0xffff) { - printf - ("Flash not erased at offset 0x%x Please erase to reprogram \n", - ulOffset); - return FLASH_FAIL; - } - unlock_flash(ulOffset); - d = (int)(pnData[i] | pnData[i + 1] << 8); - write_flash(ulOffset, d); - if (poll_toggle_bit(ulOffset) < 0) { - printf("Error programming the flash \n"); - return FLASH_FAIL; - } - if ((i > 0) && (!(i % AFP_SectorSize2))) - printf("."); - } - if (flag) { - get_sector_number(ulOffset, &nSector); - read_flash(ulOffset, &d); - if (d != 0xffff) { - printf - ("Flash not erased at offset 0x%x Please erase to reprogram \n", - ulOffset); - return FLASH_FAIL; - } - unlock_flash(ulOffset); - d = (int)(pnData[i] | (d & 0xFF00)); - write_flash(ulOffset, d); - if (poll_toggle_bit(ulOffset) < 0) { - printf("Error programming the flash \n"); - return FLASH_FAIL; - } - } - return FLASH_SUCCESS; -} - -int write_flash(long nOffset, int nValue) -{ - long addr; - - addr = (CFG_FLASH_BASE + nOffset); - *(unsigned volatile short *)addr = nValue; - SSYNC(); -#if (BFIN_BOOT_MODE == BF537_SPI_MASTER_BOOT) - if (icache_status()) - udelay(CONFIG_CCLK_HZ / 1000000); -#endif - return FLASH_SUCCESS; -} - -int read_flash(long nOffset, int *pnValue) -{ - unsigned short *pFlashAddr = - (unsigned short *)(CFG_FLASH_BASE + nOffset); - - *pnValue = *pFlashAddr; - - return TRUE; -} - -int poll_toggle_bit(long lOffset) -{ - unsigned int u1, u2; - volatile unsigned long *FB = - (volatile unsigned long *)(CFG_FLASH_BASE + lOffset); - while (1) { - u1 = *(volatile unsigned short *)FB; - u2 = *(volatile unsigned short *)FB; - u1 ^= u2; - if (!(u1 & 0x0040)) - break; - if (!(u2 & 0x0020)) - continue; - else { - u1 = *(volatile unsigned short *)FB; - u2 = *(volatile unsigned short *)FB; - u1 ^= u2; - if (!(u1 & 0x0040)) - break; - else { - reset_flash(); - return FLASH_FAIL; - } - } - } - return FLASH_SUCCESS; -} - -void reset_flash(void) -{ - write_flash(WRITESEQ1, RESET_VAL); - /* Wait for 10 micro seconds */ - udelay(10); -} - -int erase_flash(void) -{ - write_flash(WRITESEQ1, WRITEDATA1); - write_flash(WRITESEQ2, WRITEDATA2); - write_flash(WRITESEQ3, WRITEDATA3); - write_flash(WRITESEQ4, WRITEDATA4); - write_flash(WRITESEQ5, WRITEDATA5); - write_flash(WRITESEQ6, WRITEDATA6); - - if (poll_toggle_bit(0x0000) < 0) - return FLASH_FAIL; - - return FLASH_SUCCESS; -} - -int erase_block_flash(int nBlock) -{ - long ulSectorOff = 0x0; - - if ((nBlock < 0) || (nBlock > AFP_NumSectors)) - return FALSE; - - /* figure out the offset of the block in flash */ - if ((nBlock >= 0) && (nBlock < SecFlashABegin)) - ulSectorOff = nBlock * AFP_SectorSize1; - - else if ((nBlock >= SecFlashABegin) && (nBlock < NUM_SECTORS)) - ulSectorOff = - SecFlashAOff + (nBlock - SecFlashABegin) * AFP_SectorSize2; - /* no such sector */ - else - return FLASH_FAIL; - - write_flash((WRITESEQ1 | ulSectorOff), WRITEDATA1); - write_flash((WRITESEQ2 | ulSectorOff), WRITEDATA2); - write_flash((WRITESEQ3 | ulSectorOff), WRITEDATA3); - write_flash((WRITESEQ4 | ulSectorOff), WRITEDATA4); - write_flash((WRITESEQ5 | ulSectorOff), WRITEDATA5); - - write_flash(ulSectorOff, BlockEraseVal); - - if (poll_toggle_bit(ulSectorOff) < 0) - return FLASH_FAIL; - printf("."); - - return FLASH_SUCCESS; -} - -void unlock_flash(long ulOffset) -{ - unsigned long ulOffsetAddr = ulOffset; - ulOffsetAddr &= 0xFFFF0000; - - write_flash((WRITESEQ1 | ulOffsetAddr), UNLOCKDATA1); - write_flash((WRITESEQ2 | ulOffsetAddr), UNLOCKDATA2); - write_flash((WRITESEQ3 | ulOffsetAddr), UNLOCKDATA3); -} - -int get_codes() -{ - int dev_id = 0; - - write_flash(WRITESEQ1, GETCODEDATA1); - write_flash(WRITESEQ2, GETCODEDATA2); - write_flash(WRITESEQ3, GETCODEDATA3); - - read_flash(0x0402, &dev_id); - dev_id &= 0x0000FFFF; - - reset_flash(); - - return dev_id; -} - -void get_sector_number(long ulOffset, int *pnSector) -{ - int nSector = 0; - long lMainEnd = 0x400000; - long lBootEnd = 0x10000; - - /* sector numbers for the FLASH A boot sectors */ - if (ulOffset < lBootEnd) { - nSector = (int)ulOffset / AFP_SectorSize1; - } - /* sector numbers for the FLASH B boot sectors */ - else if ((ulOffset >= lBootEnd) && (ulOffset < lMainEnd)) { - nSector = ((ulOffset / (AFP_SectorSize2)) + 7); - } - /* if it is a valid sector, set it */ - if ((nSector >= 0) && (nSector < AFP_NumSectors)) - *pnSector = nSector; - -} diff --git a/common/Makefile b/common/Makefile index a88d1ef536d..56d05819f95 100644 --- a/common/Makefile +++ b/common/Makefile @@ -37,9 +37,11 @@ COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o COBJS-$(CONFIG_CMD_BEDBUG) += cmd_bedbug.o COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o COBJS-y += cmd_boot.o +COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-y += cmd_bootm.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o +COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o COBJS-$(CONFIG_CMD_DATE) += cmd_date.o ifdef CONFIG_4xx COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o diff --git a/common/cmd_bootldr.c b/common/cmd_bootldr.c new file mode 100644 index 00000000000..e6474aab22b --- /dev/null +++ b/common/cmd_bootldr.c @@ -0,0 +1,64 @@ +/* + * U-boot - bootldr.c + * + * Copyright (c) 2005-2008 Analog Devices Inc. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * Licensed under the GPL-2 or later. + */ + +#include <config.h> +#include <common.h> +#include <command.h> + +#include <asm/blackfin.h> +#include <asm/mach-common/bits/bootrom.h> + +/* + * the bootldr command loads an address, checks to see if there + * is a Boot stream that the on-chip BOOTROM can understand, + * and loads it via the BOOTROM Callback. It is possible + * to also add booting from SPI, or TWI, but this function does + * not currently support that. + */ + +int do_bootldr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + void *addr; + uint32_t *data; + + /* Get the address */ + if (argc < 2) + addr = (void *)load_addr; + else + addr = (void *)simple_strtoul(argv[1], NULL, 16); + + /* Check if it is a LDR file */ + data = addr; +#if defined(__ADSPBF54x__) || defined(__ADSPBF52x__) + if ((*data & 0xFF000000) == 0xAD000000 && data[2] == 0x00000000) { +#else + if (*data == 0xFF800060 || *data == 0xFF800040 || *data == 0xFF800020) { +#endif + /* We want to boot from FLASH or SDRAM */ + printf("## Booting ldr image at 0x%p ...\n", addr); + + icache_disable(); + dcache_disable(); + + __asm__( + "jump (%1);" + : + : "q7" (addr), "a" (_BOOTROM_MEMBOOT)); + } else + printf("## No ldr image at address 0x%p\n", addr); + + return 0; +} + +U_BOOT_CMD(bootldr, 2, 0, do_bootldr, + "bootldr - boot ldr image from memory\n", + "[addr]\n" + " - boot ldr image stored in memory\n"); diff --git a/common/cmd_cplbinfo.c b/common/cmd_cplbinfo.c new file mode 100644 index 00000000000..b2bbec12ea8 --- /dev/null +++ b/common/cmd_cplbinfo.c @@ -0,0 +1,59 @@ +/* + * cmd_cplbinfo.c - dump the instruction/data cplb tables + * + * Copyright (c) 2007-2008 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include <common.h> +#include <command.h> +#include <asm/blackfin.h> +#include <asm/cplb.h> +#include <asm/mach-common/bits/mpu.h> + +/* + * Translate the PAGE_SIZE bits into a human string + */ +static const char *cplb_page_size(uint32_t data) +{ + static const char page_size_string_table[][4] = { "1K", "4K", "1M", "4M" }; + return page_size_string_table[(data & PAGE_SIZE_MASK) >> PAGE_SIZE_SHIFT]; +} + +/* + * show a hardware cplb table + */ +static void show_cplb_table(uint32_t *addr, uint32_t *data) +{ + size_t i; + printf(" Address Data Size Valid Locked\n"); + for (i = 1; i <= 16; ++i) { + printf(" %2i 0x%p 0x%05X %s %c %c\n", + i, *addr, *data, + cplb_page_size(*data), + (*data & CPLB_VALID ? 'Y' : 'N'), + (*data & CPLB_LOCK ? 'Y' : 'N')); + ++addr; + ++data; + } +} + +/* + * display current instruction and data cplb tables + */ +int do_cplbinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + printf("%s CPLB table [%08x]:\n", "Instruction", *(uint32_t *)DMEM_CONTROL); + show_cplb_table((uint32_t *)ICPLB_ADDR0, (uint32_t *)ICPLB_DATA0); + + printf("%s CPLB table [%08x]:\n", "Data", *(uint32_t *)IMEM_CONTROL); + show_cplb_table((uint32_t *)DCPLB_ADDR0, (uint32_t *)DCPLB_DATA0); + + return 0; +} + +U_BOOT_CMD(cplbinfo, 1, 0, do_cplbinfo, + "cplbinfo- display current CPLB tables\n", + "\n" + " - display current CPLB tables\n"); diff --git a/include/configs/bf533-ezkit.h b/include/configs/bf533-ezkit.h index 6cb6bc4f71c..f2c87039914 100644 --- a/include/configs/bf533-ezkit.h +++ b/include/configs/bf533-ezkit.h @@ -5,6 +5,8 @@ #ifndef __CONFIG_EZKIT533_H__ #define __CONFIG_EZKIT533_H__ +#include <asm/blackfin-config-pre.h> + #define CONFIG_BAUDRATE 57600 #define CONFIG_STAMP 1 @@ -41,10 +43,7 @@ #define CONFIG_PANIC_HANG 1 -#define ADSP_BF531 0x31 -#define ADSP_BF532 0x32 -#define ADSP_BF533 0x33 -#define BFIN_CPU ADSP_BF533 +#define CONFIG_BFIN_CPU bf533-0.3 /* This sets the default state of the cache on U-Boot's boot */ #define CONFIG_ICACHE_ON @@ -120,7 +119,7 @@ #define CONFIG_BOOTARGS "root=/dev/mtdblock0 ip=192.168.0.15:192.168.0.2:192.168.0.1:255.255.255.0:ezkit:eth0:off console=ttyBF0,57600" -#define CFG_PROMPT "ezkit> " /* Monitor Command Prompt */ +#define CFG_PROMPT "bfin> " /* Monitor Command Prompt */ #if defined(CONFIG_CMD_KGDB) #define CFG_CBSIZE 1024 /* Console I/O Buffer Size */ #else diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h index cce6ef79f27..76dd2fa4a26 100644 --- a/include/configs/bf533-stamp.h +++ b/include/configs/bf533-stamp.h @@ -5,6 +5,8 @@ #ifndef __CONFIG_STAMP_H__ #define __CONFIG_STAMP_H__ +#include <asm/blackfin-config-pre.h> + #define CONFIG_STAMP 1 #define CONFIG_RTC_BFIN 1 #define CONFIG_BF533 1 @@ -21,10 +23,7 @@ #define CONFIG_PANIC_HANG 1 -#define ADSP_BF531 0x31 -#define ADSP_BF532 0x32 -#define ADSP_BF533 0x33 -#define BFIN_CPU ADSP_BF533 +#define CONFIG_BFIN_CPU bf533-0.3 /* This sets the default state of the cache on U-Boot's boot */ #define CONFIG_ICACHE_ON @@ -329,23 +328,7 @@ #define CONFIG_BAUDRATE 57600 #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#if (BFIN_BOOT_MODE == BF533_SPI_BOOT) -#if (BFIN_CPU == ADSP_BF531) -#define CFG_PROMPT "serial_bf531> " /* Monitor Command Prompt */ -#elif (BFIN_CPU == ADSP_BF532) -#define CFG_PROMPT "serial_bf532> " /* Monitor Command Prompt */ -#else -#define CFG_PROMPT "serial_bf533> " /* Monitor Command Prompt */ -#endif -#else -#if (BFIN_CPU == ADSP_BF531) -#define CFG_PROMPT "bf531> " /* Monitor Command Prompt */ -#elif (BFIN_CPU == ADSP_BF532) -#define CFG_PROMPT "bf532> " /* Monitor Command Prompt */ -#else -#define CFG_PROMPT "bf533> " /* Monitor Command Prompt */ -#endif -#endif +#define CFG_PROMPT "bfin> " /* Monitor Command Prompt */ #if defined(CONFIG_CMD_KGDB) #define CFG_CBSIZE 1024 /* Console I/O Buffer Size */ diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h index b9a9e3cb792..0e189d43247 100644 --- a/include/configs/bf537-stamp.h +++ b/include/configs/bf537-stamp.h @@ -5,6 +5,8 @@ #ifndef __CONFIG_BF537_H__ #define __CONFIG_BF537_H__ +#include <asm/blackfin-config-pre.h> + #define CFG_LONGHELP 1 #define CONFIG_CMDLINE_EDITING 1 #define CONFIG_BAUDRATE 57600 @@ -31,10 +33,8 @@ #define CONFIG_PANIC_HANG 1 -#define ADSP_BF534 0x34 -#define ADSP_BF536 0x36 -#define ADSP_BF537 0x37 -#define BFIN_CPU ADSP_BF537 +#define CONFIG_BFIN_CPU bf537-0.2 +#define CONFIG_BFIN_MAC /* This sets the default state of the cache on U-Boot's boot */ #define CONFIG_ICACHE_ON @@ -113,7 +113,7 @@ * Network Settings */ /* network support */ -#if (BFIN_CPU != ADSP_BF534) +#ifdef CONFIG_BFIN_MAC #define CONFIG_IPADDR 192.168.0.15 #define CONFIG_NETMASK 255.255.255.0 #define CONFIG_GATEWAYIP 192.168.0.1 @@ -186,7 +186,7 @@ #define CONFIG_CMD_EEPROM #define CONFIG_CMD_DATE -#if (BFIN_CPU == ADSP_BF534) +#ifndef CONFIG_BFIN_MAC #undef CONFIG_CMD_NET #else #define CONFIG_CMD_PING @@ -219,7 +219,7 @@ #define CONFIG_LOADADDR 0x1000000 #if (BFIN_BOOT_MODE == BF537_BYPASS_BOOT) -#if (BFIN_CPU != ADSP_BF534) +#ifdef CONFIG_BFIN_MAC #define CONFIG_EXTRA_ENV_SETTINGS \ "ramargs=setenv bootargs root=/dev/mtdblock0 rw console=ttyBF0,57600\0" \ "nfsargs=setenv bootargs root=/dev/nfs rw " \ @@ -243,7 +243,7 @@ "" #endif #elif (BFIN_BOOT_MODE == BF537_SPI_MASTER_BOOT) -#if (BFIN_CPU != ADSP_BF534) +#ifdef CONFIG_BFIN_MAC #define CONFIG_EXTRA_ENV_SETTINGS \ "ramargs=setenv bootargs root=/dev/mtdblock0 rw console=ttyBF0,57600\0" \ "nfsargs=setenv bootargs root=/dev/nfs rw " \ @@ -267,23 +267,7 @@ #endif #endif -#if (BFIN_BOOT_MODE == BF537_SPI_MASTER_BOOT) -#if (BFIN_CPU == ADSP_BF534) -#define CFG_PROMPT "serial_bf534> " /* Monitor Command Prompt */ -#elif (BFIN_CPU == ADSP_BF536) -#define CFG_PROMPT "serial_bf536> " /* Monitor Command Prompt */ -#else -#define CFG_PROMPT "serial_bf537> " /* Monitor Command Prompt */ -#endif -#else -#if (BFIN_CPU == ADSP_BF534) -#define CFG_PROMPT "bf534> " /* Monitor Command Prompt */ -#elif (BFIN_CPU == ADSP_BF536) -#define CFG_PROMPT "bf536> " /* Monitor Command Prompt */ -#else -#define CFG_PROMPT "bf537> " /* Monitor Command Prompt */ -#endif -#endif +#define CFG_PROMPT "bfin> " /* Monitor Command Prompt */ #if defined(CONFIG_CMD_KGDB) #define CFG_CBSIZE 1024 /* Console I/O Buffer Size */ @@ -302,6 +286,11 @@ #define CFG_SDRAM_BASE 0x00000000 #define CFG_FLASH_BASE 0x20000000 +#define CFG_FLASH_CFI /* The flash is CFI compatible */ +#define CFG_FLASH_CFI_DRIVER /* Use common CFI driver */ +#define CFG_FLASH_PROTECTION +#define CFG_MAX_FLASH_BANKS 1 +#define CFG_MAX_FLASH_SECT 71 /* some have 67 sectors (M29W320DB), but newer have 71 (M29W320EB) */ #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #define CFG_MONITOR_BASE (CFG_MAX_RAM_SIZE - CFG_MONITOR_LEN) @@ -311,10 +300,6 @@ #define CFG_GBL_DATA_ADDR (CFG_MALLOC_BASE - CFG_GBL_DATA_SIZE) #define CONFIG_STACKBASE (CFG_GBL_DATA_ADDR - 4) -#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */ -#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ -#define CFG_MAX_FLASH_SECT 71 /* max number of sectors on one chip */ - #if (BFIN_BOOT_MODE == BF537_BYPASS_BOOT) || (BFIN_BOOT_MODE == BF537_UART_BOOT) /* for bf537-stamp, usrt boot mode still store env in flash */ #define CFG_ENV_IS_IN_FLASH 1 diff --git a/include/configs/bf561-ezkit.h b/include/configs/bf561-ezkit.h index 29662604f99..c29555aeae6 100644 --- a/include/configs/bf561-ezkit.h +++ b/include/configs/bf561-ezkit.h @@ -5,6 +5,8 @@ #ifndef __CONFIG_EZKIT561_H__ #define __CONFIG_EZKIT561_H__ +#include <asm/blackfin-config-pre.h> + #define CONFIG_VDSP 1 #define CONFIG_BF561 1 @@ -18,6 +20,8 @@ #define CONFIG_PANIC_HANG 1 +#define CONFIG_BFIN_CPU bf561-0.3 + /* * Boot Mode Set * Blackfin can support several boot modes @@ -216,7 +220,7 @@ */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#define CFG_PROMPT "ezkit> " /* Monitor Command Prompt */ +#define CFG_PROMPT "bfin> " /* Monitor Command Prompt */ #if defined(CONFIG_CMD_KGDB) #define CFG_CBSIZE 1024 /* Console I/O Buffer Size */ diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c index 86a3b67c989..2a5a2fce45d 100644 --- a/lib_blackfin/board.c +++ b/lib_blackfin/board.c @@ -116,6 +116,7 @@ static int display_banner(void) { sprintf(version_string, VERSION_STRING_FORMAT, VERSION_STRING); printf("%s\n", version_string); + printf("CPU: ADSP " MK_STR(CONFIG_BFIN_CPU) " (Detected Rev: 0.%d)\n", bfin_revid()); return (0); } @@ -404,7 +405,7 @@ void board_init_r(gd_t * id, ulong dest_addr) misc_init_r(); #endif -#if ((BFIN_CPU == ADSP_BF537) || (BFIN_CPU == ADSP_BF536)) +#ifdef CONFIG_CMD_NET printf("Net: "); eth_initialize(bd); #endif diff --git a/lib_blackfin/memcmp.S b/lib_blackfin/memcmp.S index 9b58832943d..6c834a7e853 100644 --- a/lib_blackfin/memcmp.S +++ b/lib_blackfin/memcmp.S @@ -31,6 +31,7 @@ */ .globl _memcmp; +.type _memcmp, STT_FUNC; _memcmp: I1 = P3; P0 = R0; /* P0 = s1 address */ @@ -98,3 +99,5 @@ _memcmp: R0 = 0; P3 = I1; RTS; + +.size _memcmp, .-_memcmp diff --git a/lib_blackfin/memcpy.S b/lib_blackfin/memcpy.S index 24577bebdc4..e6b359a344b 100644 --- a/lib_blackfin/memcpy.S +++ b/lib_blackfin/memcpy.S @@ -23,6 +23,7 @@ .align 2 .globl _memcpy_ASM; +.type _memcpy_ASM, STT_FUNC; _memcpy_ASM: CC = R2 <= 0; /* length not positive?*/ IF CC JUMP .L_P1L2147483647; /* Nothing to do */ @@ -112,3 +113,5 @@ _memcpy_ASM: B[P0--] = R1; RTS; + +.size _memcpy_ASM, .-_memcpy_ASM diff --git a/lib_blackfin/memmove.S b/lib_blackfin/memmove.S index 46f79ed18dc..e385c4f6f5a 100644 --- a/lib_blackfin/memmove.S +++ b/lib_blackfin/memmove.S @@ -31,6 +31,7 @@ */ .globl _memmove; +.type _memmove, STT_FUNC; _memmove: I1 = P3; P0 = R0; /* P0 = To address */ @@ -91,3 +92,5 @@ _memmove: .Lno_loop: B[P0] = R1; P3 = I1; RTS; + +.size _memmove, .-_memmove diff --git a/lib_blackfin/memset.S b/lib_blackfin/memset.S index c33c5511218..26f63cdc94e 100644 --- a/lib_blackfin/memset.S +++ b/lib_blackfin/memset.S @@ -31,6 +31,7 @@ */ .globl _memset; +.type _memset, STT_FUNC; _memset: P0 = R0 ; /* P0 = address */ P2 = R2 ; /* P2 = count */ @@ -91,3 +92,5 @@ _memset: B[P0++] = R1; B[P0++] = R1; JUMP .Laligned; + +.size _memset, .-_memset |