aboutsummaryrefslogtreecommitdiffstats
path: root/programmer.h
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2018-06-05 09:38:19 +0100
committerNico Huber <nico.h@gmx.de>2018-08-17 21:16:12 +0000
commitb623f403a00a6ce796fe632d4c1ff3fc4f5a5e40 (patch)
treea2f753c253a18afe6cb09134b9a15d26eca3233b /programmer.h
parent9891b75d96a199d1740fbd7df805abf23ae8f347 (diff)
downloadflashrom-b623f403a00a6ce796fe632d4c1ff3fc4f5a5e40.tar.gz
flashrom-b623f403a00a6ce796fe632d4c1ff3fc4f5a5e40.tar.bz2
flashrom-b623f403a00a6ce796fe632d4c1ff3fc4f5a5e40.zip
bitbang_spi: Add functions to optimize xfers
On systems where the overhead of getting/setting pins is much greater than the half period (for example, USB bit banging) it significantly boosts performance if we can bang more than one bit at the same time. Add support for setting sck at the same time as mosi or miso activity. The speed up varies depending on how much the overhead of getting/setting pins dominates execution time. For a USB bit bang driver running on a 7th generation Core i5, the time to probe drops from ~9.2 seconds to ~7.7 seconds when set_clk_set_mosi() is implemented. Change-Id: Ic3430a9df34844cdfa82e109456be788eaa1789a Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-on: https://review.coreboot.org/26946 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Idwer Vollering <vidwer@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'programmer.h')
-rw-r--r--programmer.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/programmer.h b/programmer.h
index ff81036d..7e530b63 100644
--- a/programmer.h
+++ b/programmer.h
@@ -184,6 +184,9 @@ struct bitbang_spi_master {
int (*get_miso) (void);
void (*request_bus) (void);
void (*release_bus) (void);
+ /* optional functions to optimize xfers */
+ void (*set_sck_set_mosi) (int sck, int mosi);
+ int (*set_sck_get_miso) (int sck);
/* Length of half a clock period in usecs. */
unsigned int half_period;
};