From 1b52de3e3c73886784ea1216b34305919449bd24 Mon Sep 17 00:00:00 2001 From: Puthikorn Voravootivat Date: Tue, 19 Aug 2014 14:21:47 -0700 Subject: stfm32f0: Send 0xec over i2c until get NAK from host. Host i2c driver in ryu does not allow to snoop the byte stream to abort the transaction. This make host i2c driver to be in the dead state if the response message from ec is shorter than host expected length. This patch will make ec to send 0xec after end of response message until get the 'NAK' answer from host to fixed this issue which occur in these 2 situations. 1. When ec encounters host command error. 2. When response message is a null terminated string. BUG=chrome-os-partner:31367 TEST='ectool version' runs fine on ryu BRANCH=none Change-Id: Icad0f0fde6cca4abd9c833c6d179143e4c5c0561 Signed-off-by: Puthikorn Voravootivat Reviewed-on: https://chromium-review.googlesource.com/213177 Reviewed-by: Randall Spangler Reviewed-by: Alec Berg --- chip/stm32/i2c-stm32f0.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c index 11dd4c7ba4..c6cfa9e156 100644 --- a/chip/stm32/i2c-stm32f0.c +++ b/chip/stm32/i2c-stm32f0.c @@ -155,12 +155,11 @@ static void i2c_send_response_packet(struct host_packet *pkt) } /* - * If an error occurred. Set the transmitter not full so as to keep - * sending '0xec' in the event loop. That way the master doesn't have - * to snoop the response stream. + * Set the transmitter to be in 'not full' state to keep sending + * '0xec' in the event loop. Because of this, the master i2c + * doesn't need to snoop the response stream to abort transaction. */ - if (pkt->driver_result != EC_RES_SUCCESS) - STM32_I2C_CR1(host_i2c_resp_port) |= STM32_I2C_CR1_TXIE; + STM32_I2C_CR1(host_i2c_resp_port) |= STM32_I2C_CR1_TXIE; } /* Process the command in the i2c host buffer */ -- cgit v1.2.1