summaryrefslogtreecommitdiffstats
path: root/realtek_mst_i2c_spi.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-05-09 18:44:55 +0200
committerEdward O'Callaghan <quasisec@chromium.org>2021-05-12 11:53:45 +0000
commit9785daaf1160798638eeb9e4bdfd09a1dcd52221 (patch)
treeae49244eb8f9305ddaac4d061d724f63690f2086 /realtek_mst_i2c_spi.c
parent9e8486e37c0af6774d435d7a16188ef98026cd6e (diff)
downloadflashrom-9785daaf1160798638eeb9e4bdfd09a1dcd52221.tar.gz
flashrom-9785daaf1160798638eeb9e4bdfd09a1dcd52221.tar.bz2
flashrom-9785daaf1160798638eeb9e4bdfd09a1dcd52221.zip
realtek_mst_i2c_spi.c: Rename `PAGE_SIZE` macro
This fixes building with musl libc on alpine:amd64-v3.9. Change-Id: I043e3d8c2d2498e94b5e7577a7378c8c3e0e6c81 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/53998 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'realtek_mst_i2c_spi.c')
-rw-r--r--realtek_mst_i2c_spi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 64579e1de..10a1dffd4 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -28,7 +28,7 @@
#define MCU_I2C_SLAVE_ADDR 0x94
#define REGISTER_ADDRESS (0x94 >> 1)
-#define PAGE_SIZE 128
+#define RTK_PAGE_SIZE 128
#define MAX_SPI_WAIT_RETRIES 1000
#define MCU_MODE 0x6F
@@ -310,8 +310,8 @@ static int realtek_mst_i2c_spi_write_page(int fd, uint8_t reg, const uint8_t *bu
* Using static buffer with maximum possible size,
* extra byte is needed for prefixing the data port register at index 0.
*/
- uint8_t wbuf[PAGE_SIZE + 1] = { MCU_DATA_PORT };
- if (len > PAGE_SIZE)
+ uint8_t wbuf[RTK_PAGE_SIZE + 1] = { MCU_DATA_PORT };
+ if (len > RTK_PAGE_SIZE)
return SPI_GENERIC_ERROR;
memcpy(&wbuf[1], buf, len);
@@ -352,9 +352,9 @@ static int realtek_mst_i2c_spi_read(struct flashctx *flash, uint8_t *buf,
uint8_t dummy;
realtek_mst_i2c_spi_read_register(fd, MCU_DATA_PORT, &dummy);
- for (i = 0; i < len; i += PAGE_SIZE) {
+ for (i = 0; i < len; i += RTK_PAGE_SIZE) {
ret |= realtek_mst_i2c_spi_read_data(fd, REGISTER_ADDRESS,
- buf + i, min(len - i, PAGE_SIZE));
+ buf + i, min(len - i, RTK_PAGE_SIZE));
if (ret)
return ret;
}
@@ -376,11 +376,11 @@ static int realtek_mst_i2c_spi_write_256(struct flashctx *flash, const uint8_t *
return SPI_GENERIC_ERROR;
ret |= realtek_mst_i2c_spi_write_register(fd, 0x6D, 0x02); /* write opcode */
- ret |= realtek_mst_i2c_spi_write_register(fd, 0x71, (PAGE_SIZE - 1)); /* fit len=256 */
+ ret |= realtek_mst_i2c_spi_write_register(fd, 0x71, (RTK_PAGE_SIZE - 1)); /* fit len=256 */
- for (i = 0; i < len; i += PAGE_SIZE) {
- uint16_t page_len = min(len - i, PAGE_SIZE);
- if (len - i < PAGE_SIZE)
+ for (i = 0; i < len; i += RTK_PAGE_SIZE) {
+ uint16_t page_len = min(len - i, RTK_PAGE_SIZE);
+ if (len - i < RTK_PAGE_SIZE)
ret |= realtek_mst_i2c_spi_write_register(fd, 0x71, page_len-1);
ret |= realtek_mst_i2c_spi_map_page(fd, start + i);
if (ret)