public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] CFI: flash_write_cfiword() slow
@ 2008-11-03 11:15 Jens Gehrlein
  2008-11-03 20:10 ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Gehrlein @ 2008-11-03 11:15 UTC (permalink / raw)
  To: u-boot

Hi list,

having a look at function 
drivers/mtd/cfi_flash.c::flash_write_cfiword(), I found that 
find_sector() is called twice when having AMD standard, extended or 
legacy device. The first time, when writing the command. The second 
time, when calling flash_full_status_check().

Maybe this is the reason, why this programming mode is so slow.
find_sector() loops through the sector table from the last sector to
the current sector. And the more sectors the device has, the slower
the algorithm becomes. And this process for every sector to be 
programmed. And yes, there are still devices around without (standard) 
write buffer, e.g. the Samsung K8P2815UQB.

Before spending time to create a patch, I would like to read your 
opinion about this proposal/question:
Would it be sufficient to just add a flag, that indicates, that the 
sector number has already been calculated for AMD flashes or would it be 
better to pass parameters to flash_full_status_check() dependent on the 
command set?
Other proposals?
Do you see any unwanted side effects?

-- 
Kind regards,
Jens

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] CFI: flash_write_cfiword() slow
  2008-11-03 11:15 [U-Boot] CFI: flash_write_cfiword() slow Jens Gehrlein
@ 2008-11-03 20:10 ` Wolfgang Denk
  2008-12-12 16:34   ` Jens Gehrlein
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Denk @ 2008-11-03 20:10 UTC (permalink / raw)
  To: u-boot

Dear Jens Gehrlein,

In message <490EDD63.1010403@tqs.de> you wrote:
> 
> find_sector() loops through the sector table from the last sector to
> the current sector. And the more sectors the device has, the slower
> the algorithm becomes. And this process for every sector to be 
> programmed. And yes, there are still devices around without (standard) 
> write buffer, e.g. the Samsung K8P2815UQB.

A classic (and  trivial  to  implement)  approach  is  not  to  start
searching  at  the  end, but at the last used sector (assuming search
driection and direction of "growth" are  identical).  This  way,  you
will  typically  find  the  match either immediately or with a single
step.

Maybe you want to give that a try...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A verbal contract isn't worth the paper it's written on.
                                                    -- Samuel Goldwyn

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] CFI: flash_write_cfiword() slow
  2008-11-03 20:10 ` Wolfgang Denk
@ 2008-12-12 16:34   ` Jens Gehrlein
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Gehrlein @ 2008-12-12 16:34 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

Wolfgang Denk schrieb:
> Dear Jens Gehrlein,
> 
> In message <490EDD63.1010403@tqs.de> you wrote:
>> find_sector() loops through the sector table from the last sector to
>> the current sector. And the more sectors the device has, the slower
>> the algorithm becomes. And this process for every sector to be 
>> programmed. And yes, there are still devices around without (standard) 
>> write buffer, e.g. the Samsung K8P2815UQB.
> 
> A classic (and  trivial  to  implement)  approach  is  not  to  start
> searching  at  the  end, but at the last used sector (assuming search
> driection and direction of "growth" are  identical). 

Okay. Because I never have seen, that a flash has been written
backwards, as a prerequisite I have to change the loop from counting 
down to counting up. Any objections?

> This  way,  you
> will  typically  find  the  match either immediately or with a single
> step.
> 
> Maybe you want to give that a try...

I'm currently trying :-) Had some other projects in the meantime.

Kind regards,
Jens

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-12 16:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-03 11:15 [U-Boot] CFI: flash_write_cfiword() slow Jens Gehrlein
2008-11-03 20:10 ` Wolfgang Denk
2008-12-12 16:34   ` Jens Gehrlein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox