summaryrefslogtreecommitdiffstats
path: root/serprog.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-10-27 00:34:23 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-10-27 00:34:23 +0000
commit92fefc921a602acb89a897193c9f31fbb78d85b5 (patch)
treeabf7f12e3a23e8447c556603dce6de5ed5509e75 /serprog.c
parent0d82e952f2a896aefa1187e53b0ec6d6d559fe9b (diff)
downloadflashrom-92fefc921a602acb89a897193c9f31fbb78d85b5.tar.gz
flashrom-92fefc921a602acb89a897193c9f31fbb78d85b5.tar.bz2
flashrom-92fefc921a602acb89a897193c9f31fbb78d85b5.zip
serprog: add opcode to control the programmer's output drivers
This allowed me to let the clips remain attached on my D946GZIS while playing with coreboot/serialice. Corresponding to flashrom svn r1618. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'serprog.c')
-rw-r--r--serprog.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/serprog.c b/serprog.c
index 28faac834..edc5a7b3e 100644
--- a/serprog.c
+++ b/serprog.c
@@ -664,6 +664,15 @@ int serprog_init(void)
sp_device_opbuf_size);
}
+ if (sp_check_commandavail(S_CMD_S_PIN_STATE)) {
+ uint8_t en = 1;
+ if (sp_docommand(S_CMD_S_PIN_STATE, 1, &en, 0, NULL) != 0) {
+ msg_perr("Error: could not enable output buffers\n");
+ return 1;
+ } else
+ msg_pdbg(MSGHEADER "Output drivers enabled\n");
+ } else
+ msg_pdbg(MSGHEADER "Warning: Programmer does not support toggling its output drivers\n");
sp_prev_was_write = 0;
sp_streamed_transmit_ops = 0;
sp_streamed_transmit_bytes = 0;
@@ -736,9 +745,15 @@ static void sp_execute_opbuf(void)
static int serprog_shutdown(void *data)
{
- msg_pspew("%s\n", __func__);
if ((sp_opbuf_usage) || (sp_max_write_n && sp_write_n_bytes))
sp_execute_opbuf();
+ if (sp_check_commandavail(S_CMD_S_PIN_STATE)) {
+ uint8_t dis = 0;
+ if (sp_docommand(S_CMD_S_PIN_STATE, 1, &dis, 0, NULL) == 0)
+ msg_pdbg(MSGHEADER "Output drivers disabled\n");
+ else
+ msg_perr(MSGHEADER "%s: Warning: could not disable output buffers\n", __func__);
+ }
/* FIXME: fix sockets on windows(?), especially closing */
serialport_shutdown(&sp_fd);
if (sp_max_write_n)