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

Woodruff, Richard r-woodruff2 at ti.com
Tue Jun 14 14:11:03 CEST 2005


I posted a trivial patch which touched CFI along with some OMAP242x work
a little while back.  Perhaps you should give that a try.

I was seeing some problems with an Intel device in flash_real_protect.
I also ran into some issues with status assumptions with partitioned
devices.  There is also a probe bit added for simulators, but you need
not worry about that.

As I recall the real protect seemed to run into some unnecessary number
of protect calls which screwed up chip state.  For each sector it redid
the whole chip or something to that effect.  I wrapped my changes in a
couple OMAP defines so only the target sector was called, but there
really isn't anything OMAP specific about it.  My intention was not to
mess up anyone else who might actually depend on that functionality.

After a couple ifdefs' real protect started working.

Regards,
Richard W.

> -----Original Message-----
> From: u-boot-users-admin at lists.sourceforge.net [mailto:u-boot-users-
> admin at lists.sourceforge.net] On Behalf Of Yusuf Ibrahim Ozkok
> Sent: Tuesday, June 14, 2005 6:10 AM
> To: u-boot-users at lists.sourceforge.net
> Cc: Yuli Barcohen
> Subject: [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=
12
> 898
> 2.
>
http://sourceforge.net/mailarchive/forum.php?thread_id=7463406&forum_id=
12
> 898
> 
> 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.
> 
> ######################################################################
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you
> shotput
> a projector? How fast can you ride your desk chair down the office
luge
> track?
> If you want to score the big prize, get to know the little guy.
> Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users




More information about the U-Boot mailing list