Run .prepare_access only once per flash context
There's only a single path now to create a flash context, after
probing, and only when we want to access the flash chip next. So
there's no need to defer this preparation step anymore.
All preparation will be done in a single step. Hence we drop the
PREPARE_POST_PROBE and PREPARE_FULL steps and the enum.
Change-Id: I7cd4058dd0b52ad0e4be45e494c4533f689893d9
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/492
diff --git a/edi.c b/edi.c
index 0f83a40..efe41c5 100644
--- a/edi.c
+++ b/edi.c
@@ -470,7 +470,7 @@
return 0;
}
-static void edi_finish(struct flashctx *flash)
+void edi_finish(struct flashctx *flash)
{
const struct spi_master *const spi = flash->mst.spi;
@@ -502,19 +502,15 @@
return edi_chip_probe(spi);
}
-int edi_prepare(struct flashctx *flash, enum preparation_steps step)
+int edi_prepare(struct flashctx *flash)
{
int rc;
- if (step < PREPARE_FULL)
- return 0;
-
rc = edi_8051_reset(flash->mst.spi);
if (rc < 0) {
msg_perr("%s: Unable to reset 8051!\n", __func__);
return rc;
}
- flash->chip->finish_access = edi_finish;
return 0;
}