summaryrefslogtreecommitdiffstats
path: root/lspcon_i2c_spi.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-04-17 15:32:12 +0200
committerEdward O'Callaghan <quasisec@chromium.org>2021-04-19 05:36:30 +0000
commitcbe8a39ece4c228ffb23736da3f477ef3b82358c (patch)
treec432ff1fa70bc68e19b03fa7e4a4b32d2e76e5fd /lspcon_i2c_spi.c
parentfbf3479c71ab5e800de71bffd3d0844b9588614f (diff)
downloadflashrom-cbe8a39ece4c228ffb23736da3f477ef3b82358c.tar.gz
flashrom-cbe8a39ece4c228ffb23736da3f477ef3b82358c.tar.bz2
flashrom-cbe8a39ece4c228ffb23736da3f477ef3b82358c.zip
lspcon_i2c_spi.c: Rename PAGE_SIZE macro
This fixes building with musl libc on alpine:i386-v3.7. Change-Id: Ibd478f3fcd6b6803098035dbdc47f72f6ab3fa6b Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/52469 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'lspcon_i2c_spi.c')
-rw-r--r--lspcon_i2c_spi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 7b9f1c099..7599db6b0 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -27,7 +27,7 @@
#define REGISTER_ADDRESS (0x94 >> 1)
#define PAGE_ADDRESS (0x9e >> 1)
-#define PAGE_SIZE 256
+#define LSPCON_PAGE_SIZE 256
#define MAX_SPI_WAIT_RETRIES 1000
#define CLT2_SPI 0x82
@@ -330,7 +330,7 @@ static int lspcon_i2c_spi_reset_mpu_stop(int fd)
static int lspcon_i2c_spi_map_page(int fd, unsigned int offset)
{
int ret = 0;
- /* Page number byte, need to / PAGE_SIZE. */
+ /* Page number byte, need to / LSPCON_PAGE_SIZE. */
ret |= lspcon_i2c_spi_write_register(fd, ROMADDR_BYTE1, (offset >> 8) & 0xff);
ret |= lspcon_i2c_spi_write_register(fd, ROMADDR_BYTE2, (offset >> 16));
@@ -349,9 +349,9 @@ static int lspcon_i2c_spi_read(struct flashctx *flash, uint8_t *buf,
if (fd < 0)
return SPI_GENERIC_ERROR;
- for (i = 0; i < len; i += PAGE_SIZE) {
+ for (i = 0; i < len; i += LSPCON_PAGE_SIZE) {
ret |= lspcon_i2c_spi_map_page(fd, start + i);
- ret |= lspcon_i2c_spi_read_data(fd, PAGE_ADDRESS, buf + i, min(len - i, PAGE_SIZE));
+ ret |= lspcon_i2c_spi_read_data(fd, PAGE_ADDRESS, buf + i, min(len - i, LSPCON_PAGE_SIZE));
}
return ret;
@@ -363,8 +363,8 @@ static int lspcon_i2c_spi_write_page(int fd, const uint8_t *buf, unsigned int le
* Using static buffer with maximum possible size,
* extra byte is needed for prefixing zero at index 0.
*/
- uint8_t write_buffer[PAGE_SIZE + 1] = { 0 };
- if (len > PAGE_SIZE)
+ uint8_t write_buffer[LSPCON_PAGE_SIZE + 1] = { 0 };
+ if (len > LSPCON_PAGE_SIZE)
return SPI_GENERIC_ERROR;
/* First byte represents the writing offset and should always be zero. */
@@ -389,9 +389,9 @@ static int lspcon_i2c_spi_write_256(struct flashctx *flash, const uint8_t *buf,
ret |= lspcon_i2c_spi_enable_hw_write(fd);
ret |= lspcon_i2c_clt2_spi_reset(fd);
- for (unsigned int i = 0; i < len; i += PAGE_SIZE) {
+ for (unsigned int i = 0; i < len; i += LSPCON_PAGE_SIZE) {
ret |= lspcon_i2c_spi_map_page(fd, start + i);
- ret |= lspcon_i2c_spi_write_page(fd, buf + i, min(len - i, PAGE_SIZE));
+ ret |= lspcon_i2c_spi_write_page(fd, buf + i, min(len - i, LSPCON_PAGE_SIZE));
}
ret |= lspcon_i2c_spi_enable_write_protection(fd);