[U-Boot-Users] [PATCH] ARM Versatile PB926EJ-S, Rev.D: Added support for flash 28F256L30B, Resend

Current u-boot works with ARM Versatile PB926EJ-S, HW- Rev.C (NOR flash 28F256K3). This patch adds support for 28F256L30B (asymmetrical sectors: 4 small sectors at bottom) used on HW-Rev.D.
Resend: patch was line wrapped.
This patch might be obsolete because of CFI flash driver: http://sourceforge.net/mailarchive/forum.php?thread_name=000201c79ea4%24be35...
Signed-off-by: Josef Meser josef.meser@odm.at --- board/versatile/flash.c | 84 +++++++++++++++++++++++++++++++++++-------- include/configs/versatile.h | 2 +- include/flash.h | 10 ++++-- 3 files changed, 77 insertions(+), 19 deletions(-)
diff --git a/board/versatile/flash.c b/board/versatile/flash.c index 7153371..b79761f 100644 --- a/board/versatile/flash.c +++ b/board/versatile/flash.c @@ -31,7 +31,9 @@ #include <common.h> #include <linux/byteorder/swab.h>
-#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */ +#define PHYS_FLASH_SECT_SIZE 0x00020000 /* *2 = 256 KB sectors */ +#define PHYS_FLASH_MAIN_SECT_SIZE 0x00020000 /* *2 = 256 KB sectors */ +#define PHYS_FLASH_PARAM_SECT_SIZE 0x00008000 /* *2 = 64 KB sectors */ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
/* Board support for 1 or 2 flash devices */ @@ -62,10 +64,19 @@ typedef struct OrgDef {
/* Flash Organizations */ -OrgDef OrgIntel_28F256K3[] = { +OrgDef OrgIntel_28F256K3[] = { /* for Hw-Rev. C */ {256, 128 * 1024}, /* 256 * 128kBytes sectors */ };
+OrgDef OrgIntel_28F256L18T[] = { + {255, 128 * 1024}, /* 255 * 128kBytes sectors */ + { 4, 32 * 1024}, /* 4 * 32kBytes sectors */ +}; + +OrgDef OrgIntel_28F256L30B[] = { /* for Hw-Rev. D */ + { 4, 32 * 1024}, /* 4 * 32kBytes sectors */ + {255, 128 * 1024}, /* 255 * 128kBytes sectors */ +};
/*----------------------------------------------------------------------- * Functions @@ -132,23 +143,55 @@ static void flash_get_offsets (ulong base, flash_info_t * info) int i; OrgDef *pOrgDef;
- pOrgDef = OrgIntel_28F256K3; - if (info->flash_id == FLASH_UNKNOWN) { + switch (info->flash_id & FLASH_VENDMASK) { + case FLASH_MAN_INTEL: + break; + default: return; }
- if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) { + switch (info->flash_id & FLASH_TYPEMASK) { + case FLASH_28F256K3: + pOrgDef = OrgIntel_28F256K3; for (i = 0; i < info->sector_count; i++) { + info->start[i] = base + (i * PHYS_FLASH_SECT_SIZE); + info->protect[i] = 0; + } + break; + case FLASH_28F256L18T: + pOrgDef = OrgIntel_28F256L18T; + for (i = 0; i < info->sector_count; i++) { + /* top param block type */ if (i > 255) { - info->start[i] = base + (i * 0x8000); - info->protect[i] = 0; + info->start[i] = base + + (255 * PHYS_FLASH_MAIN_SECT_SIZE) + + ((i -255)* PHYS_FLASH_PARAM_SECT_SIZE); + } else { + info->start[i] = base + + (i * PHYS_FLASH_MAIN_SECT_SIZE); + } + info->protect[i] = 0; + } + break; + case FLASH_28F256L30B: + pOrgDef = OrgIntel_28F256L30B; + for (i = 0; i < info->sector_count; i++) { + /* bottom param block type */ + if (i < 4) { + info->start[i] = base + + (i * PHYS_FLASH_PARAM_SECT_SIZE); } else { info->start[i] = base + - (i * PHYS_FLASH_SECT_SIZE); - info->protect[i] = 0; + ((i - 3) * PHYS_FLASH_MAIN_SECT_SIZE); } + info->protect[i] = 0; } + break; + default: + return; } + + return; }
/*----------------------------------------------------------------------- @@ -172,11 +215,14 @@ void flash_print_info (flash_info_t * info) }
switch (info->flash_id & FLASH_TYPEMASK) { + case FLASH_28F256K3: + printf ("FLASH 28F256K3\n"); + break; case FLASH_28F256L18T: printf ("FLASH 28F256L18T\n"); break; - case FLASH_28F256K3: - printf ("FLASH 28F256K3\n"); + case FLASH_28F256L30B: + printf ("FLASH 28F256L30B\n"); break; default: printf ("Unknown Chip Type\n"); @@ -221,6 +267,7 @@ static ulong flash_get_size (FPW * addr, flash_info_t * info) info->flash_id = FLASH_UNKNOWN; info->sector_count = 0; info->size = 0; + printf ("Unknown flash vendor %0x\n", value); addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ return (0); /* no or unknown flash */ } @@ -229,20 +276,27 @@ static ulong flash_get_size (FPW * addr, flash_info_t * info) value = addr[1]; /* device ID */ switch (value) {
+ case (FPW)(INTEL_ID_28F256K3): + info->flash_id += FLASH_28F256K3; + info->sector_count = 256; + info->size = 0x02000000; + break; + case (FPW) (INTEL_ID_28F256L18T): info->flash_id += FLASH_28F256L18T; info->sector_count = 259; info->size = 0x02000000; break; /* => 32 MB */
- case (FPW)(INTEL_ID_28F256K3): - info->flash_id += FLASH_28F256K3; - info->sector_count = 256; - info->size = 0x02000000; + case (FPW)(INTEL_ID_28F256L30B): + info->flash_id += FLASH_28F256L30B; + info->sector_count = 259; + info->size = 0x02000000; /* 32 MB */ break;
default: info->flash_id = FLASH_UNKNOWN; + printf ("Unknown chip type %0x\n", value); break; }
diff --git a/include/configs/versatile.h b/include/configs/versatile.h index 16db43b..fe26c42 100644 --- a/include/configs/versatile.h +++ b/include/configs/versatile.h @@ -166,7 +166,7 @@ /* timeout values are in ticks */ #define CFG_FLASH_ERASE_TOUT (20*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT (20*CFG_HZ) /* Timeout for Flash Write */ -#define CFG_MAX_FLASH_SECT (256) +#define CFG_MAX_FLASH_SECT (259)
#define PHYS_FLASH_1 (CFG_FLASH_BASE)
diff --git a/include/flash.h b/include/flash.h index 43b9c6b..c1e327f 100644 --- a/include/flash.h +++ b/include/flash.h @@ -284,10 +284,12 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of #define INTEL_ID_28F640J3A 0x00170017 /* 64M = 128K x 64 */ #define INTEL_ID_28F128J3A 0x00180018 /* 128M = 128K x 128 */ #define INTEL_ID_28F256J3A 0x001D001D /* 256M = 128K x 256 */ +#define INTEL_ID_28F64K3 0x88018801 /* 64M = 32K x 256 */ +#define INTEL_ID_28F128K3 0x88028802 /* 128M = 64K x 256 */ +#define INTEL_ID_28F256K3 0x88038803 /* 256M = 128K x 256 */ #define INTEL_ID_28F256L18T 0x880D880D /* 256M = 128K x 255 + 32k x 4 */ -#define INTEL_ID_28F64K3 0x88018801 /* 64M = 32K x 255 + 32k x 4 */ -#define INTEL_ID_28F128K3 0x88028802 /* 128M = 64K x 255 + 32k x 4 */ -#define INTEL_ID_28F256K3 0x88038803 /* 256M = 128K x 255 + 32k x 4 */ +#define INTEL_ID_28F256L30T 0x88138813 /* 256M = 128K x 255 + 32k x 4 */ +#define INTEL_ID_28F256L30B 0x88168816 /* 256M = 128K x 255 + 32k x 4 */ #define INTEL_ID_28F64P30T 0x88178817 /* 64M = 32K x 255 + 32k x 4 */ #define INTEL_ID_28F64P30B 0x881A881A /* 64M = 32K x 255 + 32k x 4 */ #define INTEL_ID_28F128P30T 0x88188818 /* 128M = 64K x 255 + 32k x 4 */ @@ -420,6 +422,8 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of #define FLASH_28F64K3 0x00B4 /* Intel 28F64K3 ( 64M) */ #define FLASH_28F128K3 0x00B6 /* Intel 28F128K3 ( 128M = 8M x 16 ) */ #define FLASH_28F256K3 0x00B8 /* Intel 28F256K3 ( 256M = 16M x 16 ) */ +#define FLASH_28F256L30T 0x00B9 /* Intel 28F256L30T ( 256M = 16M x 16 ) */ +#define FLASH_28F256L30B 0x00BA /* Intel 28F256L30B ( 256M = 16M x 16 ) */
#define FLASH_28F320J3A 0x00C0 /* INTEL 28F320J3A ( 32M = 128K x 32) */ #define FLASH_28F640J3A 0x00C2 /* INTEL 28F640J3A ( 64M = 128K x 64) */
participants (1)
-
Josef Meser