[U-Boot-Users] Trouble in cfi_flash, help please!

Hi,
I'm still in trouble with cfi_flash. My previous posts on the subject can be reached by the following links;
1. http://sourceforge.net/mailarchive/forum.php?thread_id=7456151&forum_id=... 2. http://sourceforge.net/mailarchive/forum.php?thread_id=7463406&forum_id=...
Every thing works well if I use command prompt of u-boot ( using mw.l and md commands as Yuli suggested.) mw.l ff000000 60606060 mw.l ff000000 d0d0d0d0 md ff000000
But somehow protect command which calls flash_real_protect insists on not to work :-( (Actually everything seems to be alright, but why it doesn't work!!!)
I have modified flash_real_protect() as follows, to see what is going on. I can read status register first of all by sending the cmd 0x70. But whenever I send the command to unprotect a block I get a status of 0xb0 which indicates a failure!
Below in the modified function, after sending cmd_protect I send a reset and clear status commands, because after calling protect off command at the command prompt, sending a 0x60 results with b0 on the status register. Then sending cmd_protect and clear_status and 0x60 results with 0x80(which is expected to) on the status register (returns from failure condition). So I tried that sequence in flash_real_protect().
int flash_real_protect (flash_info_t * info, long sector, int prot) { int retcode = 0; /*yio: flash_print_StatusBits(info, sector);*/ flash_write_cmd (info, sector, 0, 0x70); printf("yio: after 0x%x addr=0x%x databus: 0x%x\n", 0x70, info->start[sector], *(unsigned long *)(info->start[sector])); flash_write_cmd (info, sector, 0, FLASH_CMD_CLEAR_STATUS); printf("yio: after 0x%x addr=0x%x databus: 0x%x\n", FLASH_CMD_CLEAR_STATUS, info->start[sector], *(unsigned long *)(info->start[sector])); udelay(10000); /*not needed but maybe I need to wait*/ flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT); udelay(10000); /*not needed but maybe I need to wait*/ printf("yio: after 0x%x addr=0x%x databus: 0x%x\n", FLASH_CMD_PROTECT, info->start[sector], *(unsigned long *)(info->start[sector])); flash_write_cmd (info, sector, 0, FLASH_CMD_RESET); printf("yio: after 0x%x addr=0x%x databus: 0x%x\n", FLASH_CMD_RESET, info->start[sector], *(unsigned long *)(info->start[sector])); flash_write_cmd (info, sector, 0, FLASH_CMD_CLEAR_STATUS); printf("yio: after 0x%x addr=0x%x databus: 0x%x\n", FLASH_CMD_CLEAR_STATUS, info->start[sector], *(unsigned long *)(info->start[sector])); flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT); printf("yio: after 0x%x addr=0x%x databus: 0x%x\n", FLASH_CMD_PROTECT, info->start[sector], *(unsigned long *)(info->start[sector]));
if (prot) flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT_SET); else { flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT_CLEAR); printf("yio: after 0x%x addr=0x%x databus: 0x%x\n", FLASH_CMD_PROTECT_CLEAR, info->start[sector], *(unsigned long *)(info->start[sector])); } if ((retcode = flash_full_status_check (info, sector, info->erase_blk_tout, prot ? "protect" : "unprotect")) == 0) { info->protect[sector] = prot; /* Intel's unprotect unprotects all locking *yio/ if (prot == 0) { flash_sect_t i; printf("yio: entering for loop in flash_real_protect\n"); for (i = 0; i < info->sector_count; i++) { if (info->protect[i]) flash_real_protect (info, i, 1); } } ~yio*/ } printf("yio: flash_real_protect retcode=%d\n", retcode); return retcode; }
Debug messages are below; => protect off ff000000 ff03ffff fwrite addr ff000000 cmd 70 0070007000700070 64 bit x 16 bit yio: after 0x70 addr=0xff000000 databus: 0x800080 fwrite addr ff000000 cmd 50 0050005000500050 64 bit x 16 bit yio: after 0x50 addr=0xff000000 databus: 0x27051956 fwrite addr ff000000 cmd 60 0060006000600060 64 bit x 16 bit yio: after 0x60 addr=0xff000000 databus: 0xb000b0 fwrite addr ff000000 cmd ff 00ff00ff00ff00ff 64 bit x 16 bit yio: after 0xff addr=0xff000000 databus: 0x27051956 fwrite addr ff000000 cmd 50 0050005000500050 64 bit x 16 bit yio: after 0x50 addr=0xff000000 databus: 0x27051956 fwrite addr ff000000 cmd 60 0060006000600060 64 bit x 16 bit yio: after 0x60 addr=0xff000000 databus: 0xb000b0 fwrite addr ff000000 cmd d0 00d000d000d000d0 64 bit x 16 bit yio: after 0xd0 addr=0xff000000 databus: 0x27051956 yio: in flash_isset flash_is_busy: 1 yio: in flash_isset flash_is_busy: 1 yio: in flash_isset flash_is_busy: 1 yio: in flash_isset flash_is_busy: 1 yio: in flash_isset flash_is_busy: 1 yio: in flash_isset flash_is_busy: 1 long addr is at ff000000 info->portwidth = 8 addr[0] = 0x27 addr[1] = 0x5 addr[2] = 0x19 addr[3] = 0x56 addr[4] = 0x55 addr[5] = 0x2d addr[6] = 0x42 addr[7] = 0x6f addr[8] = 0x6f addr[9] = 0x74 addr[a] = 0x20 addr[b] = 0x31 addr[c] = 0x2e addr[d] = 0x31 addr[e] = 0x2e addr[f] = 0x32 addr[10] = 0x20 addr[11] = 0x28 addr[12] = 0x4a addr[13] = 0x75 addr[14] = 0x6e addr[15] = 0x20 addr[16] = 0x20 addr[17] = 0x37 addr[18] = 0x20 addr[19] = 0x32 addr[1a] = 0x30 addr[1b] = 0x30 addr[1c] = 0x35 addr[1d] = 0x20 addr[1e] = 0x2d addr[1f] = 0x20 Flash unprotect timeout at address ff000000 data 326f2037 fwrite addr ff000000 cmd ff 00ff00ff00ff00ff 64 bit x 16 bit is= cmd 80(?) addr ff000000 is= 27051956552d426f 0080008000800080 Flash unprotect error at address ff000000 yio: in flash_isset yio: in flash_isset yio: in flash_isset yio: in flash_isset yio: in flash_isset fwrite addr ff000000 cmd ff 00ff00ff00ff00ff 64 bit x 16 bit yio: flash_real_protect retcode=8 .Un-Protected 1 sectors =>
Thank you very much Yusuf Ibrahim Ozkok.
###################################################################### Dikkat:
Bu elektronik posta mesaji kisisel ve ozeldir. Eger size gonderilmediyse lutfen gondericiyi bilgilendirip mesaji siliniz. Firmamiza gelen ve giden mesajlar virus taramasindan gecirilmekte, guvenlik nedeni ile kontrol edilerek saklanmaktadir. Mesajdaki gorusler ve bakis acisi gondericiye ait olup Aselsan A.S. resmi gorusu olmak zorunda degildir.
###################################################################### Attention:
This e-mail message is privileged and confidential. If you are not the intended recipient please delete the message and notify the sender. E-mails to and from the company are monitored for operational reasons and in accordance with lawful business practices. Any views or opinions presented are solely those of the author and do not necessarily represent the views of the company.
######################################################################

Yusuf Ibrahim Ozkok writes:
...
Yusuf> I have modified flash_real_protect() as follows, to see what Yusuf> is going on. I can read status register first of all by Yusuf> sending the cmd 0x70. But whenever I send the command to Yusuf> unprotect a block I get a status of 0xb0 which indicates a Yusuf> failure!
...
Status 0xB0 means incorrect command sequence so instead of sending 0x60 0xD0, `protect off' commands sends something else. I'd try to enable debug prints in cmd_flash.c to see what's sent. According to the log which you sent, 0xFF (reset) is sent in the middle.
participants (2)
-
Yuli Barcohen
-
Yusuf Ibrahim Ozkok