Skip to content

Commit

Permalink
spi: tegra114: use spi_transfer_delay_exec helper
Browse files Browse the repository at this point in the history
The tegra114 driver has a weird/separate `tegra_spi_transfer_delay()`
function that does 2 delays: one mdelay() and one udelay().

This was introduced via commit f4fade1
("spi/tegra114: Correct support for cs_change").

There doesn't seem to be a mention in that commit message to suggest a
specific need/use-case for having the 2 delay calls.
For the most part, udelay() should be sufficient.

This change replaces it with the new `spi_transfer_delay_exec()`, which
should do the same thing.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20190926105147.7839-11-alexandru.ardelean@analog.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Alexandru Ardelean authored and Mark Brown committed Oct 15, 2019
1 parent bebcfd2 commit cd13152
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions drivers/spi/spi-tegra114.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,17 +984,6 @@ static int tegra_spi_setup(struct spi_device *spi)
return 0;
}

static void tegra_spi_transfer_delay(int delay)
{
if (!delay)
return;

if (delay >= 1000)
mdelay(delay / 1000);

udelay(delay % 1000);
}

static void tegra_spi_transfer_end(struct spi_device *spi)
{
struct tegra_spi_data *tspi = spi_master_get_devdata(spi->master);
Expand Down Expand Up @@ -1098,19 +1087,19 @@ static int tegra_spi_transfer_one_message(struct spi_master *master,
complete_xfer:
if (ret < 0 || skip) {
tegra_spi_transfer_end(spi);
tegra_spi_transfer_delay(xfer->delay_usecs);
spi_transfer_delay_exec(xfer);
goto exit;
} else if (list_is_last(&xfer->transfer_list,
&msg->transfers)) {
if (xfer->cs_change)
tspi->cs_control = spi;
else {
tegra_spi_transfer_end(spi);
tegra_spi_transfer_delay(xfer->delay_usecs);
spi_transfer_delay_exec(xfer);
}
} else if (xfer->cs_change) {
tegra_spi_transfer_end(spi);
tegra_spi_transfer_delay(xfer->delay_usecs);
spi_transfer_delay_exec(xfer);
}

}
Expand Down

0 comments on commit cd13152

Please sign in to comment.