drivers/: Make 'internal_delay' the default unless defined

Drop the explicit need to specify the default 'internal_delay'
callback function pointer in the programmer_entry struct.
This is a reasonable default for every other driver in the
tree with only the two exceptions of ch341a_spi.c and serprog.c.

Thus this simplifies driver development.

flashrom-stable: Updated `dirtyjtag_spi` which was added earlier.

Change-Id: I17460bc2c0aebcbb48c8dfa052b260991525cc49
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/67391
Original-Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Thomas Heijligen <src@posteo.de>
Original-Reviewed-by: Felix Singer <felixsinger@posteo.net>
Original-Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72359
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/atahpt.c b/atahpt.c
index 02508ff..d92d470 100644
--- a/atahpt.c
+++ b/atahpt.c
@@ -98,5 +98,4 @@
 	.init			= atahpt_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/atapromise.c b/atapromise.c
index 6033030..86f8e2e 100644
--- a/atapromise.c
+++ b/atapromise.c
@@ -171,5 +171,4 @@
 	.init			= atapromise_init,
 	.map_flash_region	= atapromise_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/atavia.c b/atavia.c
index 368c169..df2e428 100644
--- a/atavia.c
+++ b/atavia.c
@@ -193,5 +193,4 @@
 	.init			= atavia_init,
 	.map_flash_region	= atavia_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/buspirate_spi.c b/buspirate_spi.c
index efd3e8b..a23fdb7 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -721,5 +721,4 @@
 	.init			= buspirate_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/dediprog.c b/dediprog.c
index 966ebe7..ad5bad2 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -1324,5 +1324,4 @@
 	.init			= dediprog_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/developerbox_spi.c b/developerbox_spi.c
index 6b54fc6..26af1e8 100644
--- a/developerbox_spi.c
+++ b/developerbox_spi.c
@@ -172,5 +172,4 @@
 	.init			= developerbox_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/digilent_spi.c b/digilent_spi.c
index 128c95c..cc99b46 100644
--- a/digilent_spi.c
+++ b/digilent_spi.c
@@ -464,5 +464,4 @@
 	.init			= digilent_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/dirtyjtag_spi.c b/dirtyjtag_spi.c
index 47b553d..f02df49 100644
--- a/dirtyjtag_spi.c
+++ b/dirtyjtag_spi.c
@@ -319,5 +319,4 @@
 	.init			= dirtyjtag_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/drkaiser.c b/drkaiser.c
index 2725a2a..e704ea0 100644
--- a/drkaiser.c
+++ b/drkaiser.c
@@ -97,5 +97,4 @@
 	.init			= drkaiser_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/dummyflasher.c b/dummyflasher.c
index 4ddf3d2..56ba338 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -1194,5 +1194,4 @@
 	.init			= dummy_init,
 	.map_flash_region	= dummy_map,
 	.unmap_flash_region	= dummy_unmap,
-	.delay			= internal_delay,
 };
diff --git a/flashrom.c b/flashrom.c
index d08c130..c434cff 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -223,8 +223,12 @@
 
 void programmer_delay(unsigned int usecs)
 {
-	if (usecs > 0)
-		programmer->delay(usecs);
+	if (usecs > 0) {
+		if (programmer->delay)
+			programmer->delay(usecs);
+		else
+			internal_delay(usecs);
+	}
 }
 
 int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start,
@@ -1416,10 +1420,6 @@
 			msg_gerr("Programmer %s does not have a valid init function!\n", p->name);
 			ret = 1;
 		}
-		if (p->delay == NULL) {
-			msg_gerr("Programmer %s does not have a valid delay function!\n", p->name);
-			ret = 1;
-		}
 		if (p->map_flash_region == NULL) {
 			msg_gerr("Programmer %s does not have a valid map_flash_region function!\n", p->name);
 			ret = 1;
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 9bd92af..e232fe5 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -713,5 +713,4 @@
 	.init			= ft2232_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/gfxnvidia.c b/gfxnvidia.c
index e068560..1a75688 100644
--- a/gfxnvidia.c
+++ b/gfxnvidia.c
@@ -124,5 +124,4 @@
 	.init			= gfxnvidia_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/internal.c b/internal.c
index 8d0b905..9ddcff9 100644
--- a/internal.c
+++ b/internal.c
@@ -364,5 +364,4 @@
 	.init			= internal_init,
 	.map_flash_region	= physmap,
 	.unmap_flash_region	= physunmap,
-	.delay			= internal_delay,
 };
diff --git a/it8212.c b/it8212.c
index 5da7c3d..842c172 100644
--- a/it8212.c
+++ b/it8212.c
@@ -85,5 +85,4 @@
 	.init			= it8212_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/jlink_spi.c b/jlink_spi.c
index fd14908..196ca0f 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -540,5 +540,4 @@
 	.devs.note		= "SEGGER J-Link and compatible devices\n",
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/linux_mtd.c b/linux_mtd.c
index 2183907..ce93f86 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -439,5 +439,4 @@
 	.init			= linux_mtd_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/linux_spi.c b/linux_spi.c
index b1911fe..8598dc1 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -262,5 +262,4 @@
 	.init			= linux_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/mstarddc_spi.c b/mstarddc_spi.c
index 46bcd32..ef44470 100644
--- a/mstarddc_spi.c
+++ b/mstarddc_spi.c
@@ -233,5 +233,4 @@
 	.init			= mstarddc_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/ni845x_spi.c b/ni845x_spi.c
index 75e5312..487bef5 100644
--- a/ni845x_spi.c
+++ b/ni845x_spi.c
@@ -642,5 +642,4 @@
 	.init			= ni845x_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/nic3com.c b/nic3com.c
index 45c3177..32c5961 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -143,5 +143,4 @@
 	.init			= nic3com_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/nicintel.c b/nicintel.c
index 75d8886..8692a73 100644
--- a/nicintel.c
+++ b/nicintel.c
@@ -116,5 +116,4 @@
 	.init			= nicintel_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index f024afc..00d1d6b 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -520,5 +520,4 @@
 	.init			= nicintel_ee_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/nicintel_spi.c b/nicintel_spi.c
index 174af9a..774ffeb 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -307,5 +307,4 @@
 	.init			= nicintel_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/nicnatsemi.c b/nicnatsemi.c
index 3e0263c..3819d22 100644
--- a/nicnatsemi.c
+++ b/nicnatsemi.c
@@ -110,5 +110,4 @@
 	.init			= nicnatsemi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/nicrealtek.c b/nicrealtek.c
index 8279739..170b757 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -132,5 +132,4 @@
 	.init			= nicrealtek_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/ogp_spi.c b/ogp_spi.c
index a0c297b..99d29b6 100644
--- a/ogp_spi.c
+++ b/ogp_spi.c
@@ -146,5 +146,4 @@
 	.init			= ogp_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/pickit2_spi.c b/pickit2_spi.c
index 4965911..3a49207 100644
--- a/pickit2_spi.c
+++ b/pickit2_spi.c
@@ -512,5 +512,4 @@
 	.init			= pickit2_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/pony_spi.c b/pony_spi.c
index fef8495..6b68fdc 100644
--- a/pony_spi.c
+++ b/pony_spi.c
@@ -238,5 +238,4 @@
 	.init			= pony_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/rayer_spi.c b/rayer_spi.c
index fc22c0a..316efc2 100644
--- a/rayer_spi.c
+++ b/rayer_spi.c
@@ -287,5 +287,4 @@
 	.init			= rayer_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/satamv.c b/satamv.c
index c9d89ed..6c55eb9 100644
--- a/satamv.c
+++ b/satamv.c
@@ -194,5 +194,4 @@
 	.init			= satamv_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/satasii.c b/satasii.c
index a82b952..6e741de 100644
--- a/satasii.c
+++ b/satasii.c
@@ -139,5 +139,4 @@
 	.init			= satasii_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c
index c7ee33b..2f622b7 100644
--- a/stlinkv3_spi.c
+++ b/stlinkv3_spi.c
@@ -521,5 +521,4 @@
 	.init			= stlinkv3_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };
diff --git a/usbblaster_spi.c b/usbblaster_spi.c
index 36105c2..9c21903 100644
--- a/usbblaster_spi.c
+++ b/usbblaster_spi.c
@@ -219,5 +219,4 @@
 	.init			= usbblaster_spi_init,
 	.map_flash_region	= fallback_map,
 	.unmap_flash_region	= fallback_unmap,
-	.delay			= internal_delay,
 };