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 ......................................................................
Patch Set 11:
(4 comments)
https://review.coreboot.org/c/flashrom/+/40477/8/ft2232_spi.c File ft2232_spi.c:
https://review.coreboot.org/c/flashrom/+/40477/8/ft2232_spi.c@471 PS8, Line 471: static unsigned char *buf = NULL;
Just make this an array: […]
This is related to Line 481. FTDI_HW_BUFFER_SIZE = 4096 Done
https://review.coreboot.org/c/flashrom/+/40477/8/ft2232_spi.c@473 PS8, Line 473: static
Why is `i` static now?
This is related to Line 541 and following lines. It is explained (shortly) in Line 542. If there is a WREN command this will not be send immediately to the FTDI chip but is saved in buf. Then WREN command will be send together with the next WR ore ERASE command (the command which made WREN necessary). The FTDI goes through it´s buffer and will first send WREN and then the next cmd. So the data send to the flash are the same but this saves one time consuming FTDI call every PROGRAM or ERASE command. To not overwrite the WREN in buf 'i' must be static and only set to '0' after send_buf/FTDI call.
https://review.coreboot.org/c/flashrom/+/40477/8/ft2232_spi.c@481 PS8, Line 481: 4096
Please #define this magic number somewhere
s. Line 471
https://review.coreboot.org/c/flashrom/+/40477/8/ft2232_spi.c@542 PS8, Line 542: /* Return to get second op (Program or Erase) without resetting buf nor i*/
Why?
s Line 473