Skip to content

Commit

Permalink
spi: img-spfi: Setup TRANSACTION register before CONTROL register
Browse files Browse the repository at this point in the history
Setting the transfer length in the TRANSACTION register after the
CONTROL register is programmed causes intermittent timeout issues in
SPFI transfers when using the SPI framework to control the CS GPIO
lines.  To avoid this issue, set transfer length before programming
the CONTROL register.

Signed-off-by: Sifan Naeem <[email protected]>
Signed-off-by: Andrew Bresticker <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Sifan Naeem authored and broonie committed Apr 8, 2015
1 parent b6fe397 commit ede8342
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/spi/spi-img-spfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ static void img_spfi_config(struct spi_master *master, struct spi_device *spi,
val |= div << SPFI_DEVICE_PARAMETER_BITCLK_SHIFT;
spfi_writel(spfi, val, SPFI_DEVICE_PARAMETER(spi->chip_select));

spfi_writel(spfi, xfer->len << SPFI_TRANSACTION_TSIZE_SHIFT,
SPFI_TRANSACTION);

val = spfi_readl(spfi, SPFI_CONTROL);
val &= ~(SPFI_CONTROL_SEND_DMA | SPFI_CONTROL_GET_DMA);
if (xfer->tx_buf)
Expand All @@ -452,8 +455,6 @@ static void img_spfi_config(struct spi_master *master, struct spi_device *spi,
&master->cur_msg->transfers))
val |= SPFI_CONTROL_CONTINUE;
spfi_writel(spfi, val, SPFI_CONTROL);
spfi_writel(spfi, xfer->len << SPFI_TRANSACTION_TSIZE_SHIFT,
SPFI_TRANSACTION);
}

static int img_spfi_transfer_one(struct spi_master *master,
Expand Down

0 comments on commit ede8342

Please sign in to comment.