[coreboot] can AAI be used in flashrom?

Bao, Zheng Zheng.Bao at amd.com
Thu Dec 25 08:49:20 CET 2008


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;
}





More information about the coreboot mailing list