Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Intel flash parts not performing buffered writes -- bug in mtd-flash or fs-flash3?: (5 Items)
   
Intel flash parts not performing buffered writes -- bug in mtd-flash or fs-flash3?  
We have Intel StrataFlash parts and are using the stock devf-generic. The flash is correctly recognized as 16-bit and 
supporting buffered writes (f3s_iCFI_ident() finds dbase->buffer_size to be 64 and sets the F3S_WRITE_BUFFER on dbase->
flags).

However, I've stepped through the f3s_iCFI_v2write() code (at least that available from the MPC8641d BSP) when we're 
doing flash writes on the raw flash device, and it is not using buffered writes (the (flags & F3S_WRITE_BUFFER) check fails). The call tree for our writes looks like:
f3s_raw_write() -> f3s_flash_write() -> 
f3s_iCFI_v2write().

Grepping the fs-flash3 code, it looks like the "flags" parameter that is passed to f3s_iCFI_v2write() is the write_flags
 parameter passed to f3s_flash_write(), which doesn't at all care about dbase->flags (it is always explicitly set to 0, 
1, or F3S_VERIFY_WRITE when f3s_flash_write() is called) -- so the "buffered writes" path in f3s_iCFI_v2write() is never
 taken.

Is this a bug in the fs-flash3 code (not correctly passing the F3S_WRITE_BUFFER flag) or in f3s_iCFI_v2write() (should 
be checking (dbase->flags & F3S_WRITE_BUFFER) instead of (flags & F3S_WRITE_BUFFER))?
RE: Intel flash parts not performing buffered writes -- bug in mtd-flash or fs-flash3?  
Josh,

Thank you for reporting this.  Yes, this is a bug in the MTD library.
The function iCFI_ident() was setting the capability flag incorrectly,
and f3s_iCFI_v2write() was checking the wrong flag.  This has been
fixed, and the fix is available on the Foundry27 "BSP and Drivers"
project.

http://community.qnx.com/integration/viewcvs/viewcvs.cgi/trunk/hardware/
flash/mtd-flash/intel/?root=bsp&system=exsy1001

That's the link to the trunk (ie. 6.4.1) branch.  The change is also
available on the 6.3.0 branch.

David 

> -----Original Message-----
> From: Josh Radel [mailto:community-noreply@qnx.com] 
> Sent: June 30, 2009 8:55 PM
> To: general-filesystems
> Subject: Intel flash parts not performing buffered writes -- 
> bug in mtd-flash or fs-flash3?
> 
> We have Intel StrataFlash parts and are using the stock 
> devf-generic. The flash is correctly recognized as 16-bit and 
> supporting buffered writes (f3s_iCFI_ident() finds 
> dbase->buffer_size to be 64 and sets the F3S_WRITE_BUFFER on 
> dbase->flags).
> 
> However, I've stepped through the f3s_iCFI_v2write() code (at 
> least that available from the MPC8641d BSP) when we're doing 
> flash writes on the raw flash device, and it is not using 
> buffered writes (the (flags & F3S_WRITE_BUFFER) check fails). 
> The call tree for our writes looks like:
> f3s_raw_write() -> f3s_flash_write() -> f3s_iCFI_v2write().
> 
> Grepping the fs-flash3 code, it looks like the "flags" 
> parameter that is passed to f3s_iCFI_v2write() is the 
> write_flags parameter passed to f3s_flash_write(), which 
> doesn't at all care about dbase->flags (it is always 
> explicitly set to 0, 1, or F3S_VERIFY_WRITE when 
> f3s_flash_write() is called) -- so the "buffered writes" path 
> in f3s_iCFI_v2write() is never taken.
> 
> Is this a bug in the fs-flash3 code (not correctly passing 
> the F3S_WRITE_BUFFER flag) or in f3s_iCFI_v2write() (should 
> be checking (dbase->flags & F3S_WRITE_BUFFER) instead of 
> (flags & F3S_WRITE_BUFFER))?
> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post32898
> 
> 
Re: RE: Intel flash parts not performing buffered writes -- bug in mtd-flash or fs-flash3?  
Hi David,

I might be missing something... but it looks to me like the bug is still there. The devf-generic shipped in 6.4.1 is 
still slow -- not taking advantaged of buffered writes -- and the code in http://community.qnx.com/integration/viewvc/
viewvc.cgi/trunk/hardware/flash/mtd-flash/intel/?root=bsp&system=exsy1001&pathrev=137 still appears to have the bug.

How I fixed it in my local BSP:

In iCFI_v2write.c, I changed the line:

if ((flags & F3S_WRITE_BUFFER) && (left >= (4 * flashcfg.bus_width)))

to:

if ((dbase->flags & F3S_WRITE_BUFFER) && (left >= (4 * flashcfg.bus_width)))
RE: RE: Intel flash parts not performing buffered writes -- bug in mtd-flash or fs-flash3?  
Josh,

I think you're right.  That code used to check for an entirely different
(incorrect) flag.  That was fixed for 6.4.1, but you're right that it
should be the dbase->flags, and not the passed-in flags.  I'll open a PR
and make a change to the code.

Thanks,

David 

> -----Original Message-----
> From: Josh Radel [mailto:community-noreply@qnx.com] 
> Sent: August 3, 2009 3:38 PM
> To: general-filesystems
> Subject: Re: RE: Intel flash parts not performing buffered 
> writes -- bug in mtd-flash or fs-flash3?
> 
> Hi David,
> 
> I might be missing something... but it looks to me like the 
> bug is still there. The devf-generic shipped in 6.4.1 is 
> still slow -- not taking advantaged of buffered writes -- and 
> the code in 
> http://community.qnx.com/integration/viewvc/viewvc.cgi/trunk/h
> ardware/flash/mtd-flash/intel/?root=bsp&system=exsy1001&pathre
v=137 still appears to have the bug.
> 
> How I fixed it in my local BSP:
> 
> In iCFI_v2write.c, I changed the line:
> 
> if ((flags & F3S_WRITE_BUFFER) && (left >= (4 * flashcfg.bus_width)))
> 
> to:
> 
> if ((dbase->flags & F3S_WRITE_BUFFER) && (left >= (4 * 
> flashcfg.bus_width)))
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post35148
> 
> 
Re: RE: RE: Intel flash parts not performing buffered writes -- bug in mtd-flash or fs-flash3?  
Hello, I just ran into the same problem. I use BSP for i.MX35 3DS, the MTD library shipped with this still contains that
 bug. I modified it accordingly and now I have write speed increased from 11KB/s (!!) to 70KB/s. Still not really 
satisfying, but might be that the flash part (RC28F256P33 from Numonyx) requires some special code.

I downloaded bsp-freescale-p1022-ds-6.5.0.zip, which is only Sept 2011 released, and the MTD library shipped with this 
still contains that bug.

Can you tell us the PR# for this issue and what the status is, please. We should much prefer to use an unmodified MTD 
library from QSS.

Can the MTD library accessed separately anywhere?

Thanks,
Albrecht