1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 22:21:16 +02:00

spi25: Remove now obsolete four_bytes_addr_funcs path

Change-Id: Idb7c576cb159630da2268813388b497cb5f46b43
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/22386
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber
2017-10-14 18:18:30 +02:00
parent a1672f8293
commit 7a07722256
4 changed files with 22 additions and 76 deletions

30
spi25.c
View File

@ -652,10 +652,7 @@ int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start,
lenhere = min(start + len, (i + 1) * area_size) - starthere;
for (j = 0; j < lenhere; j += chunksize) {
toread = min(chunksize, lenhere - j);
rc = (flash->chip->feature_bits & FEATURE_4BA_SUPPORT) == 0
? spi_nbyte_read(flash, starthere + j, buf + starthere - start + j, toread)
: flash->chip->four_bytes_addr_funcs.read_nbyte(flash, starthere + j,
buf + starthere - start + j, toread);
rc = spi_nbyte_read(flash, starthere + j, buf + starthere - start + j, toread);
if (rc)
break;
}
@ -674,7 +671,6 @@ int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start,
int spi_write_chunked(struct flashctx *flash, const uint8_t *buf, unsigned int start,
unsigned int len, unsigned int chunksize)
{
int rc = 0;
unsigned int i, j, starthere, lenhere, towrite;
/* FIXME: page_size is the wrong variable. We need max_writechunk_size
* in struct flashctx to do this properly. All chips using
@ -699,21 +695,16 @@ int spi_write_chunked(struct flashctx *flash, const uint8_t *buf, unsigned int s
/* Length of bytes in the range in this page. */
lenhere = min(start + len, (i + 1) * page_size) - starthere;
for (j = 0; j < lenhere; j += chunksize) {
int rc;
towrite = min(chunksize, lenhere - j);
rc = (flash->chip->feature_bits & FEATURE_4BA_SUPPORT) == 0
? spi_nbyte_program(flash, starthere + j, buf + starthere - start + j, towrite)
: flash->chip->four_bytes_addr_funcs.program_nbyte(flash, starthere + j,
buf + starthere - start + j, towrite);
rc = spi_nbyte_program(flash, starthere + j, buf + starthere - start + j, towrite);
if (rc)
break;
while (spi_read_status_register(flash) & SPI_SR_WIP)
programmer_delay(10);
return rc;
}
if (rc)
break;
}
return rc;
return 0;
}
/*
@ -726,18 +717,11 @@ int spi_write_chunked(struct flashctx *flash, const uint8_t *buf, unsigned int s
int spi_chip_write_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len)
{
unsigned int i;
int result = 0;
for (i = start; i < start + len; i++) {
result = (flash->chip->feature_bits & FEATURE_4BA_SUPPORT) == 0
? spi_nbyte_program(flash, i, buf + i - start, 1)
: flash->chip->four_bytes_addr_funcs.program_byte(flash, i, buf[i - start]);
if (result)
if (spi_nbyte_program(flash, i, buf + i - start, 1))
return 1;
while (spi_read_status_register(flash) & SPI_SR_WIP)
programmer_delay(10);
}
return 0;
}