[U-Boot-Users] 答复: [U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug.

Zhang Wei-r63237 Wei.Zhang at freescale.com
Fri Dec 22 17:34:18 CET 2006


Hi, Wolfgang,

Yes, the memcpy() is just a byte copy. But a x16 read can be emulated by two x8 read. And in fact, the flash_read_ushort(), flash_read_long() in cfi_flash.c are using the same implementation.

In addition, the original code only reads 8bit, not the full 16bit. My patch ensures the full 16bit data are read completely.

Thanks!

Best Regards,
Zhang Wei


-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: 2006-12-22 (星期五) 22:11
To: Zhang Wei-r63237
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug. 
 
In message <458BBB5D.1030005 at freescale.com> you wrote:
> 
> After perform flash_read_jedec_ids(), the cfi query read will get an 
> '0xff'. From this flash's specification, the read for flash commands in 
> 16bit port connection should perform 16bit read and ignore the high 8bit 
> data. Although this issue maybe occurs in the special chip, perform the 
> fully 16bit read is a safety operation.

But your patch does NOT perform a 16 bit read. It calls memcpy(); the
default implementation of memcpy [see lib_generic/string.c] does this:

	char *tmp = (char *) dest, *s = (char *) src;

	while (count--)
		*tmp++ = *s++;

i. e. it performs a character copy, too, so it makes no difference
compared to the original code.

> The modification refers to the cfi flash drivers in Linux kernel (The 
> cfi_read_query() function in include/linux/mtd/cfi.h file). It's more 
> easy and clear than making the different type date read for different 
> portwidth (such as ushort_read() for x16, ulong_read() for x32).

I understand your intentions, but your patch does  not  do  what  you
think it does, so if it really fixes the problem on your system there
must be another cause or effect.

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
Emotions are alien to me.  I'm a scientist.
	-- Spock, "This Side of Paradise", stardate 3417.3

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20061223/e5b62754/attachment.htm 


More information about the U-Boot mailing list