public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Bug in StrataFlash drivers
@ 2005-11-10 14:18 llandre
  2005-11-10 16:44 ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: llandre @ 2005-11-10 14:18 UTC (permalink / raw)
  To: u-boot

Several platforms are equipped with StrataFlash memory. Most of the 
existing drivers seem to not handle correctly odd-sized buffers in 
writing. IIUC the bug is the function flash_write_cfibuffer - enabled 
when CFG_FLASH_USE_BUFFER_WRITE is defined - when working with 16-bit 
wide memories. The following code ...

		...
		case FLASH_CFI_8BIT:
			cnt = len;
			break;
		case FLASH_CFI_16BIT:
			cnt = len >> 1;
			break;
		case FLASH_CFI_32BIT:
		...

... must be changed like this:

		...
			break;
		case FLASH_CFI_16BIT:						
			cnt = len >> 1;
			if (len % 2)
				cnt += 1;
			break;
		case FLASH_CFI_32BIT:
		...


Best regards,
llandre

DAVE Electronics System House - R&D Department
web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it

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

* [U-Boot-Users] Bug in StrataFlash drivers
  2005-11-10 14:18 llandre
@ 2005-11-10 16:44 ` Wolfgang Denk
  2005-11-11  9:29   ` llandre
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2005-11-10 16:44 UTC (permalink / raw)
  To: u-boot

In message <437356C4.9090704@dave-tech.it> you wrote:
> Several platforms are equipped with StrataFlash memory. Most of the 
> existing drivers seem to not handle correctly odd-sized buffers in 
> writing. IIUC the bug is the function flash_write_cfibuffer - enabled 
> when CFG_FLASH_USE_BUFFER_WRITE is defined - when working with 16-bit 
> wide memories. The following code ...
...
> ... must be changed like this:

Do you have a spoecific test case that shows the presence of the bug?

And can you please provide a  proper  patch,  with  CHANGELOG  entry,
Signed-off-by line and everything?

Thanks.

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
Randal said it would be tough to do in sed. He didn't say  he  didn't
understand  sed.  Randal  understands sed quite well. Which is why he
uses Perl. :-)         - Larry Wall in <7874@jpl-devvax.JPL.NASA.GOV>

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

* [U-Boot-Users] Bug in StrataFlash drivers
  2005-11-10 16:44 ` Wolfgang Denk
@ 2005-11-11  9:29   ` llandre
  0 siblings, 0 replies; 8+ messages in thread
From: llandre @ 2005-11-11  9:29 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

> Do you have a spoecific test case that shows the presence of the bug?

I experience the problem when trying to store in Flash my ramdisk image 
that is 1502693 bytes.

> And can you please provide a  proper  patch,  with  CHANGELOG  entry,
> Signed-off-by line and everything?
The file I fixed is not in your repository (this file would be added by 
the patch I sent you last month about Zefeer boards) and it is 
platform-specific. Do you want me to send you the patch anyway? Also I 
noted that similar fix is in the file board/g2000/strataflash.c around 
line 757 and this file is already in the public repository.


Best regards,
llandre

DAVE Electronics System House - R&D Department
web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it

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

* [U-Boot-Users] Bug in StrataFlash drivers
       [not found] <20051111093808.0F719352681@atlas.denx.de>
@ 2005-11-11 10:26 ` llandre
  2006-08-18  9:40   ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: llandre @ 2005-11-11 10:26 UTC (permalink / raw)
  To: u-boot

>>>Do you have a spoecific test case that shows the presence of the bug?
>>
>>I experience the problem when trying to store in Flash my ramdisk image 
>>that is 1502693 bytes.
> 
> 
> This will probably also happen with smaller size?
Yes, I think it will happen with any odd-sized files.


>>>And can you please provide a  proper  patch,  with  CHANGELOG  entry,
>>>Signed-off-by line and everything?
See attached file.

ChangeLog:
* Patch by Andrea Marson, 11 November 2005:
Fixed odd-sized images writing in Zefeer StrataFlash driver.


Signed-off-by: Andrea Marson <r&d2@dave-tech.it>




Best regards,
llandre

DAVE Electronics System House - R&D Department
web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: zefeer-odd-sized-writing.patch
Url: http://lists.denx.de/pipermail/u-boot/attachments/20051111/f6033ac0/attachment.txt 

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

* [U-Boot-Users] Bug in StrataFlash drivers
@ 2005-11-11 15:39 Menon, Nishanth
  2005-11-11 15:47 ` llandre
  0 siblings, 1 reply; 8+ messages in thread
From: Menon, Nishanth @ 2005-11-11 15:39 UTC (permalink / raw)
  To: u-boot

Greetings,
I can see it hit here too:
		case FLASH_CFI_32BIT:
 			cnt = len >> 2;
 			break;
 		default:
it is a div 4operation.. so last 3 bytes may go missin!!
Mebbe I am wrong abt it.. but then.. so it seems..
Regards,
Nishanth Menon
> -----Original Message-----
> From: u-boot-users-admin at lists.sourceforge.net [mailto:u-boot-users-
> admin at lists.sourceforge.net] On Behalf Of llandre
> Sent: Friday, November 11, 2005 4:27 AM
> To: Wolfgang Denk
> Cc: u-boot-users at lists.sourceforge.net
> Subject: Re: [U-Boot-Users] Bug in StrataFlash drivers
> 
> >>>Do you have a spoecific test case that shows the presence of the
bug?
> >>
> >>I experience the problem when trying to store in Flash my ramdisk
image
> >>that is 1502693 bytes.
> >
> >
> > This will probably also happen with smaller size?
> Yes, I think it will happen with any odd-sized files.
> 
> 
> >>>And can you please provide a  proper  patch,  with  CHANGELOG
entry,
> >>>Signed-off-by line and everything?
> See attached file.
> 
> ChangeLog:
> * Patch by Andrea Marson, 11 November 2005:
> Fixed odd-sized images writing in Zefeer StrataFlash driver.
> 
> 
> Signed-off-by: Andrea Marson <r&d2@dave-tech.it>
> 
> 
> 
> 
> Best regards,
> llandre
> 
> DAVE Electronics System House - R&D Department
> web:   http://www.dave-tech.it
> email: r&d2 at dave-tech.it

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

* [U-Boot-Users] Bug in StrataFlash drivers
  2005-11-11 15:39 [U-Boot-Users] Bug in StrataFlash drivers Menon, Nishanth
@ 2005-11-11 15:47 ` llandre
  2005-11-21 20:40   ` Detlev Zundel
  0 siblings, 1 reply; 8+ messages in thread
From: llandre @ 2005-11-11 15:47 UTC (permalink / raw)
  To: u-boot

Hello,

> I can see it hit here too:
> 		case FLASH_CFI_32BIT:
>  			cnt = len >> 2;
>  			break;
>  		default:
> it is a div 4operation.. so last 3 bytes may go missin!!
> Mebbe I am wrong abt it.. but then.. so it seems..

yes, I think you are right.


llandre

DAVE Electronics System House - R&D Department
web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it

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

* [U-Boot-Users] Bug in StrataFlash drivers
  2005-11-11 15:47 ` llandre
@ 2005-11-21 20:40   ` Detlev Zundel
  0 siblings, 0 replies; 8+ messages in thread
From: Detlev Zundel @ 2005-11-21 20:40 UTC (permalink / raw)
  To: u-boot

Hi,

> Hello,
>
>> I can see it hit here too:
>> 		case FLASH_CFI_32BIT:
>>  			cnt = len >> 2;
>>  			break;
>>  		default:
>> it is a div 4operation.. so last 3 bytes may go missin!!
>> Mebbe I am wrong abt it.. but then.. so it seems..

I guess code like this should read like

  cnt = len + (2^n-1) >> n;

For the two cases in question (n=1)

  cnt = len + 1 >> 1;

and (n=2)

  cnt = len + 3 >> 2;

This avoids the branch.

Cheers
  Detlev

-- 
Modern methods of production have given us the possibility of ease and
security for all;  we have chosen, instead,  to have overwork for some
and starvation for others.
                                    -- Bertrand Russell

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

* [U-Boot-Users] Bug in StrataFlash drivers
  2005-11-11 10:26 ` llandre
@ 2006-08-18  9:40   ` Wolfgang Denk
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2006-08-18  9:40 UTC (permalink / raw)
  To: u-boot

Dear Andrea,

in message <437471DE.9070607@dave-tech.it> you wrote:
> 
> ChangeLog:
> * Patch by Andrea Marson, 11 November 2005:
> Fixed odd-sized images writing in Zefeer StrataFlash driver.

Sorry, I cannot apply this patch:

> --- a/board/dave/ZefeerEVB/flashmem.c
> +++ b/board/dave/ZefeerEVB/flashmem.c

There is no such file in the U-Boot source tree...

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
Pain is a thing of the mind.  The mind can be controlled.
	-- Spock, "Operation -- Annihilate!" stardate 3287.2

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

end of thread, other threads:[~2006-08-18  9:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-11 15:39 [U-Boot-Users] Bug in StrataFlash drivers Menon, Nishanth
2005-11-11 15:47 ` llandre
2005-11-21 20:40   ` Detlev Zundel
     [not found] <20051111093808.0F719352681@atlas.denx.de>
2005-11-11 10:26 ` llandre
2006-08-18  9:40   ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2005-11-10 14:18 llandre
2005-11-10 16:44 ` Wolfgang Denk
2005-11-11  9:29   ` llandre

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