diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2014-06-29 16:17:33 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2014-07-14 19:42:49 +0200 |
commit | 1110495de926db4b21b9969da522e5270c67f115 (patch) | |
tree | 04a04b6e797173c1b3639a4c4ecb90c544ab84ab /src/drivers/spi/gigadevice.c | |
parent | 77d1280d0c866a9f85e62f74c43fe8d021a4ff39 (diff) |
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>
Diffstat (limited to 'src/drivers/spi/gigadevice.c')
-rw-r--r-- | src/drivers/spi/gigadevice.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/drivers/spi/gigadevice.c b/src/drivers/spi/gigadevice.c index 3fb89c7fc5..783d321566 100644 --- a/src/drivers/spi/gigadevice.c +++ b/src/drivers/spi/gigadevice.c @@ -141,7 +141,7 @@ static int gigadevice_write(struct spi_flash *flash, u32 offset, 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); ret = spi_flash_cmd(flash->spi, CMD_GD25_WREN, NULL, 0); if (ret < 0) { @@ -161,7 +161,7 @@ static int gigadevice_write(struct spi_flash *flash, u32 offset, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len); #endif - 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, |