Thomas Heijligen has uploaded this change for review.

View Change

spi25.c: Rename spi_get_erasefn_from_opcode to spi25_get_erasefn_from_opcode

This function works only with spi25 chips

Change-Id: Ie054160b0fdd34bcb128285c6a047e3a3fa8be0c
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
---
M include/chipdrivers.h
M sfdp.c
M spi25.c
3 files changed, 35 insertions(+), 23 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/16/67716/1
diff --git a/include/chipdrivers.h b/include/chipdrivers.h
index 61d43c9..4027072 100644
--- a/include/chipdrivers.h
+++ b/include/chipdrivers.h
@@ -52,7 +52,7 @@
int spi_block_erase_d8(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
int spi_block_erase_db(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
int spi_block_erase_dc(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
-erasefunc_t *spi_get_erasefn_from_opcode(uint8_t opcode);
+erasefunc_t *spi25_get_erasefn_from_opcode(uint8_t opcode);
uint8_t spi_get_opcode_from_erasefn(erasefunc_t *func);
int spi_chip_write_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
int spi_nbyte_read(struct flashctx *flash, unsigned int addr, uint8_t *bytes, unsigned int len);
diff --git a/sfdp.c b/sfdp.c
index b549417..e4860d3 100644
--- a/sfdp.c
+++ b/sfdp.c
@@ -81,7 +81,7 @@
{
int i;
uint32_t total_size = chip->total_size * 1024;
- erasefunc_t *erasefn = spi_get_erasefn_from_opcode(opcode);
+ erasefunc_t *erasefn = spi25_get_erasefn_from_opcode(opcode);

if (erasefn == NULL || total_size == 0 || block_size == 0 ||
total_size % block_size != 0) {
diff --git a/spi25.c b/spi25.c
index 0279f9a..1899d53 100644
--- a/spi25.c
+++ b/spi25.c
@@ -619,32 +619,32 @@
}

static const struct {
- erasefunc_t *func;
uint8_t opcode;
-} function_opcode_list[] = {
- {&spi_block_erase_20, 0x20},
- {&spi_block_erase_21, 0x21},
- {&spi_block_erase_50, 0x50},
- {&spi_block_erase_52, 0x52},
- {&spi_block_erase_53, 0x53},
- {&spi_block_erase_5c, 0x5c},
- {&spi_block_erase_60, 0x60},
- {&spi_block_erase_62, 0x62},
- {&spi_block_erase_81, 0x81},
- {&spi_block_erase_c4, 0xc4},
- {&spi_block_erase_c7, 0xc7},
- {&spi_block_erase_d7, 0xd7},
- {&spi_block_erase_d8, 0xd8},
- {&spi_block_erase_db, 0xdb},
- {&spi_block_erase_dc, 0xdc},
+ erasefunc_t *func;
+} spi25_opcode_function_list[] = {
+ {0x20, &spi_block_erase_20},
+ {0x21, &spi_block_erase_21},
+ {0x50, &spi_block_erase_50},
+ {0x52, &spi_block_erase_52},
+ {0x53, &spi_block_erase_53},
+ {0x5c, &spi_block_erase_5c},
+ {0x60, &spi_block_erase_60},
+ {0x62, &spi_block_erase_62},
+ {0x81, &spi_block_erase_81},
+ {0xc4, &spi_block_erase_c4},
+ {0xc7, &spi_block_erase_c7},
+ {0xd7, &spi_block_erase_d7},
+ {0xd8, &spi_block_erase_d8},
+ {0xdb, &spi_block_erase_db},
+ {0xdc, &spi_block_erase_dc},
};

-erasefunc_t *spi_get_erasefn_from_opcode(uint8_t opcode)
+erasefunc_t *spi25_get_erasefn_from_opcode(uint8_t opcode)
{
size_t i;
- for (i = 0; i < ARRAY_SIZE(function_opcode_list); i++) {
- if (function_opcode_list[i].opcode == opcode)
- return function_opcode_list[i].func;
+ for (i = 0; i < ARRAY_SIZE(spi25_opcode_function_list); i++) {
+ if (spi25_opcode_function_list[i].opcode == opcode)
+ return spi25_opcode_function_list[i].func;
}
msg_cinfo("%s: unknown erase opcode (0x%02x). Please report "
"this at flashrom@flashrom.org\n", __func__, opcode);

To view, visit change 67716. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie054160b0fdd34bcb128285c6a047e3a3fa8be0c
Gerrit-Change-Number: 67716
Gerrit-PatchSet: 1
Gerrit-Owner: Thomas Heijligen <src@posteo.de>
Gerrit-MessageType: newchange