@@ -211,10 +211,10 @@ static void spi_get_fifo_levels(struct exynos_spi *regs,
*/
static void spi_request_bytes(struct exynos_spi *regs, int count)
{
- assert(count && count < (1 << 16));
setbits_le32(®s->ch_cfg, SPI_CH_RST);
clrbits_le32(®s->ch_cfg, SPI_CH_RST);
- writel(count | SPI_PACKET_CNT_EN, ®s->pkt_cnt);
+ if (count)
+ writel(count | SPI_PACKET_CNT_EN, ®s->pkt_cnt);
}
static void spi_rx_tx(struct exynos_spi_slave *spi_slave, int todo,
@@ -225,14 +225,20 @@ static void spi_rx_tx(struct exynos_spi_slave
*spi_slave, int todo,
const uchar *txp = *doutp;
int rx_lvl, tx_lvl;
uint out_bytes, in_bytes;
-
+ int hunting;
+
+ if (spi_slave->free_running_mode) {
+ spi_request_bytes(regs, 0);
+ hunting = 1;
+ } else {
+ hunting = 0;
+ spi_request_bytes(regs, todo);
+ }
out_bytes = in_bytes = todo;
- /*
- * If there's something to send, do a software reset and set a
- * transaction size.
- */
- spi_request_bytes(regs, todo);
+ /* Software reset the channel. */
+ setbits_le32(®s->ch_cfg, SPI_CH_RST);
+ clrbits_le32(®s->ch_cfg, SPI_CH_RST);
/*