From 9e49b0a2c58233e30673df343ad4c46a807822f4 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Wed, 19 Apr 2017 19:23:16 -0700 Subject: drivers/spi/spiconsole: Fix broken spiconsole driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/19385 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) Reviewed-by: Philippe Mathieu-Daudé --- src/drivers/spi/spiconsole.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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 #include +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; -- cgit v1.2.3