Simon Buhrow has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40477 )
Change subject: ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c
File ft2232_spi.c:
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c@549
PS2, Line 549: return 0;
> I missed that buf is static, so this will work out fine.
Well, in the usual use case with maximum buf size equal to normal page program operations, I agree.
But if writecnt gets bigger than page program (plus cmd and addr bytes), realloc is called again. And then the WREN which was saved at the old buf memory location will get lost, right? (although buf is static)
I think at the moment there does not happen bigger writecnt than 256Byte page program?! Nevertheless it might be better to make this somewhat cleaner. I see the following options:
A) to catch bigger writecnt in line 477
OR
B) to filter them in line 481
OR
C) to set bufsize fix to 4096. This is the size of the FIFO buffer of the ftdi2232 [1]. So this is the biggest size which ever can be send to the ftdi chip. Sure, this would lead to some overhead in current case of use only page program size, but it might be OK and lead to a simpler code.
I would prefer option C) and add it to this commit. Or are there any other preferences?
[1] https://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT2232H.pdf -> chapter 4.2
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 3
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Comment-Date: Tue, 21 Apr 2020 07:56:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Simon Buhrow
Comment-In-Reply-To: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: comment
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40477 )
Change subject: ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c
File ft2232_spi.c:
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c@549
PS2, Line 549: return 0;
> Oh, good comment. […]
I missed that buf is static, so this will work out fine.
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 3
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Comment-Date: Mon, 20 Apr 2020 14:37:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Simon Buhrow
Comment-In-Reply-To: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: comment
Simon Buhrow has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40477 )
Change subject: ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
......................................................................
Patch Set 3:
(4 comments)
> Patch Set 2:
>
> (4 comments)
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c
File ft2232_spi.c:
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c@473
PS2, Line 473:
> tab for consistency
Done
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c@482
PS2, Line 482: /* 280 Byte = (9 Byte CMD + 1 Byte WREN) + (9 Byte CMD + 1 Byte op) + 4 Byte Addr + 256 Byte PageWrite-data
> wrap differently so it fits on 80 columns? (also in line 548)
Done
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c@546
PS2, Line 546:
> no trailing white space (also elsewhere)
Done
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c@549
PS2, Line 549: return 0;
> so you're filling in buf, then leaving it hanging and somehow that data re-appears on the next run. […]
Oh, good comment. I was assuming that realloc is called only once (as I assume that the highest writecnt value refers to page write).
But if there will be any bigger write operations it will fail. Is there a chance for calls with more than one 256Byte page to write?
If yes: May be it´s OK to save only a flag which indicates if WREN was passed in the previous call. And according to that flag the WREN cmd is prepend or not.
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 3
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Comment-Date: Mon, 20 Apr 2020 11:37:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: comment
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/40477
to look at the new patch set (#3).
Change subject: ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
......................................................................
ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
Every ftdi_write_data() call is quite time consuming as the ftdi-chips seems to take always 2-3ms to respond.
This leads to what the comment already says: Minimize USB transfers by packing as many commands as possible together.
So I packed the WREN command together with the following operation which can be program or erase operation.
This saves about 1 minute when programming a 128MBit Flash with my config!
See timings WREN in extra ftdi_write_data() call:
https://ibb.co/0c1J25d
WREN packed with op:
https://ibb.co/7G1hLkj
I´m using ftdi-2232H chip. That´s why I put it at this place.
If anyone has a good overview about all programmers:
This could be implemented in spi_write_cmd() in case that it is compatible to all programmers
or this principle could be transfered to other programmers which act in a similar way.
Signed-off-by: Simon Buhrow <simon.buhrow(a)posteo.de>
Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
---
M ft2232_spi.c
1 file changed, 19 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/77/40477/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 3
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-MessageType: newpatchset