summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/spi/spi_flash.c10
-rw-r--r--src/drivers/spi/spi_flash_internal.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index 11597c6c1d..6ecd29f773 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -129,6 +129,16 @@ int spi_flash_cmd(const struct spi_slave *spi, u8 cmd, void *response, size_t le
return ret;
}
+int spi_flash_cmd_multi(const struct spi_slave *spi, const u8 *dout, size_t bytes_out,
+ void *din, size_t bytes_in)
+{
+ int ret = do_spi_flash_cmd(spi, dout, bytes_out, din, bytes_in);
+ if (ret)
+ printk(BIOS_WARNING, "SF: Failed to send command %02x: %d\n", dout[0], ret);
+
+ return ret;
+}
+
/* TODO: This code is quite possibly broken and overflowing stacks. Fix ASAP! */
#pragma GCC diagnostic push
#if defined(__GNUC__) && !defined(__clang__)
diff --git a/src/drivers/spi/spi_flash_internal.h b/src/drivers/spi/spi_flash_internal.h
index 131c32bec8..d0f32c52ed 100644
--- a/src/drivers/spi/spi_flash_internal.h
+++ b/src/drivers/spi/spi_flash_internal.h
@@ -32,6 +32,10 @@
/* Send a single-byte command to the device and read the response */
int spi_flash_cmd(const struct spi_slave *spi, u8 cmd, void *response, size_t len);
+/* Send a multi-byte command to the device and read the response */
+int spi_flash_cmd_multi(const struct spi_slave *spi, const u8 *dout, size_t bytes_out,
+ void *din, size_t bytes_in);
+
/*
* Send a multi-byte command to the device followed by (optional)
* data. Used for programming the flash array, etc.