From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Thu, 25 Jan 2007 21:33:51 +0100 Subject: [U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug. In-Reply-To: Your message of "Thu, 25 Jan 2007 10:10:18 CST." <45B8D66A.6080209@freescale.com> Message-ID: <20070125203351.A17AE352B48@atlas.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message <45B8D66A.6080209@freescale.com> you wrote: > > > Can the instruction ' > > retval = (addr[0] << 16) | (addr[(info->portwidth)] << 24) | > > (addr[(2 * info->portwidth)]) | (addr[(3 * > > info->portwidth)] << 8);' > > In flash_read_long() be replaced by memcpy() function? INHO: no, it cannot. > If you want to read 32 bits at one time, then just do a 32-bit read! > > retval = * (ulong *) addr; You assume that we want to read four contiguous bytes, which may, or may not, be the case. > Looking at the code, I don't understand why it's so complicated. If > portwidth is 2, then retval above will be a conglomeration of addr[0], > addr[2], addr[4], and addr[6]. Why isn't it just reading from > [0][1][2][3]?? Because the data we are interested in is only available in every other byte? Best regards, Wolfgang Denk -- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The Gates in my computer are AND, OR and NOT; they are not Bill.