All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haiying Wang <r54964@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug.
Date: Thu, 01 Feb 2007 17:06:14 -0500	[thread overview]
Message-ID: <1170367574.10652.26.camel@udp097531uds.am.freescale.net> (raw)
In-Reply-To: <45C179F0.6050206@orkun.us>

> Except for "vendor" everything looks OK here. I should have asked you to 
> print vendor right before flash_read_jedec_ids() call. It was not yet 
> initialized when printed. It must be correctly set as well since 
> flash_read_jedec_ids() uses it would not have returned correct data 
> otherwise.
My fault, vendor is 2 when I put the printf to the correct place.:-)

> You have a 16-bit flash accessible on 16-bit bus. The flash manufacturer 
> is "AMD/Spansion" or compatible and device id is 7E1301 which is correct 
> for your part:
> 
> http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25538a1.pdf
> 
> Please note that flash_read_jedec_ids() is used for manufacturer id and 
> device_ids and this function in turn is using flash_read_uchar() which 
> worked just fine for you.
Thanks.

> > 124 erase regions found, only 4 used
> 
> This is not correct. This is why you are blaming the flash_read_uchar() 
> function. But since it worked correctly before the failure to read the 
> number of erase regions is probably not due to the function.
I agree with you that the failure is not due to the function
(flash_read_uchar()). We thought before that it was better to modify
this function so that flash with different port-width could be accessed
safer.

> You demonstrated that this did not affect you because the output was the 
> same. The problem with this line was that info->cmd_reset was not yet 
> initialized when flash_detect_cfi() was called. This is a minor bug 
> since the flash was not in query mode yet. I think we can safely remove 
> this call as well or replace it both amd anf intel reset commands back 
> to back. But anyway, back to your issue.
Understood.:)

> It looks like the rest of the commands worked as well :) All without 
> changing flash_read_uchar() functionality!
Yes. But in our previous tests, without adding code in between
flash_write_cmd() and flash_read_uchar()(for num_erase_region), just
adding some code elsewhere, the flash worked sometimes and failed
sometimes. Another case is that, one of our customer pointed that on
their test, flash could work with ELDK 1.3.0 and failed at ELDK 1.4.0. I
just suspect that the different compiler may have difference on
optimization thus affected the instruction execution sequence.

> At this point, all data indicates that flash_read_uchar() is just fine.
> 
> I am suspecting two things:
> 
> 1) Your CPU might be trying to re-order writes and reads to optimize 
> performance. Since the command write and data read are from different 
> addresses it could do this but the write command should really finish 
> before we access the table data. So, we might need to add powerpc "sync" 
> instructions in flash_write_cmd() function. Apparently CONFIG_BLACKFIN 
> has a similar need as well. I would add a generic "sync" for the whole 
> PowerPC family but there is not a conveninent CONFIG_POWERPC macro as 
> far as I can see. Anyway, try adding:
> 
> asm("sync;");
> 
> statements in that function. Use Blackfin as an example.
> 
> 2) Because you have a rather fast CPU it is possible that we are not 
> allowing enough time after reset command is executed before array is in 
> read mode. According to the datasheet of your flash part if external 
> reset signal was asserted you could need up to 20usec before flash 
> returns to read mode. I am not sure if this delay is needed for issued 
> reset commands as well. We might need to add some delay after flash 
> reset commands. Try adding udelay(100); right after flash reset command 
> is sent. You can locate flash reset commands by searching 
> flash_write_cmd() statements that passes FLASH_CMD_RESET, AMD_CMD_RESET 
> or cfi->cmd_reset as the last argument.
Your suggestions are very valuable. I did think about the flash response
time for reset command, but did not figure out where and why was
reasonable.I am very appreciated for your kind help on this. We will try
both suggestions and do enough tests before sending out a new patch for
review.:-)
 
> I hope this helps.
Many thanks again.

Haiying

  reply	other threads:[~2007-02-01 22:06 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-22  7:27 [U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug wei.zhang at freescale.com
2006-12-22 10:00 ` Wolfgang Denk
2006-12-22 11:02   ` Zhang Wei
2006-12-22 14:11     ` Wolfgang Denk
2006-12-22 16:34       ` [U-Boot-Users] 答复: " Zhang Wei-r63237
2006-12-22 17:17         ` Wolfgang Denk
2006-12-25  7:03           ` Zhang Wei
2006-12-25 23:24             ` Wolfgang Denk
2006-12-26  6:04               ` Zhang Wei
2007-01-04  2:07                 ` Zhang Wei-r63237
2007-01-04  8:17                   ` Wolfgang Denk
2007-01-04  8:36               ` Zhang Wei-r63237
2007-01-04  9:23                 ` Wolfgang Denk
2007-01-04 11:19                   ` Stefan Roese
2007-01-05 13:27                   ` Stefan Roese
2007-01-07 10:12                     ` Tolunay Orkun
2007-01-07 10:40                       ` Wolfgang Denk
2007-01-13  7:11                         ` Tolunay Orkun
2007-01-13 17:53                           ` Håvard Skinnemoen
2007-01-16  6:52                             ` Stefan Roese
2007-01-25  4:38                           ` Zhang Wei-r63237
2007-01-25 16:10                             ` Timur Tabi
2007-01-25 20:33                               ` Wolfgang Denk
2007-01-26  2:13                                 ` Zhang Wei-r63237
2007-01-29 11:29                                   ` Tolunay Orkun
2007-01-30  3:36                                     ` Wang Haiying-r54964
2007-01-31  9:01                                       ` Tolunay Orkun
2007-01-31 19:25                                         ` Haiying Wang
2007-02-01  5:26                                           ` Tolunay Orkun
2007-02-01 22:06                                             ` Haiying Wang [this message]
2007-02-01 22:52                                               ` Chris Fester
2007-02-09 17:47                                             ` [U-Boot-Users] [PATCH0/2] Re-do the patch for adding DO_SYNC in flash_write_cmd Haiying Wang
2007-02-09 19:42                                               ` Wolfgang Denk
2007-02-09 19:48                                                 ` Haiying Wang
2007-02-10  1:04                                                   ` Wolfgang Denk
2007-02-10  7:23                                                     ` Tolunay Orkun
2007-02-10  7:40                                                       ` Stefan Roese
2007-02-10  7:57                                                         ` Tolunay Orkun
2007-02-10  8:07                                                           ` Stefan Roese
2007-02-10 21:55                                                             ` Wolfgang Denk
2007-02-10 21:54                                                         ` Wolfgang Denk
2007-02-11  2:34                                                         ` Timur Tabi
2007-02-11 10:23                                                           ` Wolfgang Denk
2007-02-09 19:59                                                 ` Haavard Skinnemoen
2007-02-10  1:02                                                   ` Wolfgang Denk
2007-02-09 17:47                                             ` [U-Boot-Users] [PATCH 1/2] Add DO_SYNC at the end of flash_write_cmd Haiying Wang
2007-02-09 19:45                                               ` Wolfgang Denk
2007-02-09 17:47                                             ` [U-Boot-Users] [PATCH 2/2] Define DO_SYNC in each CPU's header file Haiying Wang
2007-02-09 19:46                                               ` Wolfgang Denk
2007-02-10  7:17                                                 ` Tolunay Orkun
2007-01-08  2:41                     ` [U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug Zhang Wei-r63237
2006-12-22 17:07       ` Chris Fester
2006-12-22 17:24         ` Wolfgang Denk
2006-12-22 17:42           ` Chris Fester
2006-12-22 21:33             ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1170367574.10652.26.camel@udp097531uds.am.freescale.net \
    --to=r54964@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.