Hi Bob, sorry for the late reply.
On Wednesday 02 November 2011 08:20:03 Bob Liu wrote: > Hi, folks > > I think this patch make cfi_flash can't work correctly. > http://git.denx.de/?p=u-boot.git;a=commitdiff;h=df4e813b72bf07d9026b00455f5 > e7dffd694ae48 > > --- a/drivers/mtd/cfi_flash.c > +++ b/drivers/mtd/cfi_flash.c > @@ -1426,6 +1426,11 @@ int flash_real_protect (flash_info_t * info, > long sector, int prot) > #endif > }; > > + /* > + * Flash needs to be in status register read mode for > + * flash_full_status_check() to work correctly > + */ > + flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); > > -------------------------------------- > without this line, flash can't be recognized. So it's correct here. > > U-Boot 2011.09-svn2735 (ADI-2012R1-pre) (Nov 02 2011 - 15:05:23) <snip> > -------------------------------------- > > if ((retcode = > flash_full_status_check (info, sector, info->erase_blk_tout, > prot ? "protect" : "unprotect")) == > 0) { @@ -1975,6 +1980,13 @@ ulong flash_get_size (phys_addr_t base, int > banknum) > case CFI_CMDSET_INTEL_PROG_REGIONS: > case CFI_CMDSET_INTEL_EXTENDED: > case CFI_CMDSET_INTEL_STANDARD: > + /* > + * Set flash to read-id mode. > Otherwise > + * reading protected status is not > + * guaranteed. > + */ > + flash_write_cmd(info, sect_cnt, 0, > + FLASH_CMD_READ_ID); > --------------------------------------------------------------------------- > - But with this two lines. flash ops are not correct. > > I used old uboot version to read out data from flash. > Then tftpboot and run with latest uboot version, you can see that the read > out data from flash is different. > And without set flash to read-id mode here, it works fine. > > U-Boot 2010.06 (ADI-2010R1-RC2) (Oct 20 2010 - 04:37:34) > > CPU: ADSP bf526-0.0 (Detected Rev: 0.2) (parallel flash boot) > Board: ADI BF526 EZ-Board board > Support: http://blackfin.uclinux.org/ > Clock: VCO: 400 MHz, Core: 400 MHz, System: 80 MHz > RAM: 64 MiB > Flash: 4 MiB > In: serial > Out: serial > Err: serial > KGDB: [on serial] ready > Net: bfin_mac > Hit any key to stop autoboot: 0 > bfin> > bfin> md 0x20100000 > 20100000: 56190527 0b223987 d60baf4e 2e871c00 '..V.9".N....... > 20100010: 00100000 c42c1c00 a86adb94 01021005 ......,...j..... > 20100020: 32356662 2e302d36 2e332d30 2d382e30 bf526-0.0-3.0.8- > 20100030: 2d494441 31313032 702d3152 732d6572 ADI-2011R1-pre-s > 20100040: 00088b1f 00000000 fdc40302 4514780b .............x.E > 20100050: 570e38d6 3d33264f 24f48743 0649d303 .8.WO&3=C..$..I. > 20100060: 93080932 834e9970 0931141a 648443a0 2...p.N...1..C.d > 20100070: e0804212 12048762 56501a34 086bb2f1 .B..b...4.PV..k. > 20100080: 66e0888a d9782808 d165049d 75049945 ...f.(x...e.E..u > 20100090: 31415041 ba02cba2 aebbb2ae 8093d34b APA1........K... > 201000a0: 682f1a8a 9cffceb8 105ceeea 7f7df77d ../h......\.}.}. > 201000b0: 3c7cf3df 3aea984f 9d554ea7 4e753aaa ..|<O..:.NU..:uN > 201000c0: b1a94e5d b13ae91e cc436dbe 749b42c2 ]N....:..mC..B.t > 201000d0: fa449283 2aa2ec29 a82e0846 b7089ae5 ..D.)..*F....... > 201000e0: cc1f9dc4 a9920651 113e5122 b1122213 ....Q..."Q>..".. > 201000f0: 308f15a9 b6496a6a 12562598 49a8c8af ...0jjI..%V....I > > bfin> tftpboot 0x1000 u-boot.bin > Using bfin_mac device > TFTP from server 10.100.4.174; our IP address is 10.100.4.50 > Filename 'u-boot.bin'. > Load address: 0x1000 > Loading: ############### > done > Bytes transferred = 213828 (34344 hex) > bfin> go 0x1000 > ## Starting application at 0x00001000 ... > > > U-Boot 2011.09-svn2735 (ADI-2012R1-pre) (Nov 02 2011 - 15:15:05) > > CPU: ADSP bf526-0.0 (Detected Rev: 0.2) (parallel flash boot) > Board: ADI BF526 EZ-Board board > Support: http://blackfin.uclinux.org/ > Clock: VCO: 400 MHz, Core: 400 MHz, System: 80 MHz > RAM: 64 MiB > Flash: 4 MiB > In: serial > Out: serial > Err: serial > KGDB: [on serial] ready > Net: bfin_mac > Hit any key to stop autoboot: 0 > bfin> md 0x20100000 > 20100000: 88150020 ffff0001 bfcfffff ffffffff ............... > 20100010: ffffffff ffffffff ffffffff ffffffff ................ > 20100020: 00520051 00030059 00390000 00000000 Q.R.Y.....9..... Hmmm. Strange. Your flash still seems to be in read-id mode after initial detection. But from looking at flash_get_size(), the following flash reset command should bring it back to read-array mode: flash_write_cmd (info, 0, 0, info->cmd_reset); Did you check that cmd_reset is set correctly on your hardware (AMD vs. Intel)? Which flash chip are you using? Thanks, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot