Commit 2613d2bf authored by Serge Semin's avatar Serge Semin Committed by Mark Brown

spi: dw: Update Rx sample delay in the config function

Rx sample delay can be SPI device specific, and should be synchronously
initialized with the rest of the communication and peripheral device
related controller setups. So let's move the Rx-sample delay setup into
the DW APB SSI configuration update method.
Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20201007235511.4935-7-Sergey.Semin@baikalelectronics.ruSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c449ad74
...@@ -294,13 +294,18 @@ static void dw_spi_update_config(struct dw_spi *dws, struct spi_device *spi, ...@@ -294,13 +294,18 @@ static void dw_spi_update_config(struct dw_spi *dws, struct spi_device *spi,
spi_set_clk(dws, clk_div); spi_set_clk(dws, clk_div);
dws->current_freq = speed_hz; dws->current_freq = speed_hz;
} }
/* Update RX sample delay if required */
if (dws->cur_rx_sample_dly != chip->rx_sample_dly) {
dw_writel(dws, DW_SPI_RX_SAMPLE_DLY, chip->rx_sample_dly);
dws->cur_rx_sample_dly = chip->rx_sample_dly;
}
} }
static int dw_spi_transfer_one(struct spi_controller *master, static int dw_spi_transfer_one(struct spi_controller *master,
struct spi_device *spi, struct spi_transfer *transfer) struct spi_device *spi, struct spi_transfer *transfer)
{ {
struct dw_spi *dws = spi_controller_get_devdata(master); struct dw_spi *dws = spi_controller_get_devdata(master);
struct chip_data *chip = spi_get_ctldata(spi);
u8 imask = 0; u8 imask = 0;
u16 txlevel = 0; u16 txlevel = 0;
int ret; int ret;
...@@ -326,12 +331,6 @@ static int dw_spi_transfer_one(struct spi_controller *master, ...@@ -326,12 +331,6 @@ static int dw_spi_transfer_one(struct spi_controller *master,
if (master->can_dma && master->can_dma(master, spi, transfer)) if (master->can_dma && master->can_dma(master, spi, transfer))
dws->dma_mapped = master->cur_msg_mapped; dws->dma_mapped = master->cur_msg_mapped;
/* Update RX sample delay if required */
if (dws->cur_rx_sample_dly != chip->rx_sample_dly) {
dw_writel(dws, DW_SPI_RX_SAMPLE_DLY, chip->rx_sample_dly);
dws->cur_rx_sample_dly = chip->rx_sample_dly;
}
/* For poll mode just disable all interrupts */ /* For poll mode just disable all interrupts */
spi_mask_intr(dws, 0xff); spi_mask_intr(dws, 0xff);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment