summaryrefslogtreecommitdiff
path: root/src/drivers/spi
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-04-19 19:23:16 -0700
committerMartin Roth <martinroth@google.com>2017-04-24 19:28:42 +0200
commit9e49b0a2c58233e30673df343ad4c46a807822f4 (patch)
tree330b0167118f4756ec25327f057179f71c2141c7 /src/drivers/spi
parent10d1fde5756d9535b2301806c01d0b029661eddc (diff)
downloadcoreboot-9e49b0a2c58233e30673df343ad4c46a807822f4.tar.xz
drivers/spi/spiconsole: Fix broken spiconsole driver
Use spi_setup_slave to fill up the spi_slave structure with pointer to spi_ctrlr structure which can then be used to perform all spi operations. Change-Id: I2804ed1e85402426a654352e1ceaf0993546cd8b Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/19385 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
Diffstat (limited to 'src/drivers/spi')
-rw-r--r--src/drivers/spi/spiconsole.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/drivers/spi/spiconsole.c b/src/drivers/spi/spiconsole.c
index 0831f2c896..41846b7e6a 100644
--- a/src/drivers/spi/spiconsole.c
+++ b/src/drivers/spi/spiconsole.c
@@ -17,8 +17,11 @@
#include <spi_flash.h>
#include <console/spi.h>
+static struct spi_slave slave;
+
void spiconsole_init(void) {
spi_init();
+ spi_setup_slave(0, 0, &slave);
return;
}
@@ -54,9 +57,7 @@ void spiconsole_tx_byte(unsigned char c) {
if (c == '\n' || (sizeof(struct em100_msg_header) +
msg.header.msg_length == spi_crop_chunk(0,
MAX_MSG_LENGTH))) {
- struct spi_slave spi = { };
-
- spi_xfer(&spi, &msg, sizeof(struct em100_msg_header) +
+ spi_xfer(&slave, &msg, sizeof(struct em100_msg_header) +
msg.header.msg_length, NULL, 0);
msg.header.msg_length = 0;