Edward O'Callaghan has uploaded this change for review.

View Change

programmer: Add pre-init hook

Some specialised programmers such as internal require pre-initalisation
via either board or chipset enables or both. Subsequently this state is
later passed onto the init entry of the programmer itself.

Change-Id: Icb9ba758650fbe3731021d6b8f95c46ea0d24af1
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M flashrom.c
M include/programmer.h
2 files changed, 20 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/79/71579/1
diff --git a/flashrom.c b/flashrom.c
index 62f38f8..d6414ab 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -160,6 +160,11 @@
cfg.params = NULL;
}

+ if (prog->pre_init) {
+ msg_pdbg("Pre-Initialising %s programmer\n", prog->name);
+ ret = prog->pre_init(&cfg);
+ }
+
msg_pdbg("Initializing %s programmer\n", prog->name);
ret = prog->init(&cfg);
if (cfg.params && strlen(cfg.params)) {
diff --git a/include/programmer.h b/include/programmer.h
index 67e7b4a..bdb7711 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -48,6 +48,7 @@
const char *const note;
} devs;

+ int (*pre_init) (struct programmer_cfg *cfg);
int (*init) (const struct programmer_cfg *cfg);
};


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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Icb9ba758650fbe3731021d6b8f95c46ea0d24af1
Gerrit-Change-Number: 71579
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange