SPI: Split writes using spi_crop_chunk()
SPI controllers in Intel and AMD bridges have a slightly different restriction on how long transactions they can handle. Change-Id: I3d149d4b7e7e9633482a153d5e380a86c553d871 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/6163 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
@ -82,7 +82,7 @@ static int amic_write(struct spi_flash *flash,
|
||||
|
||||
for (actual = 0; actual < len; actual += chunk_len) {
|
||||
chunk_len = min(len - actual, page_size - byte_addr);
|
||||
chunk_len = min(chunk_len, CONTROLLER_PAGE_LIMIT);
|
||||
chunk_len = spi_crop_chunk(sizeof(cmd), chunk_len);
|
||||
|
||||
cmd[0] = CMD_A25_PP;
|
||||
cmd[1] = (offset >> 16) & 0xff;
|
||||
@ -100,7 +100,7 @@ static int amic_write(struct spi_flash *flash,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = spi_flash_cmd_write(flash->spi, cmd, 4,
|
||||
ret = spi_flash_cmd_write(flash->spi, cmd, sizeof(cmd),
|
||||
buf + actual, chunk_len);
|
||||
if (ret < 0) {
|
||||
printk(BIOS_WARNING, "SF: AMIC Page Program failed\n");
|
||||
|
Reference in New Issue
Block a user