Edward O'Callaghan has uploaded this change for review.
spi25_statusreg.c: Allow opaque masters to hook spi_{rw}_register()
Change-Id: I3ab0d7f5f48338c8ecb118a69651c203fbc516ac
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M include/programmer.h
M spi25_statusreg.c
2 files changed, 11 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/75/64375/1
diff --git a/include/programmer.h b/include/programmer.h
index 5fb0626..4afaddd 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -405,6 +405,8 @@
enum flashrom_wp_result (*wp_write_cfg)(struct flashctx *, const struct flashrom_wp_cfg *);
enum flashrom_wp_result (*wp_read_cfg)(struct flashrom_wp_cfg *, struct flashctx *);
enum flashrom_wp_result (*wp_get_ranges)(struct flashrom_wp_ranges **, struct flashctx *);
+ uint8_t (*read_status) (const struct flashctx *flash);
+ int (*write_status) (const struct flashctx *flash, int status);
int (*shutdown)(void *data);
void *data;
};
diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index 0f43056..0b90716 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -19,6 +19,7 @@
#include "flash.h"
#include "chipdrivers.h"
+#include "programmer.h"
#include "spi.h"
/* === Generic functions === */
@@ -35,6 +36,9 @@
*/
switch (reg) {
case STATUS1:
+ if ((flash->mst->buses_supported & BUS_PROG) && flash->mst->opaque.write_status)
+ return flash->mst->opaque.write_status(flash, value);
+
write_cmd[0] = JEDEC_WRSR;
write_cmd[1] = value;
write_cmd_len = JEDEC_WRSR_OUTSIZE;
@@ -149,6 +153,11 @@
switch (reg) {
case STATUS1:
+ if ((flash->mst->buses_supported & BUS_PROG) && flash->mst->opaque.read_status) {
+ *value = flash->mst->opaque.read_status(flash);
+ return 0;
+ }
+
read_cmd = JEDEC_RDSR;
break;
case STATUS2:
To view, visit change 64375. To unsubscribe, or for help writing mail filters, visit settings.