The AAI (Auto Address Increment Programming) command (0xAD) can be found in SST25VF080B. I am wondering if it is available in every SPI chip. If yes, the SB600 pragramming would be much faster than doing it one byte at a time. I tested on my board with SB600. I don't make a patch because I am not sure I can do that.
Zheng
int sb600_spi_write(struct flashchip *flash, uint8_t *buf) { int rc = 0, i; int total_size = flash->total_size * 1024; uint8_t cmd[8] = {0xAD, 0x00, 0x00, 0x00};
/* Erase first */ printf("Erasing flash before programming... "); flash->erase(flash); printf("done.\n");
cmd[4] = buf[0]; cmd[5] = buf[1];
spi_disable_blockprotect(); spi_write_enable(); sb600_spi_command(6, 0, cmd, 0);
printf("Programming flash"); for (i = 2, buf += 2; i < total_size; i+=2, buf+=2) {
/* spi_byte_program(i, *buf); */ cmd[1] = buf[0]; cmd[2] = buf[1]; sb600_spi_command(3, 0, cmd, 0); /* wait program complete. */ if (i % 0x8000 == 0) printf("."); while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) ; } printf(" done.\n"); spi_write_disable();
return rc; }
Bao, Zheng wrote:
The AAI (Auto Address Increment Programming) command (0xAD) can be found in SST25VF080B. I am wondering if it is available in every SPI chip.
It isn't. I only checked a few data sheets and while Macronix 16/32/64 Mbit chips have it, 4 Mbit Macronix chips do not. I didn't check Numonyx (ex Winbond) chips.
If yes, the SB600 pragramming would be much faster than doing it one byte at a time. I tested on my board with SB600.
There are several cases where flashrom could perform better, but they are too complex to be handled with the current structure. We should certainly improve that at some point, but it's not top priority.
Out of curiosity, what difference in programming time do you see? (You can use: time flashrom -w to easily see it.)
I don't make a patch because I am not sure I can do that.
Everyone can always send patches, but it is good to discuss first.
//Peter