flash_info[i].start[j]= flashbase + j * MAIN_SECT_SIZE;
}
//修改flash_print_info函数如下:
case(AMD_MANUFACT & FLASH_VENDMASK):
printf("AMD: ");
break;
case(SST_MANUFACT & FLASH_VENDMASK)://添加SST39VF1601的
printf("SST:");
break;
case(AMD_ID_LV800B & FLASH_TYPEMASK):
printf("1x Amd29LV800BB (8Mbit)\n");
break;
case(SST_ID_xF1601 & FLASH_TYPEMASK)://添加SST39VF1601的
printf("1x SST39VF1610 (16Mbit)\n");
break;
//修改flash_erase函数如下:
//if ((info->flash_id & FLASH_VENDMASK) !=
// (AMD_MANUFACT & FLASH_VENDMASK)) {
// return ERR_UNKNOWN_FLASH_VENDOR;
//}
if((info->flash_id & FLASH_VENDMASK)!=
(SST_MANUFACT & FLASH_VENDMASK)){
return ERR_UNKNOWN_FLASH_VENDOR;
}
///* wait until flash is ready */
//chip = 0;
//do {
// result = *addr;
// /* check timeout */
// if (get_timer_masked () >
// CONFIG_SYS_FLASH_ERASE_TOUT) {
// MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
// chip = TMO;
// break;
// }
// if (!chip
// && (result & 0xFFFF) & BIT_ERASE_DONE)
// chip = READY;
// if (!chip
// && (result & 0xFFFF) & BIT_PROGRAM_ERROR)
// chip = ERR;
//} while (!chip);
//MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
//if (chip == ERR) {
// rc = ERR_PROG_ERROR;
// goto outahere;
//}
//if (chip == TMO) {
// rc = ERR_TIMOUT;
// goto outahere;
//}
while(1)
{
if((*addr & 0x40)!=(*addr & 0x40))
continue;
if(*addr & 0x80)
{
rc = ERR_OK;
break;
}
}
//修改write_hword函数如下:
MEM_FLASH_ADDR1 = CMD_UNLOCK1;
MEM_FLASH_ADDR2 = CMD_UNLOCK2;
//MEM_FLASH_ADDR1 = CMD_UNLOCK_BYPASS;
MEM_FLASH_ADDR1 = CMD_PROGRAM;
//*addr = CMD_PROGRAM;
*addr = data;
///* wait until flash is ready */
//chip = 0;
//do {
// result = *addr;
// /* check timeout */
// if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
// chip = ERR | TMO;
// break;
// }
// if (!chip && ((result & 0x80) == (data & 0x80)))
// chip = READY;
// if (!chip && ((result & 0xFFFF) & BIT_PROGRAM_ERROR)) {
// result = *addr;
// if ((result & 0x80) == (data & 0x80))
// chip = READY;
// else
// chip = ERR;
// }
//} while (!chip);
//*addr = CMD_READ_ARRAY;
//if (chip == ERR || *addr != data)
// rc = ERR_PROG_ERROR;
while(1)
{
if((*addr & 0x40)!=(*addr & 0x40))
continue;
if((*addr & 0x80)==(data & 0x80))
{
rc = ERR_OK;
break;
}
}
|