mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 14:11:15 +02:00
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>
This commit is contained in:

committed by
Edward O'Callaghan

parent
048aab6d66
commit
78e421bdf7
@ -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);
|
||||
|
Reference in New Issue
Block a user