linux_mtd: Provide no-op delay implementation

Flashrom has several magic programmer_delay() calls scattered
throughout its codebase (see cli_classic.s/main() and
flashrom.c/flashrom_image_write(), at least). These delays are
superfluous for the linux_mtd programmer, because it's an opaque
programmer in which all protocol details are handled by the kernel
driver.

Stub out the delay function, so we don't waste up to 1.1 seconds of
needless delay time, depending on the operation and CLI vs libflashrom
usage.

Change-Id: I3ac69d3fd7cfc689c5b32c130d044516ed846c29
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/96
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: Nico Huber <nico.h@gmx.de>
diff --git a/linux_mtd.c b/linux_mtd.c
index e52b8a5..cbc9717 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -432,9 +432,18 @@
 	return ret;
 }
 
+static void linux_mtd_nop_delay(unsigned int usecs)
+{
+	/*
+	 * Ignore delay requests. The Linux MTD framework brokers all flash
+	 * protocol, including timing, resets, etc.
+	 */
+}
+
 const struct programmer_entry programmer_linux_mtd = {
 	.name			= "linux_mtd",
 	.type			= OTHER,
 	.devs.note		= "Device files /dev/mtd*\n",
 	.init			= linux_mtd_init,
+	.delay			= linux_mtd_nop_delay,
 };