RE: [U-Boot-Users] Bug in StrataFlash drivers

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@lists.sourceforge.net [mailto:u-boot-users- admin@lists.sourceforge.net] On Behalf Of llandre Sent: Friday, November 11, 2005 4:27 AM To: Wolfgang Denk Cc: u-boot-users@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@dave-tech.it

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@dave-tech.it

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
participants (3)
-
Detlev Zundel
-
llandre
-
Menon, Nishanth