diff options
-rw-r--r-- | src/drivers/spi/adesto.c | 3 | ||||
-rw-r--r-- | src/drivers/spi/amic.c | 3 | ||||
-rw-r--r-- | src/drivers/spi/gigadevice.c | 3 | ||||
-rw-r--r-- | src/drivers/spi/macronix.c | 3 | ||||
-rw-r--r-- | src/drivers/spi/stmicro.c | 3 | ||||
-rw-r--r-- | src/drivers/spi/winbond.c | 3 |
6 files changed, 12 insertions, 6 deletions
diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c index 83be8b8995..9dc8e14546 100644 --- a/src/drivers/spi/adesto.c +++ b/src/drivers/spi/adesto.c @@ -88,7 +88,7 @@ static int adesto_write(struct spi_flash *flash, int ret; u8 cmd[4]; - page_size = min(1 << stm->params->l2_page_size, CONTROLLER_PAGE_LIMIT); + page_size = 1 << stm->params->l2_page_size; byte_addr = offset % page_size; flash->spi->rw = SPI_WRITE_FLAG; @@ -100,6 +100,7 @@ static int adesto_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); cmd[0] = CMD_AT25DF_PP; cmd[1] = (offset >> 16) & 0xff; diff --git a/src/drivers/spi/amic.c b/src/drivers/spi/amic.c index fa17036e85..4cccc71197 100644 --- a/src/drivers/spi/amic.c +++ b/src/drivers/spi/amic.c @@ -70,7 +70,7 @@ static int amic_write(struct spi_flash *flash, int ret; u8 cmd[4]; - page_size = min(1 << amic->params->l2_page_size, CONTROLLER_PAGE_LIMIT); + page_size = 1 << amic->params->l2_page_size; byte_addr = offset % page_size; flash->spi->rw = SPI_WRITE_FLAG; @@ -82,6 +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); cmd[0] = CMD_A25_PP; cmd[1] = (offset >> 16) & 0xff; diff --git a/src/drivers/spi/gigadevice.c b/src/drivers/spi/gigadevice.c index 5a8f82f053..3fb89c7fc5 100644 --- a/src/drivers/spi/gigadevice.c +++ b/src/drivers/spi/gigadevice.c @@ -128,7 +128,7 @@ static int gigadevice_write(struct spi_flash *flash, u32 offset, int ret; u8 cmd[4]; - page_size = min(1 << stm->params->l2_page_size, CONTROLLER_PAGE_LIMIT); + page_size = 1 << stm->params->l2_page_size; byte_addr = offset % page_size; flash->spi->rw = SPI_WRITE_FLAG; @@ -141,6 +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); ret = spi_flash_cmd(flash->spi, CMD_GD25_WREN, NULL, 0); if (ret < 0) { diff --git a/src/drivers/spi/macronix.c b/src/drivers/spi/macronix.c index bbc3704656..3611599065 100644 --- a/src/drivers/spi/macronix.c +++ b/src/drivers/spi/macronix.c @@ -131,7 +131,7 @@ static int macronix_write(struct spi_flash *flash, int ret; u8 cmd[4]; - page_size = min(mcx->params->page_size, CONTROLLER_PAGE_LIMIT); + page_size = mcx->params->page_size; byte_addr = offset % page_size; flash->spi->rw = SPI_WRITE_FLAG; @@ -144,6 +144,7 @@ static int macronix_write(struct spi_flash *flash, ret = 0; 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); cmd[0] = CMD_MX25XX_PP; cmd[1] = (offset >> 16) & 0xff; diff --git a/src/drivers/spi/stmicro.c b/src/drivers/spi/stmicro.c index af2385328b..c825bd083b 100644 --- a/src/drivers/spi/stmicro.c +++ b/src/drivers/spi/stmicro.c @@ -143,7 +143,7 @@ static int stmicro_write(struct spi_flash *flash, int ret; u8 cmd[4]; - page_size = min(stm->params->page_size, CONTROLLER_PAGE_LIMIT); + page_size = stm->params->page_size; byte_addr = offset % page_size; flash->spi->rw = SPI_WRITE_FLAG; @@ -155,6 +155,7 @@ static int stmicro_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); cmd[0] = CMD_M25PXX_PP; cmd[1] = (offset >> 16) & 0xff; diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c index 52c7b61245..eb0868ec7a 100644 --- a/src/drivers/spi/winbond.c +++ b/src/drivers/spi/winbond.c @@ -122,7 +122,7 @@ static int winbond_write(struct spi_flash *flash, int ret; u8 cmd[4]; - page_size = min(1 << stm->params->l2_page_size, CONTROLLER_PAGE_LIMIT); + page_size = 1 << stm->params->l2_page_size; byte_addr = offset % page_size; flash->spi->rw = SPI_WRITE_FLAG; @@ -134,6 +134,7 @@ static int winbond_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); cmd[0] = CMD_W25_PP; cmd[1] = (offset >> 16) & 0xff; |