nicintel_spi.c: Implement `set_sck_set_mosi` and `set_sck_get_miso`

Tested on a 8086:1533 (i210 GbE), reads still return the same data.
This cuts the time to read a Winbond W25Q80.V (1 MiB, SPI) from 66
seconds down to 48 seconds, i.e. a 37.5% increase in speed.

flashrom-stable: backported to use globals

Change-Id: I52a0ae5ff331ee2ed41652eb5c2ed7ebe7253d74
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/49267
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71428
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/nicintel_spi.c b/nicintel_spi.c
index 76b53fa..3af375d 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -158,6 +158,18 @@
 	pci_mmio_writel(tmp, nicintel_spibar + FLA);
 }
 
+static void nicintel_bitbang_set_sck_set_mosi(int sck, int mosi)
+{
+	uint32_t tmp;
+
+	tmp = pci_mmio_readl(nicintel_spibar + FLA);
+	tmp &= ~BIT(FL_SCK);
+	tmp &= ~BIT(FL_SI);
+	tmp |= (sck << FL_SCK);
+	tmp |= (mosi << FL_SI);
+	pci_mmio_writel(tmp, nicintel_spibar + FLA);
+}
+
 static int nicintel_bitbang_get_miso(void)
 {
 	uint32_t tmp;
@@ -167,10 +179,23 @@
 	return tmp;
 }
 
+static int nicintel_bitbang_set_sck_get_miso(int sck)
+{
+	uint32_t tmp;
+
+	tmp = pci_mmio_readl(nicintel_spibar + FLA);
+	tmp &= ~BIT(FL_SCK);
+	tmp |= (sck << FL_SCK);
+	pci_mmio_writel(tmp, nicintel_spibar + FLA);
+	return (tmp >> FL_SO) & 0x1;
+}
+
 static const struct bitbang_spi_master bitbang_spi_master_nicintel = {
 	.set_cs = nicintel_bitbang_set_cs,
 	.set_sck = nicintel_bitbang_set_sck,
 	.set_mosi = nicintel_bitbang_set_mosi,
+	.set_sck_set_mosi = nicintel_bitbang_set_sck_set_mosi,
+	.set_sck_get_miso = nicintel_bitbang_set_sck_get_miso,
 	.get_miso = nicintel_bitbang_get_miso,
 	.request_bus = nicintel_request_spibus,
 	.release_bus = nicintel_release_spibus,