X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=board%2Fbf533-ezkit%2Fflash.c;h=e4fcd1e39d2e6c455a4ca33804c693fcc5441f22;hb=18122019972ca639ee3b581257e3a63ff7c8efeb;hp=cdf4dc69ba459f1a6ee8e0346b5aa95231eebe39;hpb=9e04a8138892d64848dc6e8e74213086d9190d9a;p=u-boot diff --git a/board/bf533-ezkit/flash.c b/board/bf533-ezkit/flash.c index cdf4dc69ba..e4fcd1e39d 100644 --- a/board/bf533-ezkit/flash.c +++ b/board/bf533-ezkit/flash.c @@ -29,6 +29,10 @@ #include #include "flash-defines.h" +int AFP_NumSectors = 40; +long AFP_SectorSize1 = 0x10000; +int AFP_SectorSize2 = 0x4000; + void flash_reset(void) { reset_flash(); @@ -82,7 +86,7 @@ unsigned long flash_init(void) size_b0 = size_b1 = size_b2 = 0; #ifdef DEBUG - printf("Flash Memory Start 0x%x\n", CFG_FLASH_BASE); + printf("Flash Memory Start 0x%x\n", CONFIG_SYS_FLASH_BASE); printf("Memory Map for the Flash\n"); printf("0x20000000 - 0x200FFFFF Flash A Primary (1MB)\n"); printf("0x20100000 - 0x201FFFFF Flash B Primary (1MB)\n"); @@ -90,20 +94,20 @@ unsigned long flash_init(void) printf("0x20280000 - 0x2028FFFF Flash B Secondary (64KB)\n"); printf("Please type command flinfo for information on Sectors \n"); #endif - for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) { + for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; ++i) { flash_info[i].flash_id = FLASH_UNKNOWN; } - size_b0 = flash_get_size(CFG_FLASH0_BASE, &flash_info[0], 0); - size_b1 = flash_get_size(CFG_FLASH0_BASE, &flash_info[1], 1); - size_b2 = flash_get_size(CFG_FLASH0_BASE, &flash_info[2], 2); + size_b0 = flash_get_size(CONFIG_SYS_FLASH0_BASE, &flash_info[0], 0); + size_b1 = flash_get_size(CONFIG_SYS_FLASH0_BASE, &flash_info[1], 1); + size_b2 = flash_get_size(CONFIG_SYS_FLASH0_BASE, &flash_info[2], 2); if (flash_info[0].flash_id == FLASH_UNKNOWN || size_b0 == 0) { printf("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n", size_b0, size_b0 >> 20); } - (void)flash_protect(FLAG_PROTECT_SET, CFG_FLASH0_BASE, + (void)flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_FLASH0_BASE, (flash_info[0].start[2] - 1), &flash_info[0]); return (size_b0 + size_b1 + size_b2); @@ -123,7 +127,7 @@ void flash_print_info(flash_info_t * info) printf("ST Microelectronics "); break; default: - printf("Unknown Vendor: (0x%08X) ", info->flash_id); + printf("Unknown Vendor: (0x%08lX) ", info->flash_id); break; } for (i = 0; i < info->sector_count; ++i) { @@ -180,7 +184,7 @@ int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt) int ret; int d; if (addr % 2) { - read_flash(addr - 1 - CFG_FLASH_BASE, &d); + read_flash(addr - 1 - CONFIG_SYS_FLASH_BASE, &d); d = (int)((d & 0x00FF) | (*src++ << 8)); ret = write_data(addr - 1, 2, (uchar *) & d); if (ret == FLASH_FAIL) @@ -196,7 +200,7 @@ int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt) int write_data(long lStart, long lCount, uchar * pnData) { long i = 0; - unsigned long ulOffset = lStart - CFG_FLASH_BASE; + unsigned long ulOffset = lStart - CONFIG_SYS_FLASH_BASE; int d; int nSector = 0; int flag = 0; @@ -211,7 +215,7 @@ int write_data(long lStart, long lCount, uchar * pnData) read_flash(ulOffset, &d); if (d != 0xffff) { printf - ("Flash not erased at offset 0x%x Please erase to reprogram \n", + ("Flash not erased at offset 0x%lx Please erase to reprogram\n", ulOffset); return FLASH_FAIL; } @@ -230,7 +234,7 @@ int write_data(long lStart, long lCount, uchar * pnData) read_flash(ulOffset, &d); if (d != 0xffff) { printf - ("Flash not erased at offset 0x%x Please erase to reprogram \n", + ("Flash not erased at offset 0x%lx Please erase to reprogram\n", ulOffset); return FLASH_FAIL; } @@ -285,7 +289,7 @@ int write_flash(long nOffset, int nValue) { long addr; - addr = (CFG_FLASH_BASE + nOffset); + addr = (CONFIG_SYS_FLASH_BASE + nOffset); SSYNC(); *(unsigned volatile short *)addr = nValue; SSYNC(); @@ -297,7 +301,7 @@ int write_flash(long nOffset, int nValue) int read_flash(long nOffset, int *pnValue) { int nValue = 0x0; - long addr = (CFG_FLASH_BASE + nOffset); + long addr = (CONFIG_SYS_FLASH_BASE + nOffset); if (nOffset != 0x2) reset_flash(); @@ -305,7 +309,7 @@ int read_flash(long nOffset, int *pnValue) nValue = *(volatile unsigned short *)addr; SSYNC(); *pnValue = nValue; - return TRUE; + return true; } int poll_toggle_bit(long lOffset) @@ -394,9 +398,9 @@ int erase_block_flash(int nBlock, unsigned long address) long ulSectorOff = 0x0; if ((nBlock < 0) || (nBlock > AFP_NumSectors)) - return FALSE; + return false; - ulSectorOff = (address - CFG_FLASH_BASE); + ulSectorOff = (address - CONFIG_SYS_FLASH_BASE); write_flash((WRITESEQ1 | ulSectorOff), WRITEDATA1); write_flash((WRITESEQ2 | ulSectorOff), WRITEDATA2);