mec1322: Disable auto read after a SPI transaction

The auto mode keeps the read buffer full and thus interfere with the
next transaction. We need to disable it when we are done with the
current transaction.

BUG=chrome-os-partner:29805
TEST=Read from SPI flash multiple times
BRANCH=None

Change-Id: I624299aae29fecde03e41228a694550f1deafd2a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/205799
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Vic Yang
2014-06-26 17:33:03 -07:00
committed by chrome-internal-fetch
parent d7c19b0236
commit f1ddcab82d

View File

@@ -83,9 +83,18 @@ int spi_transaction_async(const uint8_t *txdata, int txlen,
int spi_transaction_flush(void)
{
int ret = dma_wait(SPI_DMA_CHANNEL);
uint8_t dummy __attribute__((unused)) = 0;
/* Disable auto read */
MEC1322_SPI_CR(CONFIG_SPI_PORT) &= ~(1 << 5);
gpio_set_level(CONFIG_SPI_CS_GPIO, 1);
dma_disable(SPI_DMA_CHANNEL);
dma_clear_isr(SPI_DMA_CHANNEL);
if (MEC1322_SPI_SR(CONFIG_SPI_PORT) & 0x2)
dummy = MEC1322_SPI_RD(CONFIG_SPI_PORT);
return ret;
}