From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tolunay Orkun Date: Mon, 29 Jan 2007 05:29:21 -0600 Subject: [U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug. In-Reply-To: <46B96294322F7D458F9648B60E15112C082F7B@zch01exm26.fsl.freescale.net> References: Your message of "Thu, 25 Jan 2007 10:10:18 CST." <45B8D66A.6080209@freescale.com> <20070125203351.A17AE352B48@atlas.denx.de> <46B96294322F7D458F9648B60E15112C082F7B@zch01exm26.fsl.freescale.net> Message-ID: <45BDDA91.3070303@orkun.us> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Zhang Wei-r63237 wrote: >> Because the data we are interested in is only available in every >> other byte? >> > Does it means if we need other byte data we can access them byte by byte? If we needn't we should not access them? > > Thanks! > Zhang Wei The current code works because most CPU Bus Interface Unit will execute buswide cycles and discard the unused byte(s). I understand that you would like to convert this code to use memcpy() and pick various bytes from local ram instead of directly from flash. Right? What exactly you are experiencing when you use current code. Could you refresh my memory? I do not like memcpy() as it is a black box. It could be implemented at low level using string instructions, it could do various things for different cpu architectures and various sizes so it could lead to very hard to find issues. My proposal for you to try: Do not depend on bus interface unit doing buswide reads, explicitly read buswide chunks after doing the bus-wide read into a temporary variable, pick the usable bytes from that temporary variable. This should eliminate the bus interface unit dependency of the CPU and possible board designer interfacing gimmicks. Let us know how it goes (can you post your patch too so I can verify it). Tolunay