summaryrefslogtreecommitdiff
path: root/src/soc/nvidia/tegra124/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/nvidia/tegra124/spi.c')
-rw-r--r--src/soc/nvidia/tegra124/spi.c41
1 files changed, 5 insertions, 36 deletions
diff --git a/src/soc/nvidia/tegra124/spi.c b/src/soc/nvidia/tegra124/spi.c
index ae8a9a7626..7ad771633c 100644
--- a/src/soc/nvidia/tegra124/spi.c
+++ b/src/soc/nvidia/tegra124/spi.c
@@ -23,6 +23,7 @@
#include <cbfs_core.h>
#include <inttypes.h>
#include <spi-generic.h>
+#include <spi_flash.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -722,16 +723,11 @@ int spi_xfer(struct spi_slave *slave, const void *dout,
u8 *out_buf = (u8 *)dout;
u8 *in_buf = (u8 *)din;
unsigned int todo;
- int ret = 0, frame_started = 1;
+ int ret = 0;
/* tegra bus numbers start at 1 */
ASSERT(slave->bus >= 1 && slave->bus <= ARRAY_SIZE(tegra_spi_channels));
- if (spi->rx_frame_header_enable) {
- memset(in_buf, ~spi->frame_header, in_bytes);
- frame_started = 0;
- }
-
while (out_bytes || in_bytes) {
int x = 0;
@@ -779,41 +775,14 @@ int spi_xfer(struct spi_slave *slave, const void *dout,
break;
}
- /*
- * Post-processing. For output, we only need to increment
- * the buffer and decrement the counter. Same for input if
- * there is no frame header to be concerned with.
- *
- * If a frame header is used and is found, the input buffer
- * is shifted so that the header starts at offset 0, and
- * in_bytes and in_buf are incremented/decremented according
- * to the offset where the header was originally found.
- */
+ /* Post-processing. */
if (out_bytes) {
out_bytes -= x;
out_buf += x;
}
if (in_bytes) {
- if (spi->rx_frame_header_enable && !frame_started) {
- int i;
-
- for (i = 0; i < x; i++) {
- if (in_buf[i] == spi->frame_header) {
- frame_started = 1;
- i++; /* discard frame header */
- break;
- }
- }
-
- if (frame_started) {
- memmove(&in_buf[0], &in_buf[i], x - i);
- in_bytes -= x - i;
- in_buf += x - i;
- }
- } else {
- in_bytes -= x;
- in_buf += x;
- }
+ in_bytes -= x;
+ in_buf += x;
}
}