aboutsummaryrefslogtreecommitdiffstats
path: root/include/programmer.h
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2022-09-07 12:51:16 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2022-12-12 00:01:10 +0000
commit78e421bdf73d5739daa25a9f71b2c323dc98e840 (patch)
tree293a63c17096eb667bea701e332d6ed911e8d7d0 /include/programmer.h
parent048aab6d66c45423386d0216fd7bf445fbd1dc7f (diff)
downloadflashrom-78e421bdf73d5739daa25a9f71b2c323dc98e840.tar.gz
flashrom-78e421bdf73d5739daa25a9f71b2c323dc98e840.tar.bz2
flashrom-78e421bdf73d5739daa25a9f71b2c323dc98e840.zip
tree/: Move programmer_delay() out of programmer state machine
Handle the special cases of both serprog and ch341a_spi. Also rewrite programmer_delay() to handle the two base cases of zero time and no valid flashctx yet before handling per master branching. Additionally, modify the custom delay function pointer signature to allow closure over the flashctx. This allows driver specific delay implementations to recover programmer specific opaque data within their delay implementations. Therefore programmer specific delay functions can avoid programmer specific globals. Change-Id: Id059abb58b31a066a408009073912da2b224d40c Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67393 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'include/programmer.h')
-rw-r--r--include/programmer.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/programmer.h b/include/programmer.h
index 7bcef023..8ba5781c 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -49,8 +49,6 @@ struct programmer_entry {
} devs;
int (*init) (const struct programmer_cfg *cfg);
-
- void (*delay) (unsigned int usecs);
};
extern const struct programmer_entry *const programmer_table[];
@@ -314,6 +312,7 @@ struct spi_master {
int (*write_aai)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
int (*shutdown)(void *data);
bool (*probe_opcode)(const struct flashctx *flash, uint8_t opcode);
+ void (*delay) (const struct flashctx *flash, unsigned int usecs);
void *data;
};
@@ -435,6 +434,7 @@ struct par_master {
uint32_t (*chip_readl) (const struct flashctx *flash, const chipaddr addr);
void (*chip_readn) (const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len);
int (*shutdown)(void *data);
+ void (*delay) (const struct flashctx *flash, unsigned int usecs);
void *data;
};
int register_par_master(const struct par_master *mst, const enum chipbustype buses, void *data);