提交 6bdd1377 编写于 作者: W wdenk

Patch by Stephen Williams, 11 May 2004:

Add flash support for ST M29W040B
Reduce JSE specific flash.c to remove dead code.
上级 356a0d9f
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
Changes since U-Boot 1.1.1: Changes since U-Boot 1.1.1:
====================================================================== ======================================================================
* Patch by Stephen Williams, 11 May 2004:
Add flash support for ST M29W040B
Reduce JSE specific flash.c to remove dead code.
* Patch by Markus Pietrek, 04 May 2004: * Patch by Markus Pietrek, 04 May 2004:
Fix clear_bss code for ARM systems (all except s3c44b0 which Fix clear_bss code for ARM systems (all except s3c44b0 which
doesn't clear BSS at all?) doesn't clear BSS at all?)
......
...@@ -84,36 +84,17 @@ unsigned long flash_init (void) ...@@ -84,36 +84,17 @@ unsigned long flash_init (void)
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
*/ */
/*
* This implementation assumes that the flash chips are uniform sector
* devices. This is true for all likely JSE devices.
*/
static void flash_get_offsets (ulong base, flash_info_t * info) static void flash_get_offsets (ulong base, flash_info_t * info)
{ {
int i; unsigned idx;
unsigned long sector_size = info->size / info->sector_count;
/* set up sector start address table */ for (idx = 0; idx < info->sector_count; idx += 1) {
if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) || info->start[idx] = base + (idx * sector_size);
(info->flash_id == FLASH_AM040)) {
for (i = 0; i < info->sector_count; i++)
info->start[i] = base + (i * 0x00010000);
} else {
if (info->flash_id & FLASH_BTYPE) {
/* set sector offsets for bottom boot block type */
info->start[0] = base + 0x00000000;
info->start[1] = base + 0x00004000;
info->start[2] = base + 0x00006000;
info->start[3] = base + 0x00008000;
for (i = 4; i < info->sector_count; i++) {
info->start[i] =
base + (i * 0x00010000) - 0x00030000;
}
} else {
/* set sector offsets for top boot block type */
i = info->sector_count - 1;
info->start[i--] = base + info->size - 0x00004000;
info->start[i--] = base + info->size - 0x00006000;
info->start[i--] = base + info->size - 0x00008000;
for (; i >= 0; i--) {
info->start[i] = base + i * 0x00010000;
}
}
} }
} }
...@@ -142,44 +123,21 @@ void flash_print_info (flash_info_t * info) ...@@ -142,44 +123,21 @@ void flash_print_info (flash_info_t * info)
case FLASH_MAN_SST: case FLASH_MAN_SST:
printf ("SST "); printf ("SST ");
break; break;
case FLASH_MAN_STM:
printf ("ST Micro ");
break;
default: default:
printf ("Unknown Vendor "); printf ("Unknown Vendor ");
break; break;
} }
switch (info->flash_id & FLASH_TYPEMASK) { /* (Reduced table of only parts expected in JSE boards.) */
case FLASH_AM040: switch (info->flash_id) {
case FLASH_MAN_AMD | FLASH_AM040:
printf ("AM29F040 (512 Kbit, uniform sector size)\n"); printf ("AM29F040 (512 Kbit, uniform sector size)\n");
break; break;
case FLASH_AM400B: case FLASH_MAN_STM | FLASH_AM040:
printf ("AM29LV400B (4 Mbit, bottom boot sect)\n"); printf ("MM29W040W (512 Kbit, uniform sector size)\n");
break;
case FLASH_AM400T:
printf ("AM29LV400T (4 Mbit, top boot sector)\n");
break;
case FLASH_AM800B:
printf ("AM29LV800B (8 Mbit, bottom boot sect)\n");
break;
case FLASH_AM800T:
printf ("AM29LV800T (8 Mbit, top boot sector)\n");
break;
case FLASH_AM160B:
printf ("AM29LV160B (16 Mbit, bottom boot sect)\n");
break;
case FLASH_AM160T:
printf ("AM29LV160T (16 Mbit, top boot sector)\n");
break;
case FLASH_AM320B:
printf ("AM29LV320B (32 Mbit, bottom boot sect)\n");
break;
case FLASH_AM320T:
printf ("AM29LV320T (32 Mbit, top boot sector)\n");
break;
case FLASH_SST800A:
printf ("SST39LF/VF800 (8 Mbit, uniform sector size)\n");
break;
case FLASH_SST160A:
printf ("SST39LF/VF160 (16 Mbit, uniform sector size)\n");
break; break;
default: default:
printf ("Unknown Chip Type\n"); printf ("Unknown Chip Type\n");
...@@ -253,10 +211,14 @@ static ulong flash_get_size (vu_long * addr, flash_info_t * info) ...@@ -253,10 +211,14 @@ static ulong flash_get_size (vu_long * addr, flash_info_t * info)
case (FLASH_WORD_SIZE) SST_MANUFACT: case (FLASH_WORD_SIZE) SST_MANUFACT:
info->flash_id = FLASH_MAN_SST; info->flash_id = FLASH_MAN_SST;
break; break;
case (FLASH_WORD_SIZE)STM_MANUFACT:
info->flash_id = FLASH_MAN_STM;
break;
default: default:
info->flash_id = FLASH_UNKNOWN; info->flash_id = FLASH_UNKNOWN;
info->sector_count = 0; info->sector_count = 0;
info->size = 0; info->size = 0;
printf("Unknown flash manufacturer code: 0x%x\n", value);
return (0); /* no or unknown flash */ return (0); /* no or unknown flash */
} }
...@@ -273,99 +235,19 @@ static ulong flash_get_size (vu_long * addr, flash_info_t * info) ...@@ -273,99 +235,19 @@ static ulong flash_get_size (vu_long * addr, flash_info_t * info)
info->sector_count = 8; info->sector_count = 8;
info->size = 0x0080000; /* => 512 ko */ info->size = 0x0080000; /* => 512 ko */
break; break;
case (FLASH_WORD_SIZE) AMD_ID_LV400T: case (FLASH_WORD_SIZE)STM_ID_M29W040B: /* most likele JSE chip */
info->flash_id += FLASH_AM400T; info->flash_id += FLASH_AM040;
info->sector_count = 11; info->sector_count = 8;
info->size = 0x00080000; info->size = 0x0080000; /* => 512 ko */
break; /* => 0.5 MB */ break;
case (FLASH_WORD_SIZE) AMD_ID_LV400B:
info->flash_id += FLASH_AM400B;
info->sector_count = 11;
info->size = 0x00080000;
break; /* => 0.5 MB */
case (FLASH_WORD_SIZE) AMD_ID_LV800T:
info->flash_id += FLASH_AM800T;
info->sector_count = 19;
info->size = 0x00100000;
break; /* => 1 MB */
case (FLASH_WORD_SIZE) AMD_ID_LV800B:
info->flash_id += FLASH_AM800B;
info->sector_count = 19;
info->size = 0x00100000;
break; /* => 1 MB */
case (FLASH_WORD_SIZE) AMD_ID_LV160T:
info->flash_id += FLASH_AM160T;
info->sector_count = 35;
info->size = 0x00200000;
break; /* => 2 MB */
case (FLASH_WORD_SIZE) AMD_ID_LV160B:
info->flash_id += FLASH_AM160B;
info->sector_count = 35;
info->size = 0x00200000;
break; /* => 2 MB */
#if 0 /* enable when device IDs are available */
case (FLASH_WORD_SIZE) AMD_ID_LV320T:
info->flash_id += FLASH_AM320T;
info->sector_count = 67;
info->size = 0x00400000;
break; /* => 4 MB */
case (FLASH_WORD_SIZE) AMD_ID_LV320B:
info->flash_id += FLASH_AM320B;
info->sector_count = 67;
info->size = 0x00400000;
break; /* => 4 MB */
#endif
case (FLASH_WORD_SIZE) SST_ID_xF800A:
info->flash_id += FLASH_SST800A;
info->sector_count = 16;
info->size = 0x00100000;
break; /* => 1 MB */
case (FLASH_WORD_SIZE) SST_ID_xF160A:
info->flash_id += FLASH_SST160A;
info->sector_count = 32;
info->size = 0x00200000;
break; /* => 2 MB */
default: default:
info->flash_id = FLASH_UNKNOWN; info->flash_id = FLASH_UNKNOWN;
return (0); /* => no or unknown flash */ return (0); /* => no or unknown flash */
} }
/* set up sector start address table */ /* Calculate the sector offsets (Use JSE Optimized code). */
if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) || flash_get_offsets(base, info);
(info->flash_id == FLASH_AM040)) {
for (i = 0; i < info->sector_count; i++)
info->start[i] = base + (i * 0x00010000);
} else {
if (info->flash_id & FLASH_BTYPE) {
/* set sector offsets for bottom boot block type */
info->start[0] = base + 0x00000000;
info->start[1] = base + 0x00004000;
info->start[2] = base + 0x00006000;
info->start[3] = base + 0x00008000;
for (i = 4; i < info->sector_count; i++) {
info->start[i] =
base + (i * 0x00010000) - 0x00030000;
}
} else {
/* set sector offsets for top boot block type */
i = info->sector_count - 1;
info->start[i--] = base + info->size - 0x00004000;
info->start[i--] = base + info->size - 0x00006000;
info->start[i--] = base + info->size - 0x00008000;
for (; i >= 0; i--) {
info->start[i] = base + i * 0x00010000;
}
}
}
/* check for protected sectors */ /* check for protected sectors */
for (i = 0; i < info->sector_count; i++) { for (i = 0; i < info->sector_count; i++) {
...@@ -505,7 +387,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) ...@@ -505,7 +387,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
goto DONE; goto DONE;
wait_for_DQ7 (info, l_sect); wait_for_DQ7 (info, l_sect);
DONE: DONE:
#endif #endif
/* reset to read mode */ /* reset to read mode */
addr = (FLASH_WORD_SIZE *) info->start[0]; addr = (FLASH_WORD_SIZE *) info->start[0];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册